Skip to content

Commit

Permalink
+ support Alipay version 10.3.10.8310
Browse files Browse the repository at this point in the history
* 调整微信指纹图标
+ 4.6.0
  • Loading branch information
eritpchy committed Jan 9, 2023
1 parent 092eaa7 commit 3d81eb6
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 14
targetSdkVersion 30
versionCode 22
versionName "4.5.0"
versionName "4.6.0"
buildConfigField "String", "APP_PRODUCT_NAME", "\"FingerprintPay\""
}

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/surcumference/fingerprint/Constant.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/main/java/com/surcumference/fingerprint/Lang.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static String getString(int res) {
case R.id.settings_sub_title_update_modules_same_time:
return tr("将同时升级以下模块", "將同時升級以下模塊", "The following modules will be upgraded at the same time");
case R.id.fingerprint_verification:
return tr("请验证已有指纹", "請驗證已有指紋", "Fingerprint verification");
return tr("请验证指纹", "請驗證指紋", "Fingerprint verification");
case R.id.wechat_general:
return tr("通用", "一般", "General");
case R.id.app_settings_name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.surcumference.fingerprint.plugin;

import static com.surcumference.fingerprint.Constant.ICON_ALIPAY_SETTING_ENTRY_BASE64;
import static com.surcumference.fingerprint.Constant.PACKAGE_NAME_ALIPAY;

import android.app.Activity;
Expand All @@ -13,6 +14,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
Expand All @@ -26,6 +28,7 @@
import com.surcumference.fingerprint.util.BlackListUtils;
import com.surcumference.fingerprint.util.Config;
import com.surcumference.fingerprint.util.DpUtils;
import com.surcumference.fingerprint.util.ImageUtils;
import com.surcumference.fingerprint.util.NotifyUtils;
import com.surcumference.fingerprint.util.StyleUtils;
import com.surcumference.fingerprint.util.Task;
Expand Down Expand Up @@ -66,7 +69,6 @@ protected void onActivityCreated(Activity activity) {
L.d("activity", activity);
try {
final String activityClzName = activity.getClass().getName();
mCurrentActivity = activity;
if (BuildConfig.DEBUG) {
L.d("activity", activity, "clz", activityClzName);
}
Expand All @@ -83,6 +85,7 @@ protected void onActivityCreated(Activity activity) {
return;
}
mIsViewTreeObserverFirst = true;
int alipayVersionCode = getAlipayVersionCode(activity);
activity.getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(() -> {
if (mCurrentActivity == null) {
return;
Expand All @@ -95,7 +98,21 @@ protected void onActivityCreated(Activity activity) {
if (mCurrentActivity != activity) {
return;
}
if (ViewUtils.findViewByName(activity, (getAlipayVersionCode(activity) >= 352 /** 10.2.13.7000 */ ? "com.alipay.android.safepaysdk" : "com.alipay.android.app"), "simplePwdLayout") == null
if (alipayVersionCode >= 661 /** 10.3.10.8310 */) {
if (ViewUtils.findViewByName(activity, "com.alipay.android.phone.mobilecommon.verifyidentity", "simplePwdLayout") == null
&& ViewUtils.findViewByName(activity, "com.alipay.android.phone.mobilecommon.verifyidentity", "mini_linSimplePwdComponent") == null
&& ViewUtils.findViewByName(activity, "com.alipay.android.phone.mobilecommon.verifyidentity", "input_et_password") == null ) {
return;
}

if (mIsViewTreeObserverFirst) {
if (showFingerPrintDialog(activity)) {
mIsViewTreeObserverFirst = false;
}
}
return;
}
if (ViewUtils.findViewByName(activity, (alipayVersionCode >= 352 /** 10.2.13.7000 */ ? "com.alipay.android.safepaysdk" : "com.alipay.android.app"), "simplePwdLayout") == null
&& ViewUtils.findViewByName(activity, "com.alipay.android.phone.safepaybase", "mini_linSimplePwdComponent") == null
&& ViewUtils.findViewByName(activity, "com.alipay.android.phone.safepaysdk", "mini_linSimplePwdComponent") == null
&& ViewUtils.findViewByName(activity, "com.alipay.android.phone.mobilecommon.verifyidentity", "input_et_password") == null ) {
Expand Down Expand Up @@ -132,6 +149,12 @@ protected void onActivityCreated(Activity activity) {
}
}


public void onActivityResumed(Activity activity) {
L.d("activity resumed", activity);
mCurrentActivity = activity;
}

public void initFingerPrintLock(final Context context, final Runnable onSuccessUnlockCallback) {
mFingerprintIdentify = new FingerprintIdentify(context);
mFingerprintIdentify.setSupportAndroidL(true);
Expand Down Expand Up @@ -178,15 +201,15 @@ public void onStartFailedByDeviceLocked() {
}
}

public void showFingerPrintDialog(final Activity activity) {
public boolean showFingerPrintDialog(final Activity activity) {
final Context context = activity;
try {
if (getAlipayVersionCode(activity) >= 224) {
if (activity.getClass().getName().contains(".MspContainerActivity")) {
View payTextView = ViewUtils.findViewByText(activity.getWindow().getDecorView(), "支付宝支付密码", "支付寶支付密碼", "Alipay Payment Password");
L.d("payTextView", payTextView);
if (payTextView == null) {
return;
return false;
}
}
}
Expand Down Expand Up @@ -260,6 +283,7 @@ public void showFingerPrintDialog(final Activity activity) {
Task.onMain(100, () -> mFingerPrintAlertDialog = alipayPayView.showInDialog());
} catch (OutOfMemoryError e) {
}
return true;
}

/**
Expand Down Expand Up @@ -321,6 +345,14 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
L.e(e);
}

int versionCode = getAlipayVersionCode(activity);
if (versionCode >= 661 /** 10.3.10.8310 */) {
ImageView itemIconImageView = new ImageView(activity);
itemIconImageView.setImageBitmap(ImageUtils.base64ToBitmap(ICON_ALIPAY_SETTING_ENTRY_BASE64));
LinearLayout.LayoutParams itemIconImageViewLayoutParams = new LinearLayout.LayoutParams(DpUtils.dip2px(activity, 24), DpUtils.dip2px(activity, 24));
itemIconImageViewLayoutParams.leftMargin = DpUtils.dip2px(activity, 12);
itemHlinearLayout.addView(itemIconImageView, itemIconImageViewLayoutParams);
}
itemHlinearLayout.addView(itemNameText, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
itemHlinearLayout.addView(itemSummerText, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));

Expand All @@ -330,9 +362,20 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
LinearLayout rootLinearLayout = new LinearLayout(activity);
rootLinearLayout.setOrientation(LinearLayout.VERTICAL);
rootLinearLayout.addView(lineTopView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1));
rootLinearLayout.addView(itemHlinearLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DpUtils.dip2px(activity, 45)));
LinearLayout.LayoutParams lineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
lineParams.bottomMargin = DpUtils.dip2px(activity, 20);

if (versionCode >= 661 /** 10.3.10.8310 */) {
lineTopView.setVisibility(View.INVISIBLE);
itemHlinearLayout.setBackground(new XDrawable.Builder().defaultColor(Color.WHITE)
.pressedColor(0xFFEBEBEB).round(32).create());
lineBottomView.setVisibility(View.INVISIBLE);
lineParams.bottomMargin = DpUtils.dip2px(activity, 8);
rootLinearLayout.addView(itemHlinearLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DpUtils.dip2px(activity, 50)));
} else {
rootLinearLayout.addView(itemHlinearLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DpUtils.dip2px(activity, 45)));
lineParams.bottomMargin = DpUtils.dip2px(activity, 20);
}

rootLinearLayout.addView(lineBottomView, lineParams);

listView.addHeaderView(rootLinearLayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ protected void onPayDialogShown(ViewGroup rootView) {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
fingerPrintLayout.setLayoutParams(layoutParams);
ImageView fingerprintImageView = new ImageView(context);

fingerPrintLayout.setClipChildren(false);
ImageView fingerprintImageView = new ImageView(context);
try {
final Bitmap bitmap = ImageUtils.base64ToBitmap(Constant.ICON_FINGER_PRINT_WECHAT_BASE64);
fingerprintImageView.setImageBitmap(bitmap);
Expand All @@ -279,8 +280,11 @@ public void onWindowDetached() {
} catch (OutOfMemoryError e) {
L.d(e);
}
fingerPrintLayout.addView(fingerprintImageView);

fingerprintImageView.setScaleY(4F);
fingerprintImageView.setScaleX(4F);
RelativeLayout.LayoutParams fingerprintImageViewLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
fingerprintImageViewLayoutParams.topMargin = DpUtils.dip2px(context, 24);
fingerPrintLayout.addView(fingerprintImageView, fingerprintImageViewLayoutParams);

final Runnable switchToFingerprintRunnable = ()-> {
mInputEditText.setVisibility(View.GONE);
Expand All @@ -290,6 +294,9 @@ public void onWindowDetached() {
passwordLayout.removeView(fingerPrintLayoutLast);
}
passwordLayout.addView(fingerPrintLayout);
passwordLayout.setClipChildren(false);
((ViewGroup)passwordLayout.getParent()).setClipChildren(false);
((ViewGroup)passwordLayout.getParent().getParent()).setClipChildren(false);

initFingerPrintLock(context, ()-> {
BlackListUtils.applyIfNeeded(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Bundle;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

import com.surcumference.fingerprint.BuildConfig;
import com.surcumference.fingerprint.bean.PluginTarget;
Expand Down Expand Up @@ -54,6 +55,11 @@ public static void init() {
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
plugin.onActivityCreated(activity);
}

@Override
public void onActivityResumed(@NonNull Activity activity) {
plugin.onActivityResumed(activity);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
onActivityCreated((Activity) param.thisObject);
}
});
XposedHelpers.findAndHookMethod(Activity.class, "onResume", new XC_MethodHook() {

@TargetApi(21)
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
onActivityResumed((Activity) param.thisObject);
}
});
} catch (Throwable l) {
XposedBridge.log(l);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.surcumference.fingerprint.util.paydialog;

import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
Expand Down Expand Up @@ -49,7 +48,6 @@ public static WeChatPayDialog findFrom(int versionCode, ViewGroup rootView) {
}
if (view instanceof EditText) {
payDialog.inputEditText = (EditText)view;
view.setBackgroundColor(Color.RED);
}
} else if (view.getClass().getName().endsWith(".MyKeyboardWindow")) {
L.d("密码键盘:" + view);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.surcumference.fingerprint.view;

import static com.surcumference.fingerprint.Constant.ICON_FINGER_PRINT_ALIPAY_BASE64;
import static com.surcumference.fingerprint.Constant.ICON_FINGER_PRINT_CLOSE;
import static com.surcumference.fingerprint.Constant.ICON_FINGER_PRINT_CLOSE_BASE64;

import android.app.AlertDialog;
import android.content.Context;
Expand Down Expand Up @@ -61,7 +61,7 @@ private void init(Context context) {

mCloseImageContainer = new FrameLayout(context);
ImageView closeImage = new ImageView(context);
closeImage.setImageBitmap(ImageUtils.base64ToBitmap(ICON_FINGER_PRINT_CLOSE));
closeImage.setImageBitmap(ImageUtils.base64ToBitmap(ICON_FINGER_PRINT_CLOSE_BASE64));
mCloseImageContainer.setPadding(DpUtils.dip2px(context, 10),DpUtils.dip2px(context, 15),DpUtils.dip2px(context, 15),DpUtils.dip2px(context, 10));
mCloseImageContainer.addView(closeImage, new FrameLayout.LayoutParams(DpUtils.dip2px(context, 22), DpUtils.dip2px(context, 22)));

Expand Down

0 comments on commit 3d81eb6

Please sign in to comment.