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 1b77d3ec..5e4c7253 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 @@ -63,7 +63,7 @@ class AlbumCoverPagerAdapter( lateinit var albumCover: ImageView private var isColorReady: Boolean = false - private var color: Int = 0 + private lateinit var color: MediaNotificationProcessor private lateinit var song: Song private var colorReceiver: ColorReceiver? = null private var request: Int = 0 @@ -123,12 +123,12 @@ class AlbumCoverPagerAdapter( .generatePalette(requireContext()).build() .into(object : RetroMusicColoredTarget(albumCover) { override fun onColorReady(colors: MediaNotificationProcessor) { - setColor(colors.backgroundColor) + setColor(colors) } }) } - private fun setColor(color: Int) { + private fun setColor(color: MediaNotificationProcessor) { this.color = color isColorReady = true if (colorReceiver != null) { @@ -147,7 +147,7 @@ class AlbumCoverPagerAdapter( } interface ColorReceiver { - fun onColorReady(color: Int, request: Int) + fun onColorReady(color: MediaNotificationProcessor, request: Int) } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt index 9801c9b6..b612a7a9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt @@ -14,13 +14,14 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.transform.CarousalPagerTransformer import code.name.monkey.retromusic.transform.ParallaxPagerTransformer import code.name.monkey.retromusic.util.PreferenceUtil +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_player_album_cover.* class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener { private var callbacks: Callbacks? = null private var currentPosition: Int = 0 private val colorReceiver = object : AlbumCoverFragment.ColorReceiver { - override fun onColorReady(color: Int, request: Int) { + override fun onColorReady(color: MediaNotificationProcessor, request: Int) { if (currentPosition == request) { notifyColorChange(color) } @@ -103,7 +104,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan override fun onPageScrollStateChanged(state: Int) { } - private fun notifyColorChange(color: Int) { + private fun notifyColorChange(color: MediaNotificationProcessor) { callbacks?.onColorChanged(color) } @@ -117,7 +118,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan interface Callbacks { - fun onColorChanged(color: Int) + fun onColorChanged(color: MediaNotificationProcessor) fun onFavoriteToggled() } 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 c8f4b13d..8a0d96d7 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 @@ -19,6 +19,7 @@ import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics import code.name.monkey.retromusic.model.lyrics.Lyrics +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_adaptive_player.* class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback { @@ -194,9 +195,9 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call toggleFavorite(MusicPlayerRemote.currentSong) } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar( playerToolbar, 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 2a5fc0ed..61da453f 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 @@ -65,9 +65,9 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer toggleFavorite(MusicPlayerRemote.currentSong) } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + 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 f4f3b2c7..f44721b3 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 @@ -13,6 +13,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_card_player.* class CardFragment : AbsPlayerFragment() { @@ -43,9 +44,9 @@ class CardFragment : AbsPlayerFragment() { return Color.WHITE } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + 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/CardBlurFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/cardblur/CardBlurFragment.kt index 719f0ffa..40cc2da9 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 @@ -50,9 +50,9 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen return Color.WHITE } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks!!.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity) diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/circle/CirclePlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/circle/CirclePlayerFragment.kt index 0b8230bc..f433c7d2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/circle/CirclePlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/circle/CirclePlayerFragment.kt @@ -39,6 +39,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler 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 code.name.monkey.retromusic.views.SeekArc import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener import code.name.monkey.retromusic.volume.AudioVolumeObserver @@ -161,7 +162,7 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged override val paletteColor: Int get() = Color.BLACK - override fun onColorChanged(color: Int) { + override fun onColorChanged(color: MediaNotificationProcessor) { } override fun onFavoriteToggled() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt index e621ba56..d1e50d3d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt @@ -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 com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.card.MaterialCardView import kotlinx.android.synthetic.main.fragment_clasic_player.* @@ -175,7 +176,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener, MusicPlayerRemote.position, R.layout.item_queue ) - recyclerView .apply { + recyclerView.apply { adapter = queueAdapter layoutManager = LinearLayoutManager(requireContext()) } @@ -225,8 +226,8 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener, override val paletteColor: Int get() = lastColor - override fun onColorChanged(color: Int) { - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + lastColor = color.backgroundColor ToolbarContentTintHelper.colorizeToolbar( playerToolbar, Color.WHITE, @@ -246,7 +247,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener, } val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { - color + color.backgroundColor } else { ThemeStore.accentColor(requireContext()) }.ripAlpha() 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 8464602a..b8fe2caa 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 @@ -1,7 +1,6 @@ package code.name.monkey.retromusic.fragments.player.color import android.animation.ValueAnimator -import android.graphics.drawable.Drawable import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -9,19 +8,13 @@ import android.view.ViewGroup import androidx.appcompat.widget.Toolbar 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.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment -import code.name.monkey.retromusic.glide.RetroMusicColoredTarget -import code.name.monkey.retromusic.glide.SongGlideRequest.Builder -import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper +import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.color.MediaNotificationProcessor -import com.bumptech.glide.Glide -import com.bumptech.glide.request.animation.GlideAnimation import kotlinx.android.synthetic.main.fragment_color_player.* class ColorFragment : AbsPlayerFragment() { @@ -38,8 +31,16 @@ class ColorFragment : AbsPlayerFragment() { override val paletteColor: Int get() = backgroundColor - override fun onColorChanged(color: Int) { + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color) + lastColor = color.backgroundColor + callbacks?.onPaletteColorChanged() + ToolbarContentTintHelper.colorizeToolbar( + playerToolbar, + ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), + requireActivity() + ) } override fun onFavoriteToggled() { @@ -90,9 +91,9 @@ class ColorFragment : AbsPlayerFragment() { super.onViewCreated(view, savedInstanceState) setUpSubFragments() setUpPlayerToolbar() - playerImage.setOnClickListener { - NavigationUtil.goToLyrics(requireActivity()) - } + val playerAlbumCoverFragment = + childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment + playerAlbumCoverFragment.setCallbacks(this) } private fun setUpSubFragments() { @@ -113,70 +114,6 @@ class ColorFragment : AbsPlayerFragment() { } } - override fun onPlayingMetaChanged() { - super.onPlayingMetaChanged() - updateSong() - } - - override fun onServiceConnected() { - super.onServiceConnected() - updateSong() - } - - private fun updateSong() { - Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong) - .checkIgnoreMediaStore(requireContext()) - .generatePalette(requireContext()) - .build() - .into(object : RetroMusicColoredTarget(playerImage) { - override fun onColorReady(colors: MediaNotificationProcessor) { - - } - - override fun onResourceReady( - resource: BitmapPaletteWrapper?, - glideAnimation: GlideAnimation? - ) { - super.onResourceReady(resource, glideAnimation) - resource?.let { - - - val colors = - MediaNotificationProcessor(requireContext(), resource.bitmap) - - - /* val palette = resource.palette - val swatch = RetroColorUtil.getSwatch(palette) - - val textColor = RetroColorUtil.getTextColor(palette) - val backgroundColor = getSuitableColorFor( - palette, - ATHUtil.resolveColor(requireContext(), R.attr.colorSurface), - Color.BLACK - ) - if (ATHUtil.isWindowBackgroundDark(requireContext())) { - ColorUtil.desaturateColor(backgroundColor, 0.5f) - } - */ - setColors(colors) - } - - } - - override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { - super.onLoadFailed(e, errorDrawable) - val backgroundColor = defaultFooterColor - val textColor = - if (ColorUtil.isColorLight(defaultFooterColor)) MaterialValueHelper.getPrimaryTextColor( - requireContext(), - true - ) - else MaterialValueHelper.getPrimaryTextColor(requireContext(), false) - //setColors(backgroundColor, textColor) - } - }) - } - private fun setColors(colors: MediaNotificationProcessor) { this.lastColor = colors.backgroundColor this.backgroundColor = colors.backgroundColor 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 e961ce6e..97b367aa 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 @@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_fit.* class FitFragment : AbsPlayerFragment() { @@ -42,9 +43,9 @@ class FitFragment : AbsPlayerFragment() { return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar( playerToolbar, 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 1e3a0ffb..ae838c8e 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 @@ -19,6 +19,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import code.name.monkey.retromusic.views.DrawableGradient import kotlinx.android.synthetic.main.fragment_flat_player.* @@ -103,18 +104,18 @@ class FlatPlayerFragment : AbsPlayerFragment() { ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - lastColor = color - flatPlaybackControlsFragment.setDark(color) + override fun onColorChanged(color: MediaNotificationProcessor) { + lastColor = color.backgroundColor + flatPlaybackControlsFragment.setDark(color.backgroundColor) callbacks?.onPaletteColorChanged() - val isLight = ColorUtil.isColorLight(color) + val isLight = ColorUtil.isColorLight(color.backgroundColor) val iconColor = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) MaterialValueHelper.getPrimaryTextColor(requireContext(), isLight) else ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, requireActivity()) if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { - colorize(color) + colorize(color.backgroundColor) } } 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 7d34dfbd..50ddade6 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 @@ -197,9 +197,9 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca return Color.WHITE } - override fun onColorChanged(color: Int) { - lastColor = color - fullPlaybackControlsFragment.setDark(color) + override fun onColorChanged(color: MediaNotificationProcessor) { + lastColor = color.backgroundColor + fullPlaybackControlsFragment.setDark(color.backgroundColor) callbacks?.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity) } 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 3b40917f..9e81ce69 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 @@ -13,6 +13,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_material.* /** @@ -48,9 +49,9 @@ class MaterialFragment : AbsPlayerFragment() { return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar( 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 611f76d1..7c618122 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 @@ -17,6 +17,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import code.name.monkey.retromusic.views.DrawableGradient import kotlinx.android.synthetic.main.fragment_player.* @@ -73,9 +74,9 @@ class PlayerFragment : AbsPlayerFragment() { return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar( @@ -85,7 +86,7 @@ class PlayerFragment : AbsPlayerFragment() { ) if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { - colorize(color) + colorize(color.backgroundColor) } } 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 9a6e7221..696c552b 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 @@ -100,9 +100,9 @@ class PeakPlayerFragment : AbsPlayerFragment() { override val paletteColor: Int get() = lastColor - override fun onColorChanged(color: Int) { - playbackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + playbackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() } 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 d609f7d6..c268d95c 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 @@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_plain_player.* class PlainPlayerFragment : AbsPlayerFragment() { @@ -93,9 +94,9 @@ class PlainPlayerFragment : AbsPlayerFragment() { return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - plainPlaybackControlsFragment.setDark(color) - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + plainPlaybackControlsFragment.setDark(color.backgroundColor) + lastColor = color.backgroundColor callbacks!!.onPaletteColorChanged() ToolbarContentTintHelper.colorizeToolbar( playerToolbar, 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 d31a8206..3bb0a55f 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 @@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import kotlinx.android.synthetic.main.fragment_simple_player.* /** @@ -68,10 +69,10 @@ class SimplePlayerFragment : AbsPlayerFragment() { return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal) } - override fun onColorChanged(color: Int) { - lastColor = color + override fun onColorChanged(color: MediaNotificationProcessor) { + lastColor = color.backgroundColor callbacks?.onPaletteColorChanged() - simplePlaybackControlsFragment.setDark(color) + simplePlaybackControlsFragment.setDark(color.backgroundColor) ToolbarContentTintHelper.colorizeToolbar( playerToolbar, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), 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 4b2a26d6..1f25883d 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 @@ -25,6 +25,7 @@ import code.name.monkey.retromusic.model.Song 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_tiny_player.* class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback { @@ -71,10 +72,10 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca private var textColorPrimary = 0 private var textColorPrimaryDisabled = 0 - override fun onColorChanged(color: Int) { + override fun onColorChanged(color: MediaNotificationProcessor) { val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) { - color + color.backgroundColor } else { ThemeStore.accentColor(requireContext()) } diff --git a/app/src/main/res/layout-land/fragment_color_player.xml b/app/src/main/res/layout-land/fragment_color_player.xml index ba453b82..5e5276bd 100644 --- a/app/src/main/res/layout-land/fragment_color_player.xml +++ b/app/src/main/res/layout-land/fragment_color_player.xml @@ -36,24 +36,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - + tools:layout="@layout/fragment_album_cover" /> - + android:layout_weight="0"> - - - - + tools:layout="@layout/fragment_album_cover" /> +