@Override protected void bindView(View itemView, int partition, Cursor cursor, int position) { final ContactListItemView view = (ContactListItemView) itemView; view.setIsSectionHeaderEnabled(isSectionHeaderDisplayEnabled()); bindWorkProfileIcon(view, partition); }
@Override protected ContactListItemView newView( Context context, int partition, Cursor cursor, int position, ViewGroup parent) { final ContactListItemView view = new ContactListItemView(context, null); view.setIsSectionHeaderEnabled(isSectionHeaderDisplayEnabled()); view.setAdjustSelectionBoundsEnabled(isAdjustSelectionBoundsEnabled()); return view; }
@Override public int getItemViewType(int partitionIndex, int position) { int type = super.getItemViewType(partitionIndex, position); if (!isUserProfile(position) && isSectionHeaderDisplayEnabled() && partitionIndex == getIndexedPartition()) { Placement placement = getItemPlacementInSection(position); return placement.firstInSection ? type : getItemViewTypeCount() + type; } else { return type; } }
@Override public void changeCursor(int partitionIndex, Cursor cursor) { if (partitionIndex >= getPartitionCount()) { // There is no partition for this data return; } Partition partition = getPartition(partitionIndex); if (partition instanceof DirectoryPartition) { ((DirectoryPartition)partition).setStatus(DirectoryPartition.STATUS_LOADED); } if (mDisplayPhotos && mPhotoLoader != null && isPhotoSupported(partitionIndex)) { mPhotoLoader.refreshCache(); } super.changeCursor(partitionIndex, cursor); if (isSectionHeaderDisplayEnabled() && partitionIndex == getIndexedPartition()) { updateIndexer(cursor); } // When the cursor changes, cancel any pending asynchronous photo loads. mPhotoLoader.cancelPendingRequests(mFragmentRootView); }