mirror of
https://github.com/Freeyourgadget/Gadgetbridge
synced 2026-03-29 03:06:15 +02:00
Fossil HR: test branch for watchface with deeper menu
This commit is contained in:
parent
65cbea6713
commit
069bb5617d
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,6 +1,6 @@
|
||||
[submodule "fossil-hr-watchface"]
|
||||
path = external/fossil-hr-watchface
|
||||
url = https://github.com/arjan-s/fossil-hr-watchface
|
||||
url = https://codeberg.org/Freeyourgadget/fossil-hr-watchface
|
||||
[submodule "jerryscript"]
|
||||
path = external/jerryscript
|
||||
url = https://github.com/jerryscript-project/jerryscript
|
||||
|
||||
1
app/src/main/assets/fossil_hr/battery_layout.json
Normal file
1
app/src/main/assets/fossil_hr/battery_layout.json
Normal file
@ -0,0 +1 @@
|
||||
[{"id":0,"type":"complication_background","background":"#background","goal_ring":{"is_enable":"#goal_ring","end_angle":"#fi","is_invert":"#$e"},"dimension":{"type":"rigid","width":"#size.w","height":"#size.h"},"placement":{"type":"absolute","left":"#pos.Ue","top":"#pos.Qe"},"visible":true,"inversion":false},{"id":1,"parent_id":0,"type":"complication_content","icon":"icBattery","text_low":"#ci","dimension":{"type":"rigid","width":76,"height":76},"placement":{"type":"relative"},"visible":true,"inversion":"#$e"},{"id":2,"parent_id":1,"type":"solid","placement":{"type":"absolute","left":29,"top":23},"color":"#nt","dimension":{"type":"rigid","height":6,"width":"#it"},"visible":true,"inversion":false},{"id":3,"parent_id":1,"type":"image","image_name":"icBattCharging","draw_mode":1,"placement":{"type":"absolute","left":34,"top":21},"dimension":{"width":6,"height":9},"visible":"#et","inversion":false}]
|
||||
1
app/src/main/assets/fossil_hr/complication_layout.json
Normal file
1
app/src/main/assets/fossil_hr/complication_layout.json
Normal file
@ -0,0 +1 @@
|
||||
[{"id":0,"type":"complication_background","background":"#background","goal_ring":{"is_enable":"#goal_ring","end_angle":"#fi","is_invert":"#$e"},"dimension":{"type":"rigid","width":"#size.w","height":"#size.h"},"placement":{"type":"absolute","left":"#pos.Ue","top":"#pos.Qe"},"visible":true,"inversion":false},{"id":1,"parent_id":0,"type":"complication_content","icon":"#icon","text_high":"#dt","text_low":"#ci","dimension":{"type":"rigid","width":76,"height":76},"placement":{"type":"relative"},"visible":true,"inversion":"#$e"}]
|
||||
1
app/src/main/assets/fossil_hr/image_layout.json
Normal file
1
app/src/main/assets/fossil_hr/image_layout.json
Normal file
@ -0,0 +1 @@
|
||||
[{"id":0,"type":"container","direction":1,"main_alignment":1,"cross_alignment":1,"dimension":{"type":"rigid","width":240,"height":240},"placement":{"type":"absolute","left":0,"top":0},"visible":true,"inversion":false},{"id":1,"parent_id":0,"type":"image","image_name":"#name","draw_mode":1,"placement":{"type":"absolute","left":"#pos.Ue","top":"#pos.Qe"},"dimension":{"width":"#size.w","height":"#size.h"},"visible":true,"inversion":false}]
|
||||
207
app/src/main/assets/fossil_hr/menu_layout.json
Normal file
207
app/src/main/assets/fossil_hr/menu_layout.json
Normal file
@ -0,0 +1,207 @@
|
||||
[
|
||||
{
|
||||
"id": 0,
|
||||
"type": "container",
|
||||
"direction": 1,
|
||||
"main_alignment": 0,
|
||||
"cross_alignment": 1,
|
||||
"dimension": {
|
||||
"type": "rigid",
|
||||
"width": 240,
|
||||
"height": 240
|
||||
},
|
||||
"placement": {
|
||||
"type": "absolute",
|
||||
"left": 0,
|
||||
"top": 0
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"parent_id": 0,
|
||||
"type": "container",
|
||||
"direction": 1,
|
||||
"main_alignment": 1,
|
||||
"cross_alignment": 2,
|
||||
"dimension": {
|
||||
"type": "rigid",
|
||||
"width": 130,
|
||||
"height": 34
|
||||
},
|
||||
"placement": {
|
||||
"type": "absolute",
|
||||
"left": 75,
|
||||
"top": 45
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"parent_id": 1,
|
||||
"type": "text",
|
||||
"text": "#top_short_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"parent_id": 1,
|
||||
"type": "text",
|
||||
"text": "#top_long_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"ascent": 17,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"parent_id": 0,
|
||||
"type": "container",
|
||||
"direction": 1,
|
||||
"main_alignment": 1,
|
||||
"cross_alignment": 2,
|
||||
"dimension": {
|
||||
"type": "rigid",
|
||||
"width": 80,
|
||||
"height": 34
|
||||
},
|
||||
"placement": {
|
||||
"type": "absolute",
|
||||
"left": 135,
|
||||
"top": 103
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"parent_id": 4,
|
||||
"type": "text",
|
||||
"text": "#middle_short_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"parent_id": 4,
|
||||
"type": "text",
|
||||
"text": "#middle_long_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"ascent": 17,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"parent_id": 0,
|
||||
"type": "container",
|
||||
"direction": 1,
|
||||
"main_alignment": 1,
|
||||
"cross_alignment": 2,
|
||||
"dimension": {
|
||||
"type": "rigid",
|
||||
"width": 130,
|
||||
"height": 34
|
||||
},
|
||||
"placement": {
|
||||
"type": "absolute",
|
||||
"left": 75,
|
||||
"top": 161
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"parent_id": 7,
|
||||
"type": "text",
|
||||
"text": "#bottom_short_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"parent_id": 7,
|
||||
"type": "text",
|
||||
"text": "#bottom_long_press_label",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"ascent": 17,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"parent_id": 0,
|
||||
"type": "text",
|
||||
"text": "#menu_title",
|
||||
"ppem": 25,
|
||||
"color": 3,
|
||||
"ascent": 35,
|
||||
"placement": {
|
||||
"type": "relative"
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"parent_id": 0,
|
||||
"type": "text_page",
|
||||
"text": "#message_to_display",
|
||||
"ppem": 17,
|
||||
"color": 3,
|
||||
"ascent": 17,
|
||||
"cross_alignment": 2,
|
||||
"line_width": [
|
||||
80,
|
||||
85,
|
||||
90,
|
||||
90,
|
||||
85,
|
||||
80
|
||||
],
|
||||
"dimension": {
|
||||
"type": "rigid",
|
||||
"width": 80,
|
||||
"height": 100
|
||||
},
|
||||
"placement": {
|
||||
"type": "absolute",
|
||||
"left": 20,
|
||||
"top": 60
|
||||
},
|
||||
"visible": true,
|
||||
"inversion": false
|
||||
}
|
||||
]
|
||||
|
||||
Binary file not shown.
@ -39,11 +39,11 @@ public class FossilAppWriter {
|
||||
private String version;
|
||||
private LinkedHashMap<String, InputStream> code;
|
||||
private LinkedHashMap<String, InputStream> icons;
|
||||
private LinkedHashMap<String, String> layout;
|
||||
private LinkedHashMap<String, InputStream> layout;
|
||||
private LinkedHashMap<String, String> displayName;
|
||||
private LinkedHashMap<String, String> config;
|
||||
|
||||
public FossilAppWriter(Context context, String version, LinkedHashMap<String, InputStream> code, LinkedHashMap<String, InputStream> icons, LinkedHashMap<String, String> layout, LinkedHashMap<String, String> displayName, LinkedHashMap<String, String> config) {
|
||||
public FossilAppWriter(Context context, String version, LinkedHashMap<String, InputStream> code, LinkedHashMap<String, InputStream> icons, LinkedHashMap<String, InputStream> layout, LinkedHashMap<String, String> displayName, LinkedHashMap<String, String> config) {
|
||||
this.mContext = context;
|
||||
if (this.mContext == null) throw new AssertionError("context cannot be null");
|
||||
this.version = version;
|
||||
@ -63,7 +63,7 @@ public class FossilAppWriter {
|
||||
public byte[] getWapp() throws IOException {
|
||||
byte[] codeData = loadFiles(code);
|
||||
byte[] iconsData = loadFiles(icons);
|
||||
byte[] layoutData = loadStringFiles(layout);
|
||||
byte[] layoutData = loadFiles(layout);
|
||||
byte[] displayNameData = loadStringFiles(displayName);
|
||||
byte[] configData = loadStringFiles(config);
|
||||
|
||||
|
||||
@ -185,22 +185,15 @@ public class HybridHRWatchfaceFactory {
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Unable to read asset file", e);
|
||||
}
|
||||
LinkedHashMap<String, String> layout = new LinkedHashMap<>();
|
||||
try {
|
||||
layout.put("complication_layout", getComplicationLayout());
|
||||
} catch (JSONException e) {
|
||||
LOG.warn("Could not generate complication_layout", e);
|
||||
}
|
||||
try {
|
||||
layout.put("image_layout", getImageLayout());
|
||||
} catch (JSONException e) {
|
||||
LOG.warn("Could not generate image_layout", e);
|
||||
}
|
||||
try {
|
||||
if (includeWidget("widgetBattery") > 0) layout.put("battery_layout", getBatteryLayout());
|
||||
} catch (JSONException e) {
|
||||
LOG.warn("Could not generate battery_layout", e);
|
||||
LinkedHashMap<String, InputStream> layout = new LinkedHashMap<>();
|
||||
layout.put("complication_layout", context.getAssets().open("fossil_hr/complication_layout.json"));
|
||||
layout.put("image_layout", context.getAssets().open("fossil_hr/image_layout.json"));
|
||||
layout.put("menu_layout", context.getAssets().open("fossil_hr/menu_layout.json"));
|
||||
|
||||
if (includeWidget("widgetBattery") > 0) {
|
||||
layout.put("battery_layout", context.getAssets().open("fossil_hr/battery_layout.json"));
|
||||
}
|
||||
|
||||
LinkedHashMap<String, String> displayName = new LinkedHashMap<>();
|
||||
displayName.put("display_name", watchfaceName);
|
||||
displayName.put("theme_class", "complications");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user