From 84b5da3ada3b3859153c8a8e709f5c7adc8a7bd0 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Wed, 1 Jul 2015 01:49:02 -0400 Subject: Implement multi-select with actionbar --- .../pwdstore/utils/PasswordRecyclerAdapter.java | 88 ++++++++++++++++++---- 1 file changed, 73 insertions(+), 15 deletions(-) (limited to 'app') 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 2bcfd7ef..e72b9e07 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -1,10 +1,14 @@ 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; import android.view.View; import android.view.ViewGroup; @@ -20,6 +24,8 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter values; private final PasswordFragment.OnFragmentInteractionListener listener; + private final SparseBooleanArray selectedItems; + private ActionMode mActionMode; // Provide a reference to the views for each data item // Complex data items may need more than one view per item, and @@ -44,6 +50,7 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter