package com.ss.android.ugc.aweme.share.qrcode;

import X.2UX;
import X.2nK;
import X.2xd;
import X.46i;
import X.8gF;
import X.9w1;
import X.C3161JNo;
import X.C3227JQc;
import X.C3234JQj;
import X.C3236JQl;
import X.C3260JRj;
import X.C3324JTv;
import X.C3355JVa;
import X.C3356JVb;
import X.C3361JVg;
import X.C3367JVm;
import X.C3373JVs;
import X.C3376JVv;
import X.Drz;
import X.ESC;
import X.EdM;
import X.F2H;
import X.F2I;
import X.Fe0;
import X.Fe1;
import X.HeD;
import X.JOF;
import X.JVQ;
import X.JVS;
import X.M12;
import X.MCx;
import X.OCx;
import X.SNU;
import X.Szo;
import android.content.Context;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.ug.UgCommonServiceImpl;
import java.util.Objects;
import kotlin.h.b.n;

public final class UserQRCodeActivity extends SNU {
    public static final C3373JVs LIZIZ = new C3373JVs((byte) 0);
    public final C3234JQj LIZ = new C3234JQj(this);
    public View LIZJ;
    public ImageView LIZLLL;
    public View LJ;
    public TextView LJFF;
    public TextView LJI;
    public TextView LJII;
    public EdM LJIIIIZZ;
    public C3361JVg LJIIIZ;
    public FrameLayout LJIIJ;
    public MCx LJIIJJI;
    public OCx LJIIL;
    public final C3236JQl LJIILIIL = new C3236JQl(this);
    public final View.OnClickListener LJIILJJIL = new C3324JTv(this);
    public final View.OnClickListener LJIILL = new C3227JQc(this);
    public SparseArray LJIILLIIL;

    static {
        Covode.recordClassIndex(107627);
    }

