Display settings: properly hide unused views

Fixes #3094
This commit is contained in:
Nicolas Pomepuy 2024-11-26 14:16:26 +01:00 committed by Duncan McNamara
parent 9b3de81647
commit b9d6de8c73
2 changed files with 18 additions and 9 deletions

View File

@ -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"

View File

@ -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!!
}