mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-04-16 03:17:24 +02:00
Fossil Hybrid HR: do nothing in renderWidget() on firmware 1.0.2.20 or later
It seems that newer firmwares have watchfaces which are a special kind of apps This means that a simply specifying the layout of widget does not longer work (At least we do not know how) This commit fixes bluetooth communication being completely stuck when Gadgetbridge tries to render widgets (for example when switching force white mode or when having the notification widget enabled in settings)
This commit is contained in:
parent
ae40afb827
commit
2e67321adb
@ -414,6 +414,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderWidgets() {
|
private void renderWidgets() {
|
||||||
|
Version firmwareVersion = getCleanFWVersion();
|
||||||
|
if (firmwareVersion != null && firmwareVersion.compareTo(new Version("1.0.2.20")) >= 0) {
|
||||||
|
return; // this does not work on newer firmware versions
|
||||||
|
}
|
||||||
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(getDeviceSupport().getDevice().getAddress()));
|
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(getDeviceSupport().getDevice().getAddress()));
|
||||||
boolean forceWhiteBackground = prefs.getBoolean("force_white_color_scheme", false);
|
boolean forceWhiteBackground = prefs.getBoolean("force_white_color_scheme", false);
|
||||||
boolean drawCircles = prefs.getBoolean("widget_draw_circles", false);
|
boolean drawCircles = prefs.getBoolean("widget_draw_circles", false);
|
||||||
@ -1159,12 +1163,8 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
String singlePressEvent = "short_press_release";
|
String singlePressEvent = "short_press_release";
|
||||||
|
|
||||||
String firmware = getDeviceSupport().getDevice().getFirmwareVersion();
|
Version firmwareVersion = getCleanFWVersion();
|
||||||
Matcher matcher = Pattern.compile("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+").matcher(firmware); // DN1.0.2.19r.v5
|
if (firmwareVersion != null && firmwareVersion.compareTo(new Version("1.0.2.19")) < 0) {
|
||||||
if (matcher.find()) {
|
|
||||||
firmware = matcher.group(0);
|
|
||||||
Version version = new Version(firmware);
|
|
||||||
if (version.compareTo(new Version("1.0.2.19")) == -1)
|
|
||||||
singlePressEvent = "single_click";
|
singlePressEvent = "single_click";
|
||||||
}
|
}
|
||||||
ArrayList<ButtonConfiguration> configs = new ArrayList<>(5);
|
ArrayList<ButtonConfiguration> configs = new ArrayList<>(5);
|
||||||
@ -1180,7 +1180,8 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
// filter out all apps not installed on watch
|
// filter out all apps not installed on watch
|
||||||
ArrayList<ButtonConfiguration> availableConfigs = new ArrayList<>();
|
ArrayList<ButtonConfiguration> availableConfigs = new ArrayList<>();
|
||||||
outerLoop: for (ButtonConfiguration config : configs){
|
outerLoop:
|
||||||
|
for (ButtonConfiguration config : configs) {
|
||||||
for (ApplicationInformation installedApp : installedApplications) {
|
for (ApplicationInformation installedApp : installedApplications) {
|
||||||
if (installedApp.getAppName().equals(config.getAction())) {
|
if (installedApp.getAppName().equals(config.getAction())) {
|
||||||
availableConfigs.add(config);
|
availableConfigs.add(config);
|
||||||
@ -1200,7 +1201,8 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
GBApplication.getPrefs().getString(HRConfigActivity.CONFIG_KEY_Q_ACTIONS, "[]")
|
GBApplication.getPrefs().getString(HRConfigActivity.CONFIG_KEY_Q_ACTIONS, "[]")
|
||||||
);
|
);
|
||||||
String[] menuItems = new String[jsonArray.length()];
|
String[] menuItems = new String[jsonArray.length()];
|
||||||
for (int i = 0; i < jsonArray.length(); i++) menuItems[i] = jsonArray.getString(i);
|
for (int i = 0; i < jsonArray.length(); i++)
|
||||||
|
menuItems[i] = jsonArray.getString(i);
|
||||||
queueWrite(new CommuteConfigPutRequest(menuItems, this));
|
queueWrite(new CommuteConfigPutRequest(menuItems, this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1418,4 +1420,14 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
public byte getJsonIndex() {
|
public byte getJsonIndex() {
|
||||||
return jsonIndex++;
|
return jsonIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Version getCleanFWVersion() {
|
||||||
|
String firmware = getDeviceSupport().getDevice().getFirmwareVersion();
|
||||||
|
Matcher matcher = Pattern.compile("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+").matcher(firmware); // DN1.0.2.19r.v5
|
||||||
|
if (matcher.find()) {
|
||||||
|
firmware = matcher.group(0);
|
||||||
|
return new Version(firmware);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user