mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Zepp OS: Map some unknown display items
This commit is contained in:
+9
-1
@@ -71,6 +71,7 @@ public class ZeppOsMenuType {
|
||||
put("0000004B", "map");
|
||||
put("0000004C", "zepp_pay");
|
||||
put("0000004D", "heart_rate_push");
|
||||
put("00000052", "audio_control");
|
||||
put("00000053", "golf");
|
||||
put("00000056", "bio_charge");
|
||||
put("00000100", "alexa");
|
||||
@@ -83,11 +84,14 @@ public class ZeppOsMenuType {
|
||||
put("000F4258", "real_time_heart_rate");
|
||||
put("000F4263", "watch_storage_space");
|
||||
put("000F4259", "water_time");
|
||||
put("000F636F", "diary");
|
||||
put("000F63A5", "calorie_intake_record");
|
||||
put("000F653B", "meditation");
|
||||
put("0010132C", "breathing2");
|
||||
put("00100446", "worldclock2");
|
||||
put("00100F0A", "takephoto2");
|
||||
put("0010660A", "zepp_flow");
|
||||
put("0010953E", "zepp_flow2");
|
||||
put("000FFD3C", "jet_lag_manager");
|
||||
}};
|
||||
|
||||
@@ -132,7 +136,7 @@ public class ZeppOsMenuType {
|
||||
put("000FFD39", "hrv");
|
||||
}};
|
||||
|
||||
public static final Map<String, String> controlCenterNameLookup = new HashMap<String, String>() {{
|
||||
public static final Map<String, String> controlCenterNameLookup = new HashMap<>() {{
|
||||
put("00000000", "flashlight");
|
||||
put("00000001", "brightness");
|
||||
put("00000002", "lockscreen");
|
||||
@@ -158,5 +162,9 @@ public class ZeppOsMenuType {
|
||||
put("0000001A", "headphone");
|
||||
put("0000001B", "night_display");
|
||||
put("0000001C", "always_on_display");
|
||||
put("0000001E", "flashlight2");
|
||||
put("0000001D", "text_size");
|
||||
put("0000001F", "sos_flashlight");
|
||||
put("00000020", "mute");
|
||||
}};
|
||||
}
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ public class ZeppOsShortcutCardsService extends AbstractZeppOsService {
|
||||
WORLDCLOCK2("1049670", "1"),
|
||||
BREATHING2("1053484", "1"),
|
||||
ZEPP_FLOW("1074698", "1"),
|
||||
ASK_ANYTHING("1086782", "1"),
|
||||
;
|
||||
|
||||
private final String appNum;
|
||||
|
||||
@@ -1103,14 +1103,18 @@
|
||||
<item>@string/hrv</item>
|
||||
<item>@string/menuitem_map</item>
|
||||
<item>@string/menuitem_heart_rate_push</item>
|
||||
<item>@string/menuitem_audio_control</item>
|
||||
<item>@string/menuitem_bluetooth_scale_assistant</item>
|
||||
<item>@string/menuitem_calculator</item>
|
||||
<item>@string/menuitem_running_calculator</item>
|
||||
<item>@string/menuitem_real_time_heart_rate</item>
|
||||
<item>@string/menuitem_watch_storage_space</item>
|
||||
<item>@string/menuitem_water_time</item>
|
||||
<item>@string/menuitem_diary</item>
|
||||
<item>@string/menuitem_calorie_intake_record</item>
|
||||
<item>@string/activity_type_meditation</item>
|
||||
<item>@string/menuitem_zepp_flow</item>
|
||||
<item>@string/menuitem_zepp_flow</item>
|
||||
<item>@string/menuitem_jet_lag_manager</item>
|
||||
<item>@string/menuitem_golf</item>
|
||||
<item>@string/menuitem_bio_charge</item>
|
||||
@@ -1174,14 +1178,18 @@
|
||||
<item>hrv</item>
|
||||
<item>map</item>
|
||||
<item>heart_rate_push</item>
|
||||
<item>audio_control</item>
|
||||
<item>bluetooth_scale_assistant</item>
|
||||
<item>calculator</item>
|
||||
<item>running_calculator</item>
|
||||
<item>real_time_heart_rate</item>
|
||||
<item>watch_storage_space</item>
|
||||
<item>water_time</item>
|
||||
<item>diary</item>
|
||||
<item>calorie_intake_record</item>
|
||||
<item>meditation</item>
|
||||
<item>zepp_flow</item>
|
||||
<item>zepp_flow2</item>
|
||||
<item>jet_lag_manager</item>
|
||||
<item>golf</item>
|
||||
<item>bio_charge</item>
|
||||
@@ -1232,6 +1240,7 @@
|
||||
<item>@string/menuitem_bio_charge</item>
|
||||
<item>@string/menuitem_worldclock</item>
|
||||
<item>@string/menuitem_breathing</item>
|
||||
<item>@string/menuitem_zepp_os_ask_anything_chat_bot</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_zepp_os_shortcut_cards_values">
|
||||
@@ -1274,6 +1283,7 @@
|
||||
<item>bio_charge</item>
|
||||
<item>worldclock2</item>
|
||||
<item>breathing2</item>
|
||||
<item>ask_anything</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_huami2021_control_center">
|
||||
@@ -1302,6 +1312,10 @@
|
||||
<item>@string/menuitem_countdown</item>
|
||||
<item>@string/menuitem_stopwatch</item>
|
||||
<item>@string/menuitem_alarm</item>
|
||||
<item>@string/menuitem_flashlight</item>
|
||||
<item>@string/menuitem_text_size</item>
|
||||
<item>@string/menuitem_sos_flashlight</item>
|
||||
<item>@string/_pebble_watch_mute</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_huami2021_control_center_values">
|
||||
@@ -1330,6 +1344,10 @@
|
||||
<item>countdown</item>
|
||||
<item>stopwatch</item>
|
||||
<item>alarm</item>
|
||||
<item>flashlight2</item>
|
||||
<item>text_size</item>
|
||||
<item>sos_flashlight</item>
|
||||
<item>mute</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_miband5_workout_activity_types">
|
||||
|
||||
@@ -2240,6 +2240,9 @@
|
||||
<string name="menuitem_apps_shortcuts">Apps shortcuts</string>
|
||||
<string name="menuitem_map">Map</string>
|
||||
<string name="menuitem_heart_rate_push">Heart Rate Push</string>
|
||||
<string name="menuitem_audio_control">Audio Control</string>
|
||||
<string name="menuitem_diary">Diary</string>
|
||||
<string name="menuitem_calorie_intake_record">Calorie Intake Record</string>
|
||||
<string name="menuitem_bluetooth_scale_assistant">Bluetooth Scale Assistant</string>
|
||||
<string name="menuitem_calculator">Calculator</string>
|
||||
<string name="menuitem_running_calculator">Running Calculator</string>
|
||||
@@ -2249,6 +2252,7 @@
|
||||
<string name="menuitem_breathing">Breathing</string>
|
||||
<string name="menuitem_cycles">Cycle Tracking</string>
|
||||
<string name="menuitem_alarm">Alarm</string>
|
||||
<string name="menuitem_zepp_os_ask_anything_chat_bot">Ask Anything</string>
|
||||
<string name="menuitem_timer">Countdown</string>
|
||||
<string name="menuitem_compass">Compass</string>
|
||||
<string name="menuitem_settings">Settings</string>
|
||||
@@ -2291,6 +2295,8 @@
|
||||
<string name="menuitem_weight">Weight</string>
|
||||
<string name="menuitem_barometer">Barometer</string>
|
||||
<string name="menuitem_flashlight">Flashlight</string>
|
||||
<string name="menuitem_text_size">Text Size</string>
|
||||
<string name="menuitem_sos_flashlight">SOS Flashlight</string>
|
||||
<string name='menuitem_email'>E-mail</string>
|
||||
<string name='menuitem_countdown'>Countdown</string>
|
||||
<string name='menuitem_personal_activity_intelligence'>Personal Activity Intelligence</string>
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.test.TestBase;
|
||||
|
||||
public class ZeppOsMenuTypeTest extends TestBase {
|
||||
@Test
|
||||
public void testDisplayItemNameLookup_allValuesValid() {
|
||||
final Set<String> validAppValues = new HashSet<>(Arrays.asList(
|
||||
getContext().getResources().getStringArray(R.array.pref_zepp_os_apps_values)
|
||||
));
|
||||
|
||||
for (Map.Entry<String, String> entry : ZeppOsMenuType.displayItemNameLookup.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
|
||||
assertTrue(
|
||||
String.format("Value '%s' (key: %s) in displayItemNameLookup is not in pref_zepp_os_apps_values",
|
||||
value, key),
|
||||
validAppValues.contains(value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShortcutsNameLookup_allValuesValid() {
|
||||
final Set<String> validAppValues = new HashSet<>(Arrays.asList(
|
||||
getContext().getResources().getStringArray(R.array.pref_zepp_os_apps_values)
|
||||
));
|
||||
|
||||
for (Map.Entry<String, String> entry : ZeppOsMenuType.shortcutsNameLookup.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
|
||||
assertTrue(
|
||||
String.format("Value '%s' (key: %s) in shortcutsNameLookup is not in pref_zepp_os_apps_values",
|
||||
value, key),
|
||||
validAppValues.contains(value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testControlCenterNameLookup_allValuesValid() {
|
||||
final Set<String> validControlCenterValues = new HashSet<>(Arrays.asList(
|
||||
getContext().getResources().getStringArray(R.array.pref_huami2021_control_center_values)
|
||||
));
|
||||
|
||||
for (Map.Entry<String, String> entry : ZeppOsMenuType.controlCenterNameLookup.entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
final String value = entry.getValue();
|
||||
|
||||
assertTrue(
|
||||
String.format("Value '%s' (key: %s) in controlCenterNameLookup is not in pref_huami2021_control_center_values", value, key),
|
||||
validControlCenterValues.contains(value)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllKeys_areUppercaseHex() {
|
||||
// Verify that all keys follow the expected format: 8-digit uppercase hex strings
|
||||
final String hexPattern = "^[0-9A-F]{8}$";
|
||||
|
||||
for (String key : ZeppOsMenuType.displayItemNameLookup.keySet()) {
|
||||
assertTrue(
|
||||
String.format("Key '%s' in displayItemNameLookup should be 8-digit uppercase hex", key),
|
||||
key.matches(hexPattern)
|
||||
);
|
||||
}
|
||||
|
||||
for (String key : ZeppOsMenuType.shortcutsNameLookup.keySet()) {
|
||||
assertTrue(
|
||||
String.format("Key '%s' in shortcutsNameLookup should be 8-digit uppercase hex", key),
|
||||
key.matches(hexPattern)
|
||||
);
|
||||
}
|
||||
|
||||
for (String key : ZeppOsMenuType.controlCenterNameLookup.keySet()) {
|
||||
assertTrue(
|
||||
String.format("Key '%s' in controlCenterNameLookup should be 8-digit uppercase hex", key),
|
||||
key.matches(hexPattern)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user