Remove Material Slidr

This commit is contained in:
Hemanth S 2020-05-21 03:00:13 +05:30
parent 5ae53c2dc1
commit 87e59ae1bd
37 changed files with 489 additions and 390 deletions

View file

@ -14,10 +14,13 @@
package code.name.monkey.retromusic.extensions
import android.content.res.ColorStateList
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.SeekBar
import androidx.annotation.ColorInt
import androidx.annotation.LayoutRes
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
@ -52,3 +55,10 @@ fun Slider.setRange(progress: Float, to: Float) {
valueTo = to
value = progress
}
fun SeekBar.applyColor(@ColorInt color: Int) {
thumbTintList = ColorStateList.valueOf(color)
progressTintList = ColorStateList.valueOf(color)
progressBackgroundTintList = ColorStateList.valueOf(color)
}

View file

@ -8,21 +8,20 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.SeekBar
import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.setRange
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.volume.AudioVolumeObserver
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
import com.google.android.material.slider.Slider
import kotlinx.android.synthetic.main.fragment_volume.*
class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
View.OnClickListener, Slider.OnChangeListener {
class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolumeChangedListener,
View.OnClickListener {
private var audioVolumeObserver: AudioVolumeObserver? = null
@ -51,23 +50,20 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
val audioManager = audioManager
if (audioManager != null) {
volumeSeekBar.valueTo =
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC).toFloat()
volumeSeekBar.value = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC).toFloat()
volumeSeekBar.max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
volumeSeekBar.progress = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
}
volumeSeekBar.addOnChangeListener(this)
volumeSeekBar.setOnSeekBarChangeListener(this)
}
override fun onAudioVolumeChanged(currentVolume: Float, maxVolume: Float) {
override fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int) {
if (volumeSeekBar == null) {
return
}
if (maxVolume <= 0.0f) {
setPauseWhenZeroVolume(currentVolume < 1)
return
}
volumeSeekBar.setRange(currentVolume, maxVolume)
volumeDown.setImageResource(if (currentVolume == 0.0f) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
volumeSeekBar.max = maxVolume
volumeSeekBar.progress = currentVolume
volumeDown.setImageResource(if (currentVolume == 0) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
}
override fun onDestroyView() {
@ -77,6 +73,19 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
}
}
override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) {
val audioManager = audioManager
audioManager?.setStreamVolume(AudioManager.STREAM_MUSIC, i, 0)
setPauseWhenZeroVolume(i < 1)
volumeDown?.setImageResource(if (i == 0) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
}
override fun onStartTrackingTouch(seekBar: SeekBar) {
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
}
override fun onClick(view: View) {
val audioManager = audioManager
when (view.id) {
@ -98,11 +107,17 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
}
fun setTintable(color: Int) {
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
volumeSeekBar.applyColor(color)
}
fun removeThumb() {
volumeSeekBar.thumb = null
}
private fun setPauseWhenZeroVolume(pauseWhenZeroVolume: Boolean) {
if (PreferenceUtil.getInstance(requireContext()).pauseOnZeroVolume()) if (MusicPlayerRemote.isPlaying && pauseWhenZeroVolume) {
if (PreferenceUtil.getInstance(requireContext())
.pauseOnZeroVolume()
) if (MusicPlayerRemote.isPlaying && pauseWhenZeroVolume) {
MusicPlayerRemote.pauseSong()
}
}
@ -110,6 +125,7 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
fun setTintableColor(color: Int) {
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
//TintHelper.setTint(volumeSeekBar, color, false)
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
}
@ -119,14 +135,4 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
return VolumeFragment()
}
}
override fun onValueChange(slider: Slider, value: Float, fromUser: Boolean) {
if (value <= 0) {
return
}
val audioManager = audioManager
audioManager?.setStreamVolume(AudioManager.STREAM_MUSIC, value.toInt(), 0)
setPauseWhenZeroVolume(value < 1.0f)
volumeDown.setImageResource(if (value == 0.0f) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
}
}

View file

@ -207,11 +207,9 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
}
override fun onShow() {
playbackControlsFragment.show()
}
override fun onHide() {
playbackControlsFragment.hide()
onBackPressed()
}

