|
9 | 9 | import android.graphics.Color; |
10 | 10 | import android.os.Bundle; |
11 | 11 | import android.support.annotation.Keep; |
| 12 | +import android.support.annotation.NonNull; |
| 13 | +import android.support.annotation.Nullable; |
12 | 14 | import android.text.TextUtils; |
13 | 15 | import android.util.TypedValue; |
14 | 16 | import android.view.ContextThemeWrapper; |
@@ -333,11 +335,32 @@ public void showFingerPrintDialog(final Activity activity) { |
333 | 335 | } |
334 | 336 | } |
335 | 337 |
|
| 338 | + /** |
| 339 | + * 感觉是淘宝出bug了, 控件的id 和Resources 获取到的id 不符 |
| 340 | + */ |
| 341 | + @Nullable |
| 342 | + private View findTaobaoVSettingsPageItemView(@NonNull ViewGroup rootView) { |
| 343 | + List<View> childViewList = new ArrayList<>(); |
| 344 | + ViewUtil.getChildViews(rootView, childViewList); |
| 345 | + String packageName = rootView.getContext().getPackageName(); |
| 346 | + String identifier = packageName + ":id/v_setting_page_item} "; |
| 347 | + ViewUtil.sortViewListByYPosition(childViewList); |
| 348 | + for (View childView: childViewList) { |
| 349 | + if (ViewUtil.getViewInfo(childView).contains(identifier)) { |
| 350 | + if (childView.isShown()) { |
| 351 | + return childView; |
| 352 | + } |
| 353 | + } |
| 354 | + } |
| 355 | + return null; |
| 356 | + } |
| 357 | + |
336 | 358 | private void doSettingsMenuInject(final Activity activity) { |
337 | | - if (ViewUtil.findViewByText(activity.getWindow().getDecorView(), Lang.getString(R.id.app_settings_name)) != null) { |
| 359 | + ViewGroup rootView = (ViewGroup) activity.getWindow().getDecorView(); |
| 360 | + if (ViewUtil.findViewByText(rootView, Lang.getString(R.id.app_settings_name)) != null) { |
338 | 361 | return; |
339 | 362 | } |
340 | | - View itemView = ViewUtil.findViewByName(activity, activity.getPackageName(), "v_setting_page_item"); |
| 363 | + View itemView = findTaobaoVSettingsPageItemView(rootView); |
341 | 364 | LinearLayout linearLayout = (LinearLayout) itemView.getParent(); |
342 | 365 | linearLayout.setPadding(0, 0, 0, 0); |
343 | 366 | List<ViewGroup.LayoutParams> childViewParamsList = new ArrayList<>(); |
|
0 commit comments