package com.tencent.mm.plugin.emoji.ui.fts;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.f;
import com.tencent.mm.ai.m;
import com.tencent.mm.at.a.c.i;
import com.tencent.mm.at.o;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.emoji.model.EmojiLogic;
import com.tencent.mm.plugin.emoji.model.d$a;
import com.tencent.mm.plugin.emoji.ui.EmojiSendDialogUI;
import com.tencent.mm.plugin.gif.MMAnimateView;
import com.tencent.mm.plugin.websearch.api.an;
import com.tencent.mm.sdk.b.a;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.aa;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.sdk.platformtools.r;
import com.tencent.mm.storage.emotion.EmojiGroupInfo;
import com.tencent.mm.storage.emotion.EmojiInfo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.base.h;
import com.tencent.mm.ui.base.n.d;
import com.tencent.mm.ui.tools.j;
import com.tencent.mm.ui.widget.snackbar.b;
import com.tencent.mm.vfs.e;
import com.tencent.sqlitelint.config.SharePluginInfo;
import com.tencent.ytcommon.BuildConfig;
import java.util.ArrayList;

public class FTSEmojiDetailPageUI extends MMActivity implements f {
    private String cAo;
    private String cHg;
    private int cvp;
    private String cwg;
    private String designerName;
    private EmojiInfo exP;
    private int fjE;
    private j icA;
    private ProgressBar juA;
    private String kVF;
    private d$a kVx = new 10(this);
    private String lcA;
    private String lcB;
    private String lcC;
    private String lcD;
    private String lcE;
    private String lcF;
    private String lcG;
    private c lcH = new 9(this);
    private i lcI = new 11(this);
    private d lcJ = new 3(this);
    private MMAnimateView lcs;
    private Button lct;
    private Button lcu;
    private TextView lcv;
    private ImageView lcw;
    private View lcx;
    private boolean lcy;
    private boolean lcz;
    private int scene;
    private int type;

    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        AppMethodBeat.at(this, z);
    }

    public FTSEmojiDetailPageUI() {
        AppMethodBeat.i(53551);
        AppMethodBeat.o(53551);
    }

    static /* synthetic */ void e(FTSEmojiDetailPageUI fTSEmojiDetailPageUI) {
        AppMethodBeat.i(53564);
        fTSEmojiDetailPageUI.gs(false);
        AppMethodBeat.o(53564);
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(53552);
        super.onCreate(bundle);
        this.lct = (Button) findViewById(2131824225);
        this.lcu = (Button) findViewById(2131824224);
        this.lcs = (MMAnimateView) findViewById(2131824223);
        this.juA = (ProgressBar) findViewById(2131821605);
        this.lcv = (TextView) findViewById(2131824226);
        this.lcw = (ImageView) findViewById(2131824227);
        this.lcx = findViewById(2131823622);
        setBackBtn(new 1(this));
        this.lct.setOnClickListener(new 5(this));
        this.lcu.setOnClickListener(new 6(this));
        this.lcx.setOnClickListener(new 7(this));
        addIconOptionMenu(0, 2130839555, new 8(this));
        this.type = getIntent().getIntExtra("extra_type", 0);
        this.scene = getIntent().getIntExtra("extra_scence", 0);
        this.exP = new EmojiInfo();
        this.exP.field_designerID = getIntent().getStringExtra(SharePluginInfo.ISSUE_KEY_ID);
        this.exP.field_name = getIntent().getStringExtra("extra_emoji_name");
        this.exP.field_aeskey = getIntent().getStringExtra("extra_aeskey");
        this.exP.field_encrypturl = getIntent().getStringExtra("extra_encrypt_url");
        this.exP.field_thumbUrl = getIntent().getStringExtra("extra_thumb_url");
        this.exP.field_md5 = getIntent().getStringExtra("extra_md5");
        this.exP.field_groupId = getIntent().getStringExtra("extra_product_id");
        this.cwg = this.exP.field_groupId;
        this.lcC = getIntent().getStringExtra("extra_product_name");
        this.lcB = getIntent().getStringExtra("productUrl");
        this.lcD = getIntent().getStringExtra("extra_article_url");
        this.lcE = getIntent().getStringExtra("extra_article_name");
        this.cAo = this.exP.field_designerID;
        this.designerName = getIntent().getStringExtra("name");
        this.lcF = getIntent().getStringExtra("headurl");
        this.lcG = getIntent().getStringExtra("weapp_user_name");
        this.fjE = getIntent().getIntExtra("weapp_version", 0);
        this.cvp = getIntent().getIntExtra("source_type", 0);
        this.lcA = getIntent().getStringExtra("searchID");
        this.kVF = getIntent().getStringExtra("docID");
        this.lcy = getIntent().getBooleanExtra("disableAddSticker", false);
        this.lcz = getIntent().getBooleanExtra("needSavePhotosAlbum", false);
        String stringExtra = getIntent().getStringExtra("activityId");
        if (!bo.isNullOrNil(stringExtra)) {
            this.exP.field_activityid = stringExtra;
        }
        a.xxA.c(this.lcH);
        com.tencent.mm.plugin.emoji.model.j.bkh().kVj = this.kVx;
        an.F(this.scene, this.lcA, this.kVF);
        gs(true);
        ab.i("MicroMsg.FTS.FTSEmojiDetailPageUI", "localPath=%s", new Object[]{this.cHg});
        an.F(this.scene, this.lcA, this.kVF);
        AppMethodBeat.o(53552);
    }

    public void onResume() {
        AppMethodBeat.i(53553);
        super.onResume();
        gs(false);
        AppMethodBeat.o(53553);
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        AppMethodBeat.i(53554);
        if (i == 1001 && i2 == -1) {
            b.i(this, this.mController.ylL.getString(2131297044));
        }
        AppMethodBeat.o(53554);
    }

    private void gs(boolean z) {
        AppMethodBeat.i(53555);
        if (z) {
            setMMTitle(this.exP.getName());
        }
        switch (this.type) {
            case 2:
                o.ahp().a(this.lcB, this.lcw);
                this.lcv.setText(this.lcC);
                this.cHg = this.exP.dve();
                break;
            case 3:
                o.ahp().a(this.lcF, this.lcw);
                this.lcv.setText(this.designerName);
                this.cHg = this.exP.dve();
                break;
            case 4:
                this.lcw.setVisibility(8);
                if (!bo.isNullOrNil(this.lcE)) {
                    this.lcv.setText(this.lcE);
                    break;
                } else {
                    this.lcv.setText(2131302841);
                    break;
                }
        }
        if (e.ct(this.cHg)) {
            this.juA.setVisibility(8);
            this.lcs.setVisibility(0);
            EmojiInfo aqi = com.tencent.mm.plugin.emoji.model.j.getEmojiStorageMgr().xYn.aqi(this.exP.Aq());
            if (aqi == null || (aqi.field_reserved4 & EmojiInfo.yaB) != EmojiInfo.yaB) {
                ab.i("MicroMsg.FTS.FTSEmojiDetailPageUI", "file exist: no decrypt");
                this.lcs.setImageFilePath(this.cHg);
            } else {
                ab.i("MicroMsg.FTS.FTSEmojiDetailPageUI", "file exist: decrypt");
                this.lcs.f(((com.tencent.mm.plugin.emoji.b.d) g.M(com.tencent.mm.plugin.emoji.b.d.class)).getEmojiMgr().l(aqi), BuildConfig.FLAVOR);
            }
            blW();
            blV();
        } else if (z) {
            if (this.type == 4) {
                com.tencent.mm.vfs.b bVar = new com.tencent.mm.vfs.b(getCacheDir(), com.tencent.mm.a.g.x(this.exP.field_encrypturl.getBytes()));
                if (bVar.exists()) {
                    this.exP.field_md5 = e.atg(com.tencent.mm.vfs.j.w(bVar.mUri));
                    String L = EmojiLogic.L(com.tencent.mm.plugin.emoji.h.b.Yb(), BuildConfig.FLAVOR, this.exP.field_md5);
                    if (!e.ct(L)) {
                        e.y(com.tencent.mm.vfs.j.w(bVar.dMD()), L);
                    }
                    this.cHg = L;
                    gs(false);
                } else {
                    com.tencent.mm.at.a.a.c.a aVar = new com.tencent.mm.at.a.a.c.a();
                    aVar.ePH = true;
                    aVar.ePJ = com.tencent.mm.vfs.j.w(bVar.dMD());
                    aVar.eQd = new Object[]{com.tencent.mm.vfs.j.w(bVar.dMD())};
                    com.tencent.mm.plugin.emoji.model.j.bjW().a(this.exP.field_encrypturl, null, aVar.ahG(), this.lcI);
                }
            } else {
                this.lcs.setVisibility(8);
                this.juA.setVisibility(0);
                this.lct.setText(2131299092);
                this.lcu.setText(2131302498);
                this.lct.setEnabled(false);
                this.lcu.setEnabled(false);
                com.tencent.mm.plugin.emoji.model.j.bkh().s(this.exP);
            }
        }
        if (this.lcy) {
            this.lct.setVisibility(8);
        }
        AppMethodBeat.o(53555);
    }

    private void blV() {
        AppMethodBeat.i(53556);
        this.lcu.setEnabled(true);
        AppMethodBeat.o(53556);
    }

    private void blW() {
        AppMethodBeat.i(53557);
        EmojiInfo aqi = com.tencent.mm.plugin.emoji.model.j.getEmojiStorageMgr().xYn.aqi(this.exP.Aq());
        if (aqi == null) {
            aqi = this.exP;
        }
        if (aqi.field_catalog == EmojiGroupInfo.yae) {
            this.lct.setEnabled(false);
            this.lct.setText(2131296524);
            AppMethodBeat.o(53557);
            return;
        }
        this.lct.setText(2131299092);
        if (e.ct(this.cHg)) {
            this.lct.setEnabled(true);
            AppMethodBeat.o(53557);
            return;
        }
        this.lct.setEnabled(false);
        AppMethodBeat.o(53557);
    }

    private boolean blX() {
        AppMethodBeat.i(53558);
        if (bo.isNullOrNil(this.lcG) || this.cvp != 1) {
            AppMethodBeat.o(53558);
            return false;
        }
        AppMethodBeat.o(53558);
        return true;
    }

    public final int getLayoutId() {
        return 2130969620;
    }

    public void onDestroy() {
        AppMethodBeat.i(53559);
        a.xxA.d(this.lcH);
        com.tencent.mm.plugin.emoji.model.j.bkh().kVj = null;
        super.onDestroy();
        AppMethodBeat.o(53559);
    }

    public void onSceneEnd(int i, int i2, String str, m mVar) {
    }

    static /* synthetic */ void a(FTSEmojiDetailPageUI fTSEmojiDetailPageUI, String str, String str2, String str3, String str4) {
        AppMethodBeat.i(53560);
        an.b(fTSEmojiDetailPageUI.scene, fTSEmojiDetailPageUI.lcA, fTSEmojiDetailPageUI.kVF, 1, 0);
        EmojiInfo aqi = com.tencent.mm.plugin.emoji.model.j.getEmojiStorageMgr().xYn.aqi(str);
        String L = EmojiLogic.L(com.tencent.mm.plugin.emoji.h.b.Yb(), BuildConfig.FLAVOR, str);
        if (aqi == null && e.ct(L)) {
            int i = r.amo(L) ? EmojiInfo.yan : EmojiInfo.yam;
            EmojiInfo emojiInfo = new EmojiInfo();
            emojiInfo.field_md5 = str;
            emojiInfo.field_catalog = EmojiInfo.yaf;
            emojiInfo.field_type = i;
            emojiInfo.field_size = (int) e.asZ(L);
            emojiInfo.field_temp = 1;
            emojiInfo.field_designerID = str2;
            emojiInfo.field_thumbUrl = str3;
            emojiInfo.field_activityid = str4;
            com.tencent.mm.plugin.emoji.model.j.getEmojiStorageMgr().xYn.E(emojiInfo);
            aqi = emojiInfo;
        }
        if (aqi != null) {
            boolean a = com.tencent.mm.plugin.emoji.model.j.bki().a(fTSEmojiDetailPageUI, aqi, 18, com.tencent.mm.model.r.Yz());
            ab.i("MicroMsg.FTS.FTSEmojiDetailPageUI", "doAddAction %b", new Object[]{Boolean.valueOf(a)});
        }
        AppMethodBeat.o(53560);
    }

    static /* synthetic */ void b(FTSEmojiDetailPageUI fTSEmojiDetailPageUI) {
        AppMethodBeat.i(53561);
        an.b(fTSEmojiDetailPageUI.scene, fTSEmojiDetailPageUI.lcA, fTSEmojiDetailPageUI.kVF, 2, 0);
        Intent intent = new Intent(fTSEmojiDetailPageUI, EmojiSendDialogUI.class);
        intent.putExtra("emoji_info", fTSEmojiDetailPageUI.exP);
        fTSEmojiDetailPageUI.startActivityForResult(intent, 1001);
        AppMethodBeat.o(53561);
    }

    static /* synthetic */ void c(com.tencent.mm.plugin.emoji.ui.fts.FTSEmojiDetailPageUI r10) {
        /*
        r9 = 27;
        r3 = 3;
        r1 = 1;
        r2 = 0;
        r8 = 53562; // 0xd13a float:7.5056E-41 double:2.6463E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r8);
        r4 = r10.scene;
        r5 = r10.lcA;
        r6 = r10.kVF;
        r0 = r10.type;
        switch(r0) {
            case 2: goto L_0x00b1;
            case 3: goto L_0x00bc;
            case 4: goto L_0x00c7;
            default: goto L_0x0016;
        };
    L_0x0016:
        r0 = r2;
    L_0x0017:
        r7 = r10.blX();
        if (r7 == 0) goto L_0x001e;
    L_0x001d:
        r0 = 4;
    L_0x001e:
        com.tencent.mm.plugin.websearch.api.an.b(r4, r5, r6, r3, r0);
        r0 = r10.blX();
        if (r0 == 0) goto L_0x00d2;
    L_0x0027:
        r0 = new android.os.Bundle;
        r0.<init>();
        r2 = "stat_scene";
        r3 = 8;
        r0.putInt(r2, r3);
        r2 = "stat_search_id";
        r3 = r10.lcA;
        r0.putString(r2, r3);
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = r10.lcA;
        r2 = r2.append(r3);
        r3 = ":";
        r2 = r2.append(r3);
        r3 = r10.kVF;
        r2 = r2.append(r3);
        r3 = ":";
        r2 = r2.append(r3);
        r3 = r10.scene;
        r3 = java.lang.String.valueOf(r3);
        r2 = r2.append(r3);
        r3 = ":";
        r2 = r2.append(r3);
        r3 = r10.type;
        r3 = java.lang.String.valueOf(r3);
        r2 = r2.append(r3);
        r2 = r2.toString();
        r3 = new android.content.Intent;
        r3.<init>();
        r4 = "key_username";
        r5 = r10.lcG;
        r3.putExtra(r4, r5);
        r4 = "key_can_swipe_back";
        r3.putExtra(r4, r1);
        r1 = "key_from_scene";
        r4 = 6;
        r3.putExtra(r1, r4);
        r1 = "key_scene_note";
        r3.putExtra(r1, r2);
        r1 = "_stat_obj";
        r3.putExtra(r1, r0);
        r0 = r10.mController;
        r0 = r0.ylL;
        r1 = "appbrand";
        r2 = ".ui.AppBrandProfileUI";
        com.tencent.mm.bp.d.b(r0, r1, r2, r3);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r8);
    L_0x00b0:
        return;
    L_0x00b1:
        r0 = r10.cwg;
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r0);
        if (r0 != 0) goto L_0x0016;
    L_0x00b9:
        r0 = r1;
        goto L_0x0017;
    L_0x00bc:
        r0 = r10.cAo;
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r0);
        if (r0 != 0) goto L_0x0016;
    L_0x00c4:
        r0 = 2;
        goto L_0x0017;
    L_0x00c7:
        r0 = r10.lcD;
        r0 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r0);
        if (r0 != 0) goto L_0x0016;
    L_0x00cf:
        r0 = r3;
        goto L_0x0017;
    L_0x00d2:
        r0 = new android.content.Intent;
        r0.<init>();
        r1 = "preceding_scence";
        r3 = r10.getIntent();
        r4 = "preceding_scence";
        r2 = r3.getIntExtra(r4, r2);
        r0.putExtra(r1, r2);
        r1 = "download_entrance_scene";
        r0.putExtra(r1, r9);
        r1 = "searchID";
        r2 = r10.lcA;
        r4 = 0;
        r2 = com.tencent.mm.sdk.platformtools.bo.getLong(r2, r4);
        r0.putExtra(r1, r2);
        r1 = "docID";
        r2 = r10.kVF;
        r0.putExtra(r1, r2);
        r1 = r10.type;
        switch(r1) {
            case 2: goto L_0x0138;
            case 3: goto L_0x010d;
            case 4: goto L_0x015b;
            default: goto L_0x0109;
        };
    L_0x0109:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r8);
        goto L_0x00b0;
    L_0x010d:
        r1 = com.tencent.mm.plugin.emoji.ui.v2.EmojiStoreV2DesignerUI.class;
        r0.setClass(r10, r1);
        r1 = "extra_scence";
        r0.putExtra(r1, r9);
        r1 = "id";
        r2 = r10.cAo;
        r0.putExtra(r1, r2);
        r1 = "name";
        r2 = r10.designerName;
        r0.putExtra(r1, r2);
        r1 = "headurl";
        r2 = r10.lcF;
        r0.putExtra(r1, r2);
    L_0x0130:
        r10.startActivity(r0);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r8);
        goto L_0x00b0;
    L_0x0138:
        r1 = com.tencent.mm.plugin.emoji.ui.EmojiStoreDetailUI.class;
        r0.setClass(r10, r1);
        r1 = 268435456; // 0x10000000 float:2.5243549E-29 double:1.32624737E-315;
        r0.setFlags(r1);
        r1 = "extra_scence";
        r2 = r10.scene;
        r0.putExtra(r1, r2);
        r1 = "extra_type";
        r2 = r10.type;
        r0.putExtra(r1, r2);
        r1 = "extra_id";
        r2 = r10.cwg;
        r0.putExtra(r1, r2);
        goto L_0x0130;
    L_0x015b:
        r1 = r10.lcD;
        r1 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r1);
        if (r1 != 0) goto L_0x0178;
    L_0x0163:
        r1 = "rawUrl";
        r2 = r10.lcD;
        r0.putExtra(r1, r2);
        r1 = com.tencent.mm.sdk.platformtools.ah.getContext();
        r2 = "webview";
        r3 = ".ui.tools.WebViewUI";
        com.tencent.mm.bp.d.b(r1, r2, r3, r0);
    L_0x0178:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r8);
        goto L_0x00b0;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.emoji.ui.fts.FTSEmojiDetailPageUI.c(com.tencent.mm.plugin.emoji.ui.fts.FTSEmojiDetailPageUI):void");
    }

    static /* synthetic */ void d(FTSEmojiDetailPageUI fTSEmojiDetailPageUI) {
        AppMethodBeat.i(53563);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        if (fTSEmojiDetailPageUI.lcz) {
            arrayList.add(Integer.valueOf(1));
            arrayList2.add(fTSEmojiDetailPageUI.getString(2131302711));
        }
        arrayList.add(Integer.valueOf(2));
        arrayList2.add(fTSEmojiDetailPageUI.getString(2131299097));
        if (fTSEmojiDetailPageUI.icA == null) {
            fTSEmojiDetailPageUI.icA = new j(fTSEmojiDetailPageUI.mController.ylL);
        }
        fTSEmojiDetailPageUI.icA.rBl = new 12(fTSEmojiDetailPageUI, arrayList, arrayList2);
        fTSEmojiDetailPageUI.icA.rBm = fTSEmojiDetailPageUI.lcJ;
        fTSEmojiDetailPageUI.icA.e(new 2(fTSEmojiDetailPageUI));
        h.a(fTSEmojiDetailPageUI.mController.ylL, fTSEmojiDetailPageUI.icA.cuu());
        AppMethodBeat.o(53563);
    }

    static /* synthetic */ void h(FTSEmojiDetailPageUI fTSEmojiDetailPageUI) {
        AppMethodBeat.i(53565);
        ab.d("MicroMsg.FTS.FTSEmojiDetailPageUI", "ApplicationLanguage" + aa.dor());
        String str = fTSEmojiDetailPageUI.getString(2131300099) + aa.dor();
        Intent intent = new Intent();
        intent.putExtra("title", fTSEmojiDetailPageUI.getString(2131299097));
        intent.putExtra("rawUrl", str);
        intent.putExtra("showShare", false);
        intent.putExtra("neverGetA8Key", true);
        com.tencent.mm.bp.d.b(fTSEmojiDetailPageUI, "webview", "com.tencent.mm.plugin.webview.ui.tools.WebViewUI", intent);
        AppMethodBeat.o(53565);
    }

    static /* synthetic */ void i(FTSEmojiDetailPageUI fTSEmojiDetailPageUI) {
        AppMethodBeat.i(53566);
        g.RS().aa(new 4(fTSEmojiDetailPageUI));
        AppMethodBeat.o(53566);
    }
}
