aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-08-20 21:51:19 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-08-20 21:51:19 +0200
commit9122d43d0ab681cfafa67a0b8f81e07776f86083 (patch)
tree20d3933e59c4f5c0088421daaff8379153dfa126 /OpenKeychain
parent6ed0f667cd1d556a923bc7d624f296abe17f795a (diff)
downloadopen-keychain-9122d43d0ab681cfafa67a0b8f81e07776f86083.tar.gz
open-keychain-9122d43d0ab681cfafa67a0b8f81e07776f86083.tar.bz2
open-keychain-9122d43d0ab681cfafa67a0b8f81e07776f86083.zip
close actionmode in keylist on loading events (avoid inconsistent state)
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index e7b7d2efc..d50ff4331 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -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);