package com.tencent.mm.plugin.sns.ui;

import android.app.Activity;
import android.content.Intent;
import android.view.MenuItem;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.a.cf;
import com.tencent.mm.g.a.cl;
import com.tencent.mm.g.a.rb;
import com.tencent.mm.plugin.sns.c.a;
import com.tencent.mm.plugin.sns.data.i;
import com.tencent.mm.plugin.sns.model.af;
import com.tencent.mm.plugin.sns.model.aj;
import com.tencent.mm.plugin.sns.model.an;
import com.tencent.mm.plugin.sns.storage.n;
import com.tencent.mm.protocal.protobuf.bau;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.az;
import com.tencent.mm.ui.base.n.d;
import com.tencent.ytcommon.BuildConfig;

class FlipView$4 implements d {
    final /* synthetic */ String IN;
    final /* synthetic */ String hWl;
    final /* synthetic */ FlipView riK;
    final /* synthetic */ String riM;

    FlipView$4(FlipView flipView, String str, String str2, String str3) {
        this.riK = flipView;
        this.riM = str;
        this.hWl = str2;
        this.IN = str3;
    }

    public final void onMMMenuItemSelected(MenuItem menuItem, int i) {
        AppMethodBeat.i(38229);
        n YT = af.cnF().YT(this.riM);
        if (YT == null) {
            ab.i("MicroMsg.FlipView", "error beacause info null");
            AppMethodBeat.o(38229);
            return;
        }
        n YT2;
        switch (menuItem.getItemId()) {
            case 0:
                if (YT.field_type != 15) {
                    com.tencent.mm.pluginsdk.ui.tools.n.j(this.hWl, FlipView.e(this.riK));
                    AppMethodBeat.o(38229);
                    return;
                }
                FlipView.Zt(this.riM);
                AppMethodBeat.o(38229);
                return;
            case 1:
                if (YT.field_type != 15) {
                    Intent intent = new Intent();
                    intent.putExtra("Retr_File_Name", this.hWl);
                    intent.putExtra("Retr_Compress_Type", 0);
                    intent.putExtra("Retr_Msg_Type", 0);
                    if (YT != null) {
                        intent.putExtra("Retr_FromMainTimeline", this.riK.crK());
                        intent.putExtra("Retr_KSnsId", i.j(YT));
                    }
                    a.gkE.k(intent, FlipView.e(this.riK));
                    AppMethodBeat.o(38229);
                    return;
                }
                new StringBuilder().append(an.fZ(af.getAccSnsPath(), this.IN)).append(i.e((bau) YT.cqu().xfI.wbK.get(0)));
                FlipView.Zu(this.riM);
                AppMethodBeat.o(38229);
                return;
            case 2:
                cl clVar;
                rb rbVar;
                if (YT.field_type != 15) {
                    clVar = new cl();
                    String str = this.riM;
                    String str2 = this.IN;
                    if (str2 == null || bo.isNullOrNil(str)) {
                        ab.w("MicroMsg.Sns.GetFavDataSource", "fill favorite event fail, event is null or snsId error or position errro");
                        clVar.cvA.cvG = 2131299622;
                    } else if (af.cnn()) {
                        ab.w("MicroMsg.Sns.GetFavDataSource", "fill favorite event fail, sns core is invalid");
                        clVar.cvA.cvG = 2131299640;
                    } else {
                        YT2 = af.cnF().YT(str);
                        if (YT2 == null) {
                            ab.w("MicroMsg.Sns.GetFavDataSource", "fill favorite event fail, snsInfo is null");
                            clVar.cvA.cvG = 2131299623;
                        } else {
                            com.tencent.mm.plugin.sns.j.a.a(clVar, YT2, str2);
                        }
                    }
                    clVar.cvA.cvH = 13;
                    clVar.cvA.activity = (Activity) FlipView.e(this.riK);
                    com.tencent.mm.sdk.b.a.xxA.m(clVar);
                    if (this.riK.crK()) {
                        rbVar = new rb();
                        rbVar.cNg.cFc = i.j(YT);
                        rbVar.cNg.cwT = YT.cqU();
                        com.tencent.mm.sdk.b.a.xxA.m(rbVar);
                    }
                    AppMethodBeat.o(38229);
                    return;
                } else if (YT == null) {
                    AppMethodBeat.o(38229);
                    return;
                } else {
                    if (YT.DI(32)) {
                        clVar = new cl();
                        com.tencent.mm.plugin.sns.j.a.a(clVar, YT);
                        clVar.cvA.cvH = 14;
                        clVar.cvA.activity = (Activity) FlipView.e(this.riK);
                        com.tencent.mm.sdk.b.a.xxA.m(clVar);
                    } else {
                        FlipView.r(this.riK.crK(), YT.cqU());
                    }
                    if (this.riK.crK()) {
                        rbVar = new rb();
                        rbVar.cNg.cFc = i.j(YT);
                        rbVar.cNg.cwT = YT.cqU();
                        com.tencent.mm.sdk.b.a.xxA.m(rbVar);
                    }
                    AppMethodBeat.o(38229);
                    return;
                }
            case 3:
                Intent intent2 = new Intent();
                intent2.putExtra("k_expose_msg_id", this.riK.getSnsId());
                YT2 = af.cnF().kD(this.riK.getSnsId());
                intent2.putExtra("k_username", YT2 == null ? BuildConfig.FLAVOR : YT2.field_userName);
                intent2.putExtra("showShare", false);
                intent2.putExtra("rawUrl", "https://weixin110.qq.com/security/readtemplate?t=weixin_report/w_type&scene=%d#wechat_redirect33");
                intent2.putExtra("rawUrl", String.format("https://weixin110.qq.com/security/readtemplate?t=weixin_report/w_type&scene=%d#wechat_redirect", new Object[]{Integer.valueOf(33)}));
                com.tencent.mm.bp.d.b(FlipView.e(this.riK), "webview", ".ui.tools.WebViewUI", intent2);
                AppMethodBeat.o(38229);
                return;
            case 4:
                ab.i("MicroMsg.FlipView", "request deal QBAR string");
                cf cfVar = new cf();
                cfVar.cvm.activity = (Activity) FlipView.e(this.riK);
                cfVar.cvm.ctB = FlipView.f(this.riK);
                cfVar.cvm.cvn = FlipView.g(this.riK);
                cfVar.cvm.cvo = FlipView.h(this.riK);
                bau a = aj.a(YT, this.IN);
                if (a != null) {
                    cfVar.cvm.imagePath = a.Url;
                    cfVar.cvm.cvr = a.wEY;
                }
                cfVar.cvm.scene = 38;
                if (FlipView.e(this.riK) instanceof Activity) {
                    cfVar.cvm.cvs = ((Activity) FlipView.e(this.riK)).getIntent().getBundleExtra("_stat_obj");
                }
                if (this.riK instanceof SnsInfoFlip) {
                    SnsInfoFlip snsInfoFlip = (SnsInfoFlip) this.riK;
                    az fromScene = snsInfoFlip.getFromScene();
                    ab.d("MicroMsg.FlipView", "from Scene: %s", new Object[]{fromScene.tag});
                    if (fromScene.tag.equals(az.xYN.tag) || fromScene.tag.equals(az.xYO.tag) || fromScene.tag.equals(az.xYP.tag)) {
                        cfVar.cvm.cvp = 5;
                        if (bo.isNullOrNil(snsInfoFlip.username)) {
                            ab.i("MicroMsg.FlipView", "empty username");
                            snsInfoFlip.username = BuildConfig.FLAVOR;
                        }
                        cfVar.cvm.source = snsInfoFlip.username;
                    } else if (fromScene.tag.equals(az.xYM.tag)) {
                        cfVar.cvm.cvp = 3;
                    } else {
                        ab.i("MicroMsg.FlipView", "other scene_from: %s", new Object[]{fromScene.tag});
                    }
                }
                com.tencent.mm.sdk.b.a.xxA.m(cfVar);
                AppMethodBeat.o(38229);
                return;
            case 5:
                if (YT.cqu().xfI.wbK.size() == 0) {
                    AppMethodBeat.o(38229);
                    return;
                }
                Intent intent3 = new Intent();
                if (YT.field_type == 1) {
                    int position = this.riK.getPosition();
                    int size = YT.cqu().xfI.wbK.size();
                    if (size <= 1 || position <= 1 || position > size) {
                        position = 0;
                    } else {
                        position--;
                    }
                    String g = FlipView.g(this.hWl, FlipView.e(this.riK));
                    if (g == null) {
                        AppMethodBeat.o(38229);
                        return;
                    } else {
                        intent3.putExtra("sns_send_data_ui_image_path", g);
                        intent3.putExtra("sns_send_data_ui_image_position", position);
                    }
                }
                intent3.putExtra("sns_send_data_ui_activity", true);
                intent3.putExtra("sns_local_id", this.riM);
                com.tencent.mm.bp.d.f(FlipView.e(this.riK), ".ui.chatting.ChattingSendDataToDeviceUI", intent3);
                AppMethodBeat.o(38229);
                return;
            case 6:
                this.riK.Zs(this.hWl);
                break;
        }
        AppMethodBeat.o(38229);
    }
}
