Skip to content

Commit

Permalink
+ 3.9.22
Browse files Browse the repository at this point in the history
+ 适配支付宝10.2.13.7000
+ 适配淘宝9.20.0
+ QQ屏下指纹优化
  • Loading branch information
eritpchy committed Feb 2, 2021
1 parent d982790 commit ead8243
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 76 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'com.android.application'
def ADB_PATH = "${android.getSdkDirectory()}/platform-tools/adb"
android {

compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.surcumference.fingerprintpay"
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 30
versionCode 21
versionName "3.9.21"
versionName "3.9.22"
buildConfigField "String", "APP_PRODUCT_NAME", "\"WeChatFp\""
}

Expand Down
61 changes: 61 additions & 0 deletions app/src/main/java/com/yyxx/wechatfp/util/TaobaoVersionControl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.yyxx.wechatfp.util;

public class TaobaoVersionControl {

public static DigitPasswordKeyPad getDigitPasswordKeyPad(int taobaoVersion) {
//9.20.0
if (taobaoVersion >= 323) {
return new DigitPasswordKeyPad("com.taobao.taobao",
new String[]{"au_num_1"},
new String[]{"au_num_2"},
new String[]{"au_num_3"},
new String[]{"au_num_4"},
new String[]{"au_num_5"},
new String[]{"au_num_6"},
new String[]{"au_num_7"},
new String[]{"au_num_8"},
new String[]{"au_num_9"},
new String[]{"au_num_0"});
} else {
return new DigitPasswordKeyPad("com.taobao.taobao",
new String[]{"key_num_1"},
new String[]{"key_num_2"},
new String[]{"key_num_3"},
new String[]{"key_num_4", "key_4"},
new String[]{"key_num_5"},
new String[]{"key_num_6"},
new String[]{"key_num_7"},
new String[]{"key_num_8"},
new String[]{"key_num_9"},
new String[]{"key_num_0"});
}
}

public static class DigitPasswordKeyPad {
public String modulePackageName;
public String[] key1;
public String[] key2;
public String[] key3;
public String[] key4;
public String[] key5;
public String[] key6;
public String[] key7;
public String[] key8;
public String[] key9;
public String[] key0;

public DigitPasswordKeyPad(String modulePackageName, String[] key1, String[] key2, String[] key3, String[] key4, String[] key5, String[] key6, String[] key7, String[] key8, String[] key9, String[] key0) {
this.modulePackageName = modulePackageName;
this.key1 = key1;
this.key2 = key2;
this.key3 = key3;
this.key4 = key4;
this.key5 = key5;
this.key6 = key6;
this.key7 = key7;
this.key8 = key8;
this.key9 = key9;
this.key0 = key0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public void run() {
if (mCurrentActivity != activity) {
return;
}

if (ViewUtil.findViewByName(activity, "com.alipay.android.app", "simplePwdLayout") == null
if (ViewUtil.findViewByName(activity, (mAlipayVersionCode >= 352 /** 10.2.13.7000 */ ? "com.alipay.android.safepaysdk" : "com.alipay.android.app"), "simplePwdLayout") == null
&& ViewUtil.findViewByName(activity, "com.alipay.android.phone.safepaybase", "mini_linSimplePwdComponent") == null
&& ViewUtil.findViewByName(activity, "com.alipay.android.phone.mobilecommon.verifyidentity", "input_et_password") == null ) {
return;
Expand Down Expand Up @@ -330,7 +329,8 @@ public void showFingerPrintDialog(final Activity activity) {
onCompleteRunnable.run();
});

AlertDialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Light_Dialog_MinWidth)).setView(rootVLinearLayout).setOnDismissListener(dialogInterface -> {
AlertDialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(context, android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q ? android.R.style.Theme_DeviceDefault_DayNight : android.R.style.Theme_Holo_Light_Dialog_MinWidth))
.setView(rootVLinearLayout).setOnDismissListener(dialogInterface -> {
FingerprintIdentify fingerprintIdentify = mFingerprintIdentify;
if (fingerprintIdentify != null) {
fingerprintIdentify.cancelIdentify();
Expand All @@ -344,8 +344,7 @@ public void showFingerPrintDialog(final Activity activity) {
}
}).setCancelable(false).create();
mFingerPrintAlertDialog = dialog;
dialog.show();

Task.onMain(100, dialog::show);
} catch (OutOfMemoryError e) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
Expand All @@ -19,7 +18,6 @@
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
Expand All @@ -32,7 +30,6 @@
import com.yyxx.wechatfp.network.updateCheck.UpdateFactory;
import com.yyxx.wechatfp.util.Config;
import com.yyxx.wechatfp.util.DpUtil;
import com.yyxx.wechatfp.util.ImageUtil;
import com.yyxx.wechatfp.util.KeyboardUtils;
import com.yyxx.wechatfp.util.PermissionUtils;
import com.yyxx.wechatfp.util.QQUtils;
Expand All @@ -54,7 +51,6 @@
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

import static com.yyxx.wechatfp.Constant.ICON_FINGER_PRINT_ALIPAY_BASE64;

/**
* Created by Jason on 2017/9/8.
Expand Down Expand Up @@ -212,7 +208,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
boolean longPassword = payDialog.isLongPassword();
ViewGroup editCon = longPassword ? (ViewGroup) payDialog.inputEditText.getParent().getParent().getParent()
: (ViewGroup) payDialog.inputEditText.getParent().getParent();
ImageView fingerprintImageView = prepareFingerprintView(context);
View fingerprintView = prepareFingerprintView(context);

Runnable switchToPwdRunnable = () -> {
if (activity != mCurrentPayActivity) {
Expand All @@ -230,8 +226,8 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
payDialog.keyboardView.setVisibility(View.VISIBLE);
}
}
if (fingerprintImageView.getVisibility() != View.GONE) {
fingerprintImageView.setVisibility(View.GONE);
if (fingerprintView.getVisibility() != View.GONE) {
fingerprintView.setVisibility(View.GONE);
}
if (payDialog.titleTextView != null) {
if (mQQVersionCode >= QQ_VERSION_CODE_7_3_0) {
Expand Down Expand Up @@ -277,8 +273,8 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
});
}
}
if (fingerprintImageView.getVisibility() != View.VISIBLE) {
fingerprintImageView.setVisibility(View.VISIBLE);
if (fingerprintView.getVisibility() != View.VISIBLE) {
fingerprintView.setVisibility(View.VISIBLE);
}
if (payDialog.titleTextView != null) {
payDialog.titleTextView.setText(Lang.getString(R.id.qq_payview_fingerprint_title));
Expand All @@ -300,7 +296,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
resumeFingerprintIdentify();
};

fingerprintImageView.setOnClickListener(v -> {
fingerprintView.setOnClickListener(v -> {
switchToPwdRunnable.run();
});

Expand All @@ -316,13 +312,13 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
}

ViewGroup viewGroup = ((ViewGroup)(editCon.getParent()));
removeAllFingerprintImageView(viewGroup);
removeAllFingerprintView(viewGroup);

int keyboardViewPosition = ViewUtil.findChildViewPosition(viewGroup, payDialog.keyboardView);
if (keyboardViewPosition >= 0) {
viewGroup.addView(fingerprintImageView, keyboardViewPosition);
viewGroup.addView(fingerprintView, keyboardViewPosition);
} else {
viewGroup.addView(fingerprintImageView);
viewGroup.addView(fingerprintView);
}

mCurrentPayActivity = activity;
Expand All @@ -348,7 +344,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
}
}

private void removeAllFingerprintImageView(ViewGroup viewGroup) {
private void removeAllFingerprintView(ViewGroup viewGroup) {
List<View> pendingRemoveList = new ArrayList<>();

int childCount = viewGroup.getChildCount();
Expand All @@ -364,44 +360,20 @@ private void removeAllFingerprintImageView(ViewGroup viewGroup) {
}
}

private ImageView prepareFingerprintView(Context context) {
private View prepareFingerprintView(Context context) {

ImageView imageView = new ImageView(context);
imageView.setTag(TAG_FINGER_PRINT_IMAGE);
Bitmap bitmap = null;
try {
bitmap = ImageUtil.base64ToBitmap(ICON_FINGER_PRINT_ALIPAY_BASE64);
imageView.setImageBitmap(bitmap);
} catch (OutOfMemoryError e) {
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dip2px(context, 40), DpUtil.dip2px(context, 40));
TextView textView = new TextView(context);
textView.setTag(TAG_FINGER_PRINT_IMAGE);
textView.setText("使用密码");
textView.setTextSize(16);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
if (mQQVersionCode >= QQ_VERSION_CODE_7_3_0) {
//QQ居然拿键盘底部来定位... To TP工程师. 你们的Activity太重了
params.bottomMargin = DpUtil.dip2px(context, 30);
}
imageView.setLayoutParams(params);

final Bitmap bitmapFinal = bitmap;
imageView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
}

@Override
public void onViewDetachedFromWindow(View v) {
try {
if (bitmapFinal != null) {
bitmapFinal.recycle();
}
} catch (Exception e) {
L.e(e);
}
cancelFingerprintIdentify();
L.d("onViewDetachedFromWindow");
}
});
return imageView;
textView.setLayoutParams(params);
return textView;
}


Expand Down
Loading

0 comments on commit ead8243

Please sign in to comment.