From 8c885882dc0642f2dbf313980441911edd9f9cc7 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Wed, 1 Jul 2015 19:31:11 -0400 Subject: [PATCH] Make selectedItems Set instead of SparseBooleanArray --- .../utils/PasswordRecyclerAdapter.java | 32 ++++++++----------- .../main/res/drawable/selected_rectangle.xml | 2 +- 2 files changed, 14 insertions(+), 20 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 5ad1b890..857c8276 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -1,12 +1,9 @@ package com.zeapo.pwdstore.utils; import android.graphics.Color; -import android.support.v7.app.AppCompatActivity; import android.support.v7.view.ActionMode; -import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; import android.util.Log; -import android.util.SparseBooleanArray; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -19,12 +16,14 @@ import com.zeapo.pwdstore.PasswordStore; import com.zeapo.pwdstore.R; import java.util.ArrayList; +import java.util.Set; +import java.util.TreeSet; public class PasswordRecyclerAdapter extends RecyclerView.Adapter { private final PasswordStore activity; private final ArrayList values; private final PasswordFragment.OnFragmentInteractionListener listener; - private final SparseBooleanArray selectedItems; + private final Set selectedItems; private ActionMode mActionMode; // Provide a reference to the views for each data item @@ -50,7 +49,7 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter(); } // Create new views (invoked by the layout manager) @@ -98,7 +97,7 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter - +