diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java index 67d9dab3b..59a6cbfb4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java @@ -111,34 +111,34 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_GALAXY_BUDS_LIVE_ANC = "pref_galaxy_buds_live_anc"; public static final String PREF_GALAXY_BUDS_PRESSURE_RELIEF = "pref_galaxy_buds_live_pressure_relief"; - public static final String PREF_SONY_WH1000XM3_AMBIENT_SOUND_CONTROL = "pref_sony_wh1000xm3_ambient_sound_control"; - public static final String PREF_SONY_WH1000XM3_FOCUS_VOICE = "pref_sony_wh1000xm3_focus_voice"; - public static final String PREF_SONY_WH1000XM3_AMBIENT_SOUND_LEVEL = "pref_sony_wh1000xm3_ambient_sound_level"; - public static final String PREF_SONY_WH1000XM3_SOUND_POSITION = "pref_sony_wh1000xm3_sound_position"; - public static final String PREF_SONY_WH1000XM3_SURROUND_MODE = "pref_sony_wh1000xm3_surround_mode"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MODE = "pref_sony_wh1000xm3_equalizer_mode"; - public static final String PREF_SONY_WH1000XM3_DSEE_HX = "pref_sony_wh1000xm3_dsee_hx"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_400 = "pref_sony_wh1000xm3_equalizer_manual_band_400"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_1000 = "pref_sony_wh1000xm3_equalizer_manual_band_1000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_2500 = "pref_sony_wh1000xm3_equalizer_manual_band_2500"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_6300 = "pref_sony_wh1000xm3_equalizer_manual_band_6300"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_16000 = "pref_sony_wh1000xm3_equalizer_manual_band_16000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_CLEAR_BASS = "pref_sony_wh1000xm3_equalizer_manual_clear_bass"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_400 = "pref_sony_wh1000xm3_equalizer_custom_1_band_400"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_1000 = "pref_sony_wh1000xm3_equalizer_custom_1_band_1000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_2500 = "pref_sony_wh1000xm3_equalizer_custom_1_band_2500"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_6300 = "pref_sony_wh1000xm3_equalizer_custom_1_band_6300"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_16000 = "pref_sony_wh1000xm3_equalizer_custom_1_band_16000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_CLEAR_BASS = "pref_sony_wh1000xm3_equalizer_custom_1_clear_bass"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_400 = "pref_sony_wh1000xm3_equalizer_custom_2_band_400"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_1000 = "pref_sony_wh1000xm3_equalizer_custom_2_band_1000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_2500 = "pref_sony_wh1000xm3_equalizer_custom_2_band_2500"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_6300 = "pref_sony_wh1000xm3_equalizer_custom_2_band_6300"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_16000 = "pref_sony_wh1000xm3_equalizer_custom_2_band_16000"; - public static final String PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_CLEAR_BASS = "pref_sony_wh1000xm3_equalizer_custom_2_clear_bass"; - public static final String PREF_SONY_WH1000XM3_TOUCH_SENSOR = "pref_sony_wh1000xm3_touch_sensor"; - public static final String PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF = "pref_sony_wh1000xm3_automatic_power_off"; - public static final String PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE = "pref_sony_wh1000xm3_notification_voice_guide"; + public static final String PREF_SONY_AMBIENT_SOUND_CONTROL = "pref_sony_ambient_sound_control"; + public static final String PREF_SONY_FOCUS_VOICE = "pref_sony_focus_voice"; + public static final String PREF_SONY_AMBIENT_SOUND_LEVEL = "pref_sony_ambient_sound_level"; + public static final String PREF_SONY_SOUND_POSITION = "pref_sony_sound_position"; + public static final String PREF_SONY_SURROUND_MODE = "pref_sony_surround_mode"; + public static final String PREF_SONY_EQUALIZER_MODE = "pref_sony_equalizer_mode"; + public static final String PREF_SONY_DSEE_HX = "pref_sony_dsee_hx"; + public static final String PREF_SONY_EQUALIZER_MANUAL_BAND_400 = "pref_sony_equalizer_manual_band_400"; + public static final String PREF_SONY_EQUALIZER_MANUAL_BAND_1000 = "pref_sony_equalizer_manual_band_1000"; + public static final String PREF_SONY_EQUALIZER_MANUAL_BAND_2500 = "pref_sony_equalizer_manual_band_2500"; + public static final String PREF_SONY_EQUALIZER_MANUAL_BAND_6300 = "pref_sony_equalizer_manual_band_6300"; + public static final String PREF_SONY_EQUALIZER_MANUAL_BAND_16000 = "pref_sony_equalizer_manual_band_16000"; + public static final String PREF_SONY_EQUALIZER_MANUAL_CLEAR_BASS = "pref_sony_equalizer_manual_clear_bass"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_BAND_400 = "pref_sony_equalizer_custom_1_band_400"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_BAND_1000 = "pref_sony_equalizer_custom_1_band_1000"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_BAND_2500 = "pref_sony_equalizer_custom_1_band_2500"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_BAND_6300 = "pref_sony_equalizer_custom_1_band_6300"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_BAND_16000 = "pref_sony_equalizer_custom_1_band_16000"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_1_CLEAR_BASS = "pref_sony_equalizer_custom_1_clear_bass"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_BAND_400 = "pref_sony_equalizer_custom_2_band_400"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_BAND_1000 = "pref_sony_equalizer_custom_2_band_1000"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_BAND_2500 = "pref_sony_equalizer_custom_2_band_2500"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_BAND_6300 = "pref_sony_equalizer_custom_2_band_6300"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_BAND_16000 = "pref_sony_equalizer_custom_2_band_16000"; + public static final String PREF_SONY_EQUALIZER_CUSTOM_2_CLEAR_BASS = "pref_sony_equalizer_custom_2_clear_bass"; + public static final String PREF_SONY_TOUCH_SENSOR = "pref_sony_touch_sensor"; + public static final String PREF_SONY_AUTOMATIC_POWER_OFF = "pref_sony_automatic_power_off"; + public static final String PREF_SONY_NOTIFICATION_VOICE_GUIDE = "pref_sony_notification_voice_guide"; public static final String PREFS_ACTIVITY_IN_DEVICE_CARD = "prefs_activity_in_device_card"; public static final String PREFS_ACTIVITY_IN_DEVICE_CARD_STEPS = "prefs_activity_in_device_card_steps"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java index 2c918b287..25bfec151 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java @@ -124,34 +124,34 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_ENABLE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_NOTHING_EAR1_AUDIOMODE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_NOTHING_EAR1_INEAR; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_CONTROL; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_FOCUS_VOICE; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_LEVEL; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SOUND_POSITION; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SURROUND_MODE; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_400; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_1000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_2500; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_6300; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_16000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_CLEAR_BASS; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_400; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_1000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_2500; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_6300; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_16000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_CLEAR_BASS; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_400; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_1000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_2500; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_6300; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_16000; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_CLEAR_BASS; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_DSEE_HX; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_TOUCH_SENSOR; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF; -import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_CONTROL; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_FOCUS_VOICE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_LEVEL; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_SOUND_POSITION; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_SURROUND_MODE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_400; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_1000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_2500; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_6300; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_16000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_CLEAR_BASS; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_400; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_1000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_2500; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_6300; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_16000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_CLEAR_BASS; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_400; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_1000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_2500; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_6300; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_16000; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_CLEAR_BASS; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_DSEE_HX; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_TOUCH_SENSOR; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_AUTOMATIC_POWER_OFF; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SONY_NOTIFICATION_VOICE_GUIDE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREFS_ACTIVITY_IN_DEVICE_CARD_SLEEP; @@ -526,34 +526,34 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { addPreferenceHandlerFor(PREF_GALAXY_BUDS_PRESSURE_RELIEF); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_AMBIENT_SOUND_CONTROL); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_FOCUS_VOICE); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_AMBIENT_SOUND_LEVEL); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_SOUND_POSITION); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_SURROUND_MODE); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MODE); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_400); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_1000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_2500); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_6300); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_16000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_CLEAR_BASS); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_400); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_1000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_2500); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_6300); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_16000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_CLEAR_BASS); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_400); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_1000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_2500); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_6300); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_16000); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_CLEAR_BASS); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_DSEE_HX); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_TOUCH_SENSOR); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF); - addPreferenceHandlerFor(PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE); + addPreferenceHandlerFor(PREF_SONY_AMBIENT_SOUND_CONTROL); + addPreferenceHandlerFor(PREF_SONY_FOCUS_VOICE); + addPreferenceHandlerFor(PREF_SONY_AMBIENT_SOUND_LEVEL); + addPreferenceHandlerFor(PREF_SONY_SOUND_POSITION); + addPreferenceHandlerFor(PREF_SONY_SURROUND_MODE); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MODE); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_BAND_400); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_BAND_1000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_BAND_2500); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_BAND_6300); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_BAND_16000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_MANUAL_CLEAR_BASS); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_BAND_400); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_BAND_1000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_BAND_2500); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_BAND_6300); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_BAND_16000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_1_CLEAR_BASS); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_BAND_400); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_BAND_1000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_BAND_2500); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_BAND_6300); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_BAND_16000); + addPreferenceHandlerFor(PREF_SONY_EQUALIZER_CUSTOM_2_CLEAR_BASS); + addPreferenceHandlerFor(PREF_SONY_DSEE_HX); + addPreferenceHandlerFor(PREF_SONY_TOUCH_SENSOR); + addPreferenceHandlerFor(PREF_SONY_AUTOMATIC_POWER_OFF); + addPreferenceHandlerFor(PREF_SONY_NOTIFICATION_VOICE_GUIDE); String sleepTimeState = prefs.getString(PREF_SLEEP_TIME, PREF_DO_NOT_DISTURB_OFF); boolean sleepTimeScheduled = sleepTimeState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AmbientSoundControl.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AmbientSoundControl.java similarity index 92% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AmbientSoundControl.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AmbientSoundControl.java index e1d4900a9..915fe5764 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AmbientSoundControl.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AmbientSoundControl.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum AmbientSoundControl { OFF, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AutomaticPowerOff.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AutomaticPowerOff.java similarity index 85% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AutomaticPowerOff.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AutomaticPowerOff.java index 172a32396..2c9c3fc20 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/AutomaticPowerOff.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/AutomaticPowerOff.java @@ -14,14 +14,15 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum AutomaticPowerOff { OFF(new byte[]{(byte) 0x11, (byte) 0x00}), AFTER_5_MIN(new byte[]{(byte) 0x00, (byte) 0x00}), AFTER_30_MIN(new byte[]{(byte) 0x01, (byte) 0x01}), AFTER_1_HOUR(new byte[]{(byte) 0x02, (byte) 0x02}), - AFTER_3_HOUR(new byte[]{(byte) 0x03, (byte) 0x03}); + AFTER_3_HOUR(new byte[]{(byte) 0x03, (byte) 0x03}), + WHEN_TAKEN_OFF(new byte[]{(byte) 0x10, (byte) 0x00}); public final byte[] code; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/ButtonMode.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/ButtonMode.java new file mode 100644 index 000000000..6d0d25655 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/ButtonMode.java @@ -0,0 +1,30 @@ +/* Copyright (C) 2021 José Rebelo + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; + +public enum ButtonMode { + OFF((byte) 0xff), + AMBIENT_SOUND_CONTROL((byte) 0x00), + PLAYBACK_CONTROL((byte) 0x20), + VOLUME_CONTROL((byte) 0x10); + + public final byte code; + + ButtonMode(final byte code) { + this.code = code; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerCustomBands.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerCustomBands.java similarity index 96% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerCustomBands.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerCustomBands.java index d7b73ffa3..d739cd2f8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerCustomBands.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerCustomBands.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; import java.util.List; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerPreset.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerPreset.java similarity index 95% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerPreset.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerPreset.java index 29a03ec95..94aa0a1df 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/EqualizerPreset.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/EqualizerPreset.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum EqualizerPreset { OFF(new byte[] {(byte) 0x00, (byte) 0x00}), diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SonyWh1000Xm3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java similarity index 75% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SonyWh1000Xm3Coordinator.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java index 852cac37e..701e73d45 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SonyWh1000Xm3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; import android.app.Activity; import android.content.Context; @@ -23,38 +23,16 @@ import android.net.Uri; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import nodomain.freeyourgadget.gadgetbridge.GBException; -import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; -import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; - -public class SonyWh1000Xm3Coordinator extends AbstractDeviceCoordinator { - private static final Logger LOG = LoggerFactory.getLogger(SonyWh1000Xm3Coordinator.class); - - @NonNull - @Override - public DeviceType getSupportedType(GBDeviceCandidate candidate) { - if (candidate.getName().contains("WH-1000XM3")) { - return DeviceType.SONY_WH_1000XM3; - } - return DeviceType.UNKNOWN; - } - - @Override - public DeviceType getDeviceType() { - return DeviceType.SONY_WH_1000XM3; - } +public abstract class SonyHeadphonesCoordinator extends AbstractDeviceCoordinator { @Override public String getManufacturer() { return "Sony"; @@ -139,11 +117,4 @@ public class SonyWh1000Xm3Coordinator extends AbstractDeviceCoordinator { public boolean supportsFindDevice() { return false; } - - @Override - public int[] getSupportedDeviceSpecificSettings(final GBDevice device) { - return new int[]{ - R.xml.devicesettings_sony_1000xm3 - }; - } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SoundPosition.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SoundPosition.java similarity index 93% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SoundPosition.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SoundPosition.java index e56b4ee3a..eca7063aa 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SoundPosition.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SoundPosition.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum SoundPosition { OFF((byte) 0x00), diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SurroundMode.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SurroundMode.java similarity index 93% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SurroundMode.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SurroundMode.java index 38034e71d..0953c0e1c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/wh1000xm3/SurroundMode.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SurroundMode.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones; public enum SurroundMode { OFF((byte) 0x00), diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Coordinator.java new file mode 100644 index 000000000..71fb6de01 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Coordinator.java @@ -0,0 +1,52 @@ +/* Copyright (C) 2021 José Rebelo + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ +package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.wh1000xm3; + +import androidx.annotation.NonNull; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; + +public class SonyWh1000Xm3Coordinator extends SonyHeadphonesCoordinator { + @NonNull + @Override + public DeviceType getSupportedType(GBDeviceCandidate candidate) { + if (candidate.getName().contains("WH-1000XM3")) { + return DeviceType.SONY_WH_1000XM3; + } + return DeviceType.UNKNOWN; + } + + @Override + public DeviceType getDeviceType() { + return DeviceType.SONY_WH_1000XM3; + } + + @Override + public int[] getSupportedDeviceSpecificSettings(final GBDevice device) { + return new int[]{ + R.xml.devicesettings_sony_warning_wh1000xm3, + R.xml.devicesettings_sony_headphones_ambient_sound_control, + R.xml.devicesettings_sony_headphones_equalizer, + R.xml.devicesettings_sony_headphones_other, + R.xml.devicesettings_sony_wh_1000xm3 + }; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java index 5aa9fed15..9ee62d5a2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java @@ -88,13 +88,13 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.pinetime.PineTimeJFS import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.roidmi.RoidmiSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.smaq2oss.SMAQ2OSSSupport; +import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.SonyHeadphonesSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.SonySWR12DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.tlw64.TLW64Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Support.UM25Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.vibratissimo.VibratissimoSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.waspos.WaspOSDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.watch9.Watch9DeviceSupport; -import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.wh1000xm3.SonyWh1000Xm3Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.xwatch.XWatchSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.zetime.ZeTimeDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.util.GB; @@ -369,9 +369,9 @@ public class DeviceSupportFactory { break; case GALAXY_BUDS_LIVE: deviceSupport = new ServiceDeviceSupport(new GalaxyBudsDeviceSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); - break; + break; case SONY_WH_1000XM3: - deviceSupport = new ServiceDeviceSupport(new SonyWh1000Xm3Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); + deviceSupport = new ServiceDeviceSupport(new SonyHeadphonesSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); break; } if (deviceSupport != null) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3IoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesIoThread.java similarity index 81% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3IoThread.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesIoThread.java index 823f7bf63..952e733d3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3IoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesIoThread.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones; import android.bluetooth.BluetoothAdapter; import android.content.Context; @@ -34,11 +34,11 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread; import nodomain.freeyourgadget.gadgetbridge.util.GB; -public class SonyWh1000Xm3IoThread extends BtClassicIoThread { - private static final Logger LOG = LoggerFactory.getLogger(SonyWh1000Xm3IoThread.class); +public class SonyHeadphonesIoThread extends BtClassicIoThread { + private static final Logger LOG = LoggerFactory.getLogger(SonyHeadphonesIoThread.class); - public SonyWh1000Xm3IoThread(GBDevice gbDevice, Context context, SonyWh1000Xm3Protocol xm3protocol, SonyWh1000Xm3Support xm3support, BluetoothAdapter roidmiBtAdapter) { - super(gbDevice, context, xm3protocol, xm3support, roidmiBtAdapter); + public SonyHeadphonesIoThread(GBDevice gbDevice, Context context, SonyHeadphonesProtocol protocol, SonyHeadphonesSupport support, BluetoothAdapter btAdapter) { + super(gbDevice, context, protocol, support, btAdapter); } @Override @@ -49,12 +49,12 @@ public class SonyWh1000Xm3IoThread extends BtClassicIoThread { while (true) { inputStream.read(incoming); - if (incoming[0] == SonyWh1000Xm3Protocol.PACKET_HEADER) { + if (incoming[0] == SonyHeadphonesProtocol.PACKET_HEADER) { msgStream.reset(); continue; } - if (incoming[0] == SonyWh1000Xm3Protocol.PACKET_TRAILER) { + if (incoming[0] == SonyHeadphonesProtocol.PACKET_TRAILER) { break; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesProtocol.java similarity index 72% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesProtocol.java index 4003b8d62..87cc43168 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Protocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesProtocol.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones; import android.content.SharedPreferences; @@ -31,18 +31,18 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.AmbientSoundControl; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.AutomaticPowerOff; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.EqualizerCustomBands; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.EqualizerPreset; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.SoundPosition; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.SurroundMode; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.AmbientSoundControl; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.AutomaticPowerOff; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.EqualizerCustomBands; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.EqualizerPreset; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SoundPosition; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SurroundMode; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; import nodomain.freeyourgadget.gadgetbridge.util.GB; -public class SonyWh1000Xm3Protocol extends GBDeviceProtocol { - private static final Logger LOG = LoggerFactory.getLogger(SonyWh1000Xm3Protocol.class); +public abstract class SonyHeadphonesProtocol extends GBDeviceProtocol { + private static final Logger LOG = LoggerFactory.getLogger(SonyHeadphonesProtocol.class); /** * Packet format: @@ -71,7 +71,7 @@ public class SonyWh1000Xm3Protocol extends GBDeviceProtocol { private byte sequenceNumber = 0; - public SonyWh1000Xm3Protocol(GBDevice device) { + public SonyHeadphonesProtocol(GBDevice device) { super(device); } @@ -110,100 +110,100 @@ public class SonyWh1000Xm3Protocol extends GBDeviceProtocol { @Override public byte[] encodeSendConfiguration(String config) { final SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress()); - EqualizerPreset equalizerPreset = EqualizerPreset.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE, "off").toUpperCase()); + EqualizerPreset equalizerPreset = EqualizerPreset.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE, "off").toUpperCase()); switch (config) { - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_CONTROL: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_FOCUS_VOICE: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_LEVEL: - String soundControl = prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_CONTROL, "noise_cancelling"); - boolean focusVoice = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_FOCUS_VOICE, false); - int level = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AMBIENT_SOUND_LEVEL, 0); + case DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_CONTROL: + case DeviceSettingsPreferenceConst.PREF_SONY_FOCUS_VOICE: + case DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_LEVEL: + String soundControl = prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_CONTROL, "noise_cancelling"); + boolean focusVoice = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_FOCUS_VOICE, false); + int level = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_AMBIENT_SOUND_LEVEL, 0); return encodeSoundControl(AmbientSoundControl.valueOf(soundControl.toUpperCase()), focusVoice, level); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SOUND_POSITION: + case DeviceSettingsPreferenceConst.PREF_SONY_SOUND_POSITION: return encodeSoundPosition( - SoundPosition.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SOUND_POSITION, "off").toUpperCase()) + SoundPosition.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_SOUND_POSITION, "off").toUpperCase()) ); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SURROUND_MODE: + case DeviceSettingsPreferenceConst.PREF_SONY_SURROUND_MODE: return encodeSurroundMode( - SurroundMode.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_SURROUND_MODE, "off").toUpperCase()) + SurroundMode.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_SURROUND_MODE, "off").toUpperCase()) ); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE: return encodeEqualizerPreset(equalizerPreset); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_400: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_1000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_2500: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_6300: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_16000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_CLEAR_BASS: - int m_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_400, 10) - 10; - int m_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_1000, 10) - 10; - int m_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_2500, 10) - 10; - int m_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_6300, 10) - 10; - int m_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_BAND_16000, 10) - 10; - int m_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MANUAL_CLEAR_BASS, 10) - 10; + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_400: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_1000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_2500: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_6300: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_16000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_CLEAR_BASS: + int m_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_400, 10) - 10; + int m_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_1000, 10) - 10; + int m_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_2500, 10) - 10; + int m_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_6300, 10) - 10; + int m_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_BAND_16000, 10) - 10; + int m_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MANUAL_CLEAR_BASS, 10) - 10; // Set the equalizer preset, since changing the bands will switch it // TODO: This is not updating the UI once the user returns to the previous screen - prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE, EqualizerPreset.MANUAL.toString().toLowerCase()).apply(); + prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE, EqualizerPreset.MANUAL.toString().toLowerCase()).apply(); return encodeEqualizerCustomBands(EqualizerPreset.MANUAL, equalizerPreset, new EqualizerCustomBands(Arrays.asList(m_band1, m_band2, m_band3, m_band4, m_band5), m_bass)); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_400: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_1000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_2500: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_6300: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_16000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_CLEAR_BASS: - int c1_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_400, 10) - 10; - int c1_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_1000, 10) - 10; - int c1_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_2500, 10) - 10; - int c1_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_6300, 10) - 10; - int c1_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_BAND_16000, 10) - 10; - int c1_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_1_CLEAR_BASS, 10) - 10; + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_400: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_1000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_2500: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_6300: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_16000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_CLEAR_BASS: + int c1_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_400, 10) - 10; + int c1_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_1000, 10) - 10; + int c1_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_2500, 10) - 10; + int c1_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_6300, 10) - 10; + int c1_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_BAND_16000, 10) - 10; + int c1_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_1_CLEAR_BASS, 10) - 10; // Set the equalizer preset, since changing the bands will switch it // TODO: This is not updating the UI once the user returns to the previous screen - prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE, EqualizerPreset.CUSTOM_1.toString().toLowerCase()).apply(); + prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE, EqualizerPreset.CUSTOM_1.toString().toLowerCase()).apply(); return encodeEqualizerCustomBands(EqualizerPreset.CUSTOM_1, equalizerPreset, new EqualizerCustomBands(Arrays.asList(c1_band1, c1_band2, c1_band3, c1_band4, c1_band5), c1_bass)); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_400: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_1000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_2500: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_6300: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_16000: - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_CLEAR_BASS: - int c2_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_400, 10) - 10; - int c2_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_1000, 10) - 10; - int c2_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_2500, 10) - 10; - int c2_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_6300, 10) - 10; - int c2_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_BAND_16000, 10) - 10; - int c2_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_CUSTOM_2_CLEAR_BASS, 10) - 10; + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_400: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_1000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_2500: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_6300: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_16000: + case DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_CLEAR_BASS: + int c2_band1 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_400, 10) - 10; + int c2_band2 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_1000, 10) - 10; + int c2_band3 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_2500, 10) - 10; + int c2_band4 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_6300, 10) - 10; + int c2_band5 = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_BAND_16000, 10) - 10; + int c2_bass = prefs.getInt(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_CUSTOM_2_CLEAR_BASS, 10) - 10; // Set the equalizer preset, since changing the bands will switch it // TODO: This is not updating the UI once the user returns to the previous screen - prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_EQUALIZER_MODE, EqualizerPreset.CUSTOM_2.toString().toLowerCase()).apply(); + prefs.edit().putString(DeviceSettingsPreferenceConst.PREF_SONY_EQUALIZER_MODE, EqualizerPreset.CUSTOM_2.toString().toLowerCase()).apply(); return encodeEqualizerCustomBands(EqualizerPreset.CUSTOM_2, equalizerPreset, new EqualizerCustomBands(Arrays.asList(c2_band1, c2_band2, c2_band3, c2_band4, c2_band5), c2_bass)); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_DSEE_HX: - return encodeDSEEHX(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_DSEE_HX, false)); + case DeviceSettingsPreferenceConst.PREF_SONY_DSEE_HX: + return encodeDSEEHX(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_DSEE_HX, false)); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_TOUCH_SENSOR: - return encodeTouchSensor(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_TOUCH_SENSOR, true)); + case DeviceSettingsPreferenceConst.PREF_SONY_TOUCH_SENSOR: + return encodeTouchSensor(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_TOUCH_SENSOR, true)); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF: + case DeviceSettingsPreferenceConst.PREF_SONY_AUTOMATIC_POWER_OFF: return encodeAutomaticPowerOff( - AutomaticPowerOff.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_AUTOMATIC_POWER_OFF, "off").toUpperCase()) + AutomaticPowerOff.valueOf(prefs.getString(DeviceSettingsPreferenceConst.PREF_SONY_AUTOMATIC_POWER_OFF, "off").toUpperCase()) ); - case DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE: - return encodeVoiceNotifications(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_WH1000XM3_NOTIFICATION_VOICE_GUIDE, true)); + case DeviceSettingsPreferenceConst.PREF_SONY_NOTIFICATION_VOICE_GUIDE: + return encodeVoiceNotifications(prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SONY_NOTIFICATION_VOICE_GUIDE, true)); default: LOG.warn("Unknown config '{}'", config); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesSupport.java similarity index 71% rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Support.java rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesSupport.java index ff9b7decc..c1ad96edd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wh1000xm3/SonyWh1000Xm3Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/SonyHeadphonesSupport.java @@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.wh1000xm3; +package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones; import android.net.Uri; @@ -25,12 +25,14 @@ import java.util.ArrayList; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; +import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.wh1000xm3.SonyWh1000Xm3Protocol; import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceIoThread; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; -public class SonyWh1000Xm3Support extends AbstractSerialDeviceSupport { - private static final Logger LOG = LoggerFactory.getLogger(SonyWh1000Xm3Support.class); +public class SonyHeadphonesSupport extends AbstractSerialDeviceSupport { + private static final Logger LOG = LoggerFactory.getLogger(SonyHeadphonesSupport.class); @Override public boolean connect() { @@ -41,17 +43,24 @@ public class SonyWh1000Xm3Support extends AbstractSerialDeviceSupport { @Override protected GBDeviceProtocol createDeviceProtocol() { - return new SonyWh1000Xm3Protocol(getDevice()); + DeviceType deviceType = getDevice().getType(); + switch (deviceType) { + case SONY_WH_1000XM3: + return new SonyWh1000Xm3Protocol(getDevice()); + default: + LOG.error("Unsupported Sony device type '{}' with key '{}", deviceType, deviceType.getKey()); + return null; + } } @Override protected GBDeviceIoThread createDeviceIOThread() { - return new SonyWh1000Xm3IoThread(getDevice(), getContext(), (SonyWh1000Xm3Protocol) getDeviceProtocol(), SonyWh1000Xm3Support.this, getBluetoothAdapter()); + return new SonyHeadphonesIoThread(getDevice(), getContext(), (SonyHeadphonesProtocol) getDeviceProtocol(), SonyHeadphonesSupport.this, getBluetoothAdapter()); } @Override - public synchronized SonyWh1000Xm3IoThread getDeviceIOThread() { - return (SonyWh1000Xm3IoThread) super.getDeviceIOThread(); + public synchronized SonyHeadphonesIoThread getDeviceIOThread() { + return (SonyHeadphonesIoThread) super.getDeviceIOThread(); } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Protocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Protocol.java new file mode 100644 index 000000000..0ee549824 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/wh1000xm3/SonyWh1000Xm3Protocol.java @@ -0,0 +1,26 @@ +/* Copyright (C) 2021 José Rebelo + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ +package nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.wh1000xm3; + +import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; +import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.SonyHeadphonesProtocol; + +public class SonyWh1000Xm3Protocol extends SonyHeadphonesProtocol { + public SonyWh1000Xm3Protocol(GBDevice device) { + super(device); + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java index 6e2ca3501..b422784f4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java @@ -113,7 +113,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.um25.Coordinator.UM25Coordin import nodomain.freeyourgadget.gadgetbridge.devices.vibratissimo.VibratissimoCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.waspos.WaspOSCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9DeviceCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.sony.wh1000xm3.SonyWh1000Xm3Coordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.wh1000xm3.SonyWh1000Xm3Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator; import nodomain.freeyourgadget.gadgetbridge.entities.Device; diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 74282f80f..06e32555a 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1188,7 +1188,7 @@ Palco exterior Sala de concertos Aviso: As preferencias de posição de som / modo surround são mutuamente exclusivas. - Aviso: Estas preferencias só funcionam com o codec de audio SBC. + Aviso: As preferencias de equalizador, modo surround e posição do som só funcionam com o codec de audio SBC. Equalizador Desligado Brilhante @@ -1220,6 +1220,7 @@ 30 minutos 1 hora 3 horas + Quando retirar os auscultadores Desmarcar todos as aplicações Está prestes a instalar o firmware %s no seu Amazfit X. \n diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index e5f58c64a..86e0f8de5 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1853,21 +1853,21 @@ 3 - + @string/sony_ambient_sound_off @string/sony_ambient_sound_noise_cancelling @string/sony_ambient_sound_wind_noise_reduction @string/sony_ambient_sound_ambient_sound - + off noise_cancelling wind_noise_reduction ambient_sound - + @string/sony_sound_position_off @string/sony_sound_position_front @string/sony_sound_position_front_left @@ -1876,7 +1876,7 @@ @string/sony_sound_position_rear_right - + off front front_left @@ -1885,7 +1885,7 @@ rear_right - + @string/sony_surround_mode_off @string/sony_surround_mode_arena @string/sony_surround_mode_club @@ -1893,7 +1893,7 @@ @string/sony_surround_mode_concert_hall - + off arena club @@ -1901,7 +1901,7 @@ concert_hall - + @string/sony_equalizer_preset_off @string/sony_equalizer_preset_bright @string/sony_equalizer_preset_excited @@ -1916,7 +1916,7 @@ @string/sony_equalizer_preset_custom_2 - + off bright excited @@ -1931,7 +1931,7 @@ custom_2 - + @string/sony_automatic_power_off_off @string/sony_automatic_power_off_5_min @string/sony_automatic_power_off_30_min @@ -1939,7 +1939,7 @@ @string/sony_automatic_power_off_3_hour - + off after_5_min after_30_min diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c75086b28..e4e9700a9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1352,7 +1352,7 @@ Outdoor Stage Concert Hall Warning: The sound position / surround mode settings are mutually exclusive. - Warning: These settings only work for the SBC audio codec. + Warning: The equalizer, audio position and surround settings only work for the SBC audio codec. Equalizer Off Bright @@ -1384,6 +1384,7 @@ 30 minutes 1 hour 3 hours + When taken off Custom widget diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control.xml b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control.xml new file mode 100644 index 000000000..e1fa7b422 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/xml/devicesettings_sony_1000xm3.xml b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml similarity index 52% rename from app/src/main/res/xml/devicesettings_sony_1000xm3.xml rename to app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml index f2f0fb161..1cffd036c 100644 --- a/app/src/main/res/xml/devicesettings_sony_1000xm3.xml +++ b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml @@ -1,48 +1,15 @@ - - - - - - - - - - - - @@ -59,37 +26,37 @@ @@ -108,37 +75,37 @@ @@ -157,105 +124,40 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_other.xml b/app/src/main/res/xml/devicesettings_sony_headphones_other.xml new file mode 100644 index 000000000..f21e53d96 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_sony_headphones_other.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/devicesettings_sony_warning_wh1000xm3.xml b/app/src/main/res/xml/devicesettings_sony_warning_wh1000xm3.xml new file mode 100644 index 000000000..7590f80d4 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_sony_warning_wh1000xm3.xml @@ -0,0 +1,7 @@ + + + + diff --git a/app/src/main/res/xml/devicesettings_sony_wh_1000xm3.xml b/app/src/main/res/xml/devicesettings_sony_wh_1000xm3.xml new file mode 100644 index 000000000..7e3ad4a1a --- /dev/null +++ b/app/src/main/res/xml/devicesettings_sony_wh_1000xm3.xml @@ -0,0 +1,28 @@ + + + + + + + + + + +