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

import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ah.d$a;
import com.tencent.mm.ah.o;
import com.tencent.mm.ai.f;
import com.tencent.mm.ai.m;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.r;
import com.tencent.mm.plugin.account.model.h;
import com.tencent.mm.sdk.platformtools.BackwardSupportUtil;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ap;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.f.a.c;
import com.tencent.mm.ui.tools.o.b;

@Deprecated
public class FacebookFriendUI extends MMActivity implements d$a, f {
    private ProgressDialog ehJ = null;
    d gBe;
    private ListView gtT;
    private View gtV;
    String gtX;
    private TextView gtY = null;
    private boolean gxV = false;

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

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(124820);
        super.onCreate(bundle);
        setMMTitle(2131299802);
        g.Rg().a(32, this);
        initView();
        AppMethodBeat.o(124820);
    }

    public void onResume() {
        AppMethodBeat.i(124821);
        super.onResume();
        o.acd().d(this);
        this.gBe.notifyDataSetChanged();
        AppMethodBeat.o(124821);
    }

    public void onPause() {
        AppMethodBeat.i(124822);
        super.onPause();
        o.acd().e(this);
        AppMethodBeat.o(124822);
    }

    public void onDestroy() {
        AppMethodBeat.i(124823);
        g.Rg().b(32, this);
        this.gBe.bIf();
        super.onDestroy();
        AppMethodBeat.o(124823);
    }

    public final int getLayoutId() {
        return 2130969545;
    }

    public final void initView() {
        AppMethodBeat.i(124824);
        this.gtT = (ListView) findViewById(2131824012);
        this.gtY = (TextView) findViewById(2131824013);
        this.gtY.setText(2131299541);
        TextView textView = (TextView) findViewById(2131821807);
        textView.setText(2131299539);
        com.tencent.mm.ui.tools.o oVar = new com.tencent.mm.ui.tools.o((byte) 0);
        oVar.zHa = new b() {
            public final boolean vN(String str) {
                return false;
            }

            public final void vO(String str) {
                AppMethodBeat.i(124807);
                FacebookFriendUI.this.gtX = bo.vA(str);
                FacebookFriendUI facebookFriendUI = FacebookFriendUI.this;
                if (facebookFriendUI.gBe != null) {
                    facebookFriendUI.gBe.vM(facebookFriendUI.gtX);
                }
                AppMethodBeat.o(124807);
            }

            public final void apo() {
            }

            public final void app() {
            }

            public final void apq() {
            }

            public final void apr() {
            }
        };
        a(oVar);
        this.gBe = new d(this, new 5(this, textView));
        this.gBe.gBa = new 6(this);
        this.gtT.setAdapter(this.gBe);
        this.gtV = findViewById(2131824014);
        this.gtT.setOnItemClickListener(new 7(this));
        ab.d("MicroMsg.FacebookFriendUI", "isBindForFacebookApp:" + r.Za());
        if (r.Za()) {
            this.gtT.setVisibility(0);
            this.gtV.setVisibility(8);
            long c = bo.c((Long) g.RP().Ry().get(65831, null));
            String nullAsNil = bo.nullAsNil((String) g.RP().Ry().get(65830, null));
            if (bo.gb(c) > 86400000 && nullAsNil.length() > 0) {
                c cVar = new c(getString(2131305891));
                cVar.arX(nullAsNil);
                new h(cVar, new 8(this)).apm();
            }
            com.tencent.mm.plugin.account.friend.a.ab abVar = new com.tencent.mm.plugin.account.friend.a.ab();
            abVar.aqg();
            ap apVar = new ap(new 9(this, abVar), false);
            if (bo.h((Integer) g.RP().Ry().get(65829, null)) > 0) {
                g.RP().Ry().set(65829, Integer.valueOf(1));
                g.Rg().a(abVar, 0);
            } else {
                apVar.ae(5000, 5000);
            }
            AppCompatActivity appCompatActivity = this.mController.ylL;
            getString(2131297061);
            this.ehJ = com.tencent.mm.ui.base.h.b(appCompatActivity, getString(2131302046), true, new 10(this, apVar, abVar));
            addTextOptionMenu(0, getString(2131299803), new 11(this));
        } else {
            this.gtT.setVisibility(8);
            this.gtV.setVisibility(0);
            ((TextView) findViewById(2131824015)).setText(2131299771);
            this.gtV.setOnClickListener(new 12(this));
        }
        setBackBtn(new 2(this));
        AnonymousClass3 anonymousClass3 = new OnClickListener() {
            public final void onClick(View view) {
                AppMethodBeat.i(124809);
                BackwardSupportUtil.c.a(FacebookFriendUI.this.gtT);
                AppMethodBeat.o(124809);
            }
        };
        AppMethodBeat.o(124824);
    }

    public void onSceneEnd(int i, int i2, String str, m mVar) {
        AppMethodBeat.i(124825);
        ab.i("MicroMsg.FacebookFriendUI", "onSceneEnd: errType = " + i + " errCode = " + i2 + " errMsg = " + str);
        if (mVar.getType() != 32) {
            AppMethodBeat.o(124825);
            return;
        }
        if (this.ehJ != null) {
            this.ehJ.dismiss();
            this.ehJ = null;
        }
        if (i == 4 && i2 == -68) {
            if (bo.isNullOrNil(str)) {
                str = "error";
            }
            bj(getString(2131297061), str);
            AppMethodBeat.o(124825);
        } else if (i == 0 && i2 == 0) {
            this.gBe.a(null, null);
            AppMethodBeat.o(124825);
        } else {
            Toast.makeText(this, 2131301454, 0).show();
            AppMethodBeat.o(124825);
        }
    }

    private void bj(String str, String str2) {
        AppMethodBeat.i(124826);
        com.tencent.mm.ui.base.h.a(this, str2, str, new 4(this), null);
        AppMethodBeat.o(124826);
    }

    public final void qj(String str) {
        AppMethodBeat.i(124827);
        this.gBe.notifyDataSetChanged();
        AppMethodBeat.o(124827);
    }

    static /* synthetic */ void f(FacebookFriendUI facebookFriendUI) {
        AppMethodBeat.i(124828);
        ab.e("MicroMsg.FacebookFriendUI", "dealWithRefreshTokenFail");
        facebookFriendUI.bj(facebookFriendUI.getString(2131297061), facebookFriendUI.getString(2131299540));
        AppMethodBeat.o(124828);
    }
}
