protected void setDefaultFilterHeaderText(int resourceId) { mDefaultFilterHeaderText = getContext().getResources().getText(resourceId); }
public String getQuantityText(int count, int zeroResourceId, int pluralResourceId) { if (count == 0) { return getContext().getString(zeroResourceId); } else { String format = getContext().getResources() .getQuantityText(pluralResourceId, count).toString(); return String.format(format, count); } }
public void setProfileExists(boolean exists) { mProfileExists = exists; // Stick the "ME" header for the profile if (exists) { SectionIndexer indexer = getIndexer(); if (indexer != null) { ((ContactsSectionIndexer) indexer).setProfileHeader( getContext().getString(R.string.user_profile_contacts_list_header)); } } }
protected DirectoryPartition createDefaultDirectoryPartition() { DirectoryPartition partition = new DirectoryPartition(true, true); partition.setDirectoryId(Directory.DEFAULT); partition.setDirectoryType(getContext().getString(R.string.contactsList)); partition.setPriorityDirectory(true); partition.setPhotoSupported(true); partition.setLabel(mDefaultFilterHeaderText.toString()); return partition; }
@Override protected void bindHeaderView(View view, int partitionIndex, Cursor cursor) { Partition partition = getPartition(partitionIndex); if (!(partition instanceof DirectoryPartition)) { return; } DirectoryPartition directoryPartition = (DirectoryPartition)partition; long directoryId = directoryPartition.getDirectoryId(); TextView labelTextView = (TextView)view.findViewById(R.id.label); TextView displayNameTextView = (TextView)view.findViewById(R.id.display_name); labelTextView.setText(directoryPartition.getLabel()); if (!DirectoryCompat.isRemoteDirectoryId(directoryId)) { displayNameTextView.setText(null); } else { String directoryName = directoryPartition.getDisplayName(); String displayName = !TextUtils.isEmpty(directoryName) ? directoryName : directoryPartition.getDirectoryType(); displayNameTextView.setText(displayName); } final Resources res = getContext().getResources(); final int headerPaddingTop = partitionIndex == 1 && getPartition(0).isEmpty()? 0 : res.getDimensionPixelOffset(R.dimen.directory_header_extra_top_padding); // There should be no extra padding at the top of the first directory header view.setPaddingRelative(view.getPaddingStart(), headerPaddingTop, view.getPaddingEnd(), view.getPaddingBottom()); }