package com.tencent.mm.plugin.appbrand.menu;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.view.MenuItem;
import android.widget.Toast;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.jsapi.version.JsApiUpdateApp;
import com.tencent.mm.plugin.appbrand.page.w;
import com.tencent.mm.plugin.appbrand.s;
import com.tencent.mm.plugin.appbrand.task.b;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.ui.base.n.d;
import org.json.JSONObject;

class d$2 implements d {
    final /* synthetic */ w hIw;
    final /* synthetic */ d imu;
    final /* synthetic */ Context val$context;

    d$2(d dVar, w wVar, Context context) {
        this.imu = dVar;
        this.hIw = wVar;
        this.val$context = context;
    }

    public final void onMMMenuItemSelected(MenuItem menuItem, int i) {
        AppMethodBeat.i(132204);
        switch (menuItem.getItemId()) {
            case 1:
                JsApiUpdateApp jsApiUpdateApp = new JsApiUpdateApp();
                s atK = this.hIw.atK();
                JSONObject jSONObject = new JSONObject();
                jsApiUpdateApp.a(atK, 10000);
                AppMethodBeat.o(132204);
                return;
            case 2:
            case 7:
                String str;
                switch (menuItem.getItemId()) {
                    case 2:
                        str = "wxfile://usr";
                        break;
                    case 7:
                        str = "wxfile://opendata";
                        break;
                    default:
                        str = "wxfile://";
                        break;
                }
                str = this.hIw.asE().Z(str, true).getAbsolutePath();
                Toast.makeText(this.val$context, this.val$context.getString(2131305806, new Object[]{str}), 0).show();
                ((ClipboardManager) ah.getContext().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("text", str));
                AppMethodBeat.o(132204);
                return;
            case 3:
                ((ClipboardManager) ah.getContext().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("text", this.hIw.getAppId()));
                Toast.makeText(this.val$context, this.val$context.getString(2131305802, new Object[]{this.hIw.getAppId()}), 1).show();
                AppMethodBeat.o(132204);
                return;
            case 4:
                this.hIw.getContentView().postDelayed(new 1(this), 1000);
                AppMethodBeat.o(132204);
                return;
            case 6:
                if (b.aLG()) {
                    b.aLI();
                } else {
                    b.aLH();
                }
                menuItem.setTitle(this.val$context.getString(2131305803) + String.format("(cur:%b)", new Object[]{Boolean.valueOf(b.aLG())}));
                Toast.makeText(this.val$context, "Restart Wechat!!", 1).show();
                break;
            case 8:
                ((ClipboardManager) ah.getContext().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("text", this.hIw.getRuntime().atI().username));
                Toast.makeText(this.val$context, this.val$context.getString(2131305809, new Object[]{r1}), 1).show();
                AppMethodBeat.o(132204);
                return;
        }
        AppMethodBeat.o(132204);
    }
}
