Guy Carmeli 8 years ago
parent
commit
7abc5f8736
18 changed files with 184 additions and 73 deletions
  1. 1
    1
      android/app/build.gradle
  2. 1
    1
      android/app/src/main/java/com/reactnativenavigation/params/ScreenParams.java
  3. 2
    2
      android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java
  4. 1
    1
      android/app/src/main/java/com/reactnativenavigation/params/TitleBarButtonParams.java
  5. 4
    0
      android/app/src/main/java/com/reactnativenavigation/params/parsers/ActivityParamsParser.java
  6. 1
    1
      android/app/src/main/java/com/reactnativenavigation/params/parsers/ScreenParamsParser.java
  7. 0
    32
      android/app/src/main/java/com/reactnativenavigation/params/parsers/ScreenStyleParamsParser.java
  8. 122
    0
      android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java
  9. 2
    2
      android/app/src/main/java/com/reactnativenavigation/params/parsers/TitleBarButtonParamsParser.java
  10. 1
    1
      android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java
  11. 5
    5
      android/app/src/main/java/com/reactnativenavigation/screens/Screen.java
  12. 2
    2
      android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java
  13. 1
    1
      android/app/src/main/java/com/reactnativenavigation/screens/SingleScreen.java
  14. 1
    1
      android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java
  15. 4
    3
      android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java
  16. 3
    3
      android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java
  17. 2
    2
      android/app/src/main/java/com/reactnativenavigation/views/TopBar.java
  18. 31
    15
      src/deprecated/platformSpecificDeprecated.android.js

+ 1
- 1
android/app/build.gradle View File

46
 
46
 
