Added proper coloring and WIP for Playlist database
This commit is contained in:
parent
8d49f8cdcb
commit
bf9ddfccb7
34 changed files with 1737 additions and 185 deletions
|
@ -18,6 +18,7 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
|
|||
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.color.MediaNotificationProcessor
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.fragment_blur.*
|
||||
|
||||
|
@ -103,11 +104,15 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
|
|||
.checkIgnoreMediaStore(requireContext())
|
||||
.generatePalette(requireContext()).build()
|
||||
.dontAnimate()
|
||||
.transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build())
|
||||
.transform(
|
||||
BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat())
|
||||
.build()
|
||||
)
|
||||
.into(object : RetroMusicColoredTarget(colorBackground) {
|
||||
override fun onColorReady(color: Int) {
|
||||
if (color == defaultFooterColor) {
|
||||
colorBackground.setColorFilter(color)
|
||||
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
if (colors.backgroundColor == defaultFooterColor) {
|
||||
colorBackground.setColorFilter(colors.backgroundColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -19,6 +19,7 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
|
|||
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.color.MediaNotificationProcessor
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.fragment_card_blur_player.*
|
||||
|
||||
|
@ -133,11 +134,14 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
|
|||
.checkIgnoreMediaStore(requireContext())
|
||||
.generatePalette(requireContext()).build()
|
||||
.dontAnimate()
|
||||
.transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build())
|
||||
.transform(
|
||||
BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat())
|
||||
.build()
|
||||
)
|
||||
.into(object : RetroMusicColoredTarget(colorBackground) {
|
||||
override fun onColorReady(color: Int) {
|
||||
if (color == defaultFooterColor) {
|
||||
colorBackground.setColorFilter(color)
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
if (colors.backgroundColor == defaultFooterColor) {
|
||||
colorBackground.setColorFilter(colors.backgroundColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -175,7 +175,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
MusicPlayerRemote.position,
|
||||
R.layout.item_queue
|
||||
)
|
||||
recyclerView.apply {
|
||||
recyclerView .apply {
|
||||
adapter = queueAdapter
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.fragments.player.color
|
||||
|
||||
import android.animation.ValueAnimator
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -13,7 +12,6 @@ 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.getSuitableColorFor
|
||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest.Builder
|
||||
|
@ -21,7 +19,7 @@ import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
|||
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.RetroColorUtil
|
||||
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.*
|
||||
|
@ -131,7 +129,7 @@ class ColorFragment : AbsPlayerFragment() {
|
|||
.generatePalette(requireContext())
|
||||
.build()
|
||||
.into(object : RetroMusicColoredTarget(playerImage) {
|
||||
override fun onColorReady(color: Int) {
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -141,20 +139,26 @@ class ColorFragment : AbsPlayerFragment() {
|
|||
) {
|
||||
super.onResourceReady(resource, glideAnimation)
|
||||
resource?.let {
|
||||
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(backgroundColor, textColor)
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -168,19 +172,23 @@ class ColorFragment : AbsPlayerFragment() {
|
|||
true
|
||||
)
|
||||
else MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
setColors(backgroundColor, textColor)
|
||||
//setColors(backgroundColor, textColor)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun setColors(backgroundColor: Int, componentsColor: Int) {
|
||||
this.lastColor = componentsColor
|
||||
this.backgroundColor = backgroundColor
|
||||
playbackControlsFragment.setDark(componentsColor, backgroundColor)
|
||||
colorGradientBackground?.setBackgroundColor(backgroundColor)
|
||||
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(backgroundColor))
|
||||
private fun setColors(colors: MediaNotificationProcessor) {
|
||||
this.lastColor = colors.backgroundColor
|
||||
this.backgroundColor = colors.backgroundColor
|
||||
playbackControlsFragment.setDark(colors)
|
||||
colorGradientBackground?.setBackgroundColor(colors.backgroundColor)
|
||||
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(colors.backgroundColor))
|
||||
callbacks?.onPaletteColorChanged()
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, componentsColor, requireActivity())
|
||||
ToolbarContentTintHelper.colorizeToolbar(
|
||||
playerToolbar,
|
||||
colors.secondaryTextColor,
|
||||
requireActivity()
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -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_color_player_playback_controls.*
|
||||
|
||||
class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
@ -95,26 +96,23 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updateShuffleState()
|
||||
}
|
||||
|
||||
fun setDark(textColor: Int, background: Int) {
|
||||
setDark(textColor)
|
||||
TintHelper.setTintAuto(playPauseButton, background, false)
|
||||
TintHelper.setTintAuto(playPauseButton, textColor, true)
|
||||
fun setDark(colors: MediaNotificationProcessor) {
|
||||
setDark(colors.secondaryTextColor)
|
||||
TintHelper.setTintAuto(playPauseButton, colors.backgroundColor, false)
|
||||
TintHelper.setTintAuto(playPauseButton, colors.primaryTextColor, true)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
lastPlaybackControlsColor = color
|
||||
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color, 0.5f)
|
||||
|
||||
title.setTextColor(lastPlaybackControlsColor)
|
||||
text.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
songInfo.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, lastPlaybackControlsColor, true)
|
||||
|
||||
volumeFragment?.setTintableColor(color)
|
||||
|
||||
songCurrentProgress.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
songTotalTime.setTextColor(lastDisabledPlaybackControlsColor)
|
||||
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color, 0.25f)
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
|
|
|
@ -24,6 +24,7 @@ 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.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.fragment_full.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
@ -241,7 +242,8 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
|||
.generatePalette(requireContext())
|
||||
.build()
|
||||
.into(object : RetroMusicColoredTarget(artistImage) {
|
||||
override fun onColorReady(color: Int) {
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
|
|||
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.*
|
||||
|
||||
|
@ -125,8 +126,8 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
|||
.generatePalette(requireContext())
|
||||
.build()
|
||||
.into(object : RetroMusicColoredTarget(playerImage) {
|
||||
override fun onColorReady(color: Int) {
|
||||
playbackControlsFragment.setDark(color)
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
playbackControlsFragment.setDark(colors.backgroundColor)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue