Przeglądaj źródła

Fixes titleBarDisabledButtonColor (#490)

Guy Carmeli 8 lat temu
rodzic
commit
64928654ac

+ 7
- 0
android/app/src/main/java/com/reactnativenavigation/params/TitleBarButtonParams.java Wyświetl plik

@@ -12,4 +12,11 @@ public class TitleBarButtonParams extends BaseTitleBarButtonParams {
12 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 Wyświetl plik

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

+ 2
- 3
android/app/src/main/java/com/reactnativenavigation/views/TitleBarButton.java Wyświetl plik

@@ -17,7 +17,7 @@ class TitleBarButton implements MenuItem.OnMenuItemClickListener {
17 17
 
18 18
     protected final Menu menu;
19 19
     protected final View parent;
20
-    protected TitleBarButtonParams buttonParams;
20
+    TitleBarButtonParams buttonParams;
21 21
     @Nullable protected String navigatorEventId;
22 22
 
23 23
     TitleBarButton(Menu menu, View parent, TitleBarButtonParams buttonParams, @Nullable String navigatorEventId) {
@@ -37,7 +37,6 @@ class TitleBarButton implements MenuItem.OnMenuItemClickListener {
37 37
         return item;
38 38
     }
39 39
 
40
-
41 40
     private void setIcon(MenuItem item) {
42 41
         if (hasIcon()) {
43 42
             item.setIcon(buttonParams.icon);
@@ -79,7 +78,7 @@ class TitleBarButton implements MenuItem.OnMenuItemClickListener {
79 78
 
80 79
     private void setTextColorForFoundButtonViews(ArrayList<View> outViews) {
81 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