mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-28 03:25:49 +01:00
Fossil Hybrid HR: allow setting vibration strength
Also allow re-fetching of configuration again (it updates battery levels)
This commit is contained in:
parent
3f480b30df
commit
101e2c6664
@ -28,4 +28,5 @@ public class DeviceSettingsPreferenceConst {
|
|||||||
public static final String PREF_BUTTON_1_FUNCTION = "button_1_function";
|
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_2_FUNCTION = "button_2_function";
|
||||||
public static final String PREF_BUTTON_3_FUNCTION = "button_3_function";
|
public static final String PREF_BUTTON_3_FUNCTION = "button_3_function";
|
||||||
|
public static final String PREF_VIBRATION_STRENGH_PERCENTAGE = "vibration_strength";
|
||||||
}
|
}
|
@ -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_DATEFORMAT;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SCREEN_ORIENTATION;
|
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_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.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_ACTIVATE_DISPLAY_ON_LIFT;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION;
|
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_1_FUNCTION);
|
||||||
addPreferenceHandlerFor(PREF_BUTTON_2_FUNCTION);
|
addPreferenceHandlerFor(PREF_BUTTON_2_FUNCTION);
|
||||||
addPreferenceHandlerFor(PREF_BUTTON_3_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);
|
String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF);
|
||||||
boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED);
|
boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED);
|
||||||
|
@ -79,7 +79,7 @@ public class QHybridCoordinator extends AbstractDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsActivityDataFetching() {
|
public boolean supportsActivityDataFetching() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -106,7 +106,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
loadNotificationConfigurations();
|
loadNotificationConfigurations();
|
||||||
queueWrite(new NotificationFilterPutHRRequest(this.notificationConfigurations, this));
|
queueWrite(new NotificationFilterPutHRRequest(this.notificationConfigurations, this));
|
||||||
setVibrationStrength((short) 75);
|
setVibrationStrength();
|
||||||
|
|
||||||
syncSettings();
|
syncSettings();
|
||||||
|
|
||||||
@ -123,6 +123,15 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
queueWrite(new SetDeviceStateRequest(GBDevice.State.INITIALIZED));
|
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
|
@Override
|
||||||
public void setVibrationStrength(short strength) {
|
public void setVibrationStrength(short strength) {
|
||||||
negotiateSymmetricKey();
|
negotiateSymmetricKey();
|
||||||
@ -692,6 +701,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
case DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION:
|
case DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION:
|
||||||
case DeviceSettingsPreferenceConst.PREF_BUTTON_3_FUNCTION:
|
case DeviceSettingsPreferenceConst.PREF_BUTTON_3_FUNCTION:
|
||||||
overwriteButtons(null);
|
overwriteButtons(null);
|
||||||
|
break;
|
||||||
|
case DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE:
|
||||||
|
setVibrationStrength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +186,7 @@
|
|||||||
<string name="pref_summary_allow_high_mtu">Increases transfer speed, but might not work on some Android devices.</string>
|
<string name="pref_summary_allow_high_mtu">Increases transfer speed, but might not work on some Android devices.</string>
|
||||||
<string name="pref_summary_sync_calendar">Enables calendar alerts, even when disconnected</string>
|
<string name="pref_summary_sync_calendar">Enables calendar alerts, even when disconnected</string>
|
||||||
<string name="pref_title_sync_caldendar">Sync calendar events</string>
|
<string name="pref_title_sync_caldendar">Sync calendar events</string>
|
||||||
|
<string name="pref_title_vibration_strength">Vibration strength</string>
|
||||||
<string name="pref_display_add_device_fab">Connect new device button</string>
|
<string name="pref_display_add_device_fab">Connect new device button</string>
|
||||||
<string name="pref_display_add_device_fab_on">Always visible</string>
|
<string name="pref_display_add_device_fab_on">Always visible</string>
|
||||||
<string name="pref_display_add_device_fab_off">Visible only if no device is added</string>
|
<string name="pref_display_add_device_fab_off">Visible only if no device is added</string>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="weatherApp"
|
android:defaultValue="weatherApp"
|
||||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||||
@ -26,4 +27,11 @@
|
|||||||
android:key="force_white_color_scheme"
|
android:key="force_white_color_scheme"
|
||||||
android:summary="@string/pref_summary_force_white_color_scheme"
|
android:summary="@string/pref_summary_force_white_color_scheme"
|
||||||
android:title="@string/pref_title_force_white_color_scheme" />
|
android:title="@string/pref_title_force_white_color_scheme" />
|
||||||
|
<SeekBarPreference
|
||||||
|
android:defaultValue="2"
|
||||||
|
android:key="@string/pref_title_vibration_strength"
|
||||||
|
android:max="3"
|
||||||
|
android:title="@string/pref_title_vibration_strength"
|
||||||
|
app:showSeekBarValue="true" />
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user