package com.tencent.mm.plugin.fav.ui.gallery;

import android.view.MenuItem;
import android.widget.Toast;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.kernel.g;
import com.tencent.mm.modelvideo.u;
import com.tencent.mm.platformtools.q;
import com.tencent.mm.plugin.fav.a.b;
import com.tencent.mm.plugin.fav.a.h;
import com.tencent.mm.plugin.fav.a.y;
import com.tencent.mm.plugin.fav.ui.gallery.f.c;
import com.tencent.mm.plugin.fav.ui.gallery.f.d.4;
import com.tencent.mm.pluginsdk.ui.tools.n;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.base.n.d;
import java.util.ArrayList;

class f$d$4$3 implements d {
    final /* synthetic */ int gvp;
    final /* synthetic */ 4 mos;
    final /* synthetic */ c mot;

    f$d$4$3(4 4, c cVar, int i) {
        this.mos = 4;
        this.mot = cVar;
        this.gvp = i;
    }

    public final void onMMMenuItemSelected(MenuItem menuItem, int i) {
        AppMethodBeat.i(74574);
        String b = b.b(this.mot.mof.cAJ);
        switch (menuItem.getItemId()) {
            case 0:
                ArrayList arrayList = new ArrayList();
                arrayList.add(this.mot.mof);
                this.mos.mor.moe.mob.bS(arrayList);
                AppMethodBeat.o(74574);
                return;
            case 1:
                h.j(this.mot.mof.mnW.field_localId, 0, 0);
                b.d(b, this.mos.mor.moe.mContext);
                AppMethodBeat.o(74574);
                return;
            case 2:
                if (bo.isNullOrNil(b)) {
                    ab.w("MicroMsg.MediaHistoryGalleryAdapter", "save image fail, path is null");
                    AppMethodBeat.o(74574);
                    return;
                } else if (this.mot.mog) {
                    String uu = u.uu(b);
                    ab.i("MicroMsg.MediaHistoryGalleryAdapter", "save video now video path %s out path %s", new Object[]{b, uu});
                    if (bo.isNullOrNil(uu)) {
                        Toast.makeText(this.mos.mor.moe.mContext, this.mos.mor.moe.mContext.getString(2131304256), 1).show();
                        AppMethodBeat.o(74574);
                        return;
                    }
                    Toast.makeText(this.mos.mor.moe.mContext, this.mos.mor.moe.mContext.getString(2131304257, new Object[]{uu}), 1).show();
                    n.a(uu, this.mos.mor.moe.mContext);
                    AppMethodBeat.o(74574);
                    return;
                } else if (!q.a(b, this.mos.mor.moe.mContext, 2131298807)) {
                    Toast.makeText(this.mos.mor.moe.mContext, this.mos.mor.moe.mContext.getString(2131299726), 1).show();
                    AppMethodBeat.o(74574);
                    return;
                }
                break;
            case 4:
                this.mos.mor.moe.mnG.index = this.mos.mor.moe.getItemCount() - this.gvp;
                ((y) g.K(y.class)).a(this.mos.mor.moe.mContext, this.mot.mof.mnW, this.mos.mor.moe.mnG);
                break;
        }
        AppMethodBeat.o(74574);
    }
}
