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

import a.f.b.j;
import a.f.b.y;
import a.k.m;
import a.l;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.i;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.b.a.be;
import com.tencent.mm.plugin.appbrand.v;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.ui.MMActivity;
import com.tencent.ytcommon.BuildConfig;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@com.tencent.mm.ui.base.a(3)
@l(dWo = {1, 1, 13}, dWp = {"\u0000b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u0000 +2\u00020\u0001:\u0001+B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010!\u001a\u00020\"H\u0014J\b\u0010#\u001a\u00020$H\u0002J\b\u0010%\u001a\u00020$H\u0002J\u0012\u0010&\u001a\u00020$2\b\u0010'\u001a\u0004\u0018\u00010(H\u0016J\b\u0010)\u001a\u00020$H\u0014J\b\u0010*\u001a\u00020$H\u0002R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\bX\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u0006X\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u0004\u0018\u00010\u000eX\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u000f\u001a\u0004\u0018\u00010\bX\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0010\u0010\u0011\"\u0004\b\u0012\u0010\u0013R\u001e\u0010\u0014\u001a\u0012\u0012\u0004\u0012\u00020\u00160\u0015j\b\u0012\u0004\u0012\u00020\u0016`\u0017X\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0018\u001a\u0004\u0018\u00010\u0019X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001a\u0010\u001b\"\u0004\b\u001c\u0010\u001dR\u000e\u0010\u001e\u001a\u00020\u001fX\u000e¢\u0006\u0002\n\u0000R\u0010\u0010 \u001a\u0004\u0018\u00010\u0006X\u000e¢\u0006\u0002\n\u0000¨\u0006,"}, dWq = {"Lcom/tencent/mm/plugin/appbrand/phonenumber/PhoneNumberManagerUI;", "Lcom/tencent/mm/ui/MMActivity;", "()V", "addPhoneLineV", "Landroid/view/View;", "addPhoneTv", "Landroid/widget/TextView;", "appId", "", "authDesc", "exposeTv", "itemAdapter", "Lcom/tencent/mm/plugin/appbrand/phonenumber/DeleteItemAdapter;", "listRv", "Landroid/support/v7/widget/RecyclerView;", "pagePath", "getPagePath", "()Ljava/lang/String;", "setPagePath", "(Ljava/lang/String;)V", "phoneItems", "Ljava/util/ArrayList;", "Lcom/tencent/mm/plugin/appbrand/phonenumber/PhoneItem;", "Lkotlin/collections/ArrayList;", "report", "Lcom/tencent/mm/autogen/mmdata/rpt/WAPhoneAuthActionLogStruct;", "getReport", "()Lcom/tencent/mm/autogen/mmdata/rpt/WAPhoneAuthActionLogStruct;", "setReport", "(Lcom/tencent/mm/autogen/mmdata/rpt/WAPhoneAuthActionLogStruct;)V", "showDelete", "", "tipsTv", "getLayoutId", "", "initExpose", "", "initListView", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onResume", "updateListView", "Companion", "plugin-appbrand-integration_release"})
public final class PhoneNumberManagerUI extends MMActivity {
    public static final a iyG = new a();
    private String appId = BuildConfig.FLAVOR;
    private String csu;
    be ixV;
    private boolean ixx;
    private final ArrayList<PhoneItem> ixy = new ArrayList();
    private String iyA;
    private TextView iyB;
    private View iyC;
    private TextView iyD;
    private TextView iyE;
    private h iyF;
    private RecyclerView iyp;

    @l(dWo = {1, 1, 13}, dWp = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0004J&\u0010\u0010\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u0004R\u000e\u0010\u0003\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007XT¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000¨\u0006\u0013"}, dWq = {"Lcom/tencent/mm/plugin/appbrand/phonenumber/PhoneNumberManagerUI$Companion;", "", "()V", "APPID", "", "AUTH_DESC", "MAX_COUNT", "", "PAGE_PATH", "SHOWDELETE", "TAG", "editPhoneNumber", "", "context", "Landroid/content/Context;", "appId", "managePhoneNumber", "pagePath", "authDesc", "plugin-appbrand-integration_release"})
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(byte b) {
            this();
        }
    }

    @l(dWo = {1, 1, 13}, dWp = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0005"}, dWq = {"<anonymous>", "", "it", "Landroid/view/View;", "kotlin.jvm.PlatformType", "onClick"})
    static final class b implements OnClickListener {
        final /* synthetic */ PhoneNumberManagerUI iyH;

        b(PhoneNumberManagerUI phoneNumberManagerUI) {
            this.iyH = phoneNumberManagerUI;
        }

        public final void onClick(View view) {
            AppMethodBeat.i(134859);
            be beVar = this.iyH.ixV;
            if (beVar != null) {
                be beVar2 = this.iyH.ixV;
                Long valueOf = beVar2 != null ? Long.valueOf(beVar2.GO()) : null;
                if (valueOf == null) {
                    j.dWJ();
                }
                beVar.de(valueOf.longValue() + 1);
            }
            com.tencent.mm.plugin.appbrand.phonenumber.PhoneNumberAddUI.a aVar = PhoneNumberAddUI.ixW;
            AppCompatActivity dxU = this.iyH.dxU();
            j.o(dxU, "context");
            com.tencent.mm.plugin.appbrand.phonenumber.PhoneNumberAddUI.a.X((Context) dxU, this.iyH.appId);
            AppMethodBeat.o(134859);
        }
    }

    static {
        AppMethodBeat.i(134868);
        AppMethodBeat.o(134868);
    }

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

    public PhoneNumberManagerUI() {
        AppMethodBeat.i(134867);
        AppMethodBeat.o(134867);
    }

    public final void onCreate(Bundle bundle) {
        AppMethodBeat.i(134865);
        super.onCreate(bundle);
        xE(-1);
        getContentView().setBackgroundColor(dyd());
        String stringExtra = getIntent().getStringExtra("APPID");
        j.o(stringExtra, "intent.getStringExtra(APPID)");
        this.appId = stringExtra;
        this.iyA = getIntent().getStringExtra("AUTHDESC");
        this.csu = getIntent().getStringExtra("PAGEPATH");
        this.ixx = getIntent().getBooleanExtra("SHOW_DELETE", false);
        ab.i("MicroMsg.PhoneNumberManagerUI", "onCreate() appId:%s showDelete:%b", new Object[]{this.appId, Boolean.valueOf(this.ixx)});
        this.ixV = b.a.a.a.a.a.a.a.a.BTg.awB(this.appId);
        if (this.ixx) {
            overridePendingTransition(2131034130, 2131034130);
        }
        this.iyp = (RecyclerView) findViewById(2131821272);
        RecyclerView recyclerView = this.iyp;
        if (recyclerView != null) {
            recyclerView.setLayoutManager((i) new LinearLayoutManager());
        }
        AppCompatActivity dxU = dxU();
        j.o(dxU, "context");
        this.iyF = new h((Context) dxU, this.ixy);
        h hVar = this.iyF;
        if (hVar != null) {
            hVar.ixx = this.ixx;
        }
        recyclerView = this.iyp;
        if (recyclerView != null) {
            recyclerView.setAdapter((android.support.v7.widget.RecyclerView.a) this.iyF);
        }
        String string = getString(2131297137);
        y yVar = y.AVH;
        stringExtra = getString(2131297138);
        j.o(stringExtra, "getString(R.string.appbr…mber_expose_slogan_start)");
        String format = String.format(stringExtra, Arrays.copyOf(new Object[]{string}, 1));
        j.o(format, "java.lang.String.format(format, *args)");
        this.iyD = (TextView) findViewById(2131821276);
        com.tencent.mm.plugin.appbrand.config.WxaExposedParams.a aVar = new com.tencent.mm.plugin.appbrand.config.WxaExposedParams.a();
        com.tencent.mm.plugin.appbrand.config.WxaExposedParams.a zC = aVar.zC(this.appId);
        stringExtra = this.csu;
        if (stringExtra == null) {
            stringExtra = BuildConfig.FLAVOR;
        }
        zC.zG(stringExtra).nF(8);
        com.tencent.mm.plugin.appbrand.jsapi.a.a aVar2 = new com.tencent.mm.plugin.appbrand.jsapi.a.a(v.b(aVar.ayP()));
        SpannableString spannableString = new SpannableString(format);
        CharSequence charSequence = format;
        j.o(string, "expose_desc_end");
        spannableString.setSpan(aVar2, m.a(charSequence, string, 0, false, 6), m.a(format, string, 0, false, 6) + string.length(), 18);
        TextView textView = this.iyD;
        if (textView != null) {
            textView.setMovementMethod(LinkMovementMethod.getInstance());
        }
        TextView textView2 = this.iyD;
        if (textView2 != null) {
            textView2.setText(spannableString);
        }
        this.iyB = (TextView) findViewById(2131821273);
        textView2 = this.iyB;
        if (textView2 != null) {
            textView2.setOnClickListener(new b(this));
        }
        this.iyC = findViewById(2131821274);
        this.iyE = (TextView) findViewById(2131821275);
        textView = this.iyE;
        if (textView != null) {
            textView.setVisibility(4);
            AppMethodBeat.o(134865);
            return;
        }
        AppMethodBeat.o(134865);
    }

    public final int getLayoutId() {
        return 2130968704;
    }

    public final void onResume() {
        TextView textView;
        AppMethodBeat.i(134866);
        super.onResume();
        setMMTitle(2131297147);
        dyb();
        this.ixy.clear();
        this.ixy.addAll(j.ixQ.aKN());
        h hVar = this.iyF;
        if (hVar != null) {
            List list = this.ixy;
            j.p(list, "phoneItems");
            hVar.ixy = (ArrayList) list;
            hVar.notifyDataSetChanged();
        }
        View view;
        if (this.ixx || this.ixy.size() >= 3) {
            textView = this.iyB;
            if (textView != null) {
                textView.setVisibility(8);
            }
            view = this.iyC;
            if (view != null) {
                view.setVisibility(8);
            }
        } else {
            textView = this.iyB;
            if (textView != null) {
                textView.setVisibility(0);
            }
            view = this.iyC;
            if (view != null) {
                view.setVisibility(0);
            }
        }
        if (this.ixx) {
            textView = this.iyE;
            if (textView != null) {
                textView.setVisibility(8);
            }
        } else if (this.ixy.size() >= 3) {
            textView = this.iyE;
            if (textView != null) {
                textView.setVisibility(0);
            }
        } else {
            textView = this.iyE;
            if (textView != null) {
                textView.setVisibility(8);
            }
        }
        if (this.ixx) {
            a(0, getString(2131297139), (OnMenuItemClickListener) new c(this), com.tencent.mm.ui.q.b.ymw);
            setBackBtn((OnMenuItemClickListener) new d(this), 2131230739);
            AppMethodBeat.o(134866);
            return;
        }
        a(0, getString(2131297146), (OnMenuItemClickListener) new e(this), com.tencent.mm.ui.q.b.ymw);
        setBackBtn((OnMenuItemClickListener) new f(this));
        AppMethodBeat.o(134866);
    }
}
