Browse Source

Fixes titleBarDisabledButtonColor (#490)

Guy Carmeli 8 years ago
parent
commit
64928654ac

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

12
             color = titleBarButtonColor;
12
             color = titleBarButtonColor;
13
         }
13
         }
14
     }
14
     }
15
+
16
+    public StyleParams.Color getColor() {
17
+        if (enabled) {
18
+            return color;
19
+        }
20
+        return disabledColor.hasColor() ? disabledColor : AppStyle.appStyle.titleBarDisabledButtonColor;
21
+    }
15
 }
22
 }

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

27
         }
27
         }
28
         result.color = getColor(bundle, "color", AppStyle.appStyle.titleBarButtonColor);
28
         result.color = getColor(bundle, "color", AppStyle.appStyle.titleBarButtonColor);
29
         result.disabledColor =
29
         result.disabledColor =
30
-                getColor(bundle, "disabledColor", AppStyle.appStyle.titleBarDisabledButtonColor);
30
+                getColor(bundle, "titleBarDisabledButtonColor", AppStyle.appStyle.titleBarDisabledButtonColor);
31
         result.showAsAction = parseShowAsAction(bundle.getString("showAsAction"));
31
         result.showAsAction = parseShowAsAction(bundle.getString("showAsAction"));
32
         result.enabled = bundle.getBoolean("enabled", true);
32
         result.enabled = bundle.getBoolean("enabled", true);
33
         result.hint = bundle.getString("hint", "");
33
         result.hint = bundle.getString("hint", "");

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

17
 
17
 
18
     protected final Menu menu;
18
     protected final Menu menu;
19
     protected final View parent;
19
     protected final View parent;
20
-    protected TitleBarButtonParams buttonParams;
20
+    TitleBarButtonParams buttonParams;
21
     @Nullable protected String navigatorEventId;
21
     @Nullable protected String navigatorEventId;
22
 
22
 
23
     TitleBarButton(Menu menu, View parent, TitleBarButtonParams buttonParams, @Nullable String navigatorEventId) {
23
     TitleBarButton(Menu menu, View parent, TitleBarButtonParams buttonParams, @Nullable String navigatorEventId) {
37
         return item;
37
         return item;
38
     }
38
     }
39
 
39
 
40
-
41
     private void setIcon(MenuItem item) {
40
     private void setIcon(MenuItem item) {
42
         if (hasIcon()) {
41
         if (hasIcon()) {
43
             item.setIcon(buttonParams.icon);
42
             item.setIcon(buttonParams.icon);
79
 
78
 
80
     private void setTextColorForFoundButtonViews(ArrayList<View> outViews) {
79
     private void setTextColorForFoundButtonViews(ArrayList<View> outViews) {
81
         for (View button : outViews) {
80
         for (View button : outViews) {
82
-            ((TextView) button).setTextColor(buttonParams.color.getColor());
81
+            ((TextView) button).setTextColor(buttonParams.getColor().getColor());
83
         }
82
         }
84
     }
83
     }
85
 
84