47
 dependencies {
47
 dependencies {
48
     compile fileTree(dir: "libs", include: ["*.jar"])
48
     compile fileTree(dir: "libs", include: ["*.jar"])
49
-    compile "com.aurelhubert:ahbottomnavigation:1.3.0"
49
+    compile "com.aurelhubert:ahbottomnavigation:1.3.3"
50
     compile "com.android.support:appcompat-v7:23.0.1"
50
     compile "com.android.support:appcompat-v7:23.0.1"
51
     compile 'com.android.support:design:23.1.1'
51
     compile 'com.android.support:design:23.1.1'
52
     compile "com.facebook.react:react-native:+"  // From node_modules
52
     compile "com.facebook.react:react-native:+"  // From node_modules

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/params/ScreenParams.java View File

11
     public List<TitleBarButtonParams> rightButtons;
11
     public List<TitleBarButtonParams> rightButtons;
12
     public TitleBarLeftButtonParams leftButton;
12
     public TitleBarLeftButtonParams leftButton;
13
     public String title;
13
     public String title;
14
-    public ScreenStyleParams styleParams;
14
+    public StyleParams styleParams;
15
     public List<TopTabParams> topTabParams;
15
     public List<TopTabParams> topTabParams;
16
     public String fragmentCreatorClassName;
16
     public String fragmentCreatorClassName;
17
 
17
 

android/app/src/main/java/com/reactnativenavigation/params/ScreenStyleParams.java → android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java View File

2
 
2
 
3
 import android.support.annotation.ColorInt;
3
 import android.support.annotation.ColorInt;
4
 
4
 
5
-public class ScreenStyleParams {
5
+public class StyleParams {
6
     public static class Color {
6
     public static class Color {
7
         @ColorInt
7
         @ColorInt
8
         private int color = -1;
8
         private int color = -1;
41
 
41
 
42
     public Color navigationBarColor;
42
     public Color navigationBarColor;
43
 
43
 
44
-    public boolean drawBelowTopBar;
44
+    public boolean drawScreenBelowTopBar;
45
 }
45
 }

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/params/TitleBarButtonParams.java View File

20
     public String eventId;
20
     public String eventId;
21
     public String label;
21
     public String label;
22
     public Drawable icon;
22
     public Drawable icon;
23
-    public ScreenStyleParams.Color color;
23
+    public StyleParams.Color color;
24
     public ShowAsAction showAsAction;
24
     public ShowAsAction showAsAction;
25
     public boolean enabled = true;
25
     public boolean enabled = true;
26
 }
26
 }

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/ActivityParamsParser.java View File

3
 import android.os.Bundle;
3
 import android.os.Bundle;
4
 
4
 
5
 import com.reactnativenavigation.params.ActivityParams;
5
 import com.reactnativenavigation.params.ActivityParams;
6
+import com.reactnativenavigation.params.StyleParams;
6
 
7
 
7
 public class ActivityParamsParser extends Parser {
8
 public class ActivityParamsParser extends Parser {
8
     public static ActivityParams parse(Bundle params) {
9
     public static ActivityParams parse(Bundle params) {
9
         ActivityParams result = new ActivityParams();
10
         ActivityParams result = new ActivityParams();
11
+
12
+        StyleParamsParser.setAppStyle(params);
13
+
10
         if (hasKey(params, "screen")) {
14
         if (hasKey(params, "screen")) {
11
             result.type = ActivityParams.Type.SingleScreen;
15
             result.type = ActivityParams.Type.SingleScreen;
12
             result.screenParams = ScreenParamsParser.parse(params.getBundle("screen"));
16
             result.screenParams = ScreenParamsParser.parse(params.getBundle("screen"));

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/params/parsers/ScreenParamsParser.java View File

38
             result.leftButton = new TitleBarLeftButtonParamsParser().parseSingleButton(params.getBundle(KEY_LEFT_BUTTON));
38
             result.leftButton = new TitleBarLeftButtonParamsParser().parseSingleButton(params.getBundle(KEY_LEFT_BUTTON));
39
         }
39
         }
40
         result.title = params.getString(KEY_TITLE);
40
         result.title = params.getString(KEY_TITLE);
41
-        result.styleParams = ScreenStyleParamsParser.parse(params.getBundle(STYLE_PARAMS));
41
+        result.styleParams = new StyleParamsParser(params.getBundle(STYLE_PARAMS)).parse();
42
         if (hasKey(params, TOP_TABS)) {
42
         if (hasKey(params, TOP_TABS)) {
43
             result.topTabParams = TopTabParamsParser.parse(params.getBundle(TOP_TABS));
43
             result.topTabParams = TopTabParamsParser.parse(params.getBundle(TOP_TABS));
44
         }
44
         }

+ 0
- 32
android/app/src/main/java/com/reactnativenavigation/params/parsers/ScreenStyleParamsParser.java View File

1
-package com.reactnativenavigation.params.parsers;
2
-
3
-import android.os.Bundle;
4
-
5
-import com.reactnativenavigation.params.ScreenStyleParams;
6
-
7
-public class ScreenStyleParamsParser {
8
-    public static ScreenStyleParams parse(Bundle params) {
9
-        ScreenStyleParams result = new ScreenStyleParams();
10
-        if (params == null) {
11
-            return result;
12
-        }
13
-
14
-        result.statusBarColor = new ScreenStyleParams.Color(ColorParser.parse(params.getString("statusBarColor")));
15
-        result.topBarColor = new ScreenStyleParams.Color(ColorParser.parse(params.getString("topBarColor")));
16
-        result.navigationBarColor = new ScreenStyleParams.Color(ColorParser.parse(params.getString("navigationBarColor")));
17
-        result.titleBarHidden = params.getBoolean("titleBarHidden");
18
-        result.titleBarTitleColor =
19
-                new ScreenStyleParams.Color(ColorParser.parse(params.getString("titleBarTitleColor")));
20
-        result.backButtonHidden = params.getBoolean("backButtonHidden");
21
-        result.topTabsHidden = params.getBoolean("topTabsHidden");
22
-        result.bottomTabsHidden = params.getBoolean("bottomTabsHidden");
23
-        result.bottomTabsHiddenOnScroll = params.getBoolean("bottomTabsHiddenOnScroll");
24
-        result.bottomTabsColor = new ScreenStyleParams.Color(ColorParser.parse(params.getString("bottomTabsColor")));
25
-        result.bottomTabsButtonColor =
26
-                new ScreenStyleParams.Color(ColorParser.parse(params.getString("bottomTabsButtonColor")));
27
-        result.selectedBottomTabsButtonColor =
28
-                new ScreenStyleParams.Color(ColorParser.parse(params.getString("selectedBottomTabsButtonColor")));
29
-        result.drawBelowTopBar = params.getBoolean("drawBelowTopBar", false);
30
-        return result;
31
-    }
32
-}

+ 122
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java View File

1
+package com.reactnativenavigation.params.parsers;
2
+
3
+import android.os.Bundle;
4
+import android.support.annotation.NonNull;
5
+import android.support.annotation.Nullable;
6
+
7
+import com.reactnativenavigation.params.StyleParams;
8
+
9
+public class StyleParamsParser {
10
+    private static StyleParams appStyle;
11
+    private Bundle params;
12
+
13
+    public static void setAppStyle(Bundle params) {
14
+        StyleParamsParser.appStyle = new StyleParamsParser(params.getBundle("appStyle")).parse();
15
+    }
16
+
17
+    public StyleParamsParser(Bundle params) {
18
+        this.params = params;
19
+    }
20
+
21
+    public StyleParams parse() {
22
+        StyleParams result = new StyleParams();
23
+        if (params == null) {
24
+            return result;
25
+        }
26
+
27
+        result.statusBarColor = getColor("statusBarColor", getDefaultStatusBarColor());
28
+
29
+        result.topBarColor = getColor("topBarColor", getDefaultTopBarColor());
30
+        result.titleBarHidden = getBoolean("titleBarHidden", isDefaultTopBarHidden());
31
+        result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
32
+        result.backButtonHidden = getBoolean("backButtonHidden", isDefaultBackButtonHidden());
33
+        result.topTabsHidden = getBoolean("topTabsHidden", isDefaultTopTabsHidden());
34
+
35
+        result.drawScreenBelowTopBar = params.getBoolean("drawBelowTopBar", isDefaultScreenBelowTopBar());
36
+
37
+        result.bottomTabsHidden = getBoolean("bottomTabsHidden", isDefaultBottomTabsHidden());
38
+        result.bottomTabsHiddenOnScroll =
39
+                getBoolean("bottomTabsHiddenOnScroll", isDefaultBottomTabsHiddenOnScroll());
40
+        result.bottomTabsColor = getColor("bottomTabsColor", getDefaultBottomTabsColor());
41
+        result.bottomTabsButtonColor = getColor("bottomTabsButtonColor", getDefaultBottomTabsButtonColor());
42
+        result.selectedBottomTabsButtonColor =
43
+                getColor("selectedBottomTabsButtonColor", getDefaultSelectedBottomTabsButtonColor());
44
+
45
+        result.navigationBarColor = getColor("navigationBarColor", getDefaultNavigationColor());
46
+
47
+        return result;
48
+    }
49
+
50
+    @Nullable
51
+    private StyleParams.Color getDefaultNavigationColor() {
52
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.navigationBarColor;
53
+    }
54
+
55
+    @Nullable
56
+    private StyleParams.Color getDefaultSelectedBottomTabsButtonColor() {
57
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.selectedBottomTabsButtonColor;
58
+    }
59
+
60
+    @Nullable
61
+    private StyleParams.Color getDefaultBottomTabsButtonColor() {
62
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.bottomTabsButtonColor;
63
+    }
64
+
65
+    @Nullable
66
+    private StyleParams.Color getDefaultBottomTabsColor() {
67
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.bottomTabsColor;
68
+    }
69
+
70
+    private boolean isDefaultBottomTabsHiddenOnScroll() {
71
+        return appStyle != null && appStyle.bottomTabsHiddenOnScroll;
72
+    }
73
+
74
+    private boolean isDefaultBottomTabsHidden() {
75
+        return appStyle != null && appStyle.bottomTabsHidden;
76
+    }
77
+
78
+    private boolean isDefaultScreenBelowTopBar() {
79
+        return appStyle == null || appStyle.drawScreenBelowTopBar;
80
+    }
81
+
82
+    private boolean isDefaultTopTabsHidden() {
83
+        return appStyle != null && appStyle.topTabsHidden;
84
+    }
85
+
86
+    private boolean isDefaultBackButtonHidden() {
87
+        return appStyle != null && appStyle.backButtonHidden;
88
+    }
89
+
90
+    @Nullable
91
+    private StyleParams.Color getDefaultTitleBarColor() {
92
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.titleBarTitleColor;
93
+    }
94
+
95
+    private boolean isDefaultTopBarHidden() {
96
+        return appStyle != null && appStyle.titleBarHidden;
97
+    }
98
+
99
+    @Nullable
100
+    private StyleParams.Color getDefaultTopBarColor() {
101
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.topBarColor;
102
+    }
103
+
104
+    @Nullable
105
+    private StyleParams.Color getDefaultStatusBarColor() {
106
+        return appStyle == null ? new StyleParams.Color(-1) : appStyle.statusBarColor;
107
+    }
108
+
109
+    private boolean getBoolean(String titleBarHidden, boolean defaultValue) {
110
+        return params.containsKey(titleBarHidden) ? params.getBoolean(titleBarHidden) : defaultValue;
111
+    }
112
+
113
+    @NonNull
114
+    private StyleParams.Color getColor(String key, StyleParams.Color defaultColor) {
115
+        StyleParams.Color color = new StyleParams.Color(ColorParser.parse(params.getString(key)));
116
+        if (color.hasColor()) {
117
+            return color;
118
+        } else {
119
+            return defaultColor.hasColor() ? defaultColor : color;
120
+        }
121
+    }
122
+}

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/params/parsers/TitleBarButtonParamsParser.java View File

2
 
2
 
3
 import android.os.Bundle;
3
 import android.os.Bundle;
4
 
4
 
5
-import com.reactnativenavigation.params.ScreenStyleParams;
5
+import com.reactnativenavigation.params.StyleParams;
6
 import com.reactnativenavigation.params.TitleBarButtonParams;
6
 import com.reactnativenavigation.params.TitleBarButtonParams;
7
 import com.reactnativenavigation.react.ImageLoader;
7
 import com.reactnativenavigation.react.ImageLoader;
8
 
8
 
25
         if (hasKey(bundle,"icon")) {
25
         if (hasKey(bundle,"icon")) {
26
             result.icon = ImageLoader.loadImage(bundle.getString("icon"));
26
             result.icon = ImageLoader.loadImage(bundle.getString("icon"));
27
         }
27
         }
28
-        result.color = new ScreenStyleParams.Color(ColorParser.parse(bundle.getString("color")));
28
+        result.color = new StyleParams.Color(ColorParser.parse(bundle.getString("color")));
29
         result.showAsAction = parseShowAsAction(bundle.getString("showAsAction"));
29
         result.showAsAction = parseShowAsAction(bundle.getString("showAsAction"));
30
         result.enabled = bundle.getBoolean("enabled", true);
30
         result.enabled = bundle.getBoolean("enabled", true);
31
         result.eventId = bundle.getString("id");
31
         result.eventId = bundle.getString("id");

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/screens/FragmentScreen.java View File

41
         ContentView contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, null);
41
         ContentView contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, null);
42
         addView(contentView, 0, 0);
42
         addView(contentView, 0, 0);
43
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
43
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
44
-        if (screenParams.styleParams.drawBelowTopBar) {
44
+        if (screenParams.styleParams.drawScreenBelowTopBar) {
45
             params.addRule(BELOW, topBar.getId());
45
             params.addRule(BELOW, topBar.getId());
46
         }
46
         }
47
         addView(content, params);
47
         addView(content, params);

+ 5
- 5
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java View File

11
 
11
 
12
 import com.reactnativenavigation.animation.VisibilityAnimator;
12
 import com.reactnativenavigation.animation.VisibilityAnimator;
13
 import com.reactnativenavigation.params.ScreenParams;
13
 import com.reactnativenavigation.params.ScreenParams;
14
-import com.reactnativenavigation.params.ScreenStyleParams;
14
+import com.reactnativenavigation.params.StyleParams;
15
 import com.reactnativenavigation.params.TitleBarButtonParams;
15
 import com.reactnativenavigation.params.TitleBarButtonParams;
16
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
16
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
17
 import com.reactnativenavigation.utils.SdkSupports;
17
 import com.reactnativenavigation.utils.SdkSupports;
74
         });
74
         });
