diff options
author | Matthew Wong <wongma@protonmail.ch> | 2015-08-11 12:01:37 -0400 |
---|---|---|
committer | Matthew Wong <wongma@protonmail.ch> | 2015-08-11 12:01:37 -0400 |
commit | 33667d86e46dc4832dfec466055cf672baec6dc1 (patch) | |
tree | d07a4978f2e5e991554e2554dec6404b07eec80c | |
parent | 4b3fb7e484ac9dc838fcd22ea6b159fa89d74c28 (diff) |
Fix passwords appearing like they have been selected after exiting 'delete mode'
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java | 10 |
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; } }; |