Fix peak theme controller

This commit is contained in:
h4h13 2019-10-26 14:02:38 +05:30
parent 11f39135f0
commit 4de51eb9e3
2 changed files with 21 additions and 8 deletions

View file

@ -128,13 +128,13 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
}
private fun updatePlayPauseDrawableState() {
when {
MusicPlayerRemote.isPlaying -> playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
}
}
private fun setUpMusicControllers() {
setUpPlayPauseFab()
setUpPrevNext()
@ -144,11 +144,17 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
}
private fun setUpShuffleButton() {
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
shuffleButton.setOnClickListener {
println("shuffleButton Click")
MusicPlayerRemote.toggleShuffleMode()
}
}
private fun setUpRepeatButton() {
repeatButton.setOnClickListener { MusicPlayerRemote.cycleRepeatMode() }
repeatButton.setOnClickListener {
println("repeatButton Click")
MusicPlayerRemote.cycleRepeatMode()
}
}
override fun setUpProgressSlider() {
@ -214,4 +220,12 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
super.onServiceConnected()
updatePlayPauseDrawableState()
}
override fun onRepeatModeChanged() {
updateRepeatState()
}
override fun onShuffleModeChanged() {
updateShuffleState()
}
}

View file

@ -65,7 +65,6 @@
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
@ -75,7 +74,7 @@
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/imageContainer"
app:layout_constraintTop_toBottomOf="@+id/toolbarContainer"
tools:text="@tools:sample/lorem/random" />
tools:text="@tools:sample/lorem" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"