View file

@ -1,16 +1,20 @@
package code.name.monkey.retromusic.fragments.player.adaptive
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
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.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
@ -18,11 +22,10 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.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.*
@ -139,7 +142,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
false
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
progressSlider.applyColor(colorFinal)
volumeFragment?.setTintable(colorFinal)
}
@ -182,6 +185,14 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
}
override fun show() {
}
override fun hide() {
}
override fun updateShuffleState() {
when (MusicPlayerRemote.shuffleMode) {
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
@ -219,31 +230,29 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
public override fun show() {
//Ignore
}
public override fun hide() {
//Ignore
}
override fun setUpProgressSlider() {
progressSlider.setLabelFormatter(SliderReadTimeLabelFormatter())
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.blur
import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
@ -8,6 +9,8 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -19,11 +22,24 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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_blur_player_playback_controls.*
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.nextButton
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.playPauseButton
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.previousButton
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.progressSlider
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.repeatButton
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.shuffleButton
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songCurrentProgress
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songInfo
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songTotalTime
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.text
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.title
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
@ -252,22 +268,29 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.cardblur
import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
@ -7,20 +8,22 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.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.*
@ -62,7 +65,6 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
updatePrevNextColor()
updateProgressTextColor()
ViewUtil.setProgressDrawable(progressSlider, Color.WHITE, true)
volumeFragment?.tintWhiteColor()
}
@ -82,7 +84,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
private fun updateProgressTextColor() {
val color = MaterialValueHelper.getPrimaryTextColor(context, false)
val color = Color.WHITE
songTotalTime.setTextColor(color)
songCurrentProgress.setTextColor(color)
songInfo.setTextColor(color)
@ -210,22 +212,30 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.applyColor(Color.WHITE)
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -14,6 +14,7 @@
package code.name.monkey.retromusic.fragments.player.circle
import android.animation.ObjectAnimator
import android.content.Context
import android.graphics.Color
import android.graphics.PorterDuff
@ -22,6 +23,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
@ -29,13 +32,17 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil
@ -98,9 +105,8 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
ThemeStore.accentColor(requireContext()),
false
)
volumeSeekBar.progressColor = ThemeStore.accentColor(requireContext())
volumeSeekBar.arcColor = ColorUtil
.withAlpha(ThemeStore.accentColor(requireContext()), 0.25f)
volumeSeekBar.progressColor = accentColor()
volumeSeekBar.arcColor = ColorUtil.withAlpha(accentColor(), 0.25f)
setUpPlayPauseFab()
setUpPrevNext()
setUpPlayerToolbar()
@ -204,13 +210,12 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
}
}
override fun onAudioVolumeChanged(currentVolume: Float, maxVolume: Float) {
override fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int) {
if (volumeSeekBar == null) {
return
}
volumeSeekBar.max = maxVolume.toInt()
volumeSeekBar.progress = currentVolume.toInt()
volumeSeekBar.max = maxVolume
volumeSeekBar.progress = currentVolume
}
override fun onDestroyView() {
@ -231,22 +236,30 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
override fun onStopTrackingTouch(seekArc: SeekArc?) {
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.applyColor(accentColor())
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = AbsPlayerControlsFragment.SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.color
import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
@ -7,19 +8,22 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.*
@ -99,11 +103,11 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
override fun setColor(color: MediaNotificationProcessor) {
TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
progressSlider.applyColor(color.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)
@ -206,22 +210,29 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,17 +1,21 @@
package code.name.monkey.retromusic.fragments.player.flat
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
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.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
@ -20,10 +24,10 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.*
@ -99,9 +103,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
updateTextColors(colorFinal)
volumeFragment?.setTintable(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
progressSlider.applyColor(colorFinal)
updateRepeatState()
updateShuffleState()
}
@ -171,25 +173,6 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
}
override fun onRepeatModeChanged() {
updateRepeatState()
}
@ -238,4 +221,30 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
)
}
}
override fun setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.full
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Color
@ -11,21 +12,24 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.PopupMenu
import android.widget.SeekBar
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.model.Song
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_full_player_controls.*
@ -97,7 +101,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
playerMenu.imageTintList = tintList
songFavourite.imageTintList = tintList
volumeFragment?.setTintableColor(color.primaryTextColor)
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
progressSlider.applyColor(color.primaryTextColor)
title.setTextColor(color.primaryTextColor)
text.setTextColor(color.secondaryTextColor)
songInfo.setTextColor(color.secondaryTextColor)
@ -194,23 +198,30 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun onRepeatModeChanged() {

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.gradient
import android.animation.ObjectAnimator
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff
@ -8,7 +9,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.PopupMenu
import android.widget.SeekBar
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.constraintlayout.widget.ConstraintLayout
@ -26,10 +29,12 @@ 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.VolumeFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil
@ -305,24 +310,6 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
}
private fun setUpPlayPauseFab() {
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
@ -469,7 +456,33 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
}
fun updateFavorite() {
fun setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = AbsPlayerControlsFragment.SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
private fun updateFavorite() {
if (updateIsFavoriteTask != null) {
updateIsFavoriteTask?.cancel(false)
}

View file

@ -14,27 +14,31 @@
package code.name.monkey.retromusic.fragments.player.lockscreen
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
@ -124,11 +128,11 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color.primaryTextColor
} else {
textColorSecondary( )
textColorSecondary()
}.ripAlpha()
volumeFragment?.setTintable(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
progressSlider.applyColor(colorFinal)
updateRepeatState()
updateShuffleState()
@ -236,22 +240,29 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,25 +1,25 @@
package code.name.monkey.retromusic.fragments.player.material
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
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.extensions.textColorSecondary
import code.name.monkey.retromusic.extensions.*
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
@ -104,7 +104,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}else{
} else {
lastPlaybackControlsColor =
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
@ -116,11 +116,11 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
lastPlaybackControlsColor
} else {
textColorSecondary( )
textColorSecondary()
}.ripAlpha()
text.setTextColor(colorFinal)
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
progressSlider.applyColor(colorFinal)
volumeFragment?.setTintable(colorFinal)
@ -212,22 +212,29 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
public override fun hide() {
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -1,17 +1,21 @@
package code.name.monkey.retromusic.fragments.player.normal
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
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.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
@ -19,10 +23,10 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
@ -88,7 +92,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
false
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
progressSlider.applyColor(colorFinal)
volumeFragment?.setTintable(colorFinal)
updateRepeatState()
updateShuffleState()
@ -233,22 +237,29 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -14,25 +14,29 @@
package code.name.monkey.retromusic.fragments.player.peak
import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
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.applyColor
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
@ -90,7 +94,7 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
} else {
ThemeStore.accentColor(requireContext())
}
ViewUtil.setProgressDrawable(progressSlider, controlsColor, true)
progressSlider.applyColor(controlsColor)
volumeFragment?.setTintableColor(controlsColor)
playPauseButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
nextButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
@ -139,23 +143,30 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
private fun setUpPlayPauseFab() {

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.fragments.player.plain
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
@ -7,25 +8,27 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
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.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
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
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
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.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_adaptive_player_playback_controls.*
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.nextButton
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.playPauseButton
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.previousButton
@ -159,6 +162,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
ThemeStore.accentColor(requireContext())
}
volumeFragment?.setTintable(colorFinal)
progressSlider.applyColor(colorFinal)
TintHelper.setTintAuto(
playPauseButton,
@ -170,8 +174,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
updateRepeatState()
updateShuffleState()
updatePrevNextColor()
@ -268,22 +270,29 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.valueTo = total.toFloat()
progressSlider.value = progress.toFloat()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
override fun setUpProgressSlider() {
progressSlider.addOnChangeListener { _, value, fromUser ->
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(value.toInt())
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -25,26 +25,11 @@ 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) {
progressBar.max = total
private var lastColor: Int = 0
private var toolbarColor: Int = 0
val animator = ObjectAnimator.ofInt(progressBar, "progress", progress)
val animatorSet = AnimatorSet()
animatorSet.playSequentially(animator)
animatorSet.duration = 1500
animatorSet.interpolator = LinearInterpolator()
animatorSet.start()
playerSongTotalTime.text = String.format(
"%s/%s", MusicUtil.getReadableDurationString(total.toLong()),
MusicUtil.getReadableDurationString(progress.toLong())
)
}
override fun playerToolbar(): Toolbar {
return playerToolbar
@ -61,10 +46,9 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
}
override fun toolbarIconColor(): Int {
return lastColor
return toolbarColor
}
private var lastColor: Int = 0
override val paletteColor: Int
get() = lastColor
@ -72,6 +56,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
toolbarColor = color.secondaryTextColor
controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
@ -81,7 +66,6 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
songInfo.setTextColor(color.secondaryTextColor)
ViewUtil.setProgressDrawable(progressBar, color.backgroundColor)
Handler().post {
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
@ -176,4 +160,22 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
super.onPlayingMetaChanged()
updateSong()
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressBar.max = total
val animator = ObjectAnimator.ofInt(progressBar, "progress", progress)
val animatorSet = AnimatorSet()
animatorSet.playSequentially(animator)
animatorSet.duration = 1500
animatorSet.interpolator = LinearInterpolator()
animatorSet.start()
playerSongTotalTime.text = String.format(
"%s/%s", MusicUtil.getReadableDurationString(total.toLong()),
MusicUtil.getReadableDurationString(progress.toLong())
)
}
}

View file

@ -41,8 +41,7 @@ object ViewUtil {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
val layerDrawable = progressSlider.progressDrawable as LayerDrawable
val progressDrawable = layerDrawable.findDrawableByLayerId(android.R.id.progress)
progressDrawable.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
progressDrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
} else {
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
}

View file

@ -48,8 +48,8 @@ public class AudioVolumeContentObserver extends ContentObserver {
@Override
public void onChange(boolean selfChange, Uri uri) {
if (mAudioManager != null && mListener != null) {
float maxVolume = mAudioManager.getStreamMaxVolume(mAudioStreamType);
float currentVolume = mAudioManager.getStreamVolume(mAudioStreamType);
int maxVolume = mAudioManager.getStreamMaxVolume(mAudioStreamType);
int currentVolume = mAudioManager.getStreamVolume(mAudioStreamType);
if (currentVolume != mLastVolume) {
mLastVolume = currentVolume;
mListener.onAudioVolumeChanged(currentVolume, maxVolume);

View file

@ -14,5 +14,5 @@
package code.name.monkey.retromusic.volume
interface OnAudioVolumeChangedListener {
fun onAudioVolumeChanged(currentVolume: Float, maxVolume: Float)
fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -157,17 +157,14 @@
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:labelBehavior="gone"
app:layout_constraintBottom_toTopOf="@id/songInfo"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toBottomOf="@id/text"
app:thumbColor="?attr/colorSurface"
app:trackColorInactive="?attr/colorControlNormal"
tools:ignore="RtlHardcoded,UnusedAttribute" />
<com.google.android.material.textview.MaterialTextView

View file

@ -128,14 +128,12 @@
app:layout_constraintStart_toEndOf="@+id/nextButton"
app:layout_constraintTop_toTopOf="@+id/playPauseButton">
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/songTotalTime"
android:layout_toRightOf="@id/songCurrentProgress"
app:labelBehavior="gone"
app:thumbColor="?attr/colorSurface"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -8,7 +8,6 @@
android:orientation="vertical"
tools:ignore="MissingPrefix">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content"
@ -24,16 +23,13 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:haloRadius="0dp"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height" />
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
@ -85,6 +81,7 @@
android:id="@+id/playPauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="?attr/roundSelector"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
app:layout_constraintEnd_toStartOf="@+id/nextButton"

View file

@ -37,22 +37,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:splitTrack="false"
app:haloColor="@color/md_white_semi_transparent"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbColor="@color/md_white_1000"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackColorActive="@color/md_white_1000"
app:trackColorInactive="@color/md_white_semi_transparent"
app:trackHeight="@dimen/slider_track_height" />
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
@ -120,10 +112,10 @@
android:freezesText="true"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toTopOf="@+id/songInfo"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/playback_controls"
android:layout_width="match_parent"
@ -54,20 +53,12 @@
tools:text="22.00" />
</LinearLayout>
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:paddingEnd="20dp"
app:haloColor="@color/md_white_semi_transparent"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:thumbColor="@color/md_white_1000"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackColorActive="@color/md_white_1000"
app:trackColorInactive="@color/md_white_semi_transparent"
app:trackHeight="@dimen/slider_track_height"
tools:progress="20" />
<com.google.android.material.textview.MaterialTextView

View file

@ -150,19 +150,14 @@
app:layout_constraintStart_toStartOf="@+id/volumeSeekBar" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:labelBehavior="gone"
app:layout_constraintBottom_toTopOf="@+id/songInfo"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toBottomOf="@+id/volumeSeekBar"
app:thumbColor="@color/md_white_1000"
app:trackColorInactive="?attr/colorControlNormal"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
app:layout_constraintTop_toBottomOf="@+id/volumeSeekBar" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress"

View file

@ -23,17 +23,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -23,19 +23,16 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:splitTrack="false"
android:thumb="@drawable/switch_square"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -89,21 +89,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toBottomOf="@id/titleContainer"
app:thumbColor="@color/md_white_1000"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackColorActive="@color/md_white_1000"
app:trackColorInactive="@color/md_white_semi_transparent"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -92,21 +92,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toBottomOf="@id/titleContainer"
app:thumbColor="@color/md_white_1000"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackColorActive="@color/md_white_1000"
app:trackColorInactive="@color/md_white_semi_transparent"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
@ -145,6 +138,7 @@
android:id="@+id/playPauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="?attr/roundSelector"
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -25,7 +25,7 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"

View file

@ -24,17 +24,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -34,17 +34,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
@ -67,6 +64,7 @@
android:id="@+id/playPauseButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginTop="16dp"
android:background="?attr/roundSelector"
android:padding="8dp"
android:scaleType="fitCenter"

View file

@ -22,17 +22,14 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:labelBehavior="gone"
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="3dp"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />

View file

@ -24,17 +24,13 @@
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:haloRadius="0dp"
app:labelBehavior="gone"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="@dimen/slider_track_height"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
@ -108,8 +104,8 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingBottom="8dp"
android:paddingHorizontal="16dp"
android:paddingBottom="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"

View file

@ -24,21 +24,18 @@
app:srcCompat="@drawable/ic_volume_down_white_24dp"
app:tint="?attr/colorControlNormal" />
<com.google.android.material.slider.Slider
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/volumeSeekBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxHeight="2dp"
android:progressDrawable="@drawable/color_progress_seek"
app:labelBehavior="gone"
app:layout_constraintBottom_toBottomOf="@+id/volumeDown"
app:layout_constraintEnd_toStartOf="@+id/volumeUp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/volumeDown"
app:layout_constraintTop_toTopOf="@+id/volumeDown"
app:thumbRadius="@dimen/slider_thumb_radius"
app:trackHeight="2dp" />
app:layout_constraintTop_toTopOf="@+id/volumeDown" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/volumeUp"