diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-03-16 15:49:22 +0300 |
---|---|---|
committer | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2021-03-16 15:52:14 +0300 |
commit | 60610b7a87164c60b5f2b03fb4199f6b4e77aa6d (patch) | |
tree | 55fa6bd7c105183952f31237e3377b57e0f6f48d /app/src/main/java/it/niedermann | |
parent | cb9164e249ab31aef9a2322be942e3609a198d40 (diff) |
#945 Category label in grid view doesn't take highlight background colour upon selection
Diffstat (limited to 'app/src/main/java/it/niedermann')
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java index a5a25331..d9d484aa 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java @@ -3,8 +3,6 @@ package it.niedermann.owncloud.notes.main.items; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Color; -import android.graphics.drawable.GradientDrawable; -import android.os.Build; import android.text.SpannableString; import android.text.TextUtils; import android.text.style.BackgroundColorSpan; @@ -65,8 +63,8 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { noteCategory.setVisibility(showCategory && !category.isEmpty() ? View.VISIBLE : View.GONE); noteCategory.setText(category); - @ColorInt int categoryForeground; - @ColorInt int categoryBackground; + @ColorInt final int categoryForeground; + @ColorInt final int categoryBackground; if (isDarkThemeActive) { if (ColorUtil.INSTANCE.isColorDark(mainColor)) { @@ -92,8 +90,13 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { noteCategory.setTextColor(categoryForeground); if (noteCategory instanceof Chip) { - ((Chip) noteCategory).setChipStrokeColor(ColorStateList.valueOf(categoryBackground)); - ((Chip) noteCategory).setChipBackgroundColor(ColorStateList.valueOf(isDarkThemeActive ? categoryBackground : Color.TRANSPARENT)); + final Chip chip = (Chip) noteCategory; + chip.setChipStrokeColor(ColorStateList.valueOf(categoryBackground)); + if(isDarkThemeActive) { + chip.setChipBackgroundColor(ColorStateList.valueOf(categoryBackground)); + } else { + chip.setChipBackgroundColorResource(R.color.grid_item_background_selector); + } } else { DrawableCompat.setTint(noteCategory.getBackground(), categoryBackground); } |