/** * deselects all selected items */ public void deselect() { getAdapter().deselect(); }
/** * deselects the item with the given identifier * * @param identifier the identifier to search for */ public void deselect(long identifier) { getAdapter().deselect(getPosition(identifier)); }
@Override public void onClick(View v, int position, FastAdapter<RadioButtonSampleItem> fastAdapter, RadioButtonSampleItem item) { if (!item.isSelected()) { Set<Integer> selections = fastAdapter.getSelections(); if (!selections.isEmpty()) { int selectedPosition = selections.iterator().next(); fastAdapter.deselect(); fastAdapter.notifyItemChanged(selectedPosition); } fastAdapter.select(position); } } }
/** * set the selection of the MiniDrawer * * @param identifier the identifier of the item which should be selected (-1 for none) */ public void setSelection(long identifier) { if (identifier == -1) { mAdapter.deselect(); } int count = mAdapter.getItemCount(); for (int i = 0; i < count; i++) { IDrawerItem item = mAdapter.getItem(i); if (item.getIdentifier() == identifier && !item.isSelected()) { mAdapter.deselect(); mAdapter.select(i); } } }
drawer.getAdapter().deselect();
mSelectedItemPosition = 1; mAdapter.deselect(); mAdapter.select(mSelectedItemPosition); mAdapter.deselect(); mAdapter.withSavedInstanceState(mSavedInstance, Drawer.BUNDLE_SELECTION); DrawerUtils.setStickyFooterSelection(this, mSavedInstance.getInt(Drawer.BUNDLE_STICKY_FOOTER_SELECTION, -1), null); } else { mAdapter.deselect(); mAdapter.withSavedInstanceState(mSavedInstance, Drawer.BUNDLE_SELECTION_APPENDED); DrawerUtils.setStickyFooterSelection(this, mSavedInstance.getInt(Drawer.BUNDLE_STICKY_FOOTER_SELECTION_APPENDED, -1), null);