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
 
44
 
45
     public boolean titleBarHidden;
45
     public boolean titleBarHidden;
46
     public Color titleBarTitleColor;
46
     public Color titleBarTitleColor;
47
+    public Color titleBarSubtitleColor;
47
     public Color titleBarButtonColor;
48
     public Color titleBarButtonColor;
48
     public Color titleBarDisabledButtonColor;
49
     public Color titleBarDisabledButtonColor;
49
     public boolean backButtonHidden;
50
     public boolean backButtonHidden;

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

24
         result.topBarColor = getColor("topBarColor", getDefaultTopBarColor());
24
         result.topBarColor = getColor("topBarColor", getDefaultTopBarColor());
25
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
25
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
26
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
26
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
27
+        result.titleBarSubtitleColor = getColor("titleBarSubtitleColor", getDefaultSubtitleBarColor());
27
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
28
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
28
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
29
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
29
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
30
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
128
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarTitleColor;
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
     private StyleParams.Color getTitleBarButtonColor() {
136
     private StyleParams.Color getTitleBarButtonColor() {
132
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarButtonColor;
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
     public void setStyle(StyleParams params) {
57
     public void setStyle(StyleParams params) {
58
         setVisibility(params.titleBarHidden ? GONE : VISIBLE);
58
         setVisibility(params.titleBarHidden ? GONE : VISIBLE);
59
         setTitleTextColor(params);
59
         setTitleTextColor(params);
60
+        setSubtitleTextColor(params);
60
         colorOverflowButton(params);
61
         colorOverflowButton(params);
61
     }
62
     }
62
 
63
 
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
     private void addButtonsToTitleBar(List<TitleBarButtonParams> rightButtons, String navigatorEventId, Menu menu) {
87
     private void addButtonsToTitleBar(List<TitleBarButtonParams> rightButtons, String navigatorEventId, Menu menu) {
81
         for (int i = 0; i < rightButtons.size(); i++) {
88
         for (int i = 0; i < rightButtons.size(); i++) {
82
             final TitleBarButton button = new TitleBarButton(menu, this, rightButtons.get(i), navigatorEventId);
89
             final TitleBarButton button = new TitleBarButton(menu, this, rightButtons.get(i), navigatorEventId);

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

115
     topBarColor: originalStyleObject.navBarBackgroundColor,
115
     topBarColor: originalStyleObject.navBarBackgroundColor,
116
     titleBarHidden: originalStyleObject.navBarHidden,
116
     titleBarHidden: originalStyleObject.navBarHidden,
117
     titleBarTitleColor: originalStyleObject.navBarTextColor,
117
     titleBarTitleColor: originalStyleObject.navBarTextColor,
118
+    titleBarSubtitleColor: originalStyleObject.navBarTextSubtitleColor,
118
     titleBarButtonColor: originalStyleObject.navBarButtonColor,
119
     titleBarButtonColor: originalStyleObject.navBarButtonColor,
119
     titleBarDisabledButtonColor: originalStyleObject.titleBarDisabledButtonColor,
120
     titleBarDisabledButtonColor: originalStyleObject.titleBarDisabledButtonColor,
120
     backButtonHidden: originalStyleObject.backButtonHidden,
121
     backButtonHidden: originalStyleObject.backButtonHidden,