[Android] Fix the header shuffle visibility on non large screens
Nicolas Pomepuy
git at videolan.org
Thu Dec 23 09:45:07 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Dec 17 11:23:54 2021 +0100| [a31a5b50f5d30f1c01f7991521bc9d66ed10f808] | committer: Nicolas Pomepuy
Fix the header shuffle visibility on non large screens
> https://code.videolan.org/videolan/vlc-android/commit/a31a5b50f5d30f1c01f7991521bc9d66ed10f808
---
application/vlc-android/res/layout/audio_player.xml | 7 ++++++-
.../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/application/vlc-android/res/layout/audio_player.xml b/application/vlc-android/res/layout/audio_player.xml
index 47b4896f4..fc9b94fe9 100644
--- a/application/vlc-android/res/layout/audio_player.xml
+++ b/application/vlc-android/res/layout/audio_player.xml
@@ -18,6 +18,10 @@
<variable
name="ab_repeat_b"
type="Float" />
+
+ <variable
+ name="can_shuffle"
+ type="Boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@@ -104,7 +108,7 @@
android:focusable="true"
android:onClick="@{fragment::onShuffleClick}"
android:padding="8dp"
- android:visibility="@{fragment.isTablet() ? View.VISIBLE : View.GONE}"
+ android:visibility="@{fragment.isTablet() && can_shuffle ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="@id/header_large_play_pause"
app:layout_constraintEnd_toStartOf="@+id/header_previous"
app:layout_constraintHorizontal_bias="0.5"
@@ -624,6 +628,7 @@
android:elevation="4dp"
android:focusable="true"
android:onClick="@{fragment::onShuffleClick}"
+ android:visibility="@{can_shuffle ? View.VISIBLE : View.INVISIBLE}"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="@+id/play_pause"
app:layout_constraintEnd_toStartOf="@+id/previous"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 8abebb087..a98ceb1a5 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -343,7 +343,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
private fun updateShuffleMode() {
val ctx = context ?: return
val shuffleButtons = arrayOf(binding.shuffle, binding.headerShuffle)
- shuffleButtons.forEach { it.visibility = if (playlistModel.canShuffle) View.VISIBLE else View.INVISIBLE }
+ binding.canShuffle = playlistModel.canShuffle
val shuffling = playlistModel.shuffling
if (wasShuffling == shuffling) return
shuffleButtons.forEach {
More information about the Android
mailing list