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

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

@@ -0,0 +1,28 @@
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,7 +3,7 @@ package com.reactnativenavigation.parse.params;
3 3
 public abstract class Param<T> {
4 4
     protected T value;
5 5
 
6
-    public Param(T value) {
6
+    Param(T value) {
7 7
         this.value = value;
8 8
     }
9 9