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

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.bz.a;
import com.tencent.mm.plugin.report.service.j;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.widget.MMSwitchBtn;
import com.tencent.mm.ui.widget.a.c;
import com.tencent.mm.ui.widget.picker.b;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class KvInfoUI extends MMActivity {
    private c gLj;
    private Button grC;
    private MMSwitchBtn ixT;
    private ArrayAdapter lOF;
    private EditText nHf;
    private Button nHg;
    private ListView nHh;
    private TextView nHi;
    private String nHj;

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

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(114449);
        super.onCreate(bundle);
        setMMTitle("Debug show kv log");
        setBackBtn(new 1(this));
        this.nHf = (EditText) findViewById(2131825200);
        this.nHi = (TextView) findViewById(2131825203);
        this.nHg = (Button) findViewById(2131825201);
        this.nHg.setOnClickListener(new OnClickListener() {
            public final void onClick(View view) {
                AppMethodBeat.i(114442);
                HashMap hashMap = j.cgu().pYD;
                if (hashMap != null && hashMap.size() > 0) {
                    ArrayList arrayList = new ArrayList(hashMap.keySet());
                    b bVar = new b(KvInfoUI.this.mController.ylL, arrayList);
                    bVar.Qq(0);
                    bVar.zSq = new 1(this, bVar, arrayList);
                    bVar.Qp(a.fromDPToPix(KvInfoUI.this.mController.ylL, 288));
                    bVar.show();
                }
                AppMethodBeat.o(114442);
            }
        });
        this.ixT = (MMSwitchBtn) findViewById(2131825202);
        this.ixT.setCheck(j.cgu().pWV);
        this.ixT.setSwitchListener(new 3(this));
        this.grC = (Button) findViewById(2131820999);
        this.grC.setOnClickListener(new 4(this));
        this.nHh = (ListView) findViewById(2131825204);
        this.lOF = new 5(this, this);
        this.nHh.setAdapter(this.lOF);
        this.nHh.setOnItemClickListener(new 6(this));
        AppMethodBeat.o(114449);
    }

    public final int getLayoutId() {
        return 2130969914;
    }

    private void PC(String str) {
        AppMethodBeat.i(114450);
        ab.i("MicroMsg.KvInfoUI", "updateData new[%s] old[%s]", new Object[]{str, this.nHj});
        this.nHj = str;
        List list = (List) j.cgu().pYD.get(this.nHj);
        if (list != null) {
            this.nHi.setText(this.nHj + ":" + list.size());
            this.lOF.setNotifyOnChange(false);
            this.lOF.clear();
            this.lOF.addAll(list);
            this.lOF.notifyDataSetChanged();
            AppMethodBeat.o(114450);
            return;
        }
        this.nHi.setText(this.nHj + ":0");
        this.lOF.clear();
        AppMethodBeat.o(114450);
    }

    public void onDestroy() {
        AppMethodBeat.i(114451);
        if (this.lOF != null) {
            this.lOF.setNotifyOnChange(false);
            this.lOF.clear();
        }
        if (this.gLj != null) {
            this.gLj.dismiss();
        }
        aqX();
        super.onDestroy();
        AppMethodBeat.o(114451);
    }

    public void onResume() {
        AppMethodBeat.i(114452);
        if (!bo.isNullOrNil(this.nHj)) {
            PC(this.nHj);
        }
        super.onResume();
        AppMethodBeat.o(114452);
    }
}
