44import android .app .Activity ;
55import android .content .Context ;
66import android .content .pm .PackageInfo ;
7- import android .graphics .Bitmap ;
87import android .graphics .Color ;
98import android .graphics .drawable .ColorDrawable ;
109import android .graphics .drawable .Drawable ;
1918import android .view .ViewGroup ;
2019import android .view .ViewTreeObserver ;
2120import android .widget .EditText ;
22- import android .widget .ImageView ;
2321import android .widget .LinearLayout ;
2422import android .widget .TextView ;
2523import android .widget .Toast ;
3230import com .yyxx .wechatfp .network .updateCheck .UpdateFactory ;
3331import com .yyxx .wechatfp .util .Config ;
3432import com .yyxx .wechatfp .util .DpUtil ;
35- import com .yyxx .wechatfp .util .ImageUtil ;
3633import com .yyxx .wechatfp .util .KeyboardUtils ;
3734import com .yyxx .wechatfp .util .PermissionUtils ;
3835import com .yyxx .wechatfp .util .QQUtils ;
5451import de .robv .android .xposed .XposedHelpers ;
5552import de .robv .android .xposed .callbacks .XC_LoadPackage ;
5653
57- import static com .yyxx .wechatfp .Constant .ICON_FINGER_PRINT_ALIPAY_BASE64 ;
5854
5955/**
6056 * Created by Jason on 2017/9/8.
@@ -212,7 +208,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
212208 boolean longPassword = payDialog .isLongPassword ();
213209 ViewGroup editCon = longPassword ? (ViewGroup ) payDialog .inputEditText .getParent ().getParent ().getParent ()
214210 : (ViewGroup ) payDialog .inputEditText .getParent ().getParent ();
215- ImageView fingerprintImageView = prepareFingerprintView (context );
211+ View fingerprintView = prepareFingerprintView (context );
216212
217213 Runnable switchToPwdRunnable = () -> {
218214 if (activity != mCurrentPayActivity ) {
@@ -230,8 +226,8 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
230226 payDialog .keyboardView .setVisibility (View .VISIBLE );
231227 }
232228 }
233- if (fingerprintImageView .getVisibility () != View .GONE ) {
234- fingerprintImageView .setVisibility (View .GONE );
229+ if (fingerprintView .getVisibility () != View .GONE ) {
230+ fingerprintView .setVisibility (View .GONE );
235231 }
236232 if (payDialog .titleTextView != null ) {
237233 if (mQQVersionCode >= QQ_VERSION_CODE_7_3_0 ) {
@@ -277,8 +273,8 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
277273 });
278274 }
279275 }
280- if (fingerprintImageView .getVisibility () != View .VISIBLE ) {
281- fingerprintImageView .setVisibility (View .VISIBLE );
276+ if (fingerprintView .getVisibility () != View .VISIBLE ) {
277+ fingerprintView .setVisibility (View .VISIBLE );
282278 }
283279 if (payDialog .titleTextView != null ) {
284280 payDialog .titleTextView .setText (Lang .getString (R .id .qq_payview_fingerprint_title ));
@@ -300,7 +296,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
300296 resumeFingerprintIdentify ();
301297 };
302298
303- fingerprintImageView .setOnClickListener (v -> {
299+ fingerprintView .setOnClickListener (v -> {
304300 switchToPwdRunnable .run ();
305301 });
306302
@@ -316,13 +312,13 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
316312 }
317313
318314 ViewGroup viewGroup = ((ViewGroup )(editCon .getParent ()));
319- removeAllFingerprintImageView (viewGroup );
315+ removeAllFingerprintView (viewGroup );
320316
321317 int keyboardViewPosition = ViewUtil .findChildViewPosition (viewGroup , payDialog .keyboardView );
322318 if (keyboardViewPosition >= 0 ) {
323- viewGroup .addView (fingerprintImageView , keyboardViewPosition );
319+ viewGroup .addView (fingerprintView , keyboardViewPosition );
324320 } else {
325- viewGroup .addView (fingerprintImageView );
321+ viewGroup .addView (fingerprintView );
326322 }
327323
328324 mCurrentPayActivity = activity ;
@@ -348,7 +344,7 @@ private void initPayActivity(Activity activity, int retryDelay, int retryCountdo
348344 }
349345 }
350346
351- private void removeAllFingerprintImageView (ViewGroup viewGroup ) {
347+ private void removeAllFingerprintView (ViewGroup viewGroup ) {
352348 List <View > pendingRemoveList = new ArrayList <>();
353349
354350 int childCount = viewGroup .getChildCount ();
@@ -364,44 +360,20 @@ private void removeAllFingerprintImageView(ViewGroup viewGroup) {
364360 }
365361 }
366362
367- private ImageView prepareFingerprintView (Context context ) {
363+ private View prepareFingerprintView (Context context ) {
368364
369- ImageView imageView = new ImageView (context );
370- imageView .setTag (TAG_FINGER_PRINT_IMAGE );
371- Bitmap bitmap = null ;
372- try {
373- bitmap = ImageUtil .base64ToBitmap (ICON_FINGER_PRINT_ALIPAY_BASE64 );
374- imageView .setImageBitmap (bitmap );
375- } catch (OutOfMemoryError e ) {
376- }
377- LinearLayout .LayoutParams params = new LinearLayout .LayoutParams (DpUtil .dip2px (context , 40 ), DpUtil .dip2px (context , 40 ));
365+ TextView textView = new TextView (context );
366+ textView .setTag (TAG_FINGER_PRINT_IMAGE );
367+ textView .setText ("使用密码" );
368+ textView .setTextSize (16 );
369+ LinearLayout .LayoutParams params = new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT );
378370 params .gravity = Gravity .CENTER ;
379371 if (mQQVersionCode >= QQ_VERSION_CODE_7_3_0 ) {
380372 //QQ居然拿键盘底部来定位... To TP工程师. 你们的Activity太重了
381373 params .bottomMargin = DpUtil .dip2px (context , 30 );
382374 }
383- imageView .setLayoutParams (params );
384-
385- final Bitmap bitmapFinal = bitmap ;
386- imageView .addOnAttachStateChangeListener (new View .OnAttachStateChangeListener () {
387- @ Override
388- public void onViewAttachedToWindow (View v ) {
389- }
390-
391- @ Override
392- public void onViewDetachedFromWindow (View v ) {
393- try {
394- if (bitmapFinal != null ) {
395- bitmapFinal .recycle ();
396- }
397- } catch (Exception e ) {
398- L .e (e );
399- }
400- cancelFingerprintIdentify ();
401- L .d ("onViewDetachedFromWindow" );
402- }
403- });
404- return imageView ;
375+ textView .setLayoutParams (params );
376+ return textView ;
405377 }
406378
407379
0 commit comments