package com.tencent.mm.plugin.remittance.bankcard.ui;

import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.m;
import com.tencent.mm.plugin.remittance.bankcard.a.e;
import com.tencent.mm.plugin.remittance.bankcard.a.i;
import com.tencent.mm.protocal.protobuf.atf;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.ui.base.n.d;
import com.tencent.mm.ui.tools.j;
import java.util.ArrayList;
import java.util.List;

public class BankRemitHistoryUI extends BankRemitBaseUI implements d {
    private boolean gno = false;
    private boolean gnp = false;
    private j icA;
    private List<atf> kPz = new ArrayList();
    private View leb;
    private int limit = 20;
    private int offset = 0;
    private ListView pNq;
    private a pNr;

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

    public BankRemitHistoryUI() {
        AppMethodBeat.i(44620);
        AppMethodBeat.o(44620);
    }

    static /* synthetic */ void e(BankRemitHistoryUI bankRemitHistoryUI) {
        AppMethodBeat.i(44628);
        bankRemitHistoryUI.cfk();
        AppMethodBeat.o(44628);
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(44621);
        super.onCreate(bundle);
        nf(1511);
        nf(1737);
        setMMTitle(2131297464);
        initView();
        cfk();
        AppMethodBeat.o(44621);
    }

    public final void initView() {
        AppMethodBeat.i(44622);
        this.pNq = (ListView) findViewById(2131821671);
        this.leb = LayoutInflater.from(this).inflate(2130968581, null);
        this.icA = new j(this);
        this.pNr = new a(this, (byte) 0);
        this.pNq.addFooterView(this.leb);
        this.pNq.setAdapter(this.pNr);
        this.pNq.setOnItemLongClickListener(new 1(this));
        this.pNq.setOnScrollListener(new OnScrollListener() {
            public final void onScrollStateChanged(AbsListView absListView, int i) {
            }

            public final void onScroll(AbsListView absListView, int i, int i2, int i3) {
                AppMethodBeat.i(44607);
                if (BankRemitHistoryUI.this.pNq.getLastVisiblePosition() == BankRemitHistoryUI.this.pNq.getCount() - 1 && BankRemitHistoryUI.this.pNq.getCount() > 0 && !BankRemitHistoryUI.this.gnp && !BankRemitHistoryUI.this.gno) {
                    BankRemitHistoryUI.e(BankRemitHistoryUI.this);
                }
                AppMethodBeat.o(44607);
            }
        });
        AppMethodBeat.o(44622);
    }

    public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenuInfo contextMenuInfo) {
        AppMethodBeat.i(44623);
        contextMenu.add(0, 1, 0, 2131297480);
        AppMethodBeat.o(44623);
    }

    public void onMMMenuItemSelected(MenuItem menuItem, int i) {
        AppMethodBeat.i(44624);
        atf atf = (atf) this.pNq.getItemAtPosition(((AdapterContextMenuInfo) menuItem.getMenuInfo()).position);
        if (menuItem.getItemId() == 1 && atf != null) {
            ab.i("MicroMsg.BankRemitHistoryUI", "delete record: %s", new Object[]{atf.vPX});
            e eVar = new e(r0);
            eVar.o(this);
            a(eVar, true, true);
        }
        AppMethodBeat.o(44624);
    }

    public final boolean c(int i, int i2, String str, m mVar) {
        AppMethodBeat.i(44625);
        if (mVar instanceof i) {
            i iVar = (i) mVar;
            iVar.a(new 5(this, iVar)).b(new 4(this, iVar)).c(new 3(this));
            this.gno = false;
        } else if (mVar instanceof e) {
            e eVar = (e) mVar;
            eVar.a(new 8(this, eVar)).b(new 7(this, eVar)).c(new 6(this));
        }
        AppMethodBeat.o(44625);
        return false;
    }

    public final int getLayoutId() {
        return 2130968819;
    }

    public void onDestroy() {
        AppMethodBeat.i(44626);
        super.onDestroy();
        ng(1511);
        ng(1737);
        AppMethodBeat.o(44626);
    }

    private void cfk() {
        AppMethodBeat.i(44627);
        ab.i("MicroMsg.BankRemitHistoryUI", "fetch data: %s, %s", new Object[]{Integer.valueOf(this.limit), Integer.valueOf(this.offset)});
        this.gno = true;
        i iVar = new i(this.limit, this.offset);
        iVar.o(this);
        a(iVar, false, false);
        AppMethodBeat.o(44627);
    }
}
