package com.tencent.mm.plugin.appbrand.ui.collection;

import android.content.Context;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.appbrand.appusage.af;
import com.tencent.mm.plugin.appbrand.widget.f.c;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.ytcommon.BuildConfig;

public final class h {
    public static boolean a(boolean z, Context context, String str, int i) {
        AppMethodBeat.i(133322);
        if (z) {
            try {
                if (((af) g.K(af.class)).aD(str, i)) {
                    new c(context).F(context.getResources().getString(2131296853)).show();
                    AppMethodBeat.o(133322);
                    return true;
                }
                r(context, z);
            } catch (Exception e) {
                ab.e("MicroMsg.CollectionModifyInteractLogic", "performClick, (%s %d) added = %b, modify e = %s", new Object[]{str, Integer.valueOf(i), Boolean.valueOf(z), e});
                r(context, z);
            }
        } else {
            int aC = ((af) g.K(af.class)).aC(str, i);
            com.tencent.mm.ui.widget.a.c a;
            if (aC == 0) {
                new c(context).F(context.getResources().getString(2131296852)).show();
                AppMethodBeat.o(133322);
                return true;
            } else if (aC == -2) {
                aC = ((af) g.K(af.class)).awY();
                a = com.tencent.mm.ui.base.h.a(context, context.getResources().getString(2131296596, new Object[]{Integer.valueOf(aC)}), BuildConfig.FLAVOR, context.getResources().getString(2131296994), null);
                if (a != null) {
                    a.setCanceledOnTouchOutside(false);
                    a.qZ(true);
                }
            } else if (aC == -3) {
                a = com.tencent.mm.ui.base.h.a(context, context.getResources().getString(2131296547), BuildConfig.FLAVOR, context.getResources().getString(2131296994), null);
                if (a != null) {
                    a.setCanceledOnTouchOutside(false);
                    a.qZ(true);
                }
            } else {
                r(context, z);
            }
        }
        AppMethodBeat.o(133322);
        return false;
    }

    private static void r(Context context, boolean z) {
        AppMethodBeat.i(133323);
        al.d(new 1(context, z));
        AppMethodBeat.o(133323);
    }
}