75
     }
75
     }
76
 
76
 
77
-    private void setStyle(ScreenStyleParams styleParams) {
77
+    private void setStyle(StyleParams styleParams) {
78
         setStatusBarColor(styleParams.statusBarColor);
78
         setStatusBarColor(styleParams.statusBarColor);
79
         setNavigationBarColor(styleParams.navigationBarColor);
79
         setNavigationBarColor(styleParams.navigationBarColor);
80
         topBar.setStyle(styleParams);
80
         topBar.setStyle(styleParams);
81
     }
81
     }
82
 
82
 
83
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
83
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
84
-    private void setStatusBarColor(ScreenStyleParams.Color statusBarColor) {
84
+    private void setStatusBarColor(StyleParams.Color statusBarColor) {
85
         if (!SdkSupports.lollipop()) {
85
         if (!SdkSupports.lollipop()) {
86
             return;
86
             return;
87
         }
87
         }
96
     }
96
     }
97
 
97
 
98
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
98
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
99
-    public void setNavigationBarColor(ScreenStyleParams.Color navigationBarColor) {
99
+    public void setNavigationBarColor(StyleParams.Color navigationBarColor) {
100
         if (!SdkSupports.lollipop()) {
100
         if (!SdkSupports.lollipop()) {
101
             return;
101
             return;
102
         }
102
         }
154
         topBar.setTitleBarRightButton(navigatorEventId, backButtonListener, titleBarLeftButtonParams);
154
         topBar.setTitleBarRightButton(navigatorEventId, backButtonListener, titleBarLeftButtonParams);
155
     }
155
     }
