Browse Source

Set default StatusBarBackgroundColor in OptionsPresenter

This prevents the call to mergeOptions from applying statusBar color even
though it was not declared explicitly by the user.
Guy Carmeli 6 years ago
parent
commit
5e92a8438a

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

1
 package com.reactnativenavigation.parse;
1
 package com.reactnativenavigation.parse;
2
 
2
 
3
 import com.reactnativenavigation.parse.params.Color;
3
 import com.reactnativenavigation.parse.params.Color;
4
+import com.reactnativenavigation.parse.params.NullColor;
4
 import com.reactnativenavigation.parse.parsers.ColorParser;
5
 import com.reactnativenavigation.parse.parsers.ColorParser;
5
 
6
 
6
 import org.json.JSONObject;
7
 import org.json.JSONObject;
15
         return result;
16
         return result;
16
     }
17
     }
17
 
18
 
18
-    public Color backgroundColor = new Color(android.graphics.Color.BLACK);
19
+    public Color backgroundColor = new NullColor();
19
 
20
 
20
     public void mergeWith(StatusBarOptions other) {
21
     public void mergeWith(StatusBarOptions other) {
21
         if (other.backgroundColor.hasValue()) backgroundColor = other.backgroundColor;
22
         if (other.backgroundColor.hasValue()) backgroundColor = other.backgroundColor;

+ 2
- 1
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java View File

1
 package com.reactnativenavigation.presentation;
1
 package com.reactnativenavigation.presentation;
2
 
2
 
3
 import android.app.Activity;
3
 import android.app.Activity;
4
+import android.graphics.Color;
4
 import android.os.Build;
5
 import android.os.Build;
5
 import android.view.View;
6
 import android.view.View;
6
 
7
 
39
 
40
 
40
     private void applyStatusBarOptions(StatusBarOptions statusBar) {
41
     private void applyStatusBarOptions(StatusBarOptions statusBar) {
41
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
42
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
42
-            activity.getWindow().setStatusBarColor(statusBar.backgroundColor.get());
43
+            activity.getWindow().setStatusBarColor(statusBar.backgroundColor.get(Color.BLACK));
43
         }
44
         }
44
     }
45
     }
45
 }
46
 }