    public final void _$_clearFindViewByIdCache() {
        SparseArray sparseArray = this.LJIILLIIL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final View _$_findCachedViewById(int i) {
        if (this.LJIILLIIL == null) {
            this.LJIILLIIL = new SparseArray();
        }
        View view = (View) this.LJIILLIIL.get(i);
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LJIILLIIL.put(i, findViewById);
        return findViewById;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.SNU, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        UserQRCodeActivity.super.onDestroy();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.SNU, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        UserQRCodeActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.SNU, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity", "onResume", true);
        UserQRCodeActivity.super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.SNU, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        UserQRCodeActivity.super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity", "onWindowFocusChanged", true);
        UserQRCodeActivity.super.onWindowFocusChanged(z);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        UserQRCodeActivity.super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ() {
        /*
            r5 = this;
            com.ss.android.ugc.aweme.homepage.api.msadapt.IMSAdaptionService r0 = com.ss.android.ugc.aweme.homepage.msadapt.MSAdaptionService.LIZJ()
            r4 = r5
            boolean r0 = r0.LIZIZ(r4)
            r3 = 0
            if (r0 == 0) goto L_0x0024
            r0 = 2131824145(0x7f110e11, float:1.928111E38)
            java.lang.String r0 = r5.getString(r0)
            android.widget.Toast r2 = android.widget.Toast.makeText(r4, r0, r3)
            int r1 = android.os.Build.VERSION.SDK_INT
            r0 = 25
            if (r1 != r0) goto L_0x0020
            X.3GT.LIZ(r2)
        L_0x0020:
            r2.show()
            return
        L_0x0024:
            X.2UX r2 = new X.2UX
            r2.<init>()
            java.lang.String r1 = "enter_from"
            java.lang.String r0 = "qr_code_detail"
            r2.LIZ(r1, r0)
            java.lang.String r1 = "previous_page"
            java.lang.String r0 = "personal_homepage"
            r2.LIZ(r1, r0)
            java.util.Map r1 = r2.LIZ
            java.lang.String r0 = "qr_code_scan_enter"
            X.2nK.LIZ(r0, r1)
            X.JZx r1 = X.C3482JZx.LIZ
            r0 = 1
            r1.LIZ((android.content.Context) r4, (boolean) r3, (boolean) r0)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity.LIZ():void");
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void saveToDevice(android.view.View r3) {
        /*
            r2 = this;
            r1 = r2
            X.JVW r0 = new X.JVW
            r0.<init>(r2, r3)
            X.4vv.LIZ(r1, r0)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity.saveToDevice(android.view.View):void");
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(X.JVY r8) {
        /*
            r7 = this;
            X.MCx r0 = r7.LJIIJJI
            if (r0 == 0) goto L_0x0021
            boolean r0 = r0.LIZIZ
            if (r0 != 0) goto L_0x0021
            X.9EH r0 = X.9EH.LJJIFFI
            android.content.Context r2 = r0.LIZ()
            X.3BB r1 = new X.3BB
            r1.<init>(r2)
            r0 = 2131824015(0x7f110d8f, float:1.9280846E38)
            java.lang.String r0 = r2.getString(r0)
            r1.LIZ(r0)
            r1.LIZIZ()
            return
        L_0x0021:
            X.OCx r4 = r7.LJIIL
            if (r4 == 0) goto L_0x0041
            X.MCx r2 = r7.LJIIJJI
            if (r2 == 0) goto L_0x0041
            X.JVc r3 = new X.JVc
            r1 = r7
            r0 = 0
            r3.<init>(r1, r0)
            X.JVZ r1 = new X.JVZ
            r5 = r7
            r6 = r8
            r1.<init>(r2, r3, r4, r5, r6)
            r3.setCallback(r1)
            java.lang.String r0 = r2.getQrCodeUrl()
            r3.LIZ(r0)
        L_0x0041:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity.LIZ(X.JVY):void");
    }

    /* JADX WARNING: type inference failed for: r14v0, types: [com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity, X.1oX, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        User user;
        String str;
        float LIZIZ2;
        ViewGroup.LayoutParams layoutParams;
        ViewGroup.LayoutParams layoutParams2;
        ViewGroup.LayoutParams layoutParams3;
        String str2;
        User user2;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity", "onCreate", true);
        UserQRCodeActivity.super.onCreate(bundle);
        setContentView(2131561298);
        this.LIZJ = findViewById(2131369171);
        this.LIZLLL = (ImageView) findViewById(2131369172);
        this.LJ = findViewById(2131369157);
        this.LJFF = (TextView) findViewById(2131369178);
        this.LJI = (TextView) findViewById(2131369162);
        this.LJII = (TextView) findViewById(2131369169);
        this.LJIIIIZZ = findViewById(2131369176);
        this.LJIIIZ = (C3361JVg) findViewById(2131369158);
        this.LJIIJ = (FrameLayout) findViewById(2131369163);
        this.LJIIJJI = findViewById(2131369164);
        this.LJIIL = findViewById(2131369177);
        View findViewById = findViewById(2131369173);
        n.LIZIZ(findViewById, "");
        View findViewById2 = findViewById(2131369174);
        n.LIZIZ(findViewById2, "");
        View findViewById3 = findViewById(2131369154);
        n.LIZIZ(findViewById3, "");
        View findViewById4 = findViewById(2131369155);
        n.LIZIZ(findViewById4, "");
        View findViewById5 = findViewById(2131367472);
        n.LIZIZ(findViewById5, "");
        F2H LIZJ2 = UgCommonServiceImpl.LJIIL().LIZJ();
        F2I.LIZ(LIZJ2, (ImageView) findViewById, C3367JVm.LIZLLL);
        F2I.LIZ(LIZJ2, (ImageView) findViewById2, C3367JVm.LJ);
        F2I.LIZ(LIZJ2, (ImageView) findViewById3, C3367JVm.LIZIZ);
        F2I.LIZ(LIZJ2, (ImageView) findViewById4, C3367JVm.LIZJ);
        F2I.LIZ(LIZJ2, (ImageView) findViewById5, C3367JVm.LJFF);
        MCx mCx = this.LJIIJJI;
        if (mCx == null) {
            n.LIZIZ();
        }
        LIZJ2.LIZ(mCx, C3367JVm.LIZ);
        View view = this.LIZJ;
        if (view != null) {
            view.setOnClickListener(this.LJIILJJIL);
        }
        ImageView imageView = this.LIZLLL;
        if (imageView != null) {
            imageView.setOnClickListener(this.LJIILL);
        }
        C3361JVg jVg = this.LJIIIZ;
        if (jVg != null) {
            jVg.setCallback(this.LJIILIIL);
        }
        MCx mCx2 = this.LJIIJJI;
        ViewGroup.LayoutParams layoutParams4 = null;
        if (mCx2 != null) {
            IAccountUserService LJFF2 = 46i.LJFF();
            if (LJFF2 != null) {
                user2 = LJFF2.getCurUser();
            } else {
                user2 = null;
            }
            mCx2.LIZ(4, ESC.LJIIIZ(user2), "personal_homepage");
        }
        View view2 = this.LJ;
        if (view2 != null) {
            view2.setOnClickListener(C3376JVv.LIZ);
        }
        ImageView imageView2 = this.LIZLLL;
        if (imageView2 != null) {
            imageView2.setImageDrawable(2xd.LIZ(Fe0.LIZ).LIZ(this));
        }
        Szo LIZ2 = Szo.LIZIZ.LIZ(this);
        LIZ2.LIZ();
        LIZ2.LIZ.LIZJ();
        IAccountUserService LJFF3 = 46i.LJFF();
        if (LJFF3 != null) {
            user = LJFF3.getCurUser();
        } else {
            user = null;
        }
        TextView textView = this.LJFF;
        if (textView != null) {
            if (user != null) {
                str2 = user.getNickname();
            } else {
                str2 = null;
            }
            textView.setText(str2);
        }
        EdM edM = this.LJIIIIZZ;
        if (edM != null) {
            edM.setBorderColor(2131099659);
        }
        EdM edM2 = this.LJIIIIZZ;
        if (edM2 != null) {
            edM2.setBorderWidth(4);
        }
        StringBuilder sb = new StringBuilder("UserQRCodeActivity_");
        if (user == null || (str = user.getUid()) == null) {
            str = "no_uid";
        }
        sb.append(str);
        String sb2 = sb.toString();
        int dimension = (int) getResources().getDimension(2131165967);
        EdM edM3 = this.LJIIIIZZ;
        if (edM3 != null) {
            edM3.LIZ(Drz.LIZ(user), 9w1.LIZ(101), dimension, dimension, sb2, true);
        }
        int LIZJ3 = HeD.LIZJ(this, (float) HeD.LIZIZ(this));
        if (LIZJ3 < 654) {
            View view3 = this.LJ;
            if (view3 != null) {
                layoutParams = view3.getLayoutParams();
            } else {
                layoutParams = null;
            }
            Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
            marginLayoutParams.topMargin = (int) HeD.LIZIZ(this, 18.0f);
            View view4 = this.LJ;
            if (view4 != null) {
                view4.setLayoutParams(marginLayoutParams);
            }
            int LIZIZ3 = (int) HeD.LIZIZ(this, 130.0f);
            FrameLayout frameLayout = this.LJIIJ;
            if (frameLayout != null) {
                layoutParams2 = frameLayout.getLayoutParams();
            } else {
                layoutParams2 = null;
            }
            Objects.requireNonNull(layoutParams2, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
            layoutParams2.width = LIZIZ3;
            layoutParams2.height = LIZIZ3;
            FrameLayout frameLayout2 = this.LJIIJ;
            if (frameLayout2 != null) {
                frameLayout2.setLayoutParams(layoutParams2);
            }
            int LIZIZ4 = (int) HeD.LIZIZ(this, 115.0f);
            MCx mCx3 = this.LJIIJJI;
            if (mCx3 != null) {
                layoutParams3 = mCx3.getLayoutParams();
            } else {
                layoutParams3 = null;
            }
            Objects.requireNonNull(layoutParams3, "null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
            layoutParams3.width = LIZIZ4;
            layoutParams3.height = LIZIZ4;
            MCx mCx4 = this.LJIIJJI;
            if (mCx4 != null) {
                mCx4.setLayoutParams(layoutParams3);
            }
        }
        if (Fe1.LIZ.LIZ() != 4) {
            C3361JVg jVg2 = this.LJIIIZ;
            if (jVg2 != null) {
                layoutParams4 = jVg2.getLayoutParams();
            }
            Objects.requireNonNull(layoutParams4, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
            ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) layoutParams4;
            if (LIZJ3 < 700) {
                LIZIZ2 = HeD.LIZIZ(this, 20.0f);
            } else {
                LIZIZ2 = HeD.LIZIZ(this, 57.0f);
            }
            marginLayoutParams2.bottomMargin = (int) LIZIZ2;
            C3361JVg jVg3 = this.LJIIIZ;
            if (jVg3 != null) {
                jVg3.setLayoutParams(marginLayoutParams2);
            }
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.share.qrcode.UserQRCodeActivity", "onCreate", false);
    }

    public final void LIZ(JOF jof, Context context) {
        C3260JRj.LIZ().LIZ(jof.LIZ(), 0);
        LIZ(new JVQ(context, jof));
        2UX r2 = new 2UX();
        r2.LIZ("qr_code_type", "general");
        r2.LIZ("enter_from", "personal_homepage");
        r2.LIZ("platform", jof.LIZ());
        2nK.LIZ("share_personal_qr_code", r2.LIZ);
    }

    public final void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        M12.LIZ(strArr, iArr);
        UserQRCodeActivity.super.onRequestPermissionsResult(i, strArr, iArr);
        if (i == 1) {
            for (int i2 : iArr) {
                if (i2 == -1) {
                    Context baseContext = getBaseContext();
                    n.LIZIZ(baseContext, "");
                    C3161JNo.LIZ(baseContext);
                    return;
                }
            }
            JVS jvs = C3355JVa.LIZ;
            Context baseContext2 = getBaseContext();
            n.LIZIZ(baseContext2, "");
            jvs.LIZ(baseContext2, (View) this.LJIIL, this.LJIIJJI, true, false, (C3356JVb) null);
        }
    }
}
