mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Fossil HR: fixed some widget issues
This commit is contained in:
@@ -91,6 +91,7 @@ public class HRConfigActivity extends AbstractGBActivity implements View.OnClick
|
|||||||
Intent startIntent = new Intent(HRConfigActivity.this, WidgetSettingsActivity.class);
|
Intent startIntent = new Intent(HRConfigActivity.this, WidgetSettingsActivity.class);
|
||||||
startIntent.putExtra("EXTRA_WIDGET", widget);
|
startIntent.putExtra("EXTRA_WIDGET", widget);
|
||||||
startIntent.putExtra("EXTRA_WIDGET_IDNEX", position);
|
startIntent.putExtra("EXTRA_WIDGET_IDNEX", position);
|
||||||
|
startIntent.putExtra("EXTRA_WIDGET_INITIAL_NAME", ((CustomWidget) widget).getName());
|
||||||
|
|
||||||
startActivityForResult(startIntent, REQUEST_CODE_WIDGET_EDIT);
|
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");
|
CustomWidget widget = (CustomWidget) data.getExtras().get("EXTRA_WIDGET");
|
||||||
int updateIndex = data.getIntExtra("EXTRA_WIDGET_IDNEX", -1);
|
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);
|
this.customWidgets.set(updateIndex, widget);
|
||||||
|
|
||||||
|
loadWidgetConfigs();
|
||||||
refreshWidgetList();
|
refreshWidgetList();
|
||||||
saveCustomWidgetList();
|
saveCustomWidgetList();
|
||||||
|
|
||||||
|
@@ -411,11 +411,13 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
AssetImage[] images = widgetImages.toArray(new AssetImage[0]);
|
AssetImage[] images = widgetImages.toArray(new AssetImage[0]);
|
||||||
|
|
||||||
queueWrite(new AssetFilePutRequest(
|
if(images.length > 0) {
|
||||||
images,
|
queueWrite(new AssetFilePutRequest(
|
||||||
(byte) 0x00,
|
images,
|
||||||
this
|
(byte) 0x00,
|
||||||
));
|
this
|
||||||
|
));
|
||||||
|
}
|
||||||
// queueWrite(new FileDeleteRequest((short) 0x0503));
|
// queueWrite(new FileDeleteRequest((short) 0x0503));
|
||||||
queueWrite(new ImagesSetRequest(
|
queueWrite(new ImagesSetRequest(
|
||||||
images,
|
images,
|
||||||
|
Reference in New Issue
Block a user