[Android] Display settings: properly hide unused views

Nicolas Pomepuy git at videolan.org
Tue Nov 26 14:31:14 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Nov 26 14:16:26 2024 +0100| [b9d6de8c737bf702fbc7deb8b43f8f54ddeb7fb9] | committer: Duncan McNamara

Display settings: properly hide unused views

Fixes #3094

> https://code.videolan.org/videolan/vlc-android/commit/b9d6de8c737bf702fbc7deb8b43f8f54ddeb7fb9
---

 .../res/layout/dialog_display_settings.xml            | 19 ++++++++++---------
 .../videolan/vlc/gui/dialogs/DisplaySettingsDialog.kt |  8 ++++++++
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/application/vlc-android/res/layout/dialog_display_settings.xml b/application/vlc-android/res/layout/dialog_display_settings.xml
index cddf11923a..e1a2c850ca 100644
--- a/application/vlc-android/res/layout/dialog_display_settings.xml
+++ b/application/vlc-android/res/layout/dialog_display_settings.xml
@@ -33,9 +33,7 @@
 
         <androidx.constraintlayout.widget.ConstraintLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:gravity="center_horizontal"
-                android:orientation="vertical">
+                android:layout_height="wrap_content">
 
             <androidx.constraintlayout.widget.Guideline
                     android:id="@+id/guideline16"
@@ -123,8 +121,8 @@
                     android:layout_height="wrap_content"
                     android:layout_marginStart="24dp"
                     android:layout_marginEnd="16dp"
-                    android:textColor="?attr/font_default"
                     android:text="@string/artists_show_all_title"
+                    android:textColor="?attr/font_default"
                     android:textSize="16sp"
                     app:layout_constraintBottom_toBottomOf="@+id/show_all_artist_group"
                     app:layout_constraintEnd_toStartOf="@+id/show_all_artist_checkbox"
@@ -139,6 +137,7 @@
                     app:layout_constraintBottom_toBottomOf="@+id/show_all_artist_group"
                     app:layout_constraintEnd_toEndOf="@+id/show_all_artist_group"
                     app:layout_constraintTop_toTopOf="@+id/show_all_artist_group" />
+
             <View
                     android:id="@+id/show_all_files_group"
                     android:layout_width="0dp"
@@ -167,8 +166,8 @@
                     android:layout_height="wrap_content"
                     android:layout_marginStart="24dp"
                     android:layout_marginEnd="16dp"
-                    android:textColor="?attr/font_default"
                     android:text="@string/browser_show_all_title"
+                    android:textColor="?attr/font_default"
                     android:textSize="16sp"
                     app:layout_constraintBottom_toBottomOf="@+id/show_all_files_group"
                     app:layout_constraintEnd_toStartOf="@+id/show_all_files_checkbox"
@@ -183,6 +182,7 @@
                     app:layout_constraintBottom_toBottomOf="@+id/show_all_files_group"
                     app:layout_constraintEnd_toEndOf="@+id/show_all_files_group"
                     app:layout_constraintTop_toTopOf="@+id/show_all_files_group" />
+
             <View
                     android:id="@+id/show_hidden_files_group"
                     android:layout_width="0dp"
@@ -211,8 +211,8 @@
                     android:layout_height="wrap_content"
                     android:layout_marginStart="24dp"
                     android:layout_marginEnd="16dp"
-                    android:textColor="?attr/font_default"
                     android:text="@string/browser_show_hidden_files_title"
+                    android:textColor="?attr/font_default"
                     android:textSize="16sp"
                     app:layout_constraintBottom_toBottomOf="@+id/show_hidden_files_group"
                     app:layout_constraintEnd_toStartOf="@+id/show_hidden_files_checkbox"
@@ -320,21 +320,22 @@
 
             <TextView
                     android:id="@+id/sorts_title"
+                    style="@style/Theme.VLC.BottomSheetTitle"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginStart="16dp"
                     android:layout_marginTop="8dp"
-                    android:textColor="?attr/colorPrimary"
-                    style="@style/Theme.VLC.BottomSheetTitle"
                     android:text="@string/sortby"
+                    android:textColor="?attr/colorPrimary"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/video_groups_group" />
 
             <LinearLayout
                     android:id="@+id/sorts_container"
                     android:layout_width="match_parent"
-                    android:layout_height="match_parent"
+                    android:layout_height="wrap_content"
                     android:orientation="vertical"
+                    android:layout_marginBottom="16dp"
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/DisplaySettingsDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/DisplaySettingsDialog.kt
index 39a2b30e4a..a465f17130 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/DisplaySettingsDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/DisplaySettingsDialog.kt
@@ -48,6 +48,7 @@ import org.videolan.resources.GROUP_VIDEOS_FOLDER
 import org.videolan.resources.GROUP_VIDEOS_NAME
 import org.videolan.resources.GROUP_VIDEOS_NONE
 import org.videolan.tools.setGone
+import org.videolan.tools.setVisible
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.DialogDisplaySettingsBinding
 import org.videolan.vlc.databinding.SortDisplaySettingBinding
@@ -231,6 +232,8 @@ class DisplaySettingsDialog : VLCBottomSheetDialogFragment() {
         if (showAllArtists == null) {
             binding.showAllArtistGroup.setGone()
             binding.allArtistsImage.setGone()
+            binding.showAllArtistCheckbox.setGone()
+            binding.showAllArtistText.setGone()
             return
         }
         binding.showAllArtistCheckbox.isChecked = showAllArtists!!
@@ -244,6 +247,8 @@ class DisplaySettingsDialog : VLCBottomSheetDialogFragment() {
         if (showOnlyMultimediaFiles == null) {
             binding.showAllFilesGroup.setGone()
             binding.allFilesImage.setGone()
+            binding.showAllFilesCheckbox.setGone()
+            binding.showAllFilesText.setGone()
             return
         }
         binding.showAllFilesCheckbox.isChecked = showOnlyMultimediaFiles!!
@@ -257,6 +262,8 @@ class DisplaySettingsDialog : VLCBottomSheetDialogFragment() {
         if (showHiddenFiles == null) {
             binding.showHiddenFilesGroup.setGone()
             binding.hiddenFilesImage.setGone()
+            binding.showHiddenFilesCheckbox.setGone()
+            binding.showHiddenFilesText.setGone()
             return
         }
         binding.showHiddenFilesCheckbox.isChecked = showHiddenFiles!!
@@ -270,6 +277,7 @@ class DisplaySettingsDialog : VLCBottomSheetDialogFragment() {
         if (onlyFavs == null) {
             binding.onlyFavsGroup.setGone()
             binding.onlyFavsImage.setGone()
+            binding.onlyFavsText.setGone()
         } else binding.onlyFavsCheckbox.isChecked = onlyFavs!!
     }
 



More information about the Android mailing list