The question is similar to this except for the fact that instead of using a View Pager (VP) I want to use a Navigation Drawer (ND). I have a list of elements that activates a Contextual Action Bar (CAB) when one/several items are selected through long press actions. When the ND is opened I want to hide temporarily the CAB and show the basic action bar, while when it is closed to show again the CAB with the selected items.
The feature is specified in the ND official documentation "Hide contextual action bars while the drawer is visible.". So far I couldn't find anywhere how to make it in a nice way, but I tried a workaround:
An example of what I am trying to achieve can be experienced with the Gmail application.
Thank you in advance for any answer!
To achieve this requirement, I am calling these two methods from the ActionBarDrawerToggle callback methods:
public void onDrawerOpened() {
if (mActionMode != null) {
mCheckedListItems = mListView.getCheckedItemPositions().clone();
mActionMode.finish();
}
}
public void onDrawerClosed() {
if (mCheckedListItems!=null) {
for (int i=0; i<mCheckedListItems.size(); i++) {
if (mCheckedListItems.valueAt(i)) {
mListView.setItemChecked(mCheckedListItems.keyAt(i), true);
}
}
}
mCheckedListItems = null;
}