Better synced lyrics color in now playing themes
This commit is contained in:
parent
00581082ed
commit
0f06f42e08
1 changed files with 21 additions and 21 deletions
|
@ -20,11 +20,13 @@ import android.content.SharedPreferences
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.LYRICS_TYPE
|
import code.name.monkey.retromusic.LYRICS_TYPE
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
@ -195,15 +197,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLRCViewColors(backgroundColor: Int) {
|
private fun setLRCViewColors(@ColorInt primaryColor: Int, @ColorInt secondaryColor: Int) {
|
||||||
val primaryColor = MaterialValueHelper.getPrimaryTextColor(
|
|
||||||
requireContext(),
|
|
||||||
backgroundColor.isColorLight
|
|
||||||
)
|
|
||||||
val secondaryColor = MaterialValueHelper.getSecondaryDisabledTextColor(
|
|
||||||
requireContext(),
|
|
||||||
backgroundColor.isColorLight
|
|
||||||
)
|
|
||||||
lrcView.apply {
|
lrcView.apply {
|
||||||
setCurrentColor(primaryColor)
|
setCurrentColor(primaryColor)
|
||||||
setTimeTextColor(primaryColor)
|
setTimeTextColor(primaryColor)
|
||||||
|
@ -277,19 +271,25 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
|
|
||||||
private fun notifyColorChange(color: MediaNotificationProcessor) {
|
private fun notifyColorChange(color: MediaNotificationProcessor) {
|
||||||
callbacks?.onColorChanged(color)
|
callbacks?.onColorChanged(color)
|
||||||
setLRCViewColors(
|
val primaryColor = MaterialValueHelper.getPrimaryTextColor(
|
||||||
when (PreferenceUtil.nowPlayingScreen) {
|
requireContext(),
|
||||||
Adaptive, Fit, Plain, Simple -> surfaceColor()
|
surfaceColor().isColorLight
|
||||||
Flat, Normal, Material -> if (PreferenceUtil.isAdaptiveColor) {
|
|
||||||
color.backgroundColor
|
|
||||||
} else {
|
|
||||||
surfaceColor()
|
|
||||||
}
|
|
||||||
Color, Classic -> color.primaryTextColor
|
|
||||||
Blur -> Color.BLACK
|
|
||||||
else -> surfaceColor()
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
val secondaryColor = MaterialValueHelper.getSecondaryDisabledTextColor(
|
||||||
|
requireContext(),
|
||||||
|
surfaceColor().isColorLight
|
||||||
|
)
|
||||||
|
|
||||||
|
when (PreferenceUtil.nowPlayingScreen) {
|
||||||
|
Flat, Normal, Material -> if (PreferenceUtil.isAdaptiveColor) {
|
||||||
|
setLRCViewColors(color.primaryTextColor, color.secondaryTextColor)
|
||||||
|
} else {
|
||||||
|
setLRCViewColors(primaryColor, secondaryColor)
|
||||||
|
}
|
||||||
|
Color, Classic -> setLRCViewColors(color.primaryTextColor, color.secondaryTextColor)
|
||||||
|
Blur -> setLRCViewColors(Color.WHITE, ColorUtil.withAlpha(Color.WHITE, 0.5f))
|
||||||
|
else -> setLRCViewColors(primaryColor, secondaryColor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setCallbacks(listener: Callbacks) {
|
fun setCallbacks(listener: Callbacks) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue