11package com .surcumference .fingerprint .plugin ;
22
3+ import static com .surcumference .fingerprint .Constant .ICON_ALIPAY_SETTING_ENTRY_BASE64 ;
34import static com .surcumference .fingerprint .Constant .PACKAGE_NAME_ALIPAY ;
45
56import android .app .Activity ;
1314import android .view .View ;
1415import android .view .ViewGroup ;
1516import android .widget .EditText ;
17+ import android .widget .ImageView ;
1618import android .widget .LinearLayout ;
1719import android .widget .ListView ;
1820import android .widget .TextView ;
2628import com .surcumference .fingerprint .util .BlackListUtils ;
2729import com .surcumference .fingerprint .util .Config ;
2830import com .surcumference .fingerprint .util .DpUtils ;
31+ import com .surcumference .fingerprint .util .ImageUtils ;
2932import com .surcumference .fingerprint .util .NotifyUtils ;
3033import com .surcumference .fingerprint .util .StyleUtils ;
3134import com .surcumference .fingerprint .util .Task ;
@@ -66,7 +69,6 @@ protected void onActivityCreated(Activity activity) {
6669 L .d ("activity" , activity );
6770 try {
6871 final String activityClzName = activity .getClass ().getName ();
69- mCurrentActivity = activity ;
7072 if (BuildConfig .DEBUG ) {
7173 L .d ("activity" , activity , "clz" , activityClzName );
7274 }
@@ -83,6 +85,7 @@ protected void onActivityCreated(Activity activity) {
8385 return ;
8486 }
8587 mIsViewTreeObserverFirst = true ;
88+ int alipayVersionCode = getAlipayVersionCode (activity );
8689 activity .getWindow ().getDecorView ().getViewTreeObserver ().addOnGlobalLayoutListener (() -> {
8790 if (mCurrentActivity == null ) {
8891 return ;
@@ -95,7 +98,21 @@ protected void onActivityCreated(Activity activity) {
9598 if (mCurrentActivity != activity ) {
9699 return ;
97100 }
98- if (ViewUtils .findViewByName (activity , (getAlipayVersionCode (activity ) >= 352 /** 10.2.13.7000 */ ? "com.alipay.android.safepaysdk" : "com.alipay.android.app" ), "simplePwdLayout" ) == null
101+ if (alipayVersionCode >= 661 /** 10.3.10.8310 */ ) {
102+ if (ViewUtils .findViewByName (activity , "com.alipay.android.phone.mobilecommon.verifyidentity" , "simplePwdLayout" ) == null
103+ && ViewUtils .findViewByName (activity , "com.alipay.android.phone.mobilecommon.verifyidentity" , "mini_linSimplePwdComponent" ) == null
104+ && ViewUtils .findViewByName (activity , "com.alipay.android.phone.mobilecommon.verifyidentity" , "input_et_password" ) == null ) {
105+ return ;
106+ }
107+
108+ if (mIsViewTreeObserverFirst ) {
109+ if (showFingerPrintDialog (activity )) {
110+ mIsViewTreeObserverFirst = false ;
111+ }
112+ }
113+ return ;
114+ }
115+ if (ViewUtils .findViewByName (activity , (alipayVersionCode >= 352 /** 10.2.13.7000 */ ? "com.alipay.android.safepaysdk" : "com.alipay.android.app" ), "simplePwdLayout" ) == null
99116 && ViewUtils .findViewByName (activity , "com.alipay.android.phone.safepaybase" , "mini_linSimplePwdComponent" ) == null
100117 && ViewUtils .findViewByName (activity , "com.alipay.android.phone.safepaysdk" , "mini_linSimplePwdComponent" ) == null
101118 && ViewUtils .findViewByName (activity , "com.alipay.android.phone.mobilecommon.verifyidentity" , "input_et_password" ) == null ) {
@@ -132,6 +149,12 @@ protected void onActivityCreated(Activity activity) {
132149 }
133150 }
134151
152+
153+ public void onActivityResumed (Activity activity ) {
154+ L .d ("activity resumed" , activity );
155+ mCurrentActivity = activity ;
156+ }
157+
135158 public void initFingerPrintLock (final Context context , final Runnable onSuccessUnlockCallback ) {
136159 mFingerprintIdentify = new FingerprintIdentify (context );
137160 mFingerprintIdentify .setSupportAndroidL (true );
@@ -178,15 +201,15 @@ public void onStartFailedByDeviceLocked() {
178201 }
179202 }
180203
181- public void showFingerPrintDialog (final Activity activity ) {
204+ public boolean showFingerPrintDialog (final Activity activity ) {
182205 final Context context = activity ;
183206 try {
184207 if (getAlipayVersionCode (activity ) >= 224 ) {
185208 if (activity .getClass ().getName ().contains (".MspContainerActivity" )) {
186209 View payTextView = ViewUtils .findViewByText (activity .getWindow ().getDecorView (), "支付宝支付密码" , "支付寶支付密碼" , "Alipay Payment Password" );
187210 L .d ("payTextView" , payTextView );
188211 if (payTextView == null ) {
189- return ;
212+ return false ;
190213 }
191214 }
192215 }
@@ -260,6 +283,7 @@ public void showFingerPrintDialog(final Activity activity) {
260283 Task .onMain (100 , () -> mFingerPrintAlertDialog = alipayPayView .showInDialog ());
261284 } catch (OutOfMemoryError e ) {
262285 }
286+ return true ;
263287 }
264288
265289 /**
@@ -321,6 +345,14 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
321345 L .e (e );
322346 }
323347
348+ int versionCode = getAlipayVersionCode (activity );
349+ if (versionCode >= 661 /** 10.3.10.8310 */ ) {
350+ ImageView itemIconImageView = new ImageView (activity );
351+ itemIconImageView .setImageBitmap (ImageUtils .base64ToBitmap (ICON_ALIPAY_SETTING_ENTRY_BASE64 ));
352+ LinearLayout .LayoutParams itemIconImageViewLayoutParams = new LinearLayout .LayoutParams (DpUtils .dip2px (activity , 24 ), DpUtils .dip2px (activity , 24 ));
353+ itemIconImageViewLayoutParams .leftMargin = DpUtils .dip2px (activity , 12 );
354+ itemHlinearLayout .addView (itemIconImageView , itemIconImageViewLayoutParams );
355+ }
324356 itemHlinearLayout .addView (itemNameText , new LinearLayout .LayoutParams (0 , ViewGroup .LayoutParams .MATCH_PARENT , 1 ));
325357 itemHlinearLayout .addView (itemSummerText , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .MATCH_PARENT ));
326358
@@ -330,9 +362,20 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
330362 LinearLayout rootLinearLayout = new LinearLayout (activity );
331363 rootLinearLayout .setOrientation (LinearLayout .VERTICAL );
332364 rootLinearLayout .addView (lineTopView , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , 1 ));
333- rootLinearLayout .addView (itemHlinearLayout , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , DpUtils .dip2px (activity , 45 )));
334365 LinearLayout .LayoutParams lineParams = new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , 1 );
335- lineParams .bottomMargin = DpUtils .dip2px (activity , 20 );
366+
367+ if (versionCode >= 661 /** 10.3.10.8310 */ ) {
368+ lineTopView .setVisibility (View .INVISIBLE );
369+ itemHlinearLayout .setBackground (new XDrawable .Builder ().defaultColor (Color .WHITE )
370+ .pressedColor (0xFFEBEBEB ).round (32 ).create ());
371+ lineBottomView .setVisibility (View .INVISIBLE );
372+ lineParams .bottomMargin = DpUtils .dip2px (activity , 8 );
373+ rootLinearLayout .addView (itemHlinearLayout , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , DpUtils .dip2px (activity , 50 )));
374+ } else {
375+ rootLinearLayout .addView (itemHlinearLayout , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , DpUtils .dip2px (activity , 45 )));
376+ lineParams .bottomMargin = DpUtils .dip2px (activity , 20 );
377+ }
378+
336379 rootLinearLayout .addView (lineBottomView , lineParams );
337380
338381 listView .addHeaderView (rootLinearLayout );
0 commit comments