diff --git a/Android/doraemonkit-no-op/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/DoraemonWeakNetworkInterceptor.java b/Android/doraemonkit-no-op/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/DoraemonWeakNetworkInterceptor.java index feb27bb4595d4650261c805cc7fcab56def7a488..e6d124d9cf143ce5b2cc09cf54ef3eea6213bed4 100644 --- a/Android/doraemonkit-no-op/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/DoraemonWeakNetworkInterceptor.java +++ b/Android/doraemonkit-no-op/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/DoraemonWeakNetworkInterceptor.java @@ -7,8 +7,7 @@ import okhttp3.Request; import okhttp3.Response; /** - * @author denghaha - * created 2019-05-10 11:56 + * Created by xiandanin on 2019-05-10 11:56 */ public class DoraemonWeakNetworkInterceptor implements Interceptor { diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/interceptor/DoraemonWeakNetworkInterceptor.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/interceptor/DoraemonWeakNetworkInterceptor.java index 575b1db8b943fc66f0aacc74561ad7815930ba5b..762180c67666fe3d1c8b520e50d7a5ab797f9cde 100644 --- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/interceptor/DoraemonWeakNetworkInterceptor.java +++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/interceptor/DoraemonWeakNetworkInterceptor.java @@ -11,9 +11,8 @@ import okhttp3.Response; /** * 用于模拟弱网的拦截器 - * - * @author denghaha - * created 2019-05-09 16:29 + *
+ * Created by xiandanin on 2019-05-09 16:29
*/
public class DoraemonWeakNetworkInterceptor implements Interceptor {
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/viewcheck/ViewCheckInfoDokitView.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/viewcheck/ViewCheckInfoDokitView.java
index 15b4f2e09b917571f4859718998e4b79a6b76793..ffcec97bbb385016b95177368adeed8241449e75 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/viewcheck/ViewCheckInfoDokitView.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/viewcheck/ViewCheckInfoDokitView.java
@@ -10,6 +10,7 @@ import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@@ -80,11 +81,11 @@ public class ViewCheckInfoDokitView extends AbsDokitView implements ViewCheckDok
@Override
public void run() {
ViewCheckDokitView dokitView = (ViewCheckDokitView) DokitViewManager.getInstance().getDokitView(getActivity(), ViewCheckDokitView.class.getSimpleName());
- if(dokitView != null){
+ if (dokitView != null) {
dokitView.setViewSelectListener(ViewCheckInfoDokitView.this);
}
}
- },200);
+ }, 200);
}
@@ -98,6 +99,15 @@ public class ViewCheckInfoDokitView extends AbsDokitView implements ViewCheckDok
params.height = DokitViewLayoutParams.WRAP_CONTENT;
}
+ @Override
+ public void updateViewLayout(String tag, boolean isActivityResume) {
+ super.updateViewLayout(tag, isActivityResume);
+ // 由于父类在此方法限制了高度无法自适应,所以重新设成wrap_content以自适应
+ final FrameLayout.LayoutParams params = getNormalLayoutParams();
+ params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ getRootView().setLayoutParams(params);
+ }
+
@Override
public void onViewSelected(View view) {
if (view == null) {
@@ -111,14 +121,13 @@ public class ViewCheckInfoDokitView extends AbsDokitView implements ViewCheckDok
mId.setText(idText);
String positionText = getResources().getString(R.string.dk_view_check_info_size, view.getWidth(), view.getHeight());
mPosition.setText(positionText);
- Drawable drawable = view.getBackground();
- String backgroundColor = "";
- if (drawable instanceof ColorDrawable) {
- int colorInt = ((ColorDrawable) drawable).getColor();
- backgroundColor = ColorUtil.parseColorInt(colorInt);
+ String descText = getViewExtraInfo(view);
+ if (TextUtils.isEmpty(descText)) {
+ mDesc.setVisibility(View.GONE);
+ } else {
+ mDesc.setText(descText);
+ mDesc.setVisibility(View.VISIBLE);
}
- String descText = getResources().getString(R.string.dk_view_check_info_desc, backgroundColor);
- mDesc.setText(descText);
Activity activity = ActivityUtils.getTopActivity();
if (activity != null) {
String activityText = activity.getClass().getSimpleName();
@@ -136,6 +145,49 @@ public class ViewCheckInfoDokitView extends AbsDokitView implements ViewCheckDok
}
}
+ private String getViewExtraInfo(View v) {
+ StringBuilder info = new StringBuilder();
+ // 背景色
+ Drawable drawable = v.getBackground();
+ if (drawable != null) {
+ if (drawable instanceof ColorDrawable) {
+ int colorInt = ((ColorDrawable) drawable).getColor();
+ String backgroundColor = ColorUtil.parseColorInt(colorInt);
+ info.append(getResources().getString(R.string.dk_view_check_info_desc, backgroundColor));
+ info.append("\n");
+ }
+ }
+ // padding
+ if (v.getPaddingLeft() != 0 && v.getPaddingTop() != 0 && v.getPaddingRight() != 0 && v.getPaddingBottom() != 0) {
+ info.append(getResources().getString(R.string.dk_view_check_info_padding, v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), v.getPaddingBottom()));
+ info.append("\n");
+ }
+ // margin
+ final ViewGroup.LayoutParams layoutParams = v.getLayoutParams();
+ if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mp = ((ViewGroup.MarginLayoutParams) layoutParams);
+ if (mp.leftMargin != 0 && mp.topMargin != 0 && mp.rightMargin != 0 && mp.bottomMargin != 0) {
+ info.append(getResources().getString(R.string.dk_view_check_info_margin, mp.leftMargin, mp.topMargin, mp.rightMargin, mp.bottomMargin));
+ info.append("\n");
+ }
+ }
+ // TextView信息
+ if (v instanceof TextView) {
+ TextView tv = ((TextView) v);
+ String textColor = ColorUtil.parseColorInt(tv.getCurrentTextColor());
+ info.append(getResources().getString(R.string.dk_view_check_info_text_color, textColor));
+ info.append("\n");
+ info.append(getResources().getString(R.string.dk_view_check_info_text_size, (int) tv.getTextSize()));
+ info.append("\n");
+
+ }
+ // 删除最后一个换行
+ if (!TextUtils.isEmpty(info)) {
+ info.deleteCharAt(info.length() - 1);
+ }
+ return info.toString();
+ }
+
private void setTextAndVisible(TextView textView, String text) {
if (TextUtils.isEmpty(text)) {
textView.setVisibility(View.GONE);
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/ByteCountBufferedSink.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/ByteCountBufferedSink.java
index 33b26facdee66002e8b09432fc5f223ede085c63..2f01b946b0d30baaa06fa948bbd494aabc855f70 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/ByteCountBufferedSink.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/ByteCountBufferedSink.java
@@ -18,8 +18,7 @@ import okio.Timeout;
/**
* 可以设置每次写入大小的BufferedSink
*
- * @author denghaha
- * created 2019-05-10 16:07
+ * Created by xiandanin on 2019-05-10 16:07
*/
public class ByteCountBufferedSink implements BufferedSink {
private final long mByteCount;
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitRequestBody.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitRequestBody.java
index 6141b7b1bb3afa1ad03ebf9c193ad4ae22a8f965..ce0d73e1074360372ed5f2d4bcde237fda5a5f3a 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitRequestBody.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitRequestBody.java
@@ -12,8 +12,7 @@ import okio.ForwardingSink;
import okio.Sink;
/**
- * @author denghaha
- * created 2019-05-09 18:35
+ * Created by xiandanin on 2019-05-09 18:35
*/
public class SpeedLimitRequestBody extends RequestBody {
private long mSpeedByte;//b/s
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitResponseBody.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitResponseBody.java
index 38bf6a7bd445dfc6effec0da5afff9fcb8019784..4aaada45545880407616eca99a20e21a9e76d5cd 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitResponseBody.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/SpeedLimitResponseBody.java
@@ -13,8 +13,7 @@ import okio.Okio;
import okio.Source;
/**
- * @author denghaha
- * created 2019-05-09 18:35
+ * Created by xiandanin on 2019-05-09 18:35
*/
public class SpeedLimitResponseBody extends ResponseBody {
//b/s
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkFragment.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkFragment.java
index 6d62db5a0b9ef5d85a46146000169463a263008c..fde0aa29927b1d51bbce00323ae230dcc4ad45fa 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkFragment.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkFragment.java
@@ -22,8 +22,7 @@ import com.didichuxing.doraemonkit.ui.widget.titlebar.HomeTitleBar;
/**
* 模拟弱网
*
- * @author denghaha
- * created 2019/5/7 19:10
+ * Created by xiandanin on 2019/5/7 19:10
*/
public class WeakNetworkFragment extends BaseFragment implements TextWatcher {
private SettingItemAdapter mSettingItemAdapter;
@@ -173,22 +172,4 @@ public class WeakNetworkFragment extends BaseFragment implements TextWatcher {
}
-
- static class SimpleTextWatcher implements TextWatcher {
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
-
- }
-
- @Override
- public void afterTextChanged(Editable s) {
-
- }
- }
}
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkKit.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkKit.java
index ef01aee093b215448bb77dd8fe41f7631369e1fd..440535fcab3b48b79a341f40d3d4314c798fd2f9 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkKit.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkKit.java
@@ -10,8 +10,7 @@ import com.didichuxing.doraemonkit.kit.Category;
/**
* 模拟弱网
*
- * @author denghaha
- * created 2019/5/7 19:05
+ * Created by xiandanin on 2019/5/7 19:05
*/
public class WeakNetworkKit extends AbstractKit {
@Override
diff --git a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkManager.java b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkManager.java
index 9099a63dd8ca360637e1b11cf149a77600103bd4..1d6eadeddb43aa1d65abf5bee8a042cd2feb9446 100644
--- a/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkManager.java
+++ b/Android/doraemonkit/src/main/java/com/didichuxing/doraemonkit/kit/weaknetwork/WeakNetworkManager.java
@@ -14,8 +14,7 @@ import okhttp3.Response;
import okhttp3.ResponseBody;
/**
- * @author denghaha
- * created 2019-05-09 16:30
+ * Created by xiandanin on 2019-05-09 16:30
*/
public class WeakNetworkManager {
public static final int TYPE_OFF_NETWORK = 0;
diff --git a/Android/doraemonkit/src/main/res/layout/dk_float_view_check_info.xml b/Android/doraemonkit/src/main/res/layout/dk_float_view_check_info.xml
index 5c56de901400767557e5e8d4765bcc08c9e60177..a654f5da1b0bd28344599fba089ca239b345009e 100644
--- a/Android/doraemonkit/src/main/res/layout/dk_float_view_check_info.xml
+++ b/Android/doraemonkit/src/main/res/layout/dk_float_view_check_info.xml
@@ -40,6 +40,7 @@
android:layout_below="@id/position"
android:layout_alignLeft="@id/position"
android:layout_marginBottom="6dp"
+ android:lineSpacingExtra="7dp"
android:gravity="left"/>