mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 16:38:50 -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 KeyListAdapter mAdapter;
|
||||||
private StickyListHeadersListView mStickyList;
|
private StickyListHeadersListView mStickyList;
|
||||||
|
|
||||||
|
// saves the mode object for multiselect, needed for reset at some point
|
||||||
|
private ActionMode mActionMode = null;
|
||||||
|
|
||||||
private String mQuery;
|
private String mQuery;
|
||||||
private SearchView mSearchView;
|
private SearchView mSearchView;
|
||||||
// empty list layout
|
// empty list layout
|
||||||
@ -148,6 +151,7 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
android.view.MenuInflater inflater = getActivity().getMenuInflater();
|
android.view.MenuInflater inflater = getActivity().getMenuInflater();
|
||||||
inflater.inflate(R.menu.key_list_multi, menu);
|
inflater.inflate(R.menu.key_list_multi, menu);
|
||||||
|
mActionMode = mode;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +197,7 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyActionMode(ActionMode mode) {
|
public void onDestroyActionMode(ActionMode mode) {
|
||||||
|
mActionMode = null;
|
||||||
mAdapter.clearSelection();
|
mAdapter.clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,6 +293,11 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
// this view is made visible if no data is available
|
// this view is made visible if no data is available
|
||||||
mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_empty));
|
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.
|
// The list should now be shown.
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
setContentShown(true);
|
setContentShown(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user