1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-09-01 03:55:47 +02:00

Add defaults and fix NPE for Soundcore Motion 300

This commit is contained in:
Severin von Wnuck-Lipinski 2024-08-12 22:55:26 +02:00
parent 4fe24f28d0
commit d1b4e013d3
3 changed files with 9 additions and 2 deletions

View File

@ -50,9 +50,13 @@ public class SoundcoreMotion300SettingsCustomizer implements DeviceSpecificSetti
if (!preference.getKey().equals(PREF_SOUNDCORE_EQUALIZER_PRESET)) if (!preference.getKey().equals(PREF_SOUNDCORE_EQUALIZER_PRESET))
return; return;
String preset = ((ListPreference)preference).getEntry().toString(); CharSequence preset = ((ListPreference)preference).getEntry();
if (preset == null)
return;
Preference pref = handler.findPreference(PREF_SOUNDCORE_EQUALIZER_CUSTOM); Preference pref = handler.findPreference(PREF_SOUNDCORE_EQUALIZER_CUSTOM);
boolean customEnabled = preset.equals(handler.getContext().getString(R.string.custom)); boolean customEnabled = preset.toString().equals(handler.getContext().getString(R.string.custom));
if (pref != null) if (pref != null)
pref.setEnabled(customEnabled); pref.setEnabled(customEnabled);

View File

@ -7,6 +7,7 @@
android:layout="@layout/preference_checkbox" android:layout="@layout/preference_checkbox"
android:title="@string/soundcore_voice_prompts" /> android:title="@string/soundcore_voice_prompts" />
<ListPreference <ListPreference
android:defaultValue="70"
android:entries="@array/soundcore_button_brightness_names" android:entries="@array/soundcore_button_brightness_names"
android:entryValues="@array/soundcore_button_brightness_values" android:entryValues="@array/soundcore_button_brightness_values"
android:icon="@drawable/ic_wb_sunny" android:icon="@drawable/ic_wb_sunny"
@ -14,6 +15,7 @@
android:summary="%s" android:summary="%s"
android:title="@string/soundcore_button_brightness" /> android:title="@string/soundcore_button_brightness" />
<ListPreference <ListPreference
android:defaultValue="3"
android:entries="@array/soundcore_auto_power_off_names" android:entries="@array/soundcore_auto_power_off_names"
android:entryValues="@array/soundcore_auto_power_off_values" android:entryValues="@array/soundcore_auto_power_off_values"
android:icon="@drawable/ic_power_settings_new" android:icon="@drawable/ic_power_settings_new"

View File

@ -17,6 +17,7 @@
android:title="@string/soundcore_adaptive_direction_title" android:title="@string/soundcore_adaptive_direction_title"
android:summary="@string/soundcore_adaptive_direction_summary" /> android:summary="@string/soundcore_adaptive_direction_summary" />
<ListPreference <ListPreference
android:defaultValue="0"
android:entries="@array/soundcore_equalizer_preset_names" android:entries="@array/soundcore_equalizer_preset_names"
android:entryValues="@array/soundcore_equalizer_preset_values" android:entryValues="@array/soundcore_equalizer_preset_values"
android:icon="@drawable/ic_equalizer" android:icon="@drawable/ic_equalizer"