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

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.HeaderViewListAdapter;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.ui.contact.a.a;
import com.tencent.mm.ui.contact.n;
import java.util.Iterator;

class MassSendSelectContactUI$2 implements OnClickListener {
    final /* synthetic */ MassSendSelectContactUI opp;

    MassSendSelectContactUI$2(MassSendSelectContactUI massSendSelectContactUI) {
        this.opp = massSendSelectContactUI;
    }

    public final void onClick(View view) {
        boolean z;
        AppMethodBeat.i(22875);
        ab.i("MicroMsg.MassSendSelectContactUI", "Click SelectAll");
        n nVar = (n) ((HeaderViewListAdapter) this.opp.getContentLV().getAdapter()).getWrappedAdapter();
        if (MassSendSelectContactUI.b(this.opp)) {
            MassSendSelectContactUI.c(this.opp).setText(2131301412);
            Iterator it = MassSendSelectContactUI.a(this.opp).iterator();
            while (it.hasNext()) {
                MassSendSelectContactUI.d(this.opp).ajq((String) it.next());
            }
            MassSendSelectContactUI.a(this.opp).clear();
        } else {
            MassSendSelectContactUI.c(this.opp).setText(2131301400);
            int count = nVar.getCount();
            for (int i = 0; i < count; i++) {
                a Pn = nVar.Pn(i);
                if (!(Pn == null || Pn.ehM == null || MassSendSelectContactUI.a(this.opp).contains(Pn.ehM.field_username))) {
                    MassSendSelectContactUI.a(this.opp).add(Pn.ehM.field_username);
                    MassSendSelectContactUI.d(this.opp).ajq(Pn.ehM.field_username);
                }
            }
        }
        MassSendSelectContactUI massSendSelectContactUI = this.opp;
        if (MassSendSelectContactUI.b(this.opp)) {
            z = false;
        } else {
            z = true;
        }
        MassSendSelectContactUI.a(massSendSelectContactUI, z);
        MassSendSelectContactUI.a(this.opp, MassSendSelectContactUI.a(this.opp).size());
        nVar.notifyDataSetChanged();
        AppMethodBeat.o(22875);
    }
}
