aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatthew Wong <wongma@protonmail.ch>2015-08-11 12:01:37 -0400
committerMatthew Wong <wongma@protonmail.ch>2015-08-11 12:01:37 -0400
commit33667d86e46dc4832dfec466055cf672baec6dc1 (patch)
treed07a4978f2e5e991554e2554dec6404b07eec80c /app
parent4b3fb7e484ac9dc838fcd22ea6b159fa89d74c28 (diff)
Fix passwords appearing like they have been selected after exiting 'delete mode'
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
index 65139074..bcd869d8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
@@ -14,6 +14,7 @@ import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
@@ -113,7 +114,8 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
}
});
-
+ // after removal, everything is rebound for some reason; views are shuffled?
+ holder.view.setSelected(selectedItems.contains(position));
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@@ -151,7 +153,11 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
// Called when the user exits the action mode
@Override
public void onDestroyActionMode(ActionMode mode) {
- selectedItems.clear();
+ for (Iterator it = selectedItems.iterator(); it.hasNext();) {
+ // need the setSelected line in onBind
+ notifyItemChanged((Integer) it.next());
+ it.remove();
+ }
mActionMode = null;
}
};