Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e12b161 authored by Ben Kwa's avatar Ben Kwa
Browse files

Fix selection highlights.

Setting an item animator means the background color of the items needs
to be manually managed by the app code as well, otherwise recycled view
end up having the wrong background color.

BUG=26112851

Change-Id: If08f54eedf8da23abd4424159efa72f2f33def39
parent 8d45f5a6
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -317,12 +317,8 @@ public class DirectoryFragment extends Fragment {
        mAdapter = new DocumentsAdapter(context);
        mRecView.setAdapter(mAdapter);

        mDefaultItemColor = context.getResources().getColor(android.R.color.transparent);
        // Get the accent color.
        TypedValue selColor = new TypedValue();
        context.getTheme().resolveAttribute(android.R.attr.colorAccent, selColor, true);
        // Set the opacity to 10%.
        mSelectedItemColor = (selColor.data & 0x00ffffff) | 0x16000000;
        mDefaultItemColor = context.getResources().getColor(R.color.item_doc_background);
        mSelectedItemColor = context.getResources().getColor(R.color.item_doc_background_selected);

        GestureDetector.SimpleOnGestureListener listener =
                new GestureDetector.SimpleOnGestureListener() {
@@ -942,6 +938,7 @@ public class DirectoryFragment extends Fragment {

        public void setSelected(boolean selected) {
            itemView.setActivated(selected);
            itemView.setBackgroundColor(selected ? mSelectedItemColor : mDefaultItemColor);
        }

        @Override