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 b74575ba2..72573b18f 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 @@ -28,4 +28,5 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_BUTTON_1_FUNCTION = "button_1_function"; public static final String PREF_BUTTON_2_FUNCTION = "button_2_function"; public static final String PREF_BUTTON_3_FUNCTION = "button_3_function"; + public static final String PREF_VIBRATION_STRENGH_PERCENTAGE = "vibration_strength"; } \ No newline at end of file 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 2c9ce0c49..dbd96d8a6 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 @@ -45,6 +45,7 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DATEFORMAT; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SCREEN_ORIENTATION; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_TIMEFORMAT; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_WEARLOCATION; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION; @@ -319,6 +320,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { addPreferenceHandlerFor(PREF_BUTTON_1_FUNCTION); addPreferenceHandlerFor(PREF_BUTTON_2_FUNCTION); addPreferenceHandlerFor(PREF_BUTTON_3_FUNCTION); + addPreferenceHandlerFor(PREF_VIBRATION_STRENGH_PERCENTAGE); String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF); boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridCoordinator.java index 4f4802d9c..12d444e82 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridCoordinator.java @@ -79,7 +79,7 @@ public class QHybridCoordinator extends AbstractDeviceCoordinator { @Override public boolean supportsActivityDataFetching() { - return false; + return true; } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java index 41a5eaed8..ad8d955e0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java @@ -106,7 +106,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { loadNotificationConfigurations(); queueWrite(new NotificationFilterPutHRRequest(this.notificationConfigurations, this)); - setVibrationStrength((short) 75); + setVibrationStrength(); syncSettings(); @@ -123,6 +123,15 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { queueWrite(new SetDeviceStateRequest(GBDevice.State.INITIALIZED)); } + private void setVibrationStrength() { + Prefs prefs = new Prefs(getDeviceSpecificPreferences()); + int vibrationStrengh = prefs.getInt(DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE, 2); + if (vibrationStrengh > 0) { + vibrationStrengh = (vibrationStrengh + 1) * 25; // Seems 0,50,75,100 are working... + } + setVibrationStrength((short) (vibrationStrengh)); + } + @Override public void setVibrationStrength(short strength) { negotiateSymmetricKey(); @@ -692,6 +701,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { case DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION: case DeviceSettingsPreferenceConst.PREF_BUTTON_3_FUNCTION: overwriteButtons(null); + break; + case DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE: + setVibrationStrength(); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ab354ee0f..01d37264e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -186,6 +186,7 @@ Increases transfer speed, but might not work on some Android devices. Enables calendar alerts, even when disconnected Sync calendar events + Vibration strength Connect new device button Always visible Visible only if no device is added diff --git a/app/src/main/res/xml/devicesettings_fossilhybridhr.xml b/app/src/main/res/xml/devicesettings_fossilhybridhr.xml index a2a2e608b..4217e9401 100644 --- a/app/src/main/res/xml/devicesettings_fossilhybridhr.xml +++ b/app/src/main/res/xml/devicesettings_fossilhybridhr.xml @@ -1,5 +1,6 @@ - + + +