1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 01:09:47 +01:00

Fossil HR: fixed some widget issues

This commit is contained in:
Daniel Dakhno 2020-04-24 01:49:42 +02:00
parent a089e01433
commit ca5d177608
2 changed files with 16 additions and 5 deletions

View File

@ -91,6 +91,7 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
Intent startIntent = new Intent(HRConfigActivity.this, WidgetSettingsActivity.class);
startIntent.putExtra("EXTRA_WIDGET", widget);
startIntent.putExtra("EXTRA_WIDGET_IDNEX", position);
startIntent.putExtra("EXTRA_WIDGET_INITIAL_NAME", ((CustomWidget) widget).getName());
startActivityForResult(startIntent, REQUEST_CODE_WIDGET_EDIT);
}
@ -187,8 +188,16 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
CustomWidget widget = (CustomWidget) data.getExtras().get("EXTRA_WIDGET");
int updateIndex = data.getIntExtra("EXTRA_WIDGET_IDNEX", -1);
String initialName = data.getStringExtra("EXTRA_WIDGET_INITIAL_NAME");
String newName = widget.getName();
String widgetJSON = sharedPreferences.getString("FOSSIL_HR_WIDGETS", "{}");
widgetJSON = widgetJSON.replace("custom_" + initialName, "custom_" + newName);
sharedPreferences.edit().putString("FOSSIL_HR_WIDGETS", widgetJSON).apply();
this.customWidgets.set(updateIndex, widget);
loadWidgetConfigs();
refreshWidgetList();
saveCustomWidgetList();

View File

@ -411,11 +411,13 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
AssetImage[] images = widgetImages.toArray(new AssetImage[0]);
queueWrite(new AssetFilePutRequest(
images,
(byte) 0x00,
this
));
if(images.length > 0) {
queueWrite(new AssetFilePutRequest(
images,
(byte) 0x00,
this
));
}
// queueWrite(new FileDeleteRequest((short) 0x0503));
queueWrite(new ImagesSetRequest(
images,