Modified Peak theme
This commit is contained in:
parent
d634e718d3
commit
0d13ad1adb
6 changed files with 27 additions and 43 deletions
|
@ -24,7 +24,7 @@ android {
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
applicationId "code.name.monkey.retromusic"
|
applicationId "code.name.monkey.retromusic"
|
||||||
versionCode 430
|
versionCode 431
|
||||||
versionName '3.5.300'
|
versionName '3.5.300'
|
||||||
|
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
|
@ -382,8 +382,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
key.equals(PreferenceUtil.TOGGLE_HOME_BANNER) || key.equals(PreferenceUtil.TOGGLE_ADD_CONTROLS) ||
|
key.equals(PreferenceUtil.TOGGLE_HOME_BANNER) || key.equals(PreferenceUtil.TOGGLE_ADD_CONTROLS) ||
|
||||||
key.equals(PreferenceUtil.ALBUM_COVER_STYLE) || key.equals(PreferenceUtil.HOME_ARTIST_GRID_STYLE) ||
|
key.equals(PreferenceUtil.ALBUM_COVER_STYLE) || key.equals(PreferenceUtil.HOME_ARTIST_GRID_STYLE) ||
|
||||||
key.equals(PreferenceUtil.ALBUM_COVER_TRANSFORM) || key.equals(PreferenceUtil.DESATURATED_COLOR) ||
|
key.equals(PreferenceUtil.ALBUM_COVER_TRANSFORM) || key.equals(PreferenceUtil.DESATURATED_COLOR) ||
|
||||||
key.equals(PreferenceUtil.TAB_TEXT_MODE) || key.equals(PreferenceUtil.LANGUAGE_NAME) ||
|
key.equals(PreferenceUtil.EXTRA_SONG_INFO) || key.equals(PreferenceUtil.TAB_TEXT_MODE) ||
|
||||||
key.equals(PreferenceUtil.LIBRARY_CATEGORIES)
|
key.equals(PreferenceUtil.LANGUAGE_NAME) || key.equals(PreferenceUtil.LIBRARY_CATEGORIES)
|
||||||
) {
|
) {
|
||||||
postRecreate();
|
postRecreate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.normal
|
package code.name.monkey.retromusic.fragments.player.normal
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -27,8 +25,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||||
|
|
||||||
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
OnSharedPreferenceChangeListener {
|
|
||||||
|
|
||||||
private var lastPlaybackControlsColor: Int = 0
|
private var lastPlaybackControlsColor: Int = 0
|
||||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||||
|
@ -58,7 +55,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
||||||
showBonceAnimation(playPauseButton)
|
showBonceAnimation(playPauseButton)
|
||||||
}
|
}
|
||||||
title.isSelected = true
|
title.isSelected = true
|
||||||
PreferenceUtil.getInstance(requireContext()).registerOnSharedPreferenceChangedListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
|
@ -253,17 +250,4 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
|
||||||
|
|
||||||
if (key == PreferenceUtil.EXTRA_SONG_INFO) {
|
|
||||||
if (activity != null) updateSong()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
PreferenceUtil.getInstance(requireContext())
|
|
||||||
.unregisterOnSharedPreferenceChangedListener(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,11 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
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.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
|
||||||
import code.name.monkey.retromusic.extensions.setRange
|
|
||||||
import code.name.monkey.retromusic.extensions.textColorSecondary
|
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
|
@ -36,6 +33,7 @@ import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
|
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,9 +83,20 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
|
||||||
override fun hide() {
|
override fun hide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
fun setDark(color: MediaNotificationProcessor) {
|
||||||
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
|
val controlsColor =
|
||||||
if (ColorUtil.isColorLight(colorBg)) {
|
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
|
color.secondaryTextColor
|
||||||
|
} else {
|
||||||
|
ThemeStore.accentColor(requireContext())
|
||||||
|
}
|
||||||
|
ViewUtil.setProgressDrawable(progressSlider, controlsColor, true)
|
||||||
|
volumeFragment?.setTintableColor(controlsColor)
|
||||||
|
playPauseButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
|
nextButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
|
previousButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
|
|
||||||
|
if (!ATHUtil.isWindowBackgroundDark(requireContext())) {
|
||||||
lastPlaybackControlsColor =
|
lastPlaybackControlsColor =
|
||||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
|
@ -98,20 +107,11 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
|
||||||
lastPlaybackControlsColor = color
|
|
||||||
color
|
|
||||||
} else {
|
|
||||||
textColorSecondary(requireContext())
|
|
||||||
}.ripAlpha()
|
|
||||||
|
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
|
||||||
volumeFragment?.setTintableColor(colorFinal)
|
|
||||||
playPauseButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
updatePrevNextColor()
|
}
|
||||||
|
|
||||||
|
override fun setDark(color: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePlayPauseDrawableState() {
|
private fun updatePlayPauseDrawableState() {
|
||||||
|
@ -228,4 +228,6 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
|
||||||
override fun onShuffleModeChanged() {
|
override fun onShuffleModeChanged() {
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -101,7 +101,6 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
get() = lastColor
|
get() = lastColor
|
||||||
|
|
||||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
controlsFragment.setDark(color.primaryTextColor)
|
|
||||||
lastColor = color.primaryTextColor
|
lastColor = color.primaryTextColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
}
|
}
|
||||||
|
@ -127,7 +126,7 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
.build()
|
.build()
|
||||||
.into(object : RetroMusicColoredTarget(playerImage) {
|
.into(object : RetroMusicColoredTarget(playerImage) {
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
controlsFragment.setDark(colors.primaryTextColor)
|
controlsFragment.setDark(colors)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
|
|
||||||
if (ColorUtil.isColorLight(color)) {
|
if (ColorUtil.isColorLight(color)) {
|
||||||
lastPlaybackControlsColor =
|
lastPlaybackControlsColor =
|
||||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||||
|
|
Loading…
Reference in a new issue