1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-12 02:45:49 +01:00

Zepp OS: Fix activate display upon lift wrist smart mode

This commit is contained in:
José Rebelo 2023-03-19 22:11:39 +00:00
parent 443f13c11d
commit ac002f8db9
7 changed files with 60 additions and 2 deletions

View File

@ -19,5 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami;
public enum ActivateDisplayOnLift {
ON,
OFF,
SCHEDULED
SCHEDULED,
SMART
}

View File

@ -193,7 +193,7 @@ public abstract class Huami2021Coordinator extends HuamiCoordinator {
}
settings.add(R.xml.devicesettings_nightmode);
settings.add(R.xml.devicesettings_sleep_mode);
settings.add(R.xml.devicesettings_liftwrist_display_sensitivity);
settings.add(R.xml.devicesettings_liftwrist_display_sensitivity_with_smart);
settings.add(R.xml.devicesettings_password);
settings.add(R.xml.devicesettings_always_on_display);
settings.add(R.xml.devicesettings_screen_timeout);

View File

@ -3311,6 +3311,9 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
cmd[7] = (byte) calendar.get(Calendar.MINUTE);
writeToConfiguration(builder, cmd);
break;
default:
LOG.warn("Unknown display on lift mode {}", displayOnLift);
}
return this;
}

View File

@ -1683,6 +1683,7 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
put((byte) 0x00, ActivateDisplayOnLift.OFF);
put((byte) 0x01, ActivateDisplayOnLift.SCHEDULED);
put((byte) 0x02, ActivateDisplayOnLift.ON);
put((byte) 0x03, ActivateDisplayOnLift.SMART);
}};
private static final Map<Byte, Enum<?>> LIFT_WRIST_SENSITIVITY_MAP = new HashMap<Byte, Enum<?>>() {{

View File

@ -321,6 +321,19 @@
<item>@string/p_scheduled</item>
</string-array>
<string-array name="activate_display_on_lift_with_smart">
<item>@string/off</item>
<item>@string/on</item>
<item>@string/mi2_dnd_scheduled</item>
<item>@string/smart</item>
</string-array>
<string-array name="activate_display_on_lift_with_smart_values">
<item>@string/p_off</item>
<item>@string/p_on</item>
<item>@string/p_scheduled</item>
<item>@string/p_smart</item>
</string-array>
<string-array name="activate_display_on_lift_sensitivity">
<item>@string/normal</item>
<item>@string/sensitive</item>

View File

@ -75,6 +75,7 @@
<item name="p_always" type="string">always</item>
<item name="p_automatic" type="string">automatic</item>
<item name="p_scheduled" type="string">scheduled</item>
<item name="p_smart" type="string">smart</item>
<item name="p_normal" type="string">normal</item>
<item name="p_sensitive" type="string">sensitive</item>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
android:icon="@drawable/ic_arrow_upward"
android:key="pref_screen_lift_wrist"
android:persistent="false"
android:title="@string/mi2_prefs_activate_display_on_lift">
<!-- workaround for missing toolbar -->
<PreferenceCategory android:title="@string/mi2_prefs_activate_display_on_lift" />
<ListPreference
android:defaultValue="@string/p_off"
android:entries="@array/activate_display_on_lift_with_smart"
android:entryValues="@array/activate_display_on_lift_with_smart_values"
android:key="activate_display_on_lift_wrist"
android:summary="%s"
android:title="@string/mi2_prefs_activate_display_on_lift" />
<ListPreference
android:defaultValue="@string/p_normal"
android:entries="@array/activate_display_on_lift_sensitivity"
android:entryValues="@array/activate_display_on_lift_sensitivity_values"
android:key="display_on_lift_sensitivity"
android:summary="%s"
android:title="@string/prefs_activate_display_on_lift_sensitivity" />
<nodomain.freeyourgadget.gadgetbridge.util.XTimePreference
android:defaultValue="00:00"
android:key="display_on_lift_start"
android:title="@string/mi2_prefs_do_not_disturb_start" />
<nodomain.freeyourgadget.gadgetbridge.util.XTimePreference
android:defaultValue="00:00"
android:key="display_on_lift_end"
android:title="@string/mi2_prefs_do_not_disturb_end" />
</PreferenceScreen>
</androidx.preference.PreferenceScreen>