mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
feat: make music directory section optional
This commit is contained in:
parent
a9b264004c
commit
a508ec0af6
4 changed files with 20 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ import com.cappielloantonio.tempo.ui.adapter.MusicFolderAdapter;
|
||||||
import com.cappielloantonio.tempo.ui.adapter.PlaylistHorizontalAdapter;
|
import com.cappielloantonio.tempo.ui.adapter.PlaylistHorizontalAdapter;
|
||||||
import com.cappielloantonio.tempo.ui.dialog.PlaylistEditorDialog;
|
import com.cappielloantonio.tempo.ui.dialog.PlaylistEditorDialog;
|
||||||
import com.cappielloantonio.tempo.util.Constants;
|
import com.cappielloantonio.tempo.util.Constants;
|
||||||
|
import com.cappielloantonio.tempo.util.Preferences;
|
||||||
import com.cappielloantonio.tempo.viewmodel.LibraryViewModel;
|
import com.cappielloantonio.tempo.viewmodel.LibraryViewModel;
|
||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
|
|
||||||
|
|
@ -121,6 +122,11 @@ public class LibraryFragment extends Fragment implements ClickCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMusicFolderView() {
|
private void initMusicFolderView() {
|
||||||
|
if (!Preferences.isMusicDirectorySectionVisible()) {
|
||||||
|
bind.libraryMusicFolderSector.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bind.musicFolderRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
bind.musicFolderRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
bind.musicFolderRecyclerView.setHasFixedSize(true);
|
bind.musicFolderRecyclerView.setHasFixedSize(true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ object Preferences {
|
||||||
private const val ROUNDED_CORNER_SIZE = "rounded_corner_size"
|
private const val ROUNDED_CORNER_SIZE = "rounded_corner_size"
|
||||||
private const val PODCAST_SECTION_VISIBILITY = "podcast_section_visibility"
|
private const val PODCAST_SECTION_VISIBILITY = "podcast_section_visibility"
|
||||||
private const val RADIO_SECTION_VISIBILITY = "radio_section_visibility"
|
private const val RADIO_SECTION_VISIBILITY = "radio_section_visibility"
|
||||||
|
private const val MUSIC_DIRECTORY_SECTION_VISIBILITY = "music_directory_section_visibility"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getServer(): String? {
|
fun getServer(): String? {
|
||||||
|
|
@ -240,4 +241,9 @@ object Preferences {
|
||||||
fun setRadioSectionHidden() {
|
fun setRadioSectionHidden() {
|
||||||
App.getInstance().preferences.edit().putBoolean(RADIO_SECTION_VISIBILITY, false).apply()
|
App.getInstance().preferences.edit().putBoolean(RADIO_SECTION_VISIBILITY, false).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun isMusicDirectorySectionVisible(): Boolean {
|
||||||
|
return App.getInstance().preferences.getBoolean(MUSIC_DIRECTORY_SECTION_VISIBILITY, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,6 +185,8 @@
|
||||||
<string name="settings_max_bitrate_wifi">Bitrate in Wi-Fi</string>
|
<string name="settings_max_bitrate_wifi">Bitrate in Wi-Fi</string>
|
||||||
<string name="settings_max_bitrate_mobile">Bitrate in mobile</string>
|
<string name="settings_max_bitrate_mobile">Bitrate in mobile</string>
|
||||||
<string name="settings_media_cache">Size of media file cache</string>
|
<string name="settings_media_cache">Size of media file cache</string>
|
||||||
|
<string name="settings_music_directory">Show music directories</string>
|
||||||
|
<string name="settings_music_directory_summary">If enabled, show the music directory section. Please note that for folder navigation to work properly, the server must support this feature.</string>
|
||||||
<string name="settings_queue_syncing_title">Sync play queue for this user</string>
|
<string name="settings_queue_syncing_title">Sync play queue for this user</string>
|
||||||
<string name="settings_queue_syncing_countdown">Sync timer</string>
|
<string name="settings_queue_syncing_countdown">Sync timer</string>
|
||||||
<string name="settings_queue_syncing_summary">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.</string>
|
<string name="settings_queue_syncing_summary">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.</string>
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,12 @@
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:summary="@string/settings_radio_summary"
|
android:summary="@string/settings_radio_summary"
|
||||||
android:key="radio_section_visibility" />
|
android:key="radio_section_visibility" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:title="@string/settings_music_directory"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:summary="@string/settings_music_directory_summary"
|
||||||
|
android:key="music_directory_section_visibility" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/settings_title_data">
|
<PreferenceCategory app:title="@string/settings_title_data">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue