Changed override color
This commit is contained in:
parent
defee853c7
commit
0b16b1f5c4
35 changed files with 167 additions and 218 deletions
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ class AlbumCoverPagerAdapter(
|
|||
Fit,
|
||||
Tiny,
|
||||
Classic,
|
||||
Peak,
|
||||
Gradient,
|
||||
Full -> R.layout.fragment_album_full_cover
|
||||
else -> {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -50,7 +50,7 @@ class MaterialFragment : AbsPlayerFragment() {
|
|||
}
|
||||
|
||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||
playbackControlsFragment.setDark(color.backgroundColor)
|
||||
playbackControlsFragment.setColor(color)
|
||||
lastColor = color.backgroundColor
|
||||
callbacks?.onPaletteColorChanged()
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class PlayerFragment : AbsPlayerFragment() {
|
|||
}
|
||||
|
||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||
controlsFragment.setDark(color.primaryTextColor)
|
||||
controlsFragment.setColor(color)
|
||||
lastColor = color.backgroundColor
|
||||
callbacks?.onPaletteColorChanged()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -46,23 +46,16 @@
|
|||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
||||
android:id="@+id/imageContainer"
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginStart="16dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:layout_constraintHeight_percent="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/playerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbarContainer" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/titleContainer"
|
||||
|
@ -70,7 +63,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageContainer"
|
||||
app:layout_constraintStart_toEndOf="@id/playerAlbumCoverFragment"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbarContainer">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
@ -101,7 +94,7 @@
|
|||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/songInfo"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageContainer"
|
||||
app:layout_constraintStart_toEndOf="@id/playerAlbumCoverFragment"
|
||||
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
|
@ -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" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/playbackControlsFragmentContainer"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.peak.PeakPlayerControlFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/songInfo">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/songInfo"
|
||||
tools:layout="@layout/fragment_peak_control_player" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.peak.PeakPlayerControlFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/fragment_peak_control_player" />
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -7,7 +7,7 @@
|
|||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<fragment
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -105,7 +105,7 @@
|
|||
app:layout_constraintBottom_toTopOf="@id/toolbarContainer"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<fragment
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.tiny.TinyPlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -128,6 +128,8 @@
|
|||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextViewHeadline3"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/toolbarContainer"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/status_bar"
|
||||
|
@ -139,12 +141,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:ellipsize="end"
|
||||
android:fadingEdge="horizontal"
|
||||
android:gravity="start"
|
||||
android:maxLines="1"
|
||||
android:maxLines="2"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:rotation="0"
|
||||
android:textAppearance="@style/TextViewHeadline6"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/toolbarContainer"
|
||||
app:layout_constraintStart_toEndOf="@+id/title"
|
||||
|
|
Loading…
Reference in a new issue