feat: added preference to disable heart and show shuffle instead

This commit is contained in:
eddyizm 2025-10-05 12:59:24 -07:00
parent 791190f681
commit 9a64eeabe6
No known key found for this signature in database
GPG key ID: CF5F671829E8158A
5 changed files with 53 additions and 24 deletions

View file

@ -117,6 +117,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
actionDeleteDownloadStorage();
actionKeepScreenOn();
actionAutoDownloadLyrics();
actionMiniPlayerHeart();
bindMediaService();
actionAppEqualizer();
@ -358,6 +359,21 @@ public class SettingsFragment extends PreferenceFragmentCompat {
});
}
private void actionMiniPlayerHeart() {
SwitchPreference preference = findPreference("mini_shuffle_button_visibility");
if (preference == null) {
return;
}
preference.setChecked(Preferences.showShuffleInsteadOfHeart());
preference.setOnPreferenceChangeListener((pref, newValue) -> {
if (newValue instanceof Boolean) {
Preferences.setShuffleInsteadOfHeart((Boolean) newValue);
}
return true;
});
}
private void actionAutoDownloadLyrics() {
SwitchPreference preference = findPreference("auto_download_lyrics");
if (preference == null) {

View file

@ -73,6 +73,7 @@ object Preferences {
private const val LAST_INSTANT_MIX = "last_instant_mix"
private const val EQUALIZER_ENABLED = "equalizer_enabled"
private const val EQUALIZER_BAND_LEVELS = "equalizer_band_levels"
private const val MINI_SHUFFLE_BUTTON_VISIBILITY = "mini_shuffle_button_visibility"
@JvmStatic
fun getServer(): String? {
@ -359,6 +360,16 @@ object Preferences {
).apply()
}
@JvmStatic
fun showShuffleInsteadOfHeart(): Boolean {
return App.getInstance().preferences.getBoolean(MINI_SHUFFLE_BUTTON_VISIBILITY, false)
}
@JvmStatic
fun setShuffleInsteadOfHeart(enabled: Boolean) {
App.getInstance().preferences.edit().putBoolean(MINI_SHUFFLE_BUTTON_VISIBILITY, enabled).apply()
}
@JvmStatic
fun showServerUnreachableDialog(): Boolean {
return App.getInstance().preferences.getLong(

View file

@ -335,6 +335,8 @@
<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_title">Sync play queue for this user [Not Fully Baked]</string>
<string name="settings_show_mini_shuffle_button">Show Shuffle button</string>
<string name="settings_show_mini_shuffle_button_summary">If enabled, show the shuffle button, remove the heart in the mini player</string>
<string name="settings_radio">Show radio</string>
<string name="settings_radio_summary">If enabled, show the radio section. Restart the app for it to take full effect.</string>
<string name="settings_auto_download_lyrics">Auto download lyrics</string>

View file

@ -97,6 +97,13 @@
android:defaultValue="true"
android:summary="@string/settings_music_directory_summary"
android:key="music_directory_section_visibility" />
<SwitchPreference
android:title="@string/settings_show_mini_shuffle_button"
android:defaultValue="false"
android:summary="@string/settings_show_mini_shuffle_button_summary"
android:key="mini_shuffle_button_visibility" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/settings_title_data">