Browse Source

StatusBar options

Guy Carmeli 6 years ago
parent
commit
955693d6d6

+ 5
- 0
lib/android/app/src/main/java/com/reactnativenavigation/parse/Options.java View File

36
         result.animations = AnimationsOptions.parse(json.optJSONObject("animations"));
36
         result.animations = AnimationsOptions.parse(json.optJSONObject("animations"));
37
         result.screenBackgroundColor = ColorParser.parse(json, "screenBackgroundColor");
37
         result.screenBackgroundColor = ColorParser.parse(json, "screenBackgroundColor");
38
         result.modal = ModalOptions.parse(json);
38
         result.modal = ModalOptions.parse(json);
39
+        result.statusBar = StatusBarOptions.parse(json);
39
 
40
 
40
         return result.withDefaultOptions(defaultOptions);
41
         return result.withDefaultOptions(defaultOptions);
41
     }
42
     }
52
     @NonNull public SideMenuRootOptions sideMenuRootOptions = new SideMenuRootOptions();
53
     @NonNull public SideMenuRootOptions sideMenuRootOptions = new SideMenuRootOptions();
53
     @NonNull public Color screenBackgroundColor = new NullColor();
54
     @NonNull public Color screenBackgroundColor = new NullColor();
54
     @NonNull public ModalOptions modal = new ModalOptions();
55
     @NonNull public ModalOptions modal = new ModalOptions();
56
+    @NonNull public StatusBarOptions statusBar = new StatusBarOptions();
55
 
57
 
56
     void setTopTabIndex(int i) {
58
     void setTopTabIndex(int i) {
57
         topTabOptions.tabIndex = i;
59
         topTabOptions.tabIndex = i;
72
         result.animations.mergeWith(animations);
74
         result.animations.mergeWith(animations);
73
         result.screenBackgroundColor = screenBackgroundColor;
75
         result.screenBackgroundColor = screenBackgroundColor;
74
         result.modal.mergeWith(modal);
76
         result.modal.mergeWith(modal);
77
+        result.statusBar.mergeWith(statusBar);
75
         return result;
78
         return result;
76
     }
79
     }
77
 
80
 
89
         result.sideMenuRootOptions.mergeWith(other.sideMenuRootOptions);
92
         result.sideMenuRootOptions.mergeWith(other.sideMenuRootOptions);
90
         if (other.screenBackgroundColor.hasValue()) result.screenBackgroundColor = other.screenBackgroundColor;
93
         if (other.screenBackgroundColor.hasValue()) result.screenBackgroundColor = other.screenBackgroundColor;
91
         result.modal.mergeWith(other.modal);
94
         result.modal.mergeWith(other.modal);
95
+        result.statusBar.mergeWith(other.statusBar);
92
         return result;
96
         return result;
93
     }
97
     }
94
 
98
 
104
         sideMenuRootOptions.mergeWithDefault(defaultOptions.sideMenuRootOptions);
108
         sideMenuRootOptions.mergeWithDefault(defaultOptions.sideMenuRootOptions);
105
         if (!screenBackgroundColor.hasValue()) screenBackgroundColor = defaultOptions.screenBackgroundColor;
109
         if (!screenBackgroundColor.hasValue()) screenBackgroundColor = defaultOptions.screenBackgroundColor;
106
         modal.mergeWithDefault(defaultOptions.modal);
110
         modal.mergeWithDefault(defaultOptions.modal);
111
+        statusBar.mergeWithDefault(defaultOptions.statusBar);
107
         return this;
112
         return this;
108
     }
113
     }
109
 
114
 

+ 28
- 0
lib/android/app/src/main/java/com/reactnativenavigation/parse/StatusBarOptions.java View File

1
+package com.reactnativenavigation.parse;
2
+
3
+import com.reactnativenavigation.parse.params.Color;
4
+import com.reactnativenavigation.parse.params.NullColor;
5
+import com.reactnativenavigation.parse.parsers.ColorParser;
6
+
7
+import org.json.JSONObject;
8
+
9
+public class StatusBarOptions {
10
+    public static StatusBarOptions parse(JSONObject json) {
11
+        StatusBarOptions result = new StatusBarOptions();
12
+        if (json == null) return result;
13
+
14
+        result.backgroundColor = ColorParser.parse(json, "statusBarBackgroundColor");
15
+
16
+        return result;
17
+    }
18
+
19
+    public Color backgroundColor = new NullColor();
20
+
21
+    public void mergeWith(StatusBarOptions other) {
22
+        if (other.backgroundColor.hasValue()) backgroundColor = other.backgroundColor;
23
+    }
24
+
25
+    public void mergeWithDefault(StatusBarOptions defaultOptions) {
26
+        if (!backgroundColor.hasValue()) backgroundColor = defaultOptions.backgroundColor;
27
+    }
28
+}

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Param.java View File

3
 public abstract class Param<T> {
3
 public abstract class Param<T> {
4
     protected T value;
4
     protected T value;
5
 
5
 
6
-    public Param(T value) {
6
+    Param(T value) {
7
         this.value = value;
7
         this.value = value;
8
     }
8
     }
9
 
9