diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java index f97be710..87d21cc0 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java @@ -26,6 +26,7 @@ import com.cappielloantonio.tempo.ui.adapter.MusicFolderAdapter; import com.cappielloantonio.tempo.ui.adapter.PlaylistHorizontalAdapter; import com.cappielloantonio.tempo.ui.dialog.PlaylistEditorDialog; import com.cappielloantonio.tempo.util.Constants; +import com.cappielloantonio.tempo.util.Preferences; import com.cappielloantonio.tempo.viewmodel.LibraryViewModel; import com.google.android.material.appbar.MaterialToolbar; @@ -121,6 +122,11 @@ public class LibraryFragment extends Fragment implements ClickCallback { } private void initMusicFolderView() { + if (!Preferences.isMusicDirectorySectionVisible()) { + bind.libraryMusicFolderSector.setVisibility(View.GONE); + return; + } + bind.musicFolderRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext())); bind.musicFolderRecyclerView.setHasFixedSize(true); diff --git a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt index 95c29eeb..99252534 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt @@ -30,6 +30,7 @@ object Preferences { private const val ROUNDED_CORNER_SIZE = "rounded_corner_size" private const val PODCAST_SECTION_VISIBILITY = "podcast_section_visibility" private const val RADIO_SECTION_VISIBILITY = "radio_section_visibility" + private const val MUSIC_DIRECTORY_SECTION_VISIBILITY = "music_directory_section_visibility" @JvmStatic fun getServer(): String? { @@ -240,4 +241,9 @@ object Preferences { fun setRadioSectionHidden() { App.getInstance().preferences.edit().putBoolean(RADIO_SECTION_VISIBILITY, false).apply() } + + @JvmStatic + fun isMusicDirectorySectionVisible(): Boolean { + return App.getInstance().preferences.getBoolean(MUSIC_DIRECTORY_SECTION_VISIBILITY, true) + } } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4235ed37..ab6f1f6e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -185,6 +185,8 @@ Bitrate in Wi-Fi Bitrate in mobile Size of media file cache + Show music directories + If enabled, show the music directory section. Please note that for folder navigation to work properly, the server must support this feature. Sync play queue for this user Sync timer If enabled, the user will have the ability to save their play queue and will have the ability to load state when opening the application. diff --git a/app/src/main/res/xml/global_preferences.xml b/app/src/main/res/xml/global_preferences.xml index 41fee392..5871149e 100644 --- a/app/src/main/res/xml/global_preferences.xml +++ b/app/src/main/res/xml/global_preferences.xml @@ -51,6 +51,12 @@ android:defaultValue="true" android:summary="@string/settings_radio_summary" android:key="radio_section_visibility" /> + +