1
1
package com .surcumference .fingerprint .plugin ;
2
2
3
+ import static com .surcumference .fingerprint .Constant .ICON_ALIPAY_SETTING_ENTRY_BASE64 ;
3
4
import static com .surcumference .fingerprint .Constant .PACKAGE_NAME_ALIPAY ;
4
5
5
6
import android .app .Activity ;
13
14
import android .view .View ;
14
15
import android .view .ViewGroup ;
15
16
import android .widget .EditText ;
17
+ import android .widget .ImageView ;
16
18
import android .widget .LinearLayout ;
17
19
import android .widget .ListView ;
18
20
import android .widget .TextView ;
26
28
import com .surcumference .fingerprint .util .BlackListUtils ;
27
29
import com .surcumference .fingerprint .util .Config ;
28
30
import com .surcumference .fingerprint .util .DpUtils ;
31
+ import com .surcumference .fingerprint .util .ImageUtils ;
29
32
import com .surcumference .fingerprint .util .NotifyUtils ;
30
33
import com .surcumference .fingerprint .util .StyleUtils ;
31
34
import com .surcumference .fingerprint .util .Task ;
@@ -66,7 +69,6 @@ protected void onActivityCreated(Activity activity) {
66
69
L .d ("activity" , activity );
67
70
try {
68
71
final String activityClzName = activity .getClass ().getName ();
69
- mCurrentActivity = activity ;
70
72
if (BuildConfig .DEBUG ) {
71
73
L .d ("activity" , activity , "clz" , activityClzName );
72
74
}
@@ -83,6 +85,7 @@ protected void onActivityCreated(Activity activity) {
83
85
return ;
84
86
}
85
87
mIsViewTreeObserverFirst = true ;
88
+ int alipayVersionCode = getAlipayVersionCode (activity );
86
89
activity .getWindow ().getDecorView ().getViewTreeObserver ().addOnGlobalLayoutListener (() -> {
87
90
if (mCurrentActivity == null ) {
88
91
return ;
@@ -95,7 +98,21 @@ protected void onActivityCreated(Activity activity) {
95
98
if (mCurrentActivity != activity ) {
96
99
return ;
97
100
}
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
99
116
&& ViewUtils .findViewByName (activity , "com.alipay.android.phone.safepaybase" , "mini_linSimplePwdComponent" ) == null
100
117
&& ViewUtils .findViewByName (activity , "com.alipay.android.phone.safepaysdk" , "mini_linSimplePwdComponent" ) == null
101
118
&& ViewUtils .findViewByName (activity , "com.alipay.android.phone.mobilecommon.verifyidentity" , "input_et_password" ) == null ) {
@@ -132,6 +149,12 @@ protected void onActivityCreated(Activity activity) {
132
149
}
133
150
}
134
151
152
+
153
+ public void onActivityResumed (Activity activity ) {
154
+ L .d ("activity resumed" , activity );
155
+ mCurrentActivity = activity ;
156
+ }
157
+
135
158
public void initFingerPrintLock (final Context context , final Runnable onSuccessUnlockCallback ) {
136
159
mFingerprintIdentify = new FingerprintIdentify (context );
137
160
mFingerprintIdentify .setSupportAndroidL (true );
@@ -178,15 +201,15 @@ public void onStartFailedByDeviceLocked() {
178
201
}
179
202
}
180
203
181
- public void showFingerPrintDialog (final Activity activity ) {
204
+ public boolean showFingerPrintDialog (final Activity activity ) {
182
205
final Context context = activity ;
183
206
try {
184
207
if (getAlipayVersionCode (activity ) >= 224 ) {
185
208
if (activity .getClass ().getName ().contains (".MspContainerActivity" )) {
186
209
View payTextView = ViewUtils .findViewByText (activity .getWindow ().getDecorView (), "支付宝支付密码" , "支付寶支付密碼" , "Alipay Payment Password" );
187
210
L .d ("payTextView" , payTextView );
188
211
if (payTextView == null ) {
189
- return ;
212
+ return false ;
190
213
}
191
214
}
192
215
}
@@ -260,6 +283,7 @@ public void showFingerPrintDialog(final Activity activity) {
260
283
Task .onMain (100 , () -> mFingerPrintAlertDialog = alipayPayView .showInDialog ());
261
284
} catch (OutOfMemoryError e ) {
262
285
}
286
+ return true ;
263
287
}
264
288
265
289
/**
@@ -321,6 +345,14 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
321
345
L .e (e );
322
346
}
323
347
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
+ }
324
356
itemHlinearLayout .addView (itemNameText , new LinearLayout .LayoutParams (0 , ViewGroup .LayoutParams .MATCH_PARENT , 1 ));
325
357
itemHlinearLayout .addView (itemSummerText , new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .MATCH_PARENT ));
326
358
@@ -330,9 +362,20 @@ private void doSettingsMenuInject_10_1_38(final Activity activity) {
330
362
LinearLayout rootLinearLayout = new LinearLayout (activity );
331
363
rootLinearLayout .setOrientation (LinearLayout .VERTICAL );
332
364
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 )));
334
365
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
+
336
379
rootLinearLayout .addView (lineBottomView , lineParams );
337
380
338
381
listView .addHeaderView (rootLinearLayout );
0 commit comments