156
 
156
 
157
-    public ScreenStyleParams getStyleParams() {
157
+    public StyleParams getStyleParams() {
158
         return screenParams.styleParams;
158
         return screenParams.styleParams;
159
     }
159
     }
160
 }
160
 }

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/screens/ScreenStack.java View File

5
 import android.widget.FrameLayout;
5
 import android.widget.FrameLayout;
6
 
6
 
7
 import com.reactnativenavigation.params.ScreenParams;
7
 import com.reactnativenavigation.params.ScreenParams;
8
-import com.reactnativenavigation.params.ScreenStyleParams;
8
+import com.reactnativenavigation.params.StyleParams;
9
 import com.reactnativenavigation.params.TitleBarButtonParams;
9
 import com.reactnativenavigation.params.TitleBarButtonParams;
10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
11
 import com.reactnativenavigation.utils.Task;
11
 import com.reactnativenavigation.utils.Task;
134
         }
134
         }
135
     }
135
     }
136
 
136
 
137
-    public ScreenStyleParams getCurrentScreenStyleParams() {
137
+    public StyleParams getCurrentScreenStyleParams() {
138
         return stack.peek().getStyleParams();
138
         return stack.peek().getStyleParams();
139
     }
139
     }
140
 
140
 

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/screens/SingleScreen.java View File

