瀏覽代碼

Get color from screen when adding TitleBar buttons

Guy Carmeli 8 年之前
父節點
當前提交
84bce86fb2
共有 1 個檔案被更改,包括 13 行新增5 行删除
  1. 13
    5
      android/app/src/main/java/com/reactnativenavigation/screens/Screen.java

+ 13
- 5
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java 查看文件

48
     protected abstract void createContent();
48
     protected abstract void createContent();
49
 
49
 
50
     private void createTitleBar() {
50
     private void createTitleBar() {
51
+        addTitleBarButtons();
52
+        topBar.setTitle(screenParams.title);
53
+    }
54
+
55
+    private void addTitleBarButtons() {
56
+        setButtonColorFromScreen(screenParams.rightButtons);
57
+        if (screenParams.leftButton != null) {
58
+            screenParams.leftButton.setColorFromScreenStyle(screenParams.styleParams.titleBarButtonColor);
59
+        }
51
         topBar.addTitleBarAndSetButtons(screenParams.rightButtons, screenParams.leftButton,
60
         topBar.addTitleBarAndSetButtons(screenParams.rightButtons, screenParams.leftButton,
52
                 titleBarBackButtonListener, screenParams.navigatorEventId);
61
                 titleBarBackButtonListener, screenParams.navigatorEventId);
53
-        topBar.setTitle(screenParams.title);
54
     }
62
     }
55
 
63
 
56
     private void createTopBar() {
64
     private void createTopBar() {
117
     }
125
     }
118
 
126
 
119
     public void setTopBarVisible(boolean visible, boolean animate) {
127
     public void setTopBarVisible(boolean visible, boolean animate) {
120
-//        topBarVisibilityAnimator.setVisible(visible, animate); TODO
128
+        //        topBarVisibilityAnimator.setVisible(visible, animate); TODO
121
     }
129
     }
122
 
130
 
123
     public void setTitleBarTitle(String title) {
131
     public void setTitleBarTitle(String title) {
138
         return screenParams.styleParams;
146
         return screenParams.styleParams;
139
     }
147
     }
140
 
148
 
141
-    private void setButtonColorFromScreen(List<TitleBarButtonParams> titleBarButtonParamses) {
142
-        for (TitleBarButtonParams titleBarButtonParamse : titleBarButtonParamses) {
143
-            titleBarButtonParamse.setColorFromScreenStyle(screenParams.styleParams.titleBarButtonColor);
149
+    private void setButtonColorFromScreen(List<TitleBarButtonParams> titleBarButtonParams) {
150
+        for (TitleBarButtonParams titleBarButtonParam : titleBarButtonParams) {
151
+            titleBarButtonParam.setColorFromScreenStyle(screenParams.styleParams.titleBarButtonColor);
144
         }
152
         }
145
     }
153
     }
146
 }
154
 }