|
@@ -30,6 +30,7 @@ public class Screen extends JsonObject implements Serializable {
|
30
|
30
|
public static final String KEY_NAVIGATOR_ID = "navigatorID";
|
31
|
31
|
public static final String KEY_NAVIGATOR_EVENT_ID = "navigatorEventID";
|
32
|
32
|
private static final String KEY_ICON = "icon";
|
|
33
|
+ private static final String KEY_NAVIGATOR_BUTTONS = "navigatorButtons";
|
33
|
34
|
private static final String KEY_RIGHT_BUTTONS = "rightButtons";
|
34
|
35
|
private static final String KEY_TOOL_BAR_STYLE = "navigatorStyle";
|
35
|
36
|
private static final String KEY_STATUS_BAR_COLOR = "statusBarColor";
|
|
@@ -90,8 +91,8 @@ public class Screen extends JsonObject implements Serializable {
|
90
|
91
|
|
91
|
92
|
private ArrayList<Button> getButtons(ReadableMap screen) {
|
92
|
93
|
ArrayList<Button> ret = new ArrayList<>();
|
93
|
|
- if (screen.hasKey(KEY_RIGHT_BUTTONS)) {
|
94
|
|
- ReadableArray rightButtons = screen.getArray(KEY_RIGHT_BUTTONS);
|
|
94
|
+ if (hasButtons(screen)) {
|
|
95
|
+ ReadableArray rightButtons = getRightButtons(screen);
|
95
|
96
|
for (int i = 0; i < rightButtons.size(); i++) {
|
96
|
97
|
ret.add(new Button(rightButtons.getMap(i)));
|
97
|
98
|
}
|
|
@@ -99,6 +100,15 @@ public class Screen extends JsonObject implements Serializable {
|
99
|
100
|
return ret;
|
100
|
101
|
}
|
101
|
102
|
|
|
103
|
+ private boolean hasButtons(ReadableMap screen) {
|
|
104
|
+ return screen.hasKey(KEY_RIGHT_BUTTONS) || screen.hasKey(KEY_NAVIGATOR_BUTTONS);
|
|
105
|
+ }
|
|
106
|
+
|
|
107
|
+ private ReadableArray getRightButtons(ReadableMap screen) {
|
|
108
|
+ return screen.hasKey(KEY_RIGHT_BUTTONS) ? screen.getArray(KEY_RIGHT_BUTTONS) :
|
|
109
|
+ screen.getMap(KEY_NAVIGATOR_BUTTONS).getArray(KEY_RIGHT_BUTTONS);
|
|
110
|
+ }
|
|
111
|
+
|
102
|
112
|
public Drawable getIcon(Context ctx) {
|
103
|
113
|
return IconUtils.getIcon(ctx, icon);
|
104
|
114
|
}
|