21
     protected void createContent() {
21
     protected void createContent() {
22
         contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, this);
22
         contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, screenParams.navigationParams, this);
23
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
23
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
24
-        if (screenParams.styleParams.drawBelowTopBar) {
24
+        if (screenParams.styleParams.drawScreenBelowTopBar) {
25
             params.addRule(BELOW, topBar.getId());
25
             params.addRule(BELOW, topBar.getId());
26
         }
26
         }
27
         addView(contentView, params);
27
         addView(contentView, params);

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/screens/ViewPagerScreen.java View File

52
 
52
 
53
     private void addContent(ContentView contentView) {
53
     private void addContent(ContentView contentView) {
54
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
54
         LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
55
-        if (screenParams.styleParams.drawBelowTopBar) {
55
+        if (screenParams.styleParams.drawScreenBelowTopBar) {
56
             params.addRule(BELOW, topBar.getId());
56
             params.addRule(BELOW, topBar.getId());
57
         }
57
         }
58
         viewPager.addView(contentView, params);
58
         viewPager.addView(contentView, params);

+ 4
- 3
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java View File

6
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
6
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
7
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
7
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
8
 import com.reactnativenavigation.params.ScreenParams;
8
 import com.reactnativenavigation.params.ScreenParams;
9
-import com.reactnativenavigation.params.ScreenStyleParams;
9
+import com.reactnativenavigation.params.StyleParams;
10
 
10
 
11
 import java.util.List;
11
 import java.util.List;
12
 
12
 
25
         }
25
         }
