[UI] Harmonized colors for ColorIconsImageView.kt
Harmonized colors for Smart playlists' icon on home tab and setting categories' icon
This commit is contained in:
parent
dcc04c6ea4
commit
77b464f1bd
1 changed files with 8 additions and 2 deletions
|
@ -20,11 +20,13 @@ import android.graphics.Color
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.appcompat.widget.AppCompatImageView
|
import androidx.appcompat.widget.AppCompatImageView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
|
import com.google.android.material.color.MaterialColors
|
||||||
|
|
||||||
|
|
||||||
class ColorIconsImageView @JvmOverloads constructor(
|
class ColorIconsImageView @JvmOverloads constructor(
|
||||||
|
@ -52,8 +54,12 @@ class ColorIconsImageView @JvmOverloads constructor(
|
||||||
imageTintList =
|
imageTintList =
|
||||||
ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
||||||
} else {
|
} else {
|
||||||
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
|
val finalColor = MaterialColors.harmonize(
|
||||||
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))
|
color,
|
||||||
|
ThemeStore.accentColor(context)
|
||||||
|
)
|
||||||
|
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(finalColor, 0.22f))
|
||||||
|
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(finalColor, 0.75f))
|
||||||
}
|
}
|
||||||
requestLayout()
|
requestLayout()
|
||||||
invalidate()
|
invalidate()
|
||||||
|
|
Loading…
Reference in a new issue