Guy Carmeli пре 8 година
родитељ
комит
6cbd51fe30

+ 10
- 6
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java Прегледај датотеку

@@ -26,14 +26,18 @@ public class BottomTabs extends AHBottomNavigation {
26 26
     }
27 27
 
28 28
     public void setStyleFromScreen(ScreenStyleParams params) {
29
-        if (params.bottomTabsColor.hasColor()) {
30
-            setDefaultBackgroundColor(params.bottomTabsColor.getColor());
31
-        } else {
32
-            setDefaultBackgroundColor(Color.WHITE);
33
-        }
29
+        setBackgroundColor(params.bottomTabsColor);
34 30
 
35
-//        setForceTitlesDisplay(true);
31
+        //        setForceTitlesDisplay(true);
36 32
 //        setInactiveColor(params.bottomTabsButtonColor.getColor());
37 33
 //        setAccentColor(params.selectedBottomTabsButtonColor.getColor());
38 34
     }
35
+
36
+    private void setBackgroundColor(ScreenStyleParams.Color bottomTabsColor) {
37
+        if (bottomTabsColor.hasColor()) {
38
+            setDefaultBackgroundColor(bottomTabsColor.getColor());
39
+        } else {
40
+            setDefaultBackgroundColor(Color.WHITE);
41
+        }
42
+    }
39 43
 }

+ 14
- 9
android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java Прегледај датотеку

@@ -5,6 +5,7 @@ import android.support.v7.widget.Toolbar;
5 5
 import android.view.Menu;
6 6
 
7 7
 import com.reactnativenavigation.animation.VisibilityAnimator;
8
+import com.reactnativenavigation.params.ScreenStyleParams;
8 9
 import com.reactnativenavigation.params.TitleBarButtonParams;
9 10
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10 11
 
@@ -31,6 +32,19 @@ public class TitleBar extends Toolbar {
31 32
         addButtonsToTitleBar(rightButtons, navigatorEventId, menu);
32 33
     }
33 34
 
35
+    public void setLeftButton(TitleBarLeftButtonParams leftButtonParams,
36
+                               TitleBarBackButtonListener titleBarBackButtonListener, String navigatorEventId) {
37
+        if (shouldSetLeftButton(leftButtonParams)) {
38
+            createAndSetLeftButton(leftButtonParams, titleBarBackButtonListener, navigatorEventId);
39
+        } else if (hasLeftButton()) {
40
+            updateLeftButton(leftButtonParams);
41
+        }
42
+    }
43
+
44
+    public void setStyle(ScreenStyleParams params) {
45
+        setVisibility(params.titleBarHidden ? GONE : VISIBLE);
46
+    }
47
+
34 48
     private void addButtonsToTitleBar(List<TitleBarButtonParams> rightButtons, String navigatorEventId, Menu menu) {
35 49
         for (int i = 0; i < rightButtons.size(); i++) {
36 50
             final TitleBarButton button = new TitleBarButton(menu, this, rightButtons.get(i), navigatorEventId);
@@ -43,15 +57,6 @@ public class TitleBar extends Toolbar {
43 57
         button.addToMenu(index);
44 58
     }
45 59
 
46
-    public void setLeftButton(TitleBarLeftButtonParams leftButtonParams,
47
-                               TitleBarBackButtonListener titleBarBackButtonListener, String navigatorEventId) {
48
-        if (shouldSetLeftButton(leftButtonParams)) {
49
-            createAndSetLeftButton(leftButtonParams, titleBarBackButtonListener, navigatorEventId);
50
-        } else if (hasLeftButton()) {
51
-            updateLeftButton(leftButtonParams);
52
-        }
53
-    }
54
-
55 60
     private boolean hasLeftButton() {
56 61
         return leftButton != null;
57 62
     }

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/views/TopBar.java Прегледај датотеку

@@ -40,7 +40,7 @@ public class TopBar extends AppBarLayout {
40 40
             setBackgroundColor(styleParams.topBarColor.getColor());
41 41
         }
42 42
         setVisibility(styleParams.topBarHidden ? GONE : VISIBLE);
43
-        titleBar.setVisibility(styleParams.titleBarHidden ? GONE : VISIBLE);
43
+        titleBar.setStyle(styleParams);
44 44
     }
45 45
 
46 46
     public void setTitleBarRightButtons(String navigatorEventId, List<TitleBarButtonParams> titleBarButtons) {