26
     }
26
     }
27
 
27
 
28
-    public void setStyleFromScreen(ScreenStyleParams params) {
28
+    public void setStyleFromScreen(StyleParams params) {
29
         setBackgroundColor(params.bottomTabsColor);
29
         setBackgroundColor(params.bottomTabsColor);
30
+
30
         if (params.bottomTabsButtonColor.hasColor()) {
31
         if (params.bottomTabsButtonColor.hasColor()) {
31
             setInactiveColor(params.bottomTabsButtonColor.getColor());
32
             setInactiveColor(params.bottomTabsButtonColor.getColor());
32
         }
33
         }
36
         }
37
         }
37
     }
38
     }
38
 
39
 
39
-    private void setBackgroundColor(ScreenStyleParams.Color bottomTabsColor) {
40
+    private void setBackgroundColor(StyleParams.Color bottomTabsColor) {
40
         if (bottomTabsColor.hasColor()) {
41
         if (bottomTabsColor.hasColor()) {
41
             setDefaultBackgroundColor(bottomTabsColor.getColor());
42
             setDefaultBackgroundColor(bottomTabsColor.getColor());
42
         } else {
43
         } else {

+ 3
- 3
android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java View File

5
 import android.view.Menu;
5
 import android.view.Menu;
6
 
6
 
7
 import com.reactnativenavigation.animation.VisibilityAnimator;
7
 import com.reactnativenavigation.animation.VisibilityAnimator;
8
-import com.reactnativenavigation.params.ScreenStyleParams;
8
+import com.reactnativenavigation.params.StyleParams;
9
 import com.reactnativenavigation.params.TitleBarButtonParams;
9
 import com.reactnativenavigation.params.TitleBarButtonParams;
10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
11
 
11
 
41
         }
41
         }
42
     }
42
     }
43
 
43
 
44
-    public void setStyle(ScreenStyleParams params) {
44
+    public void setStyle(StyleParams params) {
45
         setVisibility(params.titleBarHidden ? GONE : VISIBLE);
45
         setVisibility(params.titleBarHidden ? GONE : VISIBLE);
46
         setTitleTextColor(params);
46
         setTitleTextColor(params);
47
     }
47
     }
48
 
48
 
49
-    private void setTitleTextColor(ScreenStyleParams params) {
49
+    private void setTitleTextColor(StyleParams params) {
50
         if (params.titleBarTitleColor.hasColor()) {
50
         if (params.titleBarTitleColor.hasColor()) {
51
             setTitleTextColor(params.titleBarTitleColor.getColor());
51
             setTitleTextColor(params.titleBarTitleColor.getColor());
52
         }
52
         }

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/views/TopBar.java View File

4
 import android.support.design.widget.AppBarLayout;
4
 import android.support.design.widget.AppBarLayout;
5
 import android.support.design.widget.TabLayout;
5
 import android.support.design.widget.TabLayout;
6
 
6
 
7
-import com.reactnativenavigation.params.ScreenStyleParams;
7
+import com.reactnativenavigation.params.StyleParams;
8
 import com.reactnativenavigation.params.TitleBarButtonParams;
8
 import com.reactnativenavigation.params.TitleBarButtonParams;
9
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
9
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10
 import com.reactnativenavigation.utils.ViewUtils;
10
 import com.reactnativenavigation.utils.ViewUtils;
35
         titleBar.setTitle(title);
35
         titleBar.setTitle(title);
36
     }
36
     }
37
 
37
 
38
-    public void setStyle(ScreenStyleParams styleParams) {
38
+    public void setStyle(StyleParams styleParams) {
39
         if (styleParams.topBarColor.hasColor()) {
39
         if (styleParams.topBarColor.hasColor()) {
40
             setBackgroundColor(styleParams.topBarColor.getColor());
40
             setBackgroundColor(styleParams.topBarColor.getColor());
41
         }
41
         }

+ 31
- 15
src/deprecated/platformSpecificDeprecated.android.js View File

24
   /*
24
   /*
25
    * adapt to new API
25
    * adapt to new API
26
    */
26
    */
27
+  console.log('0');
27
   screen.screenId = screen.screen;
28
   screen.screenId = screen.screen;
28
   params.screen = adaptNavigationStyleToScreenStyle(screen);
29
   params.screen = adaptNavigationStyleToScreenStyle(screen);
29
   params.screen = adaptNavigationParams(screen);
30
   params.screen = adaptNavigationParams(screen);
31
+  params.appStyle = convertStyleParams(params.appStyle);
30
 
32
 
31
   newPlatformSpecific.startApp(params);
33
   newPlatformSpecific.startApp(params);
32
 }
34
 }
