Skip to content

Commit 39e9aff

Browse files
committed
* fix Unable to show Fingerprint menu in Taobao 7.11.0
1 parent 455f04a commit 39e9aff

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

app/src/main/java/com/yyxx/wechatfp/util/ViewUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static View findViewByName(Activity activity, String packageName, String.
148148
View rootView = activity.getWindow().getDecorView();
149149
List<View> viewList = new ArrayList<>();
150150
getChildViews((ViewGroup) rootView, id, viewList);
151-
Collections.sort(viewList, sYLocationLHCompator);
151+
sortViewListByYPosition(viewList);
152152
int outViewListSize = viewList.size();
153153
if (outViewListSize == 1) {
154154
return viewList.get(0);
@@ -376,6 +376,10 @@ public int compare(View o1, View o2) {
376376
}
377377
};
378378

379+
public static void sortViewListByYPosition (List<View> viewList) {
380+
Collections.sort(viewList, sYLocationLHCompator);
381+
}
382+
379383
public static int getViewYPosInScreen(View v) {
380384
int[] location = new int[]{0, 0};
381385
v.getLocationOnScreen(location);

app/src/main/java/com/yyxx/wechatfp/xposed/plugin/XposedAlipayPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ private boolean tryInputGenericPassword(Activity activity, String password) {
464464
}
465465

466466
private EditText findPasswordEditText(Activity activity) {
467-
View pwdEditText = ViewUtil.findViewByName(activity, "com.alipay.android.phone.safepaybase", "input_et_password");;
467+
View pwdEditText = ViewUtil.findViewByName(activity, "com.alipay.android.phone.safepaybase", "input_et_password");
468468
L.d("pwdEditText1", pwdEditText);
469469
if (pwdEditText instanceof EditText) {
470470
if (!pwdEditText.isShown()) {

app/src/main/java/com/yyxx/wechatfp/xposed/plugin/XposedTaobaoPlugin.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import android.graphics.Color;
1010
import android.os.Bundle;
1111
import android.support.annotation.Keep;
12+
import android.support.annotation.NonNull;
13+
import android.support.annotation.Nullable;
1214
import android.text.TextUtils;
1315
import android.util.TypedValue;
1416
import android.view.ContextThemeWrapper;
@@ -333,11 +335,32 @@ public void showFingerPrintDialog(final Activity activity) {
333335
}
334336
}
335337

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+
336358
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) {
338361
return;
339362
}
340-
View itemView = ViewUtil.findViewByName(activity, activity.getPackageName(), "v_setting_page_item");
363+
View itemView = findTaobaoVSettingsPageItemView(rootView);
341364
LinearLayout linearLayout = (LinearLayout) itemView.getParent();
342365
linearLayout.setPadding(0, 0, 0, 0);
343366
List<ViewGroup.LayoutParams> childViewParamsList = new ArrayList<>();

0 commit comments

Comments
 (0)