package cn.jiguang.verifysdk.e; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.MediaMetadataRetriever; import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; import android.text.SpannableString; import android.text.TextPaint; import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.Window; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.LinearInterpolator; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import androidx.core.view.ViewCompat; import cn.jiguang.verifysdk.api.JVerifyUIClickCallback; import cn.jiguang.verifysdk.api.JVerifyUIConfig; import cn.jiguang.verifysdk.api.PrivacyBean; import cn.jiguang.verifysdk.b.d; import cn.jiguang.verifysdk.b.h; import cn.jiguang.verifysdk.h.a.f; import cn.jiguang.verifysdk.i.l; import java.util.ArrayList; import java.util.List; public class m { private String a; private b b; private View.OnClickListener c; private RelativeLayout d; private a e; private boolean f; private JVerifyUIConfig g; private d h; private CompoundButton.OnCheckedChangeListener i; private boolean j; private j k; private RelativeLayout l; /* access modifiers changed from: package-private */ public static class a extends ImageView { private Animation a = null; public a(Context context) { super(context); a(context); } public void a() { setVisibility(0); startAnimation(this.a); } /* access modifiers changed from: protected */ public void a(Context context) { this.a = AnimationUtils.loadAnimation(context, cn.jiguang.verifysdk.i.d.d(context, "umcsdk_anim_loading")); this.a.setInterpolator(new LinearInterpolator()); } public void b() { setVisibility(8); clearAnimation(); } } public enum b { OPERATOR_CU, OPERATOR_CT, OPERATOR_CM, OPERATOR_TEST_UI } public m(b bVar, String str, boolean z, int i2, boolean z2, View.OnClickListener onClickListener, CompoundButton.OnCheckedChangeListener onCheckedChangeListener) { this.a = str; this.b = bVar; this.c = onClickListener; this.f = z; this.i = onCheckedChangeListener; this.j = z2; this.g = f.f().b(i2); } public static int a(Context context, float f2) { if (f2 == -1.0f || f2 == -2.0f) { return (int) f2; } try { return (int) ((f2 * context.getResources().getDisplayMetrics().density) + 0.5f); } catch (Exception unused) { return (int) f2; } } private static SpannableString a(final JVerifyUIConfig jVerifyUIConfig, b bVar, String str, String str2, final o oVar, List<PrivacyBean> list) { SpannableString spannableString = new SpannableString(str); int length = jVerifyUIConfig.getPrivacyClauseStart().length(); int size = list.size(); final int i2 = 0; while (i2 < size) { final PrivacyBean privacyBean = list.get(i2); AnonymousClass6 r2 = new ClickableSpan() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass6 */ public void onClick(View view) { o oVar = oVar; if (oVar != null && !oVar.isShowing()) { oVar.a(jVerifyUIConfig); oVar.a(privacyBean.getUrl(), privacyBean.getName()); c.a(3, "privacy " + i2 + " clicked."); } } public void updateDrawState(TextPaint textPaint) { super.updateDrawState(textPaint); textPaint.setUnderlineText(jVerifyUIConfig.isPrivacyUnderlineText()); textPaint.setColor(jVerifyUIConfig.getClauseColor()); } }; int length2 = privacyBean.getText().length() + length; spannableString.setSpan(r2, length, length2, 34); i2++; length = length2; } return spannableString; } private View a(Activity activity, JVerifyUIConfig jVerifyUIConfig, b bVar, CompoundButton.OnCheckedChangeListener onCheckedChangeListener) { LinearLayout linearLayout = new LinearLayout(activity); if (jVerifyUIConfig.isPrivacyTextGravityCenter()) { linearLayout.setGravity(1); } RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2); int privacyOffsetX = jVerifyUIConfig.getPrivacyOffsetX(); int privacyOffsetY = jVerifyUIConfig.getPrivacyOffsetY(); int privacyTopOffsetY = jVerifyUIConfig.getPrivacyTopOffsetY(); int i2 = 0; if (jVerifyUIConfig.getPrivacyTopOffsetY() != -1) { layoutParams.addRule(10); privacyOffsetY = 0; } else { layoutParams.addRule(12); privacyTopOffsetY = 0; } if (privacyOffsetX == -1) { privacyOffsetX = 0; } else { layoutParams.addRule(9); i2 = privacyOffsetX; } layoutParams.setMargins(a(activity, (float) privacyOffsetX), a(activity, (float) privacyTopOffsetY), a(activity, (float) i2), a(activity, (float) privacyOffsetY)); linearLayout.setLayoutParams(layoutParams); CheckBox a2 = a(activity, jVerifyUIConfig, onCheckedChangeListener); LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(a(activity, (float) jVerifyUIConfig.getPrivacyCheckboxSize()), a(activity, (float) jVerifyUIConfig.getPrivacyCheckboxSize())); if (jVerifyUIConfig.isPrivacyCheckboxInCenter()) { layoutParams2.gravity = 16; } int a3 = a(activity, 3.0f); layoutParams2.setMargins(a3, a3, a3, a3); a2.setLayoutParams(layoutParams2); linearLayout.addView(a2); TextView b2 = b(activity, jVerifyUIConfig, bVar); LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-2, -2); layoutParams3.gravity = 16; b2.setLayoutParams(layoutParams3); linearLayout.addView(b2); return linearLayout; } private CheckBox a(Context context, JVerifyUIConfig jVerifyUIConfig, CompoundButton.OnCheckedChangeListener onCheckedChangeListener) { int i2; String uncheckedImgPath; Drawable a2; CheckBox checkBox = new CheckBox(context); checkBox.setChecked(this.f); checkBox.setOnCheckedChangeListener(onCheckedChangeListener); checkBox.setButtonDrawable(new ColorDrawable()); try { i2 = 0; if (!this.f ? (a2 = cn.jiguang.verifysdk.i.d.a((uncheckedImgPath = jVerifyUIConfig.getUncheckedImgPath()))) == null : (a2 = cn.jiguang.verifysdk.i.d.a((uncheckedImgPath = jVerifyUIConfig.getCheckedImgPath()))) == null) { i2 = cn.jiguang.verifysdk.i.d.c(context, uncheckedImgPath); } else { checkBox.setBackgroundDrawable(a2); } } catch (Exception unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, this.f ? "umcsdk_check_image" : "umcsdk_uncheck_image"); } if (this.d != null && !jVerifyUIConfig.isEnableHintToast()) { this.d.setEnabled(this.f); } if (i2 != 0) { checkBox.setBackgroundResource(i2); } if (jVerifyUIConfig.isPrivacyCheckboxHidden()) { checkBox.setVisibility(8); checkBox.setOnClickListener(null); } return checkBox; } private ImageView a(Context context, JVerifyUIConfig jVerifyUIConfig) { ImageView imageView = new ImageView(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(a(context, (float) jVerifyUIConfig.getLogoWidth()), a(context, (float) jVerifyUIConfig.getLogoHeight())); int logoOffsetX = jVerifyUIConfig.getLogoOffsetX(); int logoOffsetY = jVerifyUIConfig.getLogoOffsetY(); int logoOffsetBottomY = jVerifyUIConfig.getLogoOffsetBottomY(); int i2 = 0; if (jVerifyUIConfig.getLogoOffsetX() != -1) { layoutParams.addRule(9, -1); } else { layoutParams.addRule(14, -1); logoOffsetX = 0; } if (jVerifyUIConfig.getLogoOffsetBottomY() != -1) { layoutParams.addRule(12); logoOffsetY = 0; } else { layoutParams.addRule(3, 1002); logoOffsetBottomY = 0; } layoutParams.setMargins(a(context, (float) logoOffsetX), a(context, (float) logoOffsetY), 0, a(context, (float) logoOffsetBottomY)); imageView.setLayoutParams(layoutParams); imageView.setId(1003); if (jVerifyUIConfig.isLogoHidden()) { imageView.setVisibility(4); return imageView; } Drawable h2 = cn.jiguang.verifysdk.i.d.h(context); String logoResName = jVerifyUIConfig.getLogoResName(); if (!TextUtils.isEmpty(logoResName)) { try { i2 = cn.jiguang.verifysdk.i.d.c(context, logoResName); h2 = context.getResources().getDrawable(i2); } catch (Throwable th) { l.b("LoginUIHelper", "logo Image :" + logoResName + " not found, error is:" + th); h2 = cn.jiguang.verifysdk.i.d.a(logoResName); } } if (i2 != 0) { imageView.setBackgroundResource(i2); } else if (h2 != null) { imageView.setBackgroundDrawable(h2); } else { throw new Resources.NotFoundException("app icon resource not found "); } return imageView; } static RelativeLayout a(Context context, JVerifyUIConfig jVerifyUIConfig, View.OnClickListener onClickListener) { int i2; RelativeLayout relativeLayout = new RelativeLayout(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, a(context, 49.0f)); layoutParams.addRule(10, -1); relativeLayout.setLayoutParams(layoutParams); ImageButton imageButton = new ImageButton(context); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(a(context, (float) jVerifyUIConfig.getNavReturnBtnWidth()), a(context, (float) jVerifyUIConfig.getNavReturnBtnHeight())); int navReturnBtnOffsetX = jVerifyUIConfig.getNavReturnBtnOffsetX(); int navReturnBtnOffsetY = jVerifyUIConfig.getNavReturnBtnOffsetY(); int navReturnBtnRightOffsetX = jVerifyUIConfig.getNavReturnBtnRightOffsetX(); if (jVerifyUIConfig.getNavReturnBtnOffsetY() == -1) { layoutParams2.addRule(15, -1); navReturnBtnOffsetY = 0; } if (jVerifyUIConfig.getNavReturnBtnRightOffsetX() == -1) { layoutParams2.addRule(9, -1); navReturnBtnRightOffsetX = 0; } else { layoutParams2.addRule(11, -1); navReturnBtnOffsetX = 0; } layoutParams2.setMargins(a(context, (float) navReturnBtnOffsetX), a(context, (float) navReturnBtnOffsetY), a(context, (float) navReturnBtnRightOffsetX), 0); imageButton.setLayoutParams(layoutParams2); if (onClickListener != null) { imageButton.setOnClickListener(onClickListener); } imageButton.setId(1001); imageButton.setBackgroundColor(0); if (jVerifyUIConfig.isNavReturnBtnHidden()) { imageButton.setVisibility(8); } TextView textView = new TextView(context); RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, -2); layoutParams3.addRule(13, -1); textView.setLayoutParams(layoutParams3); textView.setTextSize(2, (float) jVerifyUIConfig.getNavTextSize()); textView.getPaint().setFakeBoldText(jVerifyUIConfig.isNavTextBold()); relativeLayout.addView(imageButton); relativeLayout.addView(textView); relativeLayout.setId(1002); relativeLayout.setBackgroundColor(jVerifyUIConfig.getNavColor()); textView.setText(jVerifyUIConfig.getNavText()); textView.setTextColor(jVerifyUIConfig.getNavTextColor()); try { String navReturnImgPath = jVerifyUIConfig.getNavReturnImgPath(); Drawable a2 = cn.jiguang.verifysdk.i.d.a(navReturnImgPath); if (a2 != null) { imageButton.setBackgroundDrawable(a2); i2 = 0; } else { i2 = cn.jiguang.verifysdk.i.d.c(context, navReturnImgPath); } } catch (Exception unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_return_bg"); } if (i2 != 0) { imageButton.setImageResource(i2); } imageButton.setScaleType(ImageView.ScaleType.CENTER_CROP); if (jVerifyUIConfig.isNavTransparent()) { relativeLayout.setBackgroundColor(0); } if (jVerifyUIConfig.isNavHidden()) { relativeLayout.setVisibility(8); } return relativeLayout; } private RelativeLayout a(Context context, JVerifyUIConfig jVerifyUIConfig, boolean z, View.OnClickListener onClickListener) { RelativeLayout relativeLayout = new RelativeLayout(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(a(context, (float) jVerifyUIConfig.getLogBtnWidth()), a(context, (float) jVerifyUIConfig.getLogBtnHeight())); int logBtnOffsetX = jVerifyUIConfig.getLogBtnOffsetX(); int logBtnOffsetY = jVerifyUIConfig.getLogBtnOffsetY(); int logBtnBottomOffsetY = jVerifyUIConfig.getLogBtnBottomOffsetY(); int i2 = 0; if (jVerifyUIConfig.getLogBtnOffsetX() != -1) { layoutParams.addRule(9); } else { layoutParams.addRule(14); logBtnOffsetX = 0; } if (jVerifyUIConfig.getLogBtnBottomOffsetY() != -1) { layoutParams.addRule(12); logBtnOffsetY = 0; } else { layoutParams.addRule(3, 1002); logBtnBottomOffsetY = 0; } layoutParams.setMargins(a(context, (float) logBtnOffsetX), a(context, (float) logBtnOffsetY), 0, a(context, (float) logBtnBottomOffsetY)); relativeLayout.setLayoutParams(layoutParams); relativeLayout.setId(1007); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2); layoutParams2.addRule(13); TextView textView = new TextView(context); textView.setTextSize(2, jVerifyUIConfig.getLogBtnTextSize()); textView.setLayoutParams(layoutParams2); textView.setText(jVerifyUIConfig.getLogBtnText()); textView.setTextColor(jVerifyUIConfig.getLogBtnTextColor()); textView.getPaint().setFakeBoldText(jVerifyUIConfig.isLogBtnTextBold()); relativeLayout.addView(textView); try { String logBtnBackgroundPath = jVerifyUIConfig.getLogBtnBackgroundPath(); Drawable a2 = cn.jiguang.verifysdk.i.d.a(logBtnBackgroundPath); if (a2 != null) { relativeLayout.setBackgroundDrawable(a2); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, logBtnBackgroundPath); } } catch (Throwable unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_login_btn_bg"); } if (i2 != 0) { relativeLayout.setBackgroundResource(i2); } if (onClickListener != null) { relativeLayout.setOnClickListener(onClickListener); } relativeLayout.setEnabled(!z); return relativeLayout; } private RelativeLayout a(Context context, boolean z) { RelativeLayout relativeLayout = new RelativeLayout(context); relativeLayout.setId(1004); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1); layoutParams.addRule(10, -1); relativeLayout.setLayoutParams(layoutParams); relativeLayout.addView(b(context)); relativeLayout.addView(a(context, this.g, this.b)); this.d = a(context, this.g, z, this.c); if (this.g.getCustomLoadingView() == null) { a c2 = c(context); this.e = c2; this.d.addView(c2); } relativeLayout.addView(this.d); return relativeLayout; } /* JADX WARNING: Removed duplicated region for block: B:20:0x0089 */ private TextView a(Context context, JVerifyUIConfig jVerifyUIConfig, b bVar) { String str; TextView textView = new TextView(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2); int sloganOffsetX = jVerifyUIConfig.getSloganOffsetX(); int sloganOffsetY = jVerifyUIConfig.getSloganOffsetY(); int sloganBottomOffsetY = jVerifyUIConfig.getSloganBottomOffsetY(); if (jVerifyUIConfig.getSloganOffsetX() != -1) { layoutParams.addRule(9); } else { layoutParams.addRule(14); sloganOffsetX = 0; } if (jVerifyUIConfig.getSloganBottomOffsetY() != -1) { layoutParams.addRule(12); sloganOffsetY = 0; } else { layoutParams.addRule(10); sloganBottomOffsetY = 0; } layoutParams.setMargins(a(context, (float) sloganOffsetX), a(context, (float) sloganOffsetY), 0, a(context, (float) sloganBottomOffsetY)); textView.setLayoutParams(layoutParams); textView.setTextSize(2, (float) jVerifyUIConfig.getSloganTextSize()); textView.setTextColor(jVerifyUIConfig.getSloganTextColor()); textView.setId(1006); if (bVar == b.OPERATOR_CU) { str = "中国联通提供认证服务"; } else if (bVar == b.OPERATOR_CT) { str = "天翼账号提供认证服务"; } else { if (bVar == b.OPERATOR_CM) { str = "中国移动提供认证服务"; } if (jVerifyUIConfig.isSloganHidden()) { textView.setVisibility(8); } textView.getPaint().setFakeBoldText(jVerifyUIConfig.isSloganTextBold()); return textView; } textView.setText(str); if (jVerifyUIConfig.isSloganHidden()) { } textView.getPaint().setFakeBoldText(jVerifyUIConfig.isSloganTextBold()); return textView; } private void a(Activity activity, JVerifyUIConfig jVerifyUIConfig) { Window window = activity.getWindow(); if (window != null) { window.setDimAmount(jVerifyUIConfig.getDimAmount()); WindowManager.LayoutParams attributes = window.getAttributes(); attributes.width = a(activity.getApplicationContext(), (float) jVerifyUIConfig.getDialogWidth()); attributes.height = a(activity.getApplicationContext(), (float) jVerifyUIConfig.getDialogHeight()); attributes.x = a(activity, (float) jVerifyUIConfig.getDialogOffsetX()); if (jVerifyUIConfig.isDialogBottom()) { attributes.gravity = 80; } else { attributes.gravity = 17; attributes.y = a(activity, (float) jVerifyUIConfig.getDialogOffsetY()); } window.setAttributes(attributes); } } private void a(final Context context, RelativeLayout relativeLayout, JVerifyUIConfig jVerifyUIConfig) { for (final h hVar : jVerifyUIConfig.getCustomViews()) { try { final View view = hVar.c; if (hVar.b && relativeLayout != null) { view.setOnClickListener(new View.OnClickListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass4 */ public void onClick(View view) { JVerifyUIClickCallback jVerifyUIClickCallback = hVar.d; if (jVerifyUIClickCallback != null) { jVerifyUIClickCallback.onClicked(context, view); } } }); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); } relativeLayout.addView(view); } } catch (Throwable th) { l.i("LoginUIHelper", "addNavCustomView error:" + th); } } } /* JADX WARNING: Removed duplicated region for block: B:26:0x005e A[ADDED_TO_REGION] */ /* JADX WARNING: Removed duplicated region for block: B:33:0x0077 A[ADDED_TO_REGION] */ /* JADX WARNING: Removed duplicated region for block: B:36:? A[ADDED_TO_REGION, RETURN, SYNTHETIC] */ public static void a(Window window, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, int i2, int i3) { int systemUiVisibility; View decorView; int i4; int i5; if (z) { window.addFlags(1024); } else { window.clearFlags(1024); } int i6 = Build.VERSION.SDK_INT; if (i6 >= 19) { window.clearFlags(67108864); } if (z2 || (z3 && z4 && !z5)) { if (i6 >= 21) { window.clearFlags(67108864); window.getDecorView().setSystemUiVisibility(1280); window.addFlags(Integer.MIN_VALUE); i5 = 0; } else { if (i6 >= 19) { window.addFlags(67108864); } systemUiVisibility = window.getDecorView().getSystemUiVisibility(); if (z6 || i6 < 23) { if (!z6 && i6 >= 23) { decorView = window.getDecorView(); i4 = systemUiVisibility & -8193; } if (i6 < 21 && z7) { window.clearFlags(134217728); window.addFlags(Integer.MIN_VALUE); window.setNavigationBarColor(i3); window.getDecorView().setSystemUiVisibility(window.getDecorView().getSystemUiVisibility() | 512); return; } return; } decorView = window.getDecorView(); i4 = systemUiVisibility | 8192; decorView.setSystemUiVisibility(i4); if (i6 < 21) { return; } return; } } else if (i6 < 21 || !z4 || z5) { if (i6 >= 21 && !z4) { i5 = ViewCompat.MEASURED_STATE_MASK; } systemUiVisibility = window.getDecorView().getSystemUiVisibility(); if (z6) { } decorView = window.getDecorView(); i4 = systemUiVisibility & -8193; decorView.setSystemUiVisibility(i4); if (i6 < 21) { } } else { window.setStatusBarColor(i2); window.addFlags(Integer.MIN_VALUE); systemUiVisibility = window.getDecorView().getSystemUiVisibility(); if (z6) { } decorView = window.getDecorView(); i4 = systemUiVisibility & -8193; decorView.setSystemUiVisibility(i4); if (i6 < 21) { } } window.setStatusBarColor(i5); systemUiVisibility = window.getDecorView().getSystemUiVisibility(); if (z6) { } decorView = window.getDecorView(); i4 = systemUiVisibility & -8193; decorView.setSystemUiVisibility(i4); if (i6 < 21) { } } private void a(final RelativeLayout relativeLayout, JVerifyUIConfig jVerifyUIConfig) { for (final h hVar : jVerifyUIConfig.getBottomViewList()) { try { final View view = hVar.c; view.setOnClickListener(new View.OnClickListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass3 */ public void onClick(View view) { JVerifyUIClickCallback jVerifyUIClickCallback = hVar.d; if (jVerifyUIClickCallback != null) { jVerifyUIClickCallback.onClicked(relativeLayout.getContext(), view); } } }); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); } relativeLayout.addView(view); } catch (Throwable th) { l.i("LoginUIHelper", "addBottomView error:" + th); } } } private static void a(RelativeLayout relativeLayout, JVerifyUIConfig jVerifyUIConfig, final d dVar) { for (final h hVar : jVerifyUIConfig.getCustomViews()) { try { View view = hVar.c; if (!hVar.b) { view.setOnClickListener(new View.OnClickListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass5 */ public void onClick(View view) { d dVar = dVar; if (dVar != null) { dVar.a(hVar); } } }); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); } relativeLayout.addView(view); } } catch (Throwable th) { l.i("LoginUIHelper", "addCustomView error:" + th); } } } /* JADX WARNING: Removed duplicated region for block: B:23:0x0042 */ /* JADX WARNING: Removed duplicated region for block: B:24:0x0046 */ private static void a(j jVar, Context context, String str, Uri uri) { try { if (str.startsWith("http://")) { return; } if (!str.startsWith("https://")) { Bitmap bitmap = null; MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); try { mediaMetadataRetriever.setDataSource(context, uri); bitmap = mediaMetadataRetriever.getFrameAtTime(); try { mediaMetadataRetriever.release(); } catch (Exception e2) { e = e2; } } catch (Exception e3) { e3.printStackTrace(); try { mediaMetadataRetriever.release(); } catch (Exception e4) { e = e4; } } catch (Throwable th) { try { mediaMetadataRetriever.release(); } catch (Exception e5) { e5.printStackTrace(); } throw th; } BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), bitmap); if (Build.VERSION.SDK_INT < 16) { jVar.setBackground(bitmapDrawable); return; } else { jVar.setBackgroundDrawable(bitmapDrawable); return; } } else { return; } e.printStackTrace(); BitmapDrawable bitmapDrawable2 = new BitmapDrawable(context.getResources(), bitmap); if (Build.VERSION.SDK_INT < 16) { } } catch (Throwable th2) { th2.printStackTrace(); } } public static void a(final j jVar, Context context, String str, String str2) { if (jVar != null && !TextUtils.isEmpty(str)) { Context applicationContext = context.getApplicationContext(); try { Uri parse = Uri.parse(str); jVar.setVideoURI(parse); jVar.setVisibility(0); if (!TextUtils.isEmpty(str2)) { try { Drawable a2 = cn.jiguang.verifysdk.i.d.a(str2); if (a2 != null) { jVar.setBackgroundDrawable(a2); } else { jVar.setBackgroundResource(cn.jiguang.verifysdk.i.d.c(applicationContext, str2)); } } catch (Throwable th) { th.printStackTrace(); } jVar.start(); l.b("LoginUIHelper", "videoView:" + jVar); jVar.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass7 */ public void onCompletion(MediaPlayer mediaPlayer) { l.b("LoginUIHelper", "onCompletion:mp:" + mediaPlayer); jVar.start(); mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass7.AnonymousClass1 */ public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) { l.b("LoginUIHelper", "onCompletion onInfo:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); return false; } }); } }); jVar.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass8 */ public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.setLooping(true); l.b("LoginUIHelper", "onPrepared:mp:" + mediaPlayer); mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass8.AnonymousClass1 */ public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) { l.b("LoginUIHelper", "onPrepared onInfo:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); if (i != 3) { return true; } jVar.setBackgroundColor(0); return true; } }); } }); jVar.setOnErrorListener(new MediaPlayer.OnErrorListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass9 */ public boolean onError(MediaPlayer mediaPlayer, int i, int i2) { l.g("LoginUIHelper", "onError:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); return true; } }); } a(jVar, applicationContext, str, parse); jVar.start(); l.b("LoginUIHelper", "videoView:" + jVar); jVar.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass7 */ public void onCompletion(MediaPlayer mediaPlayer) { l.b("LoginUIHelper", "onCompletion:mp:" + mediaPlayer); jVar.start(); mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass7.AnonymousClass1 */ public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) { l.b("LoginUIHelper", "onCompletion onInfo:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); return false; } }); } }); jVar.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass8 */ public void onPrepared(MediaPlayer mediaPlayer) { mediaPlayer.setLooping(true); l.b("LoginUIHelper", "onPrepared:mp:" + mediaPlayer); mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass8.AnonymousClass1 */ public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) { l.b("LoginUIHelper", "onPrepared onInfo:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); if (i != 3) { return true; } jVar.setBackgroundColor(0); return true; } }); } }); jVar.setOnErrorListener(new MediaPlayer.OnErrorListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass9 */ public boolean onError(MediaPlayer mediaPlayer, int i, int i2) { l.g("LoginUIHelper", "onError:mp:" + mediaPlayer + ",what:" + i + ",extra:" + i2); return true; } }); } catch (Exception e2) { e2.printStackTrace(); } } } private TextView b(Context context) { TextView textView = new TextView(context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(a(context, (float) this.g.getNumberFieldWidth()), a(context, (float) this.g.getNumberFieldHeight())); int numberOffsetX = this.g.getNumberOffsetX(); int numFieldOffsetY = this.g.getNumFieldOffsetY(); int numberFieldOffsetBottomY = this.g.getNumberFieldOffsetBottomY(); if (this.g.getNumberOffsetX() != -1) { layoutParams.addRule(9); } else { layoutParams.addRule(14); numberOffsetX = 0; } if (this.g.getNumberFieldOffsetBottomY() != -1) { layoutParams.addRule(12); numFieldOffsetY = 0; } else { layoutParams.addRule(3, 1002); numberFieldOffsetBottomY = 0; } layoutParams.setMargins(a(context, (float) numberOffsetX), a(context, (float) numFieldOffsetY), 0, a(context, (float) numberFieldOffsetBottomY)); textView.setGravity(17); textView.setTextSize(2, this.g.getNumberSize()); textView.setText(this.a); textView.setId(1005); textView.setTextColor(this.g.getNumberColor()); textView.setLayoutParams(layoutParams); textView.getPaint().setFakeBoldText(this.g.isNumberTextBold()); return textView; } private TextView b(Context context, JVerifyUIConfig jVerifyUIConfig, b bVar) { TextView textView = new TextView(context); textView.setTextSize(2, (float) jVerifyUIConfig.getPrivacyTextSize()); textView.setTextColor(jVerifyUIConfig.getClauseBaseColor()); textView.getPaint().setUnderlineText(jVerifyUIConfig.isPrivacyUnderlineText()); textView.setId(1010); List<PrivacyBean> privacyBeanList = jVerifyUIConfig.getPrivacyBeanList(); if (privacyBeanList == null || privacyBeanList.isEmpty()) { privacyBeanList = new ArrayList<>(); } PrivacyBean privacyBean = null; final String str = "https://ctaccount.21cn.com/agreementList.html?hidetop=true&appKey="; if (bVar == b.OPERATOR_CT) { privacyBean = new PrivacyBean("天翼账号服务与隐私协议", str, "", ""); } else if (bVar == b.OPERATOR_CU) { privacyBean = new PrivacyBean("联通统一认证服务条款", "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true", "", ""); } else if (bVar == b.OPERATOR_CM) { privacyBean = new PrivacyBean("中国移动认证服务条款", "https://wap.cmpassport.com/resources/html/contract.html", "", ""); } if (jVerifyUIConfig.isPrivacyWithBookTitleMark()) { privacyBean.setText("《" + privacyBean.getName() + "》"); } if (privacyBean != null) { privacyBeanList.add(0, privacyBean); } StringBuilder sb = new StringBuilder(); sb.append(jVerifyUIConfig.getPrivacyClauseStart()); for (PrivacyBean privacyBean2 : privacyBeanList) { sb.append(privacyBean2.getText()); } sb.append(jVerifyUIConfig.getPrivacyClauseEnd()); if (bVar == b.OPERATOR_CU) { str = "https://opencloud.wostore.cn/authz/resource/html/disclaimer.html?fromsdk=true"; } else if (bVar != b.OPERATOR_CT) { str = bVar == b.OPERATOR_CM ? "https://wap.cmpassport.com/resources/html/contract.html" : ""; } String sb2 = sb.toString(); final o oVar = new o(context, 16973840); oVar.setOnKeyListener(new DialogInterface.OnKeyListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass2 */ public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { if (i != 4 || keyEvent.getRepeatCount() != 0 || "https://wap.cmpassport.com/resources/html/contract.html".equals(str)) { return false; } oVar.dismiss(); return false; } }); textView.setText(a(jVerifyUIConfig, bVar, sb2, str, oVar, privacyBeanList)); textView.setLineSpacing(8.0f, 1.0f); textView.setHighlightColor(context.getResources().getColor(17170445)); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.getPaint().setFakeBoldText(jVerifyUIConfig.isPrivacyTextBold()); if (jVerifyUIConfig.isPrivacyTextGravityCenter()) { textView.setGravity(17); } return textView; } private static void b(RelativeLayout relativeLayout, JVerifyUIConfig jVerifyUIConfig) { try { View customLoadingView = jVerifyUIConfig.getCustomLoadingView(); if (customLoadingView != null) { ViewParent parent = customLoadingView.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(customLoadingView); } customLoadingView.setVisibility(8); relativeLayout.addView(customLoadingView); } } catch (Throwable th) { l.i("LoginUIHelper", "addContentCustomLoadingView error:" + th); } } private a c(Context context) { a aVar = new a(context); aVar.setBackgroundResource(cn.jiguang.verifysdk.i.d.c(context, "umcsdk_load_dot_white")); aVar.setVisibility(8); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2); layoutParams.addRule(15); layoutParams.addRule(11, -1); layoutParams.rightMargin = a(context, 12.0f); aVar.setLayoutParams(layoutParams); return aVar; } private void d(Activity activity) { activity.getWindow().setBackgroundDrawable(null); Window window = activity.getWindow(); if (window != null) { WindowManager.LayoutParams attributes = window.getAttributes(); attributes.width = -1; attributes.height = -1; attributes.x = 0; attributes.y = 0; attributes.gravity = 17; window.setAttributes(attributes); } } public JVerifyUIConfig a() { return this.g; } public void a(Context context) { Toast hintToast; if (context != null) { if (this.g.isEnableHintToast() && this.g.getHintToast() == null) { hintToast = Toast.makeText(context.getApplicationContext(), "请点击同意协议", 0); } else if (this.g.isEnableHintToast() && this.g.getHintToast() != null) { hintToast = this.g.getHintToast(); } else { return; } hintToast.show(); } } public void a(d dVar) { this.h = dVar; } public void a(boolean z) { this.j = !z; this.d.setEnabled(z); } /* JADX WARNING: Removed duplicated region for block: B:39:0x0115 */ /* JADX WARNING: Removed duplicated region for block: B:44:0x012f A[Catch:{ all -> 0x0191 }] */ /* JADX WARNING: Removed duplicated region for block: B:45:0x0140 A[Catch:{ all -> 0x0191 }] */ public boolean a(Activity activity) { boolean z; String authBGGifPath; k kVar; int i2 = Build.VERSION.SDK_INT; if (i2 >= 21) { activity.getWindow().addFlags(134217728); } a(activity.getWindow(), this.g.isStatusBarHidden(), this.g.isStarusBarTransparent(), this.g.isNavTransparent(), this.g.isStatusBarColorWithNav(), this.g.isDialogMode(), this.g.isStatusBarDarkMode(), this.g.isVirtualButtonTransparent(), this.g.getNavColor(), this.g.getVirtualButtonColor()); RelativeLayout relativeLayout = new RelativeLayout(activity); this.l = relativeLayout; relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); try { String authBGVideoPath = this.g.getAuthBGVideoPath(); if (!TextUtils.isEmpty(authBGVideoPath)) { j jVar = new j(activity.getApplicationContext()); this.k = jVar; jVar.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); a(this.k, activity.getApplicationContext(), authBGVideoPath, this.g.getAuthBGVideoImgPath()); this.l.addView(this.k); z = true; authBGGifPath = this.g.getAuthBGGifPath(); if (!z && !TextUtils.isEmpty(authBGGifPath)) { kVar = new k(activity.getApplicationContext()); kVar.setGifImage(cn.jiguang.verifysdk.i.d.c(activity, authBGGifPath)); kVar.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); this.l.addView(kVar); z = true; } String authBGImgPath = this.g.getAuthBGImgPath(); if (!z || TextUtils.isEmpty(authBGImgPath)) { this.l.setBackgroundColor(Color.parseColor("#ffffff")); activity.setContentView(this.l); if (i2 >= 14) { this.l.setFitsSystemWindows(true); } this.l.setClipToPadding(true); a(this.l, this.g); RelativeLayout relativeLayout2 = null; if (!this.g.isDialogMode()) { d(activity); relativeLayout2 = a(activity, this.g, this.c); this.l.addView(relativeLayout2); } else { a(activity, this.g); } RelativeLayout relativeLayout3 = new RelativeLayout(activity); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1); layoutParams.addRule(3, 1002); relativeLayout3.setLayoutParams(layoutParams); this.l.addView(relativeLayout3); a(activity, relativeLayout2, this.g); relativeLayout3.addView(a((Context) activity, this.g)); relativeLayout3.addView(a(activity, this.j)); relativeLayout3.addView(a(activity, this.g, this.b, new CompoundButton.OnCheckedChangeListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass1 */ public void onCheckedChanged(CompoundButton compoundButton, boolean z) { String str; int i; Context context = compoundButton.getContext(); int i2 = 0; boolean isEnableHintToast = m.this.g.isEnableHintToast(); if (z) { if (!isEnableHintToast && !m.this.j) { m.this.d.setEnabled(true); } try { String checkedImgPath = m.this.g.getCheckedImgPath(); Drawable a2 = cn.jiguang.verifysdk.i.d.a(checkedImgPath); if (a2 != null) { compoundButton.setButtonDrawable(a2); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, checkedImgPath); } } catch (Exception unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_check_image"); } i = 6; str = "checkbox checked."; } else { if (!isEnableHintToast) { m.this.d.setEnabled(false); } try { String uncheckedImgPath = m.this.g.getUncheckedImgPath(); Drawable a3 = cn.jiguang.verifysdk.i.d.a(uncheckedImgPath); if (a3 != null) { compoundButton.setButtonDrawable(a3); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, uncheckedImgPath); } } catch (Exception unused2) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_uncheck_image"); } i = 7; str = "checkbox unchecked."; } c.a(i, str); if (i2 != 0) { compoundButton.setBackgroundResource(i2); } if (m.this.i != null) { m.this.i.onCheckedChanged(compoundButton, z); } } })); a(relativeLayout3, this.g, this.h); b(relativeLayout3, this.g); return true; } Drawable a2 = cn.jiguang.verifysdk.i.d.a(authBGImgPath); if (a2 != null) { this.l.setBackgroundDrawable(a2); } else { this.l.setBackgroundResource(cn.jiguang.verifysdk.i.d.c(activity, authBGImgPath)); } activity.setContentView(this.l); if (i2 >= 14) { } this.l.setClipToPadding(true); a(this.l, this.g); RelativeLayout relativeLayout22 = null; if (!this.g.isDialogMode()) { } RelativeLayout relativeLayout32 = new RelativeLayout(activity); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1); layoutParams2.addRule(3, 1002); relativeLayout32.setLayoutParams(layoutParams2); this.l.addView(relativeLayout32); a(activity, relativeLayout22, this.g); relativeLayout32.addView(a((Context) activity, this.g)); relativeLayout32.addView(a(activity, this.j)); relativeLayout32.addView(a(activity, this.g, this.b, new CompoundButton.OnCheckedChangeListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass1 */ public void onCheckedChanged(CompoundButton compoundButton, boolean z) { String str; int i; Context context = compoundButton.getContext(); int i2 = 0; boolean isEnableHintToast = m.this.g.isEnableHintToast(); if (z) { if (!isEnableHintToast && !m.this.j) { m.this.d.setEnabled(true); } try { String checkedImgPath = m.this.g.getCheckedImgPath(); Drawable a2 = cn.jiguang.verifysdk.i.d.a(checkedImgPath); if (a2 != null) { compoundButton.setButtonDrawable(a2); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, checkedImgPath); } } catch (Exception unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_check_image"); } i = 6; str = "checkbox checked."; } else { if (!isEnableHintToast) { m.this.d.setEnabled(false); } try { String uncheckedImgPath = m.this.g.getUncheckedImgPath(); Drawable a3 = cn.jiguang.verifysdk.i.d.a(uncheckedImgPath); if (a3 != null) { compoundButton.setButtonDrawable(a3); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, uncheckedImgPath); } } catch (Exception unused2) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_uncheck_image"); } i = 7; str = "checkbox unchecked."; } c.a(i, str); if (i2 != 0) { compoundButton.setBackgroundResource(i2); } if (m.this.i != null) { m.this.i.onCheckedChanged(compoundButton, z); } } })); a(relativeLayout32, this.g, this.h); b(relativeLayout32, this.g); return true; } } catch (Throwable th) { th.printStackTrace(); } z = false; try { authBGGifPath = this.g.getAuthBGGifPath(); kVar = new k(activity.getApplicationContext()); try { kVar.setGifImage(cn.jiguang.verifysdk.i.d.c(activity, authBGGifPath)); } catch (Throwable th2) { th2.printStackTrace(); kVar.setGifImage(authBGGifPath); } kVar.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); this.l.addView(kVar); z = true; } catch (Throwable th3) { th3.printStackTrace(); } try { String authBGImgPath2 = this.g.getAuthBGImgPath(); if (!z) { } this.l.setBackgroundColor(Color.parseColor("#ffffff")); } catch (Throwable unused) { this.l.setBackgroundColor(Color.parseColor("#ffffff")); } activity.setContentView(this.l); if (i2 >= 14) { } this.l.setClipToPadding(true); a(this.l, this.g); RelativeLayout relativeLayout222 = null; try { if (!this.g.isDialogMode()) { } RelativeLayout relativeLayout322 = new RelativeLayout(activity); RelativeLayout.LayoutParams layoutParams22 = new RelativeLayout.LayoutParams(-1, -1); layoutParams22.addRule(3, 1002); relativeLayout322.setLayoutParams(layoutParams22); this.l.addView(relativeLayout322); a(activity, relativeLayout222, this.g); relativeLayout322.addView(a((Context) activity, this.g)); relativeLayout322.addView(a(activity, this.j)); relativeLayout322.addView(a(activity, this.g, this.b, new CompoundButton.OnCheckedChangeListener() { /* class cn.jiguang.verifysdk.e.m.AnonymousClass1 */ public void onCheckedChanged(CompoundButton compoundButton, boolean z) { String str; int i; Context context = compoundButton.getContext(); int i2 = 0; boolean isEnableHintToast = m.this.g.isEnableHintToast(); if (z) { if (!isEnableHintToast && !m.this.j) { m.this.d.setEnabled(true); } try { String checkedImgPath = m.this.g.getCheckedImgPath(); Drawable a2 = cn.jiguang.verifysdk.i.d.a(checkedImgPath); if (a2 != null) { compoundButton.setButtonDrawable(a2); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, checkedImgPath); } } catch (Exception unused) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_check_image"); } i = 6; str = "checkbox checked."; } else { if (!isEnableHintToast) { m.this.d.setEnabled(false); } try { String uncheckedImgPath = m.this.g.getUncheckedImgPath(); Drawable a3 = cn.jiguang.verifysdk.i.d.a(uncheckedImgPath); if (a3 != null) { compoundButton.setButtonDrawable(a3); } else { i2 = cn.jiguang.verifysdk.i.d.c(context, uncheckedImgPath); } } catch (Exception unused2) { i2 = cn.jiguang.verifysdk.i.d.c(context, "umcsdk_uncheck_image"); } i = 7; str = "checkbox unchecked."; } c.a(i, str); if (i2 != 0) { compoundButton.setBackgroundResource(i2); } if (m.this.i != null) { m.this.i.onCheckedChanged(compoundButton, z); } } })); a(relativeLayout322, this.g, this.h); b(relativeLayout322, this.g); return true; } catch (Throwable th4) { l.i("LoginUIHelper", "UI资源加载异常 :" + th4.getMessage()); return false; } } public void b() { List<h> customViews = this.g.getCustomViews(); if (customViews != null) { customViews.clear(); } List<h> bottomViewList = this.g.getBottomViewList(); if (bottomViewList != null) { bottomViewList.clear(); } } public void b(Activity activity) { j jVar = this.k; if (jVar != null) { jVar.stopPlayback(); } } public void c() { a aVar = this.e; if (aVar != null) { aVar.a(); } else { View customLoadingView = this.g.getCustomLoadingView(); Animation loadingAnimation = this.g.getLoadingAnimation(); if (customLoadingView != null) { customLoadingView.setVisibility(0); if (loadingAnimation != null) { customLoadingView.startAnimation(loadingAnimation); } } } this.d.setClickable(false); } public void c(Activity activity) { j jVar = this.k; if (jVar != null) { jVar.start(); } } public void d() { a aVar = this.e; if (aVar != null) { aVar.b(); } else { View customLoadingView = this.g.getCustomLoadingView(); if (customLoadingView != null) { customLoadingView.setVisibility(8); customLoadingView.clearAnimation(); } } this.d.setClickable(true); } public void e() { a aVar = this.e; if (aVar != null) { aVar.b(); } else { View customLoadingView = this.g.getCustomLoadingView(); if (customLoadingView != null) { customLoadingView.setVisibility(8); customLoadingView.clearAnimation(); } else { return; } } this.d.setClickable(true); } }