Back to project page hacktoolkit-android_lib.
The source code is released under:
MIT License
If you think the Android project hacktoolkit-android_lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.hacktoolkit.android.adapters; /*from ww w .j av a2 s . c o m*/ import java.util.ArrayList; import android.app.Activity; import android.widget.ArrayAdapter; import com.hacktoolkit.android.models.HTKContact; public class HTKContactsAdapter extends ArrayAdapter<HTKContact> { private boolean loaded = false; protected final Activity context; protected final ArrayList<HTKContact> contacts; public HTKContactsAdapter(Activity context, int layoutId, ArrayList<HTKContact> contacts) { super(context, layoutId, contacts); this.context = context; this.contacts = contacts; } public void setItemSelected(int position, boolean isSelected) { HTKContact contact = this.getItem(position); contact.setSelected(isSelected); } public ArrayList<HTKContact> getSelectedContacts() { ArrayList<HTKContact> selectedContacts = new ArrayList<HTKContact>(); for (int i=0; i < this.getCount(); ++i) { HTKContact contact = this.getItem(i); if ((Boolean) contact.getMetaData("selected")) { selectedContacts.add(contact); } } return selectedContacts; } public void loadContacts(ArrayList<HTKContact> contacts) { for (HTKContact contact : contacts) { this.add(contact); } this.loadComplete(); } public void loadComplete() { loaded = true; } public boolean isLoaded() { return loaded; } }