mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Zepp OS: Fix setting of unknown button press apps
This commit is contained in:
@@ -574,7 +574,21 @@ public class ZeppOsConfigService extends AbstractZeppOsService {
|
|||||||
switch (configArg) {
|
switch (configArg) {
|
||||||
case UPPER_BUTTON_LONG_PRESS:
|
case UPPER_BUTTON_LONG_PRESS:
|
||||||
case LOWER_BUTTON_PRESS:
|
case LOWER_BUTTON_PRESS:
|
||||||
return MapUtils.reverse(Huami2021MenuType.displayItemNameLookup).get(value);
|
final String itemHex = MapUtils.reverse(Huami2021MenuType.displayItemNameLookup).get(value);
|
||||||
|
if (itemHex != null) {
|
||||||
|
return itemHex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unknown button press value - attempt to parse it as hex
|
||||||
|
final Matcher matcher = Pattern.compile("^([0-9A-F]{8})$").matcher(value);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
LOG.debug("Sending unknown button press item {} as hex", value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.warn("Failed to map button press value {}", value);
|
||||||
|
|
||||||
|
return null;
|
||||||
case DATE_FORMAT:
|
case DATE_FORMAT:
|
||||||
return value.replace("/", ".");
|
return value.replace("/", ".");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user