|
@@ -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
|
}
|