Browse Source

Color overflow button

Overflow button color is based of `options.topBar.rightButtonColor`, this might change in the future.
Guy Carmeli 6 years ago
parent
commit
cf2c6da617

+ 4
- 0
lib/android/app/src/main/java/com/reactnativenavigation/presentation/StackPresenter.java View File

@@ -264,6 +264,8 @@ public class StackPresenter {
264 264
         if (options.buttons.back.visible.isTrue() && !options.buttons.hasLeftButtons()) {
265 265
             topBar.setBackButton(createButtonController(options.buttons.back));
266 266
         }
267
+
268
+        topBar.setOverflowButtonColor(options.rightButtonColor.get(Color.BLACK));
267 269
     }
268 270
 
269 271
     private List<TitleBarButtonController> getOrCreateButtonControllers(@Nullable Map<String, TitleBarButtonController> currentButtons, @Nullable List<Button> buttons) {
@@ -339,6 +341,8 @@ public class StackPresenter {
339 341
         if (buttons.right != null) topBar.setRightButtons(rightButtonControllers);
340 342
         if (buttons.left != null) topBar.setLeftButtons(leftButtonControllers);
341 343
         if (buttons.back.hasValue()) topBar.setBackButton(createButtonController(buttons.back));
344
+
345
+        if (options.rightButtonColor.hasValue()) topBar.setOverflowButtonColor(options.rightButtonColor.get());
342 346
     }
343 347
 
344 348
     @Nullable

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

@@ -2,7 +2,11 @@ package com.reactnativenavigation.views.titlebar;
2 2
 
3 3
 import android.annotation.SuppressLint;
4 4
 import android.content.Context;
5
+import android.graphics.PorterDuff;
6
+import android.graphics.PorterDuffColorFilter;
5 7
 import android.graphics.Typeface;
8
+import android.graphics.drawable.Drawable;
9
+import android.support.v7.widget.ActionMenuView;
6 10
 import android.support.v7.widget.Toolbar;
7 11
 import android.util.Log;
8 12
 import android.view.View;
@@ -184,4 +188,14 @@ public class TitleBar extends Toolbar {
184 188
         lp.height = pixelHeight;
185 189
         setLayoutParams(lp);
186 190
     }
191
+
192
+    public void setOverflowButtonColor(int color) {
193
+        ActionMenuView actionMenuView = ViewUtils.findChildByClass(this, ActionMenuView.class);
194
+        if (actionMenuView != null) {
195
+            Drawable overflowIcon = actionMenuView.getOverflowIcon();
196
+            if (overflowIcon != null) {
197
+                overflowIcon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
198
+            }
199
+        }
200
+    }
187 201
 }

+ 4
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java View File

@@ -314,4 +314,8 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
314 314
     public void setBorderColor(int color) {
315 315
         border.setBackgroundColor(color);
316 316
     }
317
+
318
+    public void setOverflowButtonColor(int color) {
319
+        titleBar.setOverflowButtonColor(color);
320
+    }
317 321
 }