Commit 60610b7a authored by Stefan Niedermann's avatar Stefan Niedermann Committed by Niedermann IT-Dienstleistungen
Browse files

#945 Category label in grid view doesn't take highlight background colour upon selection

parent cb9164e2
......@@ -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);
}
......
<?xml version="1.0" encoding="utf-8"?><!-- Same as grid_item_background_selector in res/drawable, but can be applied as BackgroundColorResource -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/bg_highlighted" android:state_selected="true" />
<item android:color="@android:color/transparent" />
</selector>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment