Browse Source

Support navBarTextSubtitleColor on Android

Guy Carmeli 8 years ago
parent
commit
e610223e1c

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

@@ -44,6 +44,7 @@ public class StyleParams {
44 44
 
45 45
     public boolean titleBarHidden;
46 46
     public Color titleBarTitleColor;
47
+    public Color titleBarSubtitleColor;
47 48
     public Color titleBarButtonColor;
48 49
     public Color titleBarDisabledButtonColor;
49 50
     public boolean backButtonHidden;

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

@@ -24,6 +24,7 @@ public class StyleParamsParser {
24 24
         result.topBarColor = getColor("topBarColor", getDefaultTopBarColor());
25 25
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
26 26
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
27
+        result.titleBarSubtitleColor = getColor("titleBarSubtitleColor", getDefaultSubtitleBarColor());
27 28
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
28 29
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
29 30
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
@@ -128,6 +129,10 @@ public class StyleParamsParser {
128 129
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarTitleColor;
129 130
     }
130 131
 
132
+    private StyleParams.Color getDefaultSubtitleBarColor() {
133
+        return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarSubtitleColor;
134
+    }
135
+
131 136
     private StyleParams.Color getTitleBarButtonColor() {
132 137
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarButtonColor;
133 138
     }

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

@@ -57,6 +57,7 @@ public class TitleBar extends Toolbar {
57 57
     public void setStyle(StyleParams params) {
58 58
         setVisibility(params.titleBarHidden ? GONE : VISIBLE);
59 59
         setTitleTextColor(params);
60
+        setSubtitleTextColor(params);
60 61
         colorOverflowButton(params);
61 62
     }
62 63
 
@@ -77,6 +78,12 @@ public class TitleBar extends Toolbar {
77 78
         }
78 79
     }
79 80
 
81
+    private void setSubtitleTextColor(StyleParams params) {
82
+        if (params.titleBarSubtitleColor.hasColor()) {
83
+            setSubtitleTextColor(params.titleBarSubtitleColor.getColor());
84
+        }
85
+    }
86
+
80 87
     private void addButtonsToTitleBar(List<TitleBarButtonParams> rightButtons, String navigatorEventId, Menu menu) {
81 88
         for (int i = 0; i < rightButtons.size(); i++) {
82 89
             final TitleBarButton button = new TitleBarButton(menu, this, rightButtons.get(i), navigatorEventId);

+ 1
- 0
src/deprecated/platformSpecificDeprecated.android.js View File

@@ -115,6 +115,7 @@ function convertStyleParams(originalStyleObject) {
115 115
     topBarColor: originalStyleObject.navBarBackgroundColor,
116 116
     titleBarHidden: originalStyleObject.navBarHidden,
117 117
     titleBarTitleColor: originalStyleObject.navBarTextColor,
118
+    titleBarSubtitleColor: originalStyleObject.navBarTextSubtitleColor,
118 119
     titleBarButtonColor: originalStyleObject.navBarButtonColor,
119 120
     titleBarDisabledButtonColor: originalStyleObject.titleBarDisabledButtonColor,
120 121
     backButtonHidden: originalStyleObject.backButtonHidden,