From b02fa1c409142fb919c4e24cd87b39f17c479b14 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 25 Dec 2016 23:16:27 +0100 Subject: [PATCH] color the directory selected foreground properly --- .../gallery/adapters/DirectoryAdapter.kt | 36 +++++++++++++++++-- app/src/main/res/layout-v23/directory_tmb.xml | 3 +- app/src/main/res/layout/directory_tmb.xml | 6 ++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 9b803b21c..f8ab5ad18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -1,9 +1,15 @@ package com.simplemobiletools.gallery.adapters +import android.content.res.ColorStateList +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.graphics.drawable.RippleDrawable +import android.graphics.drawable.StateListDrawable import android.os.Build import android.support.v7.view.ActionMode import android.support.v7.widget.RecyclerView import android.view.* +import android.widget.FrameLayout import com.bignerdranch.android.multiselector.ModalMultiSelectorCallback import com.bignerdranch.android.multiselector.MultiSelector import com.bignerdranch.android.multiselector.SwappingHolder @@ -12,6 +18,7 @@ import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.signature.StringSignature import com.simplemobiletools.commons.dialogs.ConfirmationDialog +import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder import com.simplemobiletools.filepicker.extensions.isImageVideoGif @@ -40,6 +47,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList() + var selectorDrawableColor = 0 fun toggleItemSelection(itemView: View, select: Boolean, pos: Int = -1) { getProperView(itemView).isSelected = select @@ -59,6 +67,25 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { + class ViewHolder(view: View, val foregroundColor: Int, val itemClick: (Directory) -> (Unit)) : SwappingHolder(view, MultiSelector()) { fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, directory: Directory, pos: Int, isPinned: Boolean) : View { itemView.dir_name.text = directory.name @@ -294,6 +321,11 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList + android:layout_height="match_parent"/> diff --git a/app/src/main/res/layout/directory_tmb.xml b/app/src/main/res/layout/directory_tmb.xml index b6b9d4f7e..273cd4aa2 100644 --- a/app/src/main/res/layout/directory_tmb.xml +++ b/app/src/main/res/layout/directory_tmb.xml @@ -1,11 +1,11 @@ + + android:layout_height="match_parent">