Added proper coloring
This commit is contained in:
parent
bf9ddfccb7
commit
fd22134a23
20 changed files with 90 additions and 160 deletions
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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<in BitmapPaletteWrapper>?
|
||||
) {
|
||||
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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -36,24 +36,12 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
<fragment
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="12dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="8dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/playerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
tools:layout="@layout/fragment_album_cover" />
|
||||
</code.name.monkey.retromusic.views.HeightFitSquareLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -27,26 +27,19 @@
|
|||
<include layout="@layout/status_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareLayout
|
||||
android:id="@+id/playerAlbumCoverContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="true">
|
||||
android:layout_weight="0">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/playerImage"
|
||||
<fragment
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription,UnusedAttribute"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
|
||||
|
||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
||||
tools:layout="@layout/fragment_album_cover" />
|
||||
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue