Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
Notes
Commits
60610b7a
Commit
60610b7a
authored
Mar 16, 2021
by
Stefan Niedermann
Committed by
Niedermann IT-Dienstleistungen
Mar 16, 2021
Browse files
#945 Category label in grid view doesn't take highlight background colour upon selection
parent
cb9164e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java
View file @
60610b7a
...
...
@@ -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
);
}
...
...
app/src/main/res/color/grid_item_background_selector.xml
0 → 100644
View file @
60610b7a
<?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>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment