Improved full theme color and lyrics alignment
This commit is contained in:
parent
2f42ce1638
commit
1291666451
6 changed files with 177 additions and 155 deletions
|
@ -54,7 +54,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
private lateinit var bottomSheetBehavior: RetroBottomSheetBehavior<MaterialCardView>
|
||||
private var miniPlayerFragment: MiniPlayerFragment? = null
|
||||
private var playerFragment: AbsPlayerFragment? = null
|
||||
private var currentNowPlayingScreen: NowPlayingScreen? = null
|
||||
private var cps: NowPlayingScreen? = null
|
||||
private var navigationBarColor: Int = 0
|
||||
private var taskColor: Int = 0
|
||||
private var lightStatusBar: Boolean = false
|
||||
|
@ -117,7 +117,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).nowPlayingScreen) {
|
||||
if (cps != PreferenceUtil.getInstance(this).nowPlayingScreen) {
|
||||
postRecreate()
|
||||
}
|
||||
bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallbackList)
|
||||
|
@ -190,7 +190,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
if (currentNowPlayingScreen != PEAK) {
|
||||
if (cps != PEAK) {
|
||||
val params = slidingPanel.layoutParams as ViewGroup.LayoutParams
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||
slidingPanel.layoutParams = params
|
||||
|
@ -239,9 +239,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
}
|
||||
|
||||
private fun chooseFragmentForTheme() {
|
||||
currentNowPlayingScreen = PreferenceUtil.getInstance(this).nowPlayingScreen
|
||||
cps = PreferenceUtil.getInstance(this).nowPlayingScreen
|
||||
|
||||
val fragment: Fragment = when (currentNowPlayingScreen) {
|
||||
val fragment: Fragment = when (cps) {
|
||||
BLUR -> BlurPlayerFragment()
|
||||
ADAPTIVE -> AdaptiveFragment()
|
||||
NORMAL -> PlayerFragment()
|
||||
|
@ -309,20 +309,24 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
|||
|
||||
val isColorLight = ColorUtil.isColorLight(paletteColor)
|
||||
|
||||
if (PreferenceUtil.getInstance(this).adaptiveColor && (currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
|
||||
if (PreferenceUtil.getInstance(this).adaptiveColor && (cps == NORMAL || cps == FLAT)) {
|
||||
super.setLightNavigationBar(true)
|
||||
super.setLightStatusbar(isColorLight)
|
||||
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD || currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
|
||||
} else if (cps == CARD || cps == BLUR || cps == BLUR_CARD) {
|
||||
super.setLightStatusbar(false)
|
||||
super.setLightNavigationBar(true)
|
||||
super.setNavigationbarColor(Color.BLACK)
|
||||
} else if (currentNowPlayingScreen == COLOR || currentNowPlayingScreen == TINY) {
|
||||
} else if (cps == COLOR || cps == TINY) {
|
||||
super.setNavigationbarColor(paletteColor)
|
||||
super.setLightNavigationBar(isColorLight)
|
||||
super.setLightStatusbar(isColorLight)
|
||||
} else if (currentNowPlayingScreen == CLASSIC) {
|
||||
} else if (cps == FULL) {
|
||||
super.setNavigationbarColor(paletteColor)
|
||||
super.setLightNavigationBar(isColorLight)
|
||||
super.setLightStatusbar(false)
|
||||
} else if (currentNowPlayingScreen == FIT) {
|
||||
} else if (cps == CLASSIC) {
|
||||
super.setLightStatusbar(false)
|
||||
} else if (cps == FIT) {
|
||||
super.setLightStatusbar(false)
|
||||
} else {
|
||||
super.setLightStatusbar(
|
||||
|
|
|
@ -30,6 +30,7 @@ import code.name.monkey.retromusic.service.MusicService
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import kotlinx.android.synthetic.main.fragment_full_player_controls.*
|
||||
|
||||
/**
|
||||
|
@ -92,6 +93,29 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
|||
}
|
||||
}
|
||||
|
||||
fun setDark(color: MediaNotificationProcessor) {
|
||||
lastPlaybackControlsColor = color.primaryTextColor
|
||||
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)
|
||||
|
||||
val tintList=ColorStateList.valueOf(color.primaryTextColor)
|
||||
playerMenu.imageTintList = tintList
|
||||
songFavourite.imageTintList = tintList
|
||||
volumeFragment?.setTintableColor(color.primaryTextColor)
|
||||
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
|
||||
title.setTextColor(color.primaryTextColor)
|
||||
text.setTextColor(color.secondaryTextColor)
|
||||
songInfo.setTextColor(color.secondaryTextColor)
|
||||
songCurrentProgress.setTextColor(color.secondaryTextColor)
|
||||
songTotalTime.setTextColor(color.secondaryTextColor)
|
||||
|
||||
playPauseButton.backgroundTintList = tintList
|
||||
playPauseButton.imageTintList = ColorStateList.valueOf(color.backgroundColor)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
lastPlaybackControlsColor = Color.WHITE
|
||||
lastDisabledPlaybackControlsColor =
|
||||
|
@ -319,4 +343,6 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
|||
fun onFavoriteToggled() {
|
||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package code.name.monkey.retromusic.fragments.player.full
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -142,7 +143,7 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
lyricsLayout = view.findViewById(R.id.player_lyrics)
|
||||
lyricsLayout = view.findViewById(R.id.playerLyrics)
|
||||
lyricsLine1 = view.findViewById(R.id.player_lyrics_line1)
|
||||
lyricsLine2 = view.findViewById(R.id.player_lyrics_line2)
|
||||
|
||||
|
@ -199,7 +200,8 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
|||
|
||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||
lastColor = color.backgroundColor
|
||||
controlsFragment.setDark(color.primaryTextColor)
|
||||
mask.backgroundTintList = ColorStateList.valueOf(color.backgroundColor)
|
||||
controlsFragment.setDark(color)
|
||||
callbacks?.onPaletteColorChanged()
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package code.name.monkey.retromusic.util.theme
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||
import android.os.PowerManager
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import code.name.monkey.retromusic.R
|
||||
|
@ -30,17 +27,6 @@ object ThemeManager {
|
|||
BLACK -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
AUTO -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
}
|
||||
|
||||
private fun isSystemDarkModeEnabled(context: Context): Boolean {
|
||||
val isBatterySaverEnabled =
|
||||
(context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isPowerSaveMode
|
||||
?: false
|
||||
val isDarkModeEnabled =
|
||||
(context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) == UI_MODE_NIGHT_YES
|
||||
|
||||
return isBatterySaverEnabled or isDarkModeEnabled
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val Context.generalThemeValue: ThemeMode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue