mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 00:18:51 -05:00
close actionmode in keylist on loading events (avoid inconsistent state)
This commit is contained in:
parent
6ed0f667cd
commit
9122d43d0a
@ -79,6 +79,9 @@ public class KeyListFragment extends LoaderFragment
|
||||
private KeyListAdapter mAdapter;
|
||||
private StickyListHeadersListView mStickyList;
|
||||
|
||||
// saves the mode object for multiselect, needed for reset at some point
|
||||
private ActionMode mActionMode = null;
|
||||
|
||||
private String mQuery;
|
||||
private SearchView mSearchView;
|
||||
// empty list layout
|
||||
@ -148,6 +151,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
android.view.MenuInflater inflater = getActivity().getMenuInflater();
|
||||
inflater.inflate(R.menu.key_list_multi, menu);
|
||||
mActionMode = mode;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -193,6 +197,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
mAdapter.clearSelection();
|
||||
}
|
||||
|
||||
@ -288,6 +293,11 @@ public class KeyListFragment extends LoaderFragment
|
||||
// this view is made visible if no data is available
|
||||
mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_empty));
|
||||
|
||||
// end action mode, if any
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
|
||||
// The list should now be shown.
|
||||
if (isResumed()) {
|
||||
setContentShown(true);
|
||||
|
Loading…
Reference in New Issue
Block a user