當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewHolder類代碼示例

本文整理匯總了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);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:22,代碼來源:ContactSelectionListAdapter.java

示例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));
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:19,代碼來源:ContactSelectionListAdapter.java

示例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);
  }
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:19,代碼來源:PushContactSelectionListFragment.java

示例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());
    }
  });
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:12,代碼來源:ContactSelectionListAdapter.java

示例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);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:5,代碼來源:ContactSelectionListAdapter.java


注:本文中的org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter.ViewHolder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。