diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt
index e73109cc..0d4dd018 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt
@@ -93,7 +93,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
.generatePalette(this).build().dontAnimate()
.into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(colors: MediaNotificationProcessor) {
- fragment?.setDark(colors.backgroundColor)
+ fragment?.setColor(colors)
}
})
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
index 604f3347..3cd62383 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
@@ -95,6 +95,7 @@ class AlbumCoverPagerAdapter(
Fit,
Tiny,
Classic,
+ Peak,
Gradient,
Full -> R.layout.fragment_album_full_cover
else -> {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
index 0290fb42..f9e8e5b6 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
@@ -8,6 +8,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.VolumeFragment
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.util.PreferenceUtil
+import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
/**
* Created by hemanths on 24/09/17.
@@ -26,7 +27,7 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(),
protected abstract fun setUpProgressSlider()
- abstract fun setDark(color: Int)
+ abstract fun setColor(color: MediaNotificationProcessor)
fun showBonceAnimation(view: View) {
view.apply {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
index 4453d728..f75c4e31 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptiveFragment.kt
@@ -196,7 +196,7 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.primaryTextColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
index 57722e1e..aec2e4a8 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
@@ -23,6 +23,7 @@ import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.SliderReadTimeLabelFormatter
import code.name.monkey.retromusic.util.ViewUtil
+import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
@@ -104,7 +105,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
if (ColorUtil.isColorLight(
ATHUtil.resolveColor(
requireContext(),
@@ -127,7 +128,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
updatePlayPauseColor()
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext())
}.ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt
index 56d65a59..2203a82f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlaybackControlsFragment.kt
@@ -22,6 +22,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.*
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
@@ -106,7 +107,7 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
lastPlaybackControlsColor = Color.WHITE
lastDisabledPlaybackControlsColor =
ContextCompat.getColor(requireContext(), R.color.md_grey_500)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt
index 61da453f..ecec1a3f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/blur/BlurPlayerFragment.kt
@@ -66,7 +66,7 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.backgroundColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt
index 011bc12b..a15633d9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardFragment.kt
@@ -45,7 +45,7 @@ class CardFragment : AbsPlayerFragment() {
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.primaryTextColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
index 89c5d527..a531b2ec 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
@@ -25,6 +25,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
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.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.*
import kotlinx.android.synthetic.main.media_button.*
@@ -109,14 +110,8 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
-
- if (ColorUtil.isColorLight(
- ATHUtil.resolveColor(
- requireContext(),
- android.R.attr.windowBackground
- )
- )
+ override fun setColor(color: MediaNotificationProcessor) {
+ if (ATHUtil.isWindowBackgroundDark(requireContext())
) {
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
lastDisabledPlaybackControlsColor =
@@ -134,7 +129,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateProgressTextColor()
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext()).ripAlpha()
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt
index 40cc2da9..90b25e16 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt
@@ -51,7 +51,7 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.backgroundColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks!!.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurPlaybackControlsFragment.kt
index 23f37a75..23c2feac 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurPlaybackControlsFragment.kt
@@ -21,6 +21,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_card_blur_player_playback_controls.*
import kotlinx.android.synthetic.main.media_button.*
@@ -52,7 +53,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
setUpMusicControllers()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
lastPlaybackControlsColor = Color.WHITE
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(Color.WHITE, 0.3f)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
index 88b12c90..8c4674a3 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
@@ -34,7 +34,7 @@ class ColorFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.secondaryTextColor
- playbackControlsFragment.setDark(color)
+ playbackControlsFragment.setColor(color)
navigationColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
colorGradientBackground?.setBackgroundColor(color.backgroundColor)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt
index a1a46ee6..038fee58 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorPlaybackControlsFragment.kt
@@ -96,23 +96,20 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- fun setDark(colors: MediaNotificationProcessor) {
- setDark(colors.secondaryTextColor)
- TintHelper.setTintAuto(playPauseButton, colors.primaryTextColor, true)
- TintHelper.setTintAuto(playPauseButton, colors.backgroundColor, false)
+ override fun setColor(color: MediaNotificationProcessor) {
+ TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
+ TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
- title.setTextColor(colors.primaryTextColor)
- text.setTextColor(colors.secondaryTextColor)
- songInfo.setTextColor(colors.secondaryTextColor)
- ViewUtil.setProgressDrawable(progressSlider, colors.primaryTextColor, true)
- songCurrentProgress.setTextColor(colors.secondaryTextColor)
- songTotalTime.setTextColor(colors.secondaryTextColor)
- volumeFragment?.setTintableColor(colors.primaryTextColor)
- }
+ title.setTextColor(color.primaryTextColor)
+ text.setTextColor(color.secondaryTextColor)
+ songInfo.setTextColor(color.secondaryTextColor)
+ ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
+ songCurrentProgress.setTextColor(color.secondaryTextColor)
+ songTotalTime.setTextColor(color.secondaryTextColor)
+ volumeFragment?.setTintableColor(color.primaryTextColor)
- override fun setDark(color: Int) {
- lastPlaybackControlsColor = color
- lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color, 0.25f)
+ lastPlaybackControlsColor = color.secondaryTextColor
+ lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.secondaryTextColor, 0.25f)
updateRepeatState()
updateShuffleState()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt
index dbacacbf..76b07420 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitFragment.kt
@@ -44,7 +44,7 @@ class FitFragment : AbsPlayerFragment() {
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.primaryTextColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
index ab625478..25889891 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
@@ -27,6 +27,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
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.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_fit_playback_controls.*
class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
@@ -112,10 +113,11 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
- lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
+ lastPlaybackControlsColor =
+ MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
} else {
@@ -125,7 +127,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext()).ripAlpha()
}
@@ -239,7 +241,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
-
private fun showBonceAnimation() {
playPauseButton.apply {
clearAnimation()
@@ -262,6 +263,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
}.start()
}
}
+
override fun setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
@@ -275,6 +277,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
})
}
+
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
index b67cb8fb..568597ea 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
@@ -24,6 +24,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_flat_player_playback_controls.*
class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
@@ -77,10 +78,8 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
}
}
- override fun setDark(color: Int) {
- val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
- val isDark = ColorUtil.isColorLight(colorBg)
- if (isDark) {
+ override fun setColor(color: MediaNotificationProcessor) {
+ if (ATHUtil.isWindowBackgroundDark(requireContext())) {
lastPlaybackControlsColor =
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
@@ -93,7 +92,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext()).ripAlpha()
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
index 763b4b76..77e65107 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
@@ -106,7 +106,7 @@ class FlatPlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
- controlsFragment.setDark(color.primaryTextColor)
+ controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
val isLight = ColorUtil.isColorLight(color.backgroundColor)
val iconColor = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
index c5fb440a..7619fb02 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
@@ -12,14 +12,10 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.widget.PopupMenu
-import androidx.core.content.ContextCompat
-import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
-import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
-import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@@ -93,7 +89,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
}
}
- fun setDark(color: MediaNotificationProcessor) {
+ override fun setColor(color: MediaNotificationProcessor) {
lastPlaybackControlsColor = color.primaryTextColor
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)
@@ -116,34 +112,6 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
updatePrevNextColor()
}
- override fun setDark(color: Int) {
- lastPlaybackControlsColor = Color.WHITE
- lastDisabledPlaybackControlsColor =
- ContextCompat.getColor(requireContext(), R.color.md_grey_500)
-
- val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
- } else {
- ThemeStore.accentColor(requireContext()).ripAlpha()
- }
- volumeFragment?.setTintableColor(colorFinal)
- text.setTextColor(colorFinal)
-
- ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
-
- playPauseButton.backgroundTintList = ColorStateList.valueOf(colorFinal)
- playPauseButton.imageTintList = ColorStateList.valueOf(
- MaterialValueHelper.getPrimaryTextColor(
- context,
- ColorUtil.isColorLight(colorFinal)
- )
- )
-
- updateRepeatState()
- updateShuffleState()
- updatePrevNextColor()
- }
-
override fun onServiceConnected() {
updatePlayPauseDrawableState()
updateRepeatState()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlayerFragment.kt
index e6af1f2e..50685eec 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlayerFragment.kt
@@ -201,7 +201,7 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
mask.backgroundTintList = ColorStateList.valueOf(color.backgroundColor)
- controlsFragment.setDark(color)
+ controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
index 2d1b2d7a..5672b2b9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
@@ -35,6 +35,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_lock_screen_playback_controls.*
/**
@@ -105,7 +106,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
@@ -121,7 +122,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
textColorSecondary(requireContext())
}.ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
index a2ec97f2..d2fcf884 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
@@ -20,6 +20,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_material_playback_controls.*
/**
@@ -97,7 +98,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
lastPlaybackControlsColor =
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt
index 9e81ce69..78a69df5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialFragment.kt
@@ -50,7 +50,7 @@ class MaterialFragment : AbsPlayerFragment() {
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- playbackControlsFragment.setDark(color.backgroundColor)
+ playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
index 1e5f8210..9dc0b2a8 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
@@ -75,7 +75,7 @@ class PlayerFragment : AbsPlayerFragment() {
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- controlsFragment.setDark(color.primaryTextColor)
+ controlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
index f78915da..e54565ab 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
@@ -23,6 +23,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_player_playback_controls.*
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
@@ -58,7 +59,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
- override fun setDark(color: Int) {
+ override fun setColor(color: MediaNotificationProcessor) {
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
lastPlaybackControlsColor =
@@ -73,7 +74,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext())
}.ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
index bd0a9709..b6c2eacf 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerControlFragment.kt
@@ -83,10 +83,10 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
override fun hide() {
}
- fun setDark(color: MediaNotificationProcessor) {
+ override fun setColor(color: MediaNotificationProcessor) {
val controlsColor =
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color.secondaryTextColor
+ color.primaryTextColor
} else {
ThemeStore.accentColor(requireContext())
}
@@ -111,9 +111,6 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
updateShuffleState()
}
- override fun setDark(color: Int) {
- }
-
private fun updatePlayPauseDrawableState() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerFragment.kt
index 74e233cc..96ee263f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/peak/PeakPlayerFragment.kt
@@ -25,13 +25,10 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
-import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
-import code.name.monkey.retromusic.glide.SongGlideRequest
+import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
-import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
-import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.fragment_peak_player.*
/**
@@ -56,14 +53,16 @@ class PeakPlayerFragment : AbsPlayerFragment() {
setUpPlayerToolbar()
setUpSubFragments()
title.isSelected = true
- playerImage.setOnClickListener {
- NavigationUtil.goToLyrics(requireActivity())
- }
+
}
private fun setUpSubFragments() {
controlsFragment =
childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as PeakPlayerControlFragment
+
+ val coverFragment =
+ childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
+ coverFragment.setCallbacks(this)
}
private fun setUpPlayerToolbar() {
@@ -103,6 +102,7 @@ class PeakPlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
+ controlsFragment.setColor(color)
}
override fun onFavoriteToggled() {
@@ -119,16 +119,6 @@ class PeakPlayerFragment : AbsPlayerFragment() {
} else {
songInfo.hide()
}
-
- SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
- .checkIgnoreMediaStore(requireContext())
- .generatePalette(requireContext())
- .build()
- .into(object : RetroMusicColoredTarget(playerImage) {
- override fun onColorReady(colors: MediaNotificationProcessor) {
- controlsFragment.setDark(colors)
- }
- })
}
override fun onServiceConnected() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
index e7d9ca30..36159e83 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
@@ -15,7 +15,6 @@ import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
-import code.name.monkey.retromusic.extensions.setRange
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@@ -25,6 +24,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_adaptive_player_playback_controls.songInfo
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.nextButton
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.playPauseButton
@@ -139,28 +139,33 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
- override fun setDark(color: Int) {
- val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
+ override fun setColor(color: MediaNotificationProcessor) {
+ val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
- lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
+ lastPlaybackControlsColor =
+ MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
+ MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
} else {
- lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
+ lastPlaybackControlsColor =
+ MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
+ MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
- ThemeStore.accentColor(context!!)
+ ThemeStore.accentColor(requireContext())
}
volumeFragment?.setTintable(colorFinal)
TintHelper.setTintAuto(
playPauseButton,
- MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)),
+ MaterialValueHelper.getPrimaryTextColor(
+ requireContext(),
+ ColorUtil.isColorLight(colorFinal)
+ ),
false
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt
index 87527eaf..6d2b13cf 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlayerFragment.kt
@@ -95,7 +95,7 @@ class PlainPlayerFragment : AbsPlayerFragment() {
}
override fun onColorChanged(color: MediaNotificationProcessor) {
- plainPlaybackControlsFragment.setDark(color.primaryTextColor)
+ plainPlaybackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks!!.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
index 39539e31..df082ae9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
@@ -21,6 +21,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_simple_controls_fragment.*
/**
@@ -197,29 +198,34 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
)
}
- override fun setDark(color: Int) {
- val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
+ override fun setColor(color: MediaNotificationProcessor) {
+ val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
- lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(context!!, true)
+ lastPlaybackControlsColor =
+ MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getSecondaryDisabledTextColor(context!!, true)
+ MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
} else {
- lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(context!!, false)
+ lastPlaybackControlsColor =
+ MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
+ MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color
+ color.primaryTextColor
} else {
- ThemeStore.accentColor(context!!)
+ ThemeStore.accentColor(requireContext())
}
volumeFragment?.setTintable(colorFinal)
TintHelper.setTintAuto(
playPauseButton,
- MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)),
+ MaterialValueHelper.getPrimaryTextColor(
+ requireContext(),
+ ColorUtil.isColorLight(colorFinal)
+ ),
false
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt
index d2e31026..de504715 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlayerFragment.kt
@@ -72,7 +72,7 @@ class SimplePlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
- controlsFragment.setDark(color.primaryTextColor)
+ controlsFragment.setColor(color)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlaybackControlsFragment.kt
index 0457f6b6..388b3129 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlaybackControlsFragment.kt
@@ -6,11 +6,11 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import code.name.monkey.appthemehelper.util.ColorUtil
-import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.service.MusicService
+import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_tiny_controls_fragment.*
class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
@@ -24,18 +24,9 @@ class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
override fun setUpProgressSlider() {
}
- override fun setDark(color: Int) {
- if (ColorUtil.isColorLight(color)) {
- lastPlaybackControlsColor =
- MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
- lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
- } else {
- lastPlaybackControlsColor =
- MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
- lastDisabledPlaybackControlsColor =
- MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
- }
+ override fun setColor(color: MediaNotificationProcessor) {
+ lastPlaybackControlsColor = color.secondaryTextColor
+ lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.secondaryTextColor, 0.25f)
updateRepeatState()
updateShuffleState()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
index ee96810f..0071fc04 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
@@ -3,14 +3,12 @@ package code.name.monkey.retromusic.fragments.player.tiny
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.os.Bundle
+import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import androidx.appcompat.widget.Toolbar
-import code.name.monkey.appthemehelper.ThemeStore
-import code.name.monkey.appthemehelper.util.ColorUtil
-import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
@@ -27,6 +25,7 @@ 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_tiny_player.*
+import kotlinx.android.synthetic.main.fragment_tiny_player.playerToolbar
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
override fun onUpdateProgressViews(progress: Int, total: Int) {
@@ -62,55 +61,41 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
}
override fun toolbarIconColor(): Int {
- return textColorPrimary
+ return lastColor
}
private var lastColor: Int = 0
+
override val paletteColor: Int
get() = lastColor
- private var textColorPrimary = 0
- private var textColorPrimaryDisabled = 0
override fun onColorChanged(color: MediaNotificationProcessor) {
-
- val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
- color.primaryTextColor
- } else {
- ThemeStore.accentColor(requireContext())
- }
-
- if (ColorUtil.isColorLight(colorFinal)) {
- textColorPrimary = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
- textColorPrimaryDisabled =
- MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
- } else {
- textColorPrimary = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
- textColorPrimaryDisabled =
- MaterialValueHelper.getSecondaryTextColor(requireContext(), false)
- }
-
- this.lastColor = colorFinal
-
+ lastColor = color.backgroundColor
+ controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
- tinyPlaybackControlsFragment.setDark(colorFinal)
+ title.setTextColor(color.primaryTextColor)
+ playerSongTotalTime.setTextColor(color.primaryTextColor)
+ text.setTextColor(color.secondaryTextColor)
+ songInfo.setTextColor(color.secondaryTextColor)
+ ViewUtil.setProgressDrawable(progressBar, color.backgroundColor)
- ViewUtil.setProgressDrawable(progressBar, colorFinal)
- title.setTextColor(textColorPrimary)
- text.setTextColor(textColorPrimaryDisabled)
- songInfo.setTextColor(textColorPrimaryDisabled)
- playerSongTotalTime.setTextColor(textColorPrimary)
-
- ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColorPrimary, requireActivity())
+ Handler().post {
+ ToolbarContentTintHelper.colorizeToolbar(
+ playerToolbar,
+ color.secondaryTextColor,
+ requireActivity()
+ )
+ }
}
override fun onFavoriteToggled() {
toggleFavorite(MusicPlayerRemote.currentSong)
}
- private lateinit var tinyPlaybackControlsFragment: TinyPlaybackControlsFragment
+ private lateinit var controlsFragment: TinyPlaybackControlsFragment
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
override fun onCreate(savedInstanceState: Bundle?) {
@@ -160,7 +145,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
}
private fun setUpSubFragments() {
- tinyPlaybackControlsFragment =
+ controlsFragment =
childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as TinyPlaybackControlsFragment
val playerAlbumCoverFragment =
childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java b/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
index 99593367..cb8482c5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
@@ -33,6 +33,7 @@ import java.util.List;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
+import code.name.monkey.retromusic.R;
import static androidx.core.graphics.ColorUtils.RGBToXYZ;
@@ -82,6 +83,7 @@ public class MediaNotificationProcessor {
* A bit less then the above value, since it looks better on dark backgrounds.
*/
private static final int LIGHTNESS_TEXT_DIFFERENCE_DARK = -10;
+ private static final String TAG = "ColorPicking";
private float[] mFilteredBackgroundHsl = null;
private Palette.Filter mBlackWhiteFilter = new Palette.Filter() {
@Override
@@ -103,13 +105,13 @@ public class MediaNotificationProcessor {
getMediaPalette();
}
+
public MediaNotificationProcessor(Context context, Bitmap bitmap) {
this.context = context;
this.drawable = new BitmapDrawable(context.getResources(), bitmap);
getMediaPalette();
}
-
public MediaNotificationProcessor(Context context) {
this.context = context;
}
@@ -462,7 +464,6 @@ public class MediaNotificationProcessor {
backgroundColor);
}
-
public int getPrimaryTextColor() {
return primaryTextColor;
}
@@ -479,16 +480,26 @@ public class MediaNotificationProcessor {
return backgroundColor;
}
- public int getMightyColor() {
- if (ATHUtil.INSTANCE.isWindowBackgroundDark(context)) {
- if (!ColorUtil.INSTANCE.isColorLight(primaryTextColor)) {
- return NotificationColorUtil.ensureTextContrastOnBlack(primaryTextColor);
- }
- return NotificationColorUtil.ensureTextBackgroundColor(backgroundColor, primaryTextColor, secondaryTextColor);
- }
- return primaryTextColor;
+ boolean isWhiteColor(int color) {
+ return calculateLuminance(color) > 0.6f;
}
+ public int getMightyColor() {
+ boolean isDarkBg = ColorUtil.INSTANCE.isColorLight(ATHUtil.INSTANCE.resolveColor(context, R.attr.colorSurface));
+ if (isDarkBg) {
+ if (isColorLight(backgroundColor)) {
+ return primaryTextColor;
+ } else {
+ return backgroundColor;
+ }
+ } else {
+ if (isColorLight(backgroundColor)) {
+ return backgroundColor;
+ } else {
+ return primaryTextColor;
+ }
+ }
+ }
public interface OnPaletteLoadedListener {
void onPaletteLoaded(MediaNotificationProcessor mediaNotificationProcessor);
diff --git a/app/src/main/res/layout/fragment_peak_player.xml b/app/src/main/res/layout/fragment_peak_player.xml
index 4de46632..f063fd2d 100644
--- a/app/src/main/res/layout/fragment_peak_player.xml
+++ b/app/src/main/res/layout/fragment_peak_player.xml
@@ -46,23 +46,16 @@
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
-
-
-
-
+ app:layout_constraintTop_toBottomOf="@id/toolbarContainer" />
@@ -115,24 +108,21 @@
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
- app:layout_constraintBottom_toBottomOf="@id/imageContainer"
+ app:layout_constraintBottom_toBottomOf="@id/playerAlbumCoverFragment"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@id/imageContainer"
+ app:layout_constraintStart_toEndOf="@id/playerAlbumCoverFragment"
app:layout_constraintTop_toBottomOf="@+id/text"
tools:text="@tools:sample/lorem/random" />
-
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/songInfo"
+ tools:layout="@layout/fragment_peak_control_player" />
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_tiny_player.xml b/app/src/main/res/layout/fragment_tiny_player.xml
index 83c390a9..62a4d437 100644
--- a/app/src/main/res/layout/fragment_tiny_player.xml
+++ b/app/src/main/res/layout/fragment_tiny_player.xml
@@ -7,7 +7,7 @@
android:clickable="true"
android:focusable="true">
-
-