本文整理匯總了Java中org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder類的典型用法代碼示例。如果您正苦於以下問題:Java ViewHolder類的具體用法?Java ViewHolder怎麽用?Java ViewHolder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ViewHolder類屬於org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter包,在下文中一共展示了ViewHolder類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBindItemViewHolder
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder; //導入依賴的package包/類
@Override
public void onBindItemViewHolder(ViewHolder viewHolder, @NonNull Cursor cursor) {
long id = cursor.getLong(cursor.getColumnIndexOrThrow(ContactsDatabase.ID_COLUMN));
int contactType = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.CONTACT_TYPE_COLUMN));
String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NAME_COLUMN));
String number = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_COLUMN));
int numberType = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_TYPE_COLUMN));
String label = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.LABEL_COLUMN));
String labelText = ContactsContract.CommonDataKinds.Phone.getTypeLabel(getContext().getResources(),
numberType, label).toString();
int color = (contactType == ContactsDatabase.PUSH_TYPE) ? drawables.getColor(0, 0xa0000000) :
drawables.getColor(1, 0xff000000);
boolean preSelected = numbers != null && numbers.contains(number);
viewHolder.getView().unbind();
viewHolder.getView().set(id, contactType, name, number, labelText, color, multiSelect);
viewHolder.getView().setChecked(preSelected || selectedContacts.containsKey(id));
viewHolder.getView().setEnabled(!preSelected);
}
示例2: onBindItemViewHolder
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder; //導入依賴的package包/類
@Override
public void onBindItemViewHolder(ViewHolder viewHolder, @NonNull Cursor cursor) {
long id = cursor.getLong(cursor.getColumnIndexOrThrow(ContactsDatabase.ID_COLUMN));
int contactType = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.CONTACT_TYPE_COLUMN));
String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NAME_COLUMN));
String number = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_COLUMN));
int numberType = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_TYPE_COLUMN));
String label = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.LABEL_COLUMN));
String labelText = ContactsContract.CommonDataKinds.Phone.getTypeLabel(getContext().getResources(),
numberType, label).toString();
int color = (contactType == ContactsDatabase.PUSH_TYPE) ? drawables.getColor(0, 0xa0000000) :
drawables.getColor(1, 0xff000000);
viewHolder.getView().unbind();
viewHolder.getView().set(id, contactType, name, number, labelText, color, multiSelect);
viewHolder.getView().setChecked(selectedContacts.containsKey(id));
}
示例3: onItemClick
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder; //導入依賴的package包/類
@Override
public void onItemClick(AdapterView<?> l, View v, int position, long id) {
final DataHolder contactData = (DataHolder) v.getTag(R.id.contact_info_tag);
final ViewHolder holder = (ViewHolder) v.getTag(R.id.holder_tag);
if (holder == null) {
Log.w(TAG, "ViewHolder was null, can't proceed with click logic.");
return;
}
if (multi) holder.checkBox.toggle();
if (!multi || holder.checkBox.isChecked()) {
addContact(contactData);
} else if (multi) {
removeContact(contactData);
}
}
示例4: ViewHolder
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder; //導入依賴的package包/類
public ViewHolder(@NonNull final View itemView,
@Nullable final ItemClickListener clickListener)
{
super(itemView);
itemView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (clickListener != null) clickListener.onItemClick(getView());
}
});
}
示例5: onCreateItemViewHolder
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder; //導入依賴的package包/類
@Override
public ViewHolder onCreateItemViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(li.inflate(R.layout.contact_selection_list_item, parent, false), clickListener);
}