81
     return screen;
83
     return screen;
82
   }
84
   }
83
 
85
 
84
-  screen.styleParams = {
85
-    statusBarColor: navigatorStyle.statusBarColor,
86
-    topBarColor: navigatorStyle.toolBarColor,
87
-    navigationBarColor: navigatorStyle.navigationBarColor,
88
-    titleBarHidden: navigatorStyle.navBarHidden,
89
-    titleBarTitleColor: navigatorStyle.navBarTextColor,
90
-    backButtonHidden: navigatorStyle.backButtonHidden,
91
-    topTabsHidden: navigatorStyle.topTabsHidden,
92
-    bottomTabsHidden: navigatorStyle.tabBarHidden,
93
-    bottomTabsHiddenOnScroll: navigatorStyle.bottomTabsHiddenOnScroll,
94
-    drawBelowTopBar: !navigatorStyle.drawUnderNavBar,
95
-    bottomTabsColor: navigatorStyle.tabBarBackgroundColor,
96
-    bottomTabsButtonColor: navigatorStyle.tabBarButtonColor,
97
-    selectedBottomTabsButtonColor: navigatorStyle.tabBarButtonColor
98
-  };
86
+  screen.styleParams = convertStyleParams(navigatorStyle);
99
 
87
 
100
   return _.omit(screen, ['navigatorStyle']);
88
   return _.omit(screen, ['navigatorStyle']);
101
 }
89
 }
102
 
90
 
91
+function convertStyleParams(originalStyleObject) {
92
+  if (!originalStyleObject) {
93
+    return null;
94
+  }
95
+
96
+  return {
97
+    statusBarColor: originalStyleObject.statusBarColor,
98
+    topBarColor: originalStyleObject.toolBarColor,
99
+    navigationBarColor: originalStyleObject.navigationBarColor,
100
+    titleBarHidden: originalStyleObject.navBarHidden,
101
+    titleBarTitleColor: originalStyleObject.navBarTextColor,
102
+    backButtonHidden: originalStyleObject.backButtonHidden,
103
+    topTabsHidden: originalStyleObject.topTabsHidden,
104
+    bottomTabsHidden: originalStyleObject.tabBarHidden,
105
+    bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
106
+    drawBelowTopBar: !originalStyleObject.drawUnderNavBar,
107
+    bottomTabsColor: originalStyleObject.tabBarBackgroundColor,
108
+    bottomTabsButtonColor: originalStyleObject.tabBarButtonColor,
109
+    selectedBottomTabsButtonColor: originalStyleObject.tabBarSelectedButtonColor
110
+  }
111
+}
112
+
103
 function adaptNavigationParams(screen) {
113
 function adaptNavigationParams(screen) {
104
   screen.navigationParams = {
114
   screen.navigationParams = {
105
     screenInstanceID: screen.screenInstanceID,
115
     screenInstanceID: screen.screenInstanceID,
128
     tab.screen = adaptNavigationParams(tab);
138
     tab.screen = adaptNavigationParams(tab);
129
   });
139
   });
130
 
140
 
141
+  params.appStyle = convertStyleParams(params.appStyle);
142
+
143
+  console.log('appStyle.bottomTabsButtonColor', params.appStyle.bottomTabsButtonColor);
144
+  console.log('appStyle.bottomTabsColor', params.appStyle.bottomTabsColor);
145
+  console.log('appStyle.selectedBottomTabsButtonColor', params.appStyle.selectedBottomTabsButtonColor);
146
+
131
   // TODO: add drawer params
147
   // TODO: add drawer params
132
   newPlatformSpecific.startApp(params);
148
   newPlatformSpecific.startApp(params);
133
 }
149
 }