Remove Material Slidr
This commit is contained in:
parent
5ae53c2dc1
commit
87e59ae1bd
37 changed files with 489 additions and 390 deletions
|
@ -14,10 +14,13 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.extensions
|
package code.name.monkey.retromusic.extensions
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
|
import android.widget.SeekBar
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
|
@ -52,3 +55,10 @@ fun Slider.setRange(progress: Float, to: Float) {
|
||||||
valueTo = to
|
valueTo = to
|
||||||
value = progress
|
value = progress
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun SeekBar.applyColor(@ColorInt color: Int) {
|
||||||
|
thumbTintList = ColorStateList.valueOf(color)
|
||||||
|
progressTintList = ColorStateList.valueOf(color)
|
||||||
|
progressBackgroundTintList = ColorStateList.valueOf(color)
|
||||||
|
}
|
|
@ -8,21 +8,20 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
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.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
||||||
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
||||||
import com.google.android.material.slider.Slider
|
|
||||||
|
|
||||||
import kotlinx.android.synthetic.main.fragment_volume.*
|
import kotlinx.android.synthetic.main.fragment_volume.*
|
||||||
|
|
||||||
class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolumeChangedListener,
|
||||||
View.OnClickListener, Slider.OnChangeListener {
|
View.OnClickListener {
|
||||||
|
|
||||||
private var audioVolumeObserver: AudioVolumeObserver? = null
|
private var audioVolumeObserver: AudioVolumeObserver? = null
|
||||||
|
|
||||||
|
@ -51,23 +50,20 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
|
|
||||||
val audioManager = audioManager
|
val audioManager = audioManager
|
||||||
if (audioManager != null) {
|
if (audioManager != null) {
|
||||||
volumeSeekBar.valueTo =
|
volumeSeekBar.max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
||||||
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC).toFloat()
|
volumeSeekBar.progress = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
|
||||||
volumeSeekBar.value = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC).toFloat()
|
|
||||||
}
|
}
|
||||||
volumeSeekBar.addOnChangeListener(this)
|
volumeSeekBar.setOnSeekBarChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAudioVolumeChanged(currentVolume: Float, maxVolume: Float) {
|
override fun onAudioVolumeChanged(currentVolume: Int, maxVolume: Int) {
|
||||||
if (volumeSeekBar == null) {
|
if (volumeSeekBar == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (maxVolume <= 0.0f) {
|
|
||||||
setPauseWhenZeroVolume(currentVolume < 1)
|
volumeSeekBar.max = maxVolume
|
||||||
return
|
volumeSeekBar.progress = currentVolume
|
||||||
}
|
volumeDown.setImageResource(if (currentVolume == 0) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
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) {
|
override fun onClick(view: View) {
|
||||||
val audioManager = audioManager
|
val audioManager = audioManager
|
||||||
when (view.id) {
|
when (view.id) {
|
||||||
|
@ -98,11 +107,17 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTintable(color: Int) {
|
fun setTintable(color: Int) {
|
||||||
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
volumeSeekBar.applyColor(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeThumb() {
|
||||||
|
volumeSeekBar.thumb = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setPauseWhenZeroVolume(pauseWhenZeroVolume: Boolean) {
|
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()
|
MusicPlayerRemote.pauseSong()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,6 +125,7 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
fun setTintableColor(color: Int) {
|
fun setTintableColor(color: Int) {
|
||||||
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
|
//TintHelper.setTint(volumeSeekBar, color, false)
|
||||||
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,14 +135,4 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
return VolumeFragment()
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,11 +207,9 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShow() {
|
override fun onShow() {
|
||||||
playbackControlsFragment.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onHide() {
|
override fun onHide() {
|
||||||
playbackControlsFragment.hide()
|
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.adaptive
|
package code.name.monkey.retromusic.fragments.player.adaptive
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.widget.SeekBar
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
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.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
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 code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
||||||
|
|
||||||
|
@ -139,7 +142,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
progressSlider.applyColor(colorFinal)
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,6 +185,14 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
|
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hide() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override fun updateShuffleState() {
|
override fun updateShuffleState() {
|
||||||
when (MusicPlayerRemote.shuffleMode) {
|
when (MusicPlayerRemote.shuffleMode) {
|
||||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
|
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
|
||||||
|
@ -219,31 +230,29 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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 ->
|
|
||||||
if (fromUser) {
|
|
||||||
MusicPlayerRemote.seekTo(value.toInt())
|
|
||||||
onUpdateProgressViews(
|
|
||||||
MusicPlayerRemote.songProgressMillis,
|
|
||||||
MusicPlayerRemote.songDurationMillis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.blur
|
package code.name.monkey.retromusic.fragments.player.blur
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -8,6 +9,8 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.AccelerateInterpolator
|
import android.view.animation.AccelerateInterpolator
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
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.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
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.*
|
||||||
|
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() {
|
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
|
@ -252,22 +268,29 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.cardblur
|
package code.name.monkey.retromusic.fragments.player.cardblur
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -7,20 +8,22 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.media_button.*
|
import kotlinx.android.synthetic.main.media_button.*
|
||||||
|
@ -62,7 +65,6 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
updatePrevNextColor()
|
updatePrevNextColor()
|
||||||
updateProgressTextColor()
|
updateProgressTextColor()
|
||||||
|
|
||||||
ViewUtil.setProgressDrawable(progressSlider, Color.WHITE, true)
|
|
||||||
volumeFragment?.tintWhiteColor()
|
volumeFragment?.tintWhiteColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateProgressTextColor() {
|
private fun updateProgressTextColor() {
|
||||||
val color = MaterialValueHelper.getPrimaryTextColor(context, false)
|
val color = Color.WHITE
|
||||||
songTotalTime.setTextColor(color)
|
songTotalTime.setTextColor(color)
|
||||||
songCurrentProgress.setTextColor(color)
|
songCurrentProgress.setTextColor(color)
|
||||||
songInfo.setTextColor(color)
|
songInfo.setTextColor(color)
|
||||||
|
@ -210,22 +212,30 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setUpProgressSlider() {
|
||||||
|
progressSlider.applyColor(Color.WHITE)
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.fragments.player.circle
|
package code.name.monkey.retromusic.fragments.player.circle
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
|
@ -22,6 +23,8 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
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.TintHelper
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.show
|
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.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
@ -98,9 +105,8 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
ThemeStore.accentColor(requireContext()),
|
ThemeStore.accentColor(requireContext()),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
volumeSeekBar.progressColor = ThemeStore.accentColor(requireContext())
|
volumeSeekBar.progressColor = accentColor()
|
||||||
volumeSeekBar.arcColor = ColorUtil
|
volumeSeekBar.arcColor = ColorUtil.withAlpha(accentColor(), 0.25f)
|
||||||
.withAlpha(ThemeStore.accentColor(requireContext()), 0.25f)
|
|
||||||
setUpPlayPauseFab()
|
setUpPlayPauseFab()
|
||||||
setUpPrevNext()
|
setUpPrevNext()
|
||||||
setUpPlayerToolbar()
|
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) {
|
if (volumeSeekBar == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
volumeSeekBar.max = maxVolume
|
||||||
volumeSeekBar.max = maxVolume.toInt()
|
volumeSeekBar.progress = currentVolume
|
||||||
volumeSeekBar.progress = currentVolume.toInt()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -231,22 +236,30 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
override fun onStopTrackingTouch(seekArc: SeekArc?) {
|
override fun onStopTrackingTouch(seekArc: SeekArc?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setUpProgressSlider() {
|
||||||
|
progressSlider.applyColor(accentColor())
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = AbsPlayerControlsFragment.SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setUpProgressSlider() {
|
|
||||||
progressSlider.addOnChangeListener { _, value, fromUser ->
|
|
||||||
if (fromUser) {
|
|
||||||
MusicPlayerRemote.seekTo(value.toInt())
|
|
||||||
onUpdateProgressViews(
|
|
||||||
MusicPlayerRemote.songProgressMillis,
|
|
||||||
MusicPlayerRemote.songDurationMillis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.color
|
package code.name.monkey.retromusic.fragments.player.color
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -7,19 +8,22 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.*
|
||||||
|
|
||||||
|
@ -99,11 +103,11 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
override fun setColor(color: MediaNotificationProcessor) {
|
override fun setColor(color: MediaNotificationProcessor) {
|
||||||
TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
|
TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true)
|
||||||
TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
|
TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false)
|
||||||
|
progressSlider.applyColor(color.primaryTextColor)
|
||||||
|
|
||||||
title.setTextColor(color.primaryTextColor)
|
title.setTextColor(color.primaryTextColor)
|
||||||
text.setTextColor(color.secondaryTextColor)
|
text.setTextColor(color.secondaryTextColor)
|
||||||
songInfo.setTextColor(color.secondaryTextColor)
|
songInfo.setTextColor(color.secondaryTextColor)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
|
|
||||||
songCurrentProgress.setTextColor(color.secondaryTextColor)
|
songCurrentProgress.setTextColor(color.secondaryTextColor)
|
||||||
songTotalTime.setTextColor(color.secondaryTextColor)
|
songTotalTime.setTextColor(color.secondaryTextColor)
|
||||||
volumeFragment?.setTintableColor(color.primaryTextColor)
|
volumeFragment?.setTintableColor(color.primaryTextColor)
|
||||||
|
@ -206,22 +210,29 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.flat
|
package code.name.monkey.retromusic.fragments.player.flat
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
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
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.*
|
||||||
|
|
||||||
|
@ -99,9 +103,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
|
||||||
|
|
||||||
updateTextColors(colorFinal)
|
updateTextColors(colorFinal)
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
|
progressSlider.applyColor(colorFinal)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
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() {
|
override fun onRepeatModeChanged() {
|
||||||
updateRepeatState()
|
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())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.full
|
package code.name.monkey.retromusic.fragments.player.full
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
@ -11,21 +12,24 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
|
import android.widget.SeekBar
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.model.Song
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_full_player_controls.*
|
import kotlinx.android.synthetic.main.fragment_full_player_controls.*
|
||||||
|
|
||||||
|
@ -97,7 +101,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
||||||
playerMenu.imageTintList = tintList
|
playerMenu.imageTintList = tintList
|
||||||
songFavourite.imageTintList = tintList
|
songFavourite.imageTintList = tintList
|
||||||
volumeFragment?.setTintableColor(color.primaryTextColor)
|
volumeFragment?.setTintableColor(color.primaryTextColor)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true)
|
progressSlider.applyColor(color.primaryTextColor)
|
||||||
title.setTextColor(color.primaryTextColor)
|
title.setTextColor(color.primaryTextColor)
|
||||||
text.setTextColor(color.secondaryTextColor)
|
text.setTextColor(color.secondaryTextColor)
|
||||||
songInfo.setTextColor(color.secondaryTextColor)
|
songInfo.setTextColor(color.secondaryTextColor)
|
||||||
|
@ -194,23 +198,30 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
|
||||||
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
override fun setUpProgressSlider() {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||||
progressSlider.value = progress.toFloat()
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
if (fromUser) {
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
MusicPlayerRemote.seekTo(progress)
|
||||||
|
onUpdateProgressViews(
|
||||||
|
MusicPlayerRemote.songProgressMillis,
|
||||||
|
MusicPlayerRemote.songDurationMillis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setUpProgressSlider() {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.addOnChangeListener { _, value, fromUser ->
|
progressSlider.max = total
|
||||||
if (fromUser) {
|
|
||||||
MusicPlayerRemote.seekTo(value.toInt())
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
onUpdateProgressViews(
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
MusicPlayerRemote.songProgressMillis,
|
animator.interpolator = LinearInterpolator()
|
||||||
MusicPlayerRemote.songDurationMillis
|
animator.start()
|
||||||
)
|
|
||||||
}
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
}
|
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRepeatModeChanged() {
|
override fun onRepeatModeChanged() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.gradient
|
package code.name.monkey.retromusic.fragments.player.gradient
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
|
@ -8,7 +9,9 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
|
import android.widget.SeekBar
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
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.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.VolumeFragment
|
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.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.model.Song
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
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() {
|
private fun setUpPlayPauseFab() {
|
||||||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||||
|
@ -469,7 +456,33 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
|
||||||
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
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) {
|
if (updateIsFavoriteTask != null) {
|
||||||
updateIsFavoriteTask?.cancel(false)
|
updateIsFavoriteTask?.cancel(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,27 +14,31 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.fragments.player.lockscreen
|
package code.name.monkey.retromusic.fragments.player.lockscreen
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.textColorSecondary
|
import code.name.monkey.retromusic.extensions.textColorSecondary
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
||||||
|
|
||||||
|
@ -124,11 +128,11 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
color.primaryTextColor
|
color.primaryTextColor
|
||||||
} else {
|
} else {
|
||||||
textColorSecondary( )
|
textColorSecondary()
|
||||||
}.ripAlpha()
|
}.ripAlpha()
|
||||||
|
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
progressSlider.applyColor(colorFinal)
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
|
@ -236,22 +240,29 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,25 +1,25 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.material
|
package code.name.monkey.retromusic.fragments.player.material
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
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.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
import code.name.monkey.retromusic.extensions.*
|
||||||
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.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||||
}else{
|
} else {
|
||||||
lastPlaybackControlsColor =
|
lastPlaybackControlsColor =
|
||||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
|
@ -116,11 +116,11 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
lastPlaybackControlsColor
|
lastPlaybackControlsColor
|
||||||
} else {
|
} else {
|
||||||
textColorSecondary( )
|
textColorSecondary()
|
||||||
}.ripAlpha()
|
}.ripAlpha()
|
||||||
|
|
||||||
text.setTextColor(colorFinal)
|
text.setTextColor(colorFinal)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
progressSlider.applyColor(colorFinal)
|
||||||
|
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
|
|
||||||
|
@ -212,22 +212,29 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
public override fun hide() {
|
public override fun hide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.normal
|
package code.name.monkey.retromusic.fragments.player.normal
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
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.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||||
|
|
||||||
|
@ -88,7 +92,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)
|
progressSlider.applyColor(colorFinal)
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
|
@ -233,22 +237,29 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,25 +14,29 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.fragments.player.peak
|
package code.name.monkey.retromusic.fragments.player.peak
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.widget.SeekBar
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
|
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
|
||||||
|
|
||||||
|
@ -90,7 +94,7 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
|
||||||
} else {
|
} else {
|
||||||
ThemeStore.accentColor(requireContext())
|
ThemeStore.accentColor(requireContext())
|
||||||
}
|
}
|
||||||
ViewUtil.setProgressDrawable(progressSlider, controlsColor, true)
|
progressSlider.applyColor(controlsColor)
|
||||||
volumeFragment?.setTintableColor(controlsColor)
|
volumeFragment?.setTintableColor(controlsColor)
|
||||||
playPauseButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
|
playPauseButton.setColorFilter(controlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
nextButton.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) {
|
override fun setUpProgressSlider() {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||||
progressSlider.value = progress.toFloat()
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
if (fromUser) {
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
MusicPlayerRemote.seekTo(progress)
|
||||||
|
onUpdateProgressViews(
|
||||||
|
MusicPlayerRemote.songProgressMillis,
|
||||||
|
MusicPlayerRemote.songDurationMillis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setUpProgressSlider() {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.addOnChangeListener { _, value, fromUser ->
|
progressSlider.max = total
|
||||||
if (fromUser) {
|
|
||||||
MusicPlayerRemote.seekTo(value.toInt())
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
onUpdateProgressViews(
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
MusicPlayerRemote.songProgressMillis,
|
animator.interpolator = LinearInterpolator()
|
||||||
MusicPlayerRemote.songDurationMillis
|
animator.start()
|
||||||
)
|
|
||||||
}
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
}
|
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPlayPauseFab() {
|
private fun setUpPlayPauseFab() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.plain
|
package code.name.monkey.retromusic.fragments.player.plain
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -7,25 +8,27 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.AccelerateInterpolator
|
import android.view.animation.AccelerateInterpolator
|
||||||
import android.view.animation.DecelerateInterpolator
|
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.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
import code.name.monkey.retromusic.R
|
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.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
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.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.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.nextButton
|
||||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.playPauseButton
|
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.playPauseButton
|
||||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.previousButton
|
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.previousButton
|
||||||
|
@ -159,6 +162,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
ThemeStore.accentColor(requireContext())
|
ThemeStore.accentColor(requireContext())
|
||||||
}
|
}
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
|
progressSlider.applyColor(colorFinal)
|
||||||
|
|
||||||
TintHelper.setTintAuto(
|
TintHelper.setTintAuto(
|
||||||
playPauseButton,
|
playPauseButton,
|
||||||
|
@ -170,8 +174,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
)
|
)
|
||||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||||
|
|
||||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
|
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
updatePrevNextColor()
|
updatePrevNextColor()
|
||||||
|
@ -268,22 +270,29 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
progressSlider.valueTo = total.toFloat()
|
progressSlider.max = total
|
||||||
progressSlider.value = progress.toFloat()
|
|
||||||
|
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||||
|
animator.duration = SLIDER_ANIMATION_TIME
|
||||||
|
animator.interpolator = LinearInterpolator()
|
||||||
|
animator.start()
|
||||||
|
|
||||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,26 +25,11 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_tiny_player.*
|
import kotlinx.android.synthetic.main.fragment_tiny_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_tiny_player.playerToolbar
|
|
||||||
|
|
||||||
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
||||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
private var lastColor: Int = 0
|
||||||
progressBar.max = total
|
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 {
|
override fun playerToolbar(): Toolbar {
|
||||||
return playerToolbar
|
return playerToolbar
|
||||||
|
@ -61,10 +46,9 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toolbarIconColor(): Int {
|
override fun toolbarIconColor(): Int {
|
||||||
return lastColor
|
return toolbarColor
|
||||||
}
|
}
|
||||||
|
|
||||||
private var lastColor: Int = 0
|
|
||||||
|
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = lastColor
|
get() = lastColor
|
||||||
|
@ -72,6 +56,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
|
|
||||||
override fun onColorChanged(color: MediaNotificationProcessor) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color.backgroundColor
|
lastColor = color.backgroundColor
|
||||||
|
toolbarColor = color.secondaryTextColor
|
||||||
controlsFragment.setColor(color)
|
controlsFragment.setColor(color)
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
|
|
||||||
|
@ -81,7 +66,6 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
songInfo.setTextColor(color.secondaryTextColor)
|
songInfo.setTextColor(color.secondaryTextColor)
|
||||||
ViewUtil.setProgressDrawable(progressBar, color.backgroundColor)
|
ViewUtil.setProgressDrawable(progressBar, color.backgroundColor)
|
||||||
|
|
||||||
|
|
||||||
Handler().post {
|
Handler().post {
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
|
@ -176,4 +160,22 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
super.onPlayingMetaChanged()
|
super.onPlayingMetaChanged()
|
||||||
updateSong()
|
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())
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -41,8 +41,7 @@ object ViewUtil {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
val layerDrawable = progressSlider.progressDrawable as LayerDrawable
|
val layerDrawable = progressSlider.progressDrawable as LayerDrawable
|
||||||
val progressDrawable = layerDrawable.findDrawableByLayerId(android.R.id.progress)
|
val progressDrawable = layerDrawable.findDrawableByLayerId(android.R.id.progress)
|
||||||
progressDrawable.colorFilter =
|
progressDrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
|
||||||
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
|
|
||||||
} else {
|
} else {
|
||||||
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
|
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class AudioVolumeContentObserver extends ContentObserver {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
if (mAudioManager != null && mListener != null) {
|
if (mAudioManager != null && mListener != null) {
|
||||||
float maxVolume = mAudioManager.getStreamMaxVolume(mAudioStreamType);
|
int maxVolume = mAudioManager.getStreamMaxVolume(mAudioStreamType);
|
||||||
float currentVolume = mAudioManager.getStreamVolume(mAudioStreamType);
|
int currentVolume = mAudioManager.getStreamVolume(mAudioStreamType);
|
||||||
if (currentVolume != mLastVolume) {
|
if (currentVolume != mLastVolume) {
|
||||||
mLastVolume = currentVolume;
|
mLastVolume = currentVolume;
|
||||||
mListener.onAudioVolumeChanged(currentVolume, maxVolume);
|
mListener.onAudioVolumeChanged(currentVolume, maxVolume);
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
package code.name.monkey.retromusic.volume
|
package code.name.monkey.retromusic.volume
|
||||||
|
|
||||||
interface OnAudioVolumeChangedListener {
|
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 |
|
@ -157,17 +157,14 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
|
app:layout_constraintTop_toBottomOf="@+id/titleContainer"
|
||||||
tools:text="@tools:sample/lorem/random" />
|
tools:text="@tools:sample/lorem/random" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/songInfo"
|
app:layout_constraintBottom_toTopOf="@id/songInfo"
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toBottomOf="@id/text"
|
app:layout_constraintTop_toBottomOf="@id/text"
|
||||||
app:thumbColor="?attr/colorSurface"
|
|
||||||
app:trackColorInactive="?attr/colorControlNormal"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute" />
|
tools:ignore="RtlHardcoded,UnusedAttribute" />
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
|
|
@ -128,14 +128,12 @@
|
||||||
app:layout_constraintStart_toEndOf="@+id/nextButton"
|
app:layout_constraintStart_toEndOf="@+id/nextButton"
|
||||||
app:layout_constraintTop_toTopOf="@+id/playPauseButton">
|
app:layout_constraintTop_toTopOf="@+id/playPauseButton">
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toLeftOf="@id/songTotalTime"
|
android:layout_toLeftOf="@id/songTotalTime"
|
||||||
android:layout_toRightOf="@id/songCurrentProgress"
|
android:layout_toRightOf="@id/songCurrentProgress"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:thumbColor="?attr/colorSurface"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:ignore="MissingPrefix">
|
tools:ignore="MissingPrefix">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/songCurrentProgress"
|
android:id="@+id/songCurrentProgress"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -24,16 +23,13 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="@dimen/slider_track_height" />
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/songTotalTime"
|
android:id="@+id/songTotalTime"
|
||||||
|
@ -85,6 +81,7 @@
|
||||||
android:id="@+id/playPauseButton"
|
android:id="@+id/playPauseButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
android:background="?attr/roundSelector"
|
android:background="?attr/roundSelector"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
|
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/nextButton"
|
app:layout_constraintEnd_toStartOf="@+id/nextButton"
|
||||||
|
|
|
@ -37,22 +37,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:splitTrack="false"
|
android:splitTrack="false"
|
||||||
app:haloColor="@color/md_white_semi_transparent"
|
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
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" />
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/songTotalTime"
|
android:id="@+id/songTotalTime"
|
||||||
|
@ -120,10 +112,10 @@
|
||||||
android:freezesText="true"
|
android:freezesText="true"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:marqueeRepeatLimit="marquee_forever"
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
android:scrollHorizontally="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="8dp"
|
android:paddingVertical="8dp"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextViewBody1"
|
android:textAppearance="@style/TextViewBody1"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/songInfo"
|
app:layout_constraintBottom_toTopOf="@+id/songInfo"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/playback_controls"
|
android:id="@+id/playback_controls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -54,20 +53,12 @@
|
||||||
tools:text="22.00" />
|
tools:text="22.00" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="20dp"
|
android:paddingStart="20dp"
|
||||||
android:paddingEnd="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" />
|
tools:progress="20" />
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
|
|
@ -150,19 +150,14 @@
|
||||||
app:layout_constraintStart_toStartOf="@+id/volumeSeekBar" />
|
app:layout_constraintStart_toStartOf="@+id/volumeSeekBar" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/songInfo"
|
app:layout_constraintBottom_toTopOf="@+id/songInfo"
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/volumeSeekBar"
|
app:layout_constraintTop_toBottomOf="@+id/volumeSeekBar" />
|
||||||
app:thumbColor="@color/md_white_1000"
|
|
||||||
app:trackColorInactive="?attr/colorControlNormal"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
|
||||||
tools:progress="20" />
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/songCurrentProgress"
|
android:id="@+id/songCurrentProgress"
|
||||||
|
|
|
@ -23,17 +23,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,16 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="8"
|
android:layout_weight="8"
|
||||||
android:splitTrack="false"
|
android:splitTrack="false"
|
||||||
android:thumb="@drawable/switch_square"
|
android:thumb="@drawable/switch_square"
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -89,21 +89,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toBottomOf="@id/titleContainer"
|
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:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -92,21 +92,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toBottomOf="@id/titleContainer"
|
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:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
@ -145,6 +138,7 @@
|
||||||
android:id="@+id/playPauseButton"
|
android:id="@+id/playPauseButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
android:background="?attr/roundSelector"
|
android:background="?attr/roundSelector"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
|
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -24,17 +24,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -34,17 +34,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
@ -67,6 +64,7 @@
|
||||||
android:id="@+id/playPauseButton"
|
android:id="@+id/playPauseButton"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
android:background="?attr/roundSelector"
|
android:background="?attr/roundSelector"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
|
|
|
@ -22,17 +22,14 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
|
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="3dp"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,13 @@
|
||||||
tools:ignore="RtlHardcoded,RtlSymmetry"
|
tools:ignore="RtlHardcoded,RtlSymmetry"
|
||||||
tools:text="00:22" />
|
tools:text="00:22" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/progressSlider"
|
android:id="@+id/progressSlider"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:haloRadius="0dp"
|
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
tools:progress="20" />
|
tools:progress="20" />
|
||||||
|
|
||||||
|
@ -108,8 +104,8 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
|
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
|
||||||
|
|
|
@ -24,21 +24,18 @@
|
||||||
app:srcCompat="@drawable/ic_volume_down_white_24dp"
|
app:srcCompat="@drawable/ic_volume_down_white_24dp"
|
||||||
app:tint="?attr/colorControlNormal" />
|
app:tint="?attr/colorControlNormal" />
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<androidx.appcompat.widget.AppCompatSeekBar
|
||||||
android:id="@+id/volumeSeekBar"
|
android:id="@+id/volumeSeekBar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:maxHeight="2dp"
|
android:maxHeight="2dp"
|
||||||
android:progressDrawable="@drawable/color_progress_seek"
|
android:progressDrawable="@drawable/color_progress_seek"
|
||||||
app:labelBehavior="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/volumeDown"
|
app:layout_constraintBottom_toBottomOf="@+id/volumeDown"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/volumeUp"
|
app:layout_constraintEnd_toStartOf="@+id/volumeUp"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/volumeDown"
|
app:layout_constraintStart_toEndOf="@+id/volumeDown"
|
||||||
app:layout_constraintTop_toTopOf="@+id/volumeDown"
|
app:layout_constraintTop_toTopOf="@+id/volumeDown" />
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
|
||||||
app:trackHeight="2dp" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/volumeUp"
|
android:id="@+id/volumeUp"
|
||||||
|
|
Loading…
Reference in a new issue