|
@@ -2,8 +2,6 @@ package com.reactnativenavigation.views;
|
2
|
2
|
|
3
|
3
|
import android.annotation.SuppressLint;
|
4
|
4
|
import android.content.Context;
|
5
|
|
-import android.support.annotation.RestrictTo;
|
6
|
|
-import android.support.v4.view.ViewPager;
|
7
|
5
|
import android.widget.RelativeLayout;
|
8
|
6
|
|
9
|
7
|
import com.reactnativenavigation.interfaces.ChildDisappearListener;
|
|
@@ -13,7 +11,6 @@ import com.reactnativenavigation.viewcontrollers.ReactViewCreator;
|
13
|
11
|
import com.reactnativenavigation.viewcontrollers.TopBarButtonController;
|
14
|
12
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
15
|
13
|
import com.reactnativenavigation.views.titlebar.TitleBarReactViewCreator;
|
16
|
|
-import com.reactnativenavigation.views.topbar.TopBar;
|
17
|
14
|
import com.reactnativenavigation.views.topbar.TopBarBackgroundViewCreator;
|
18
|
15
|
|
19
|
16
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
@@ -21,20 +18,18 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
21
|
18
|
|
22
|
19
|
@SuppressLint("ViewConstructor")
|
23
|
20
|
public class StackLayout extends RelativeLayout {
|
24
|
|
- private TopBarController topBarController;
|
25
|
21
|
private String stackId;
|
26
|
22
|
private final OptionsPresenter optionsPresenter;
|
27
|
23
|
|
28
|
24
|
public StackLayout(Context context, ReactViewCreator topBarButtonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarBackgroundViewCreator topBarBackgroundViewCreator, TopBarController topBarController, TopBarButtonController.OnClickListener topBarButtonClickListener, String stackId) {
|
29
|
25
|
super(context);
|
30
|
|
- this.topBarController = topBarController;
|
31
|
26
|
this.stackId = stackId;
|
32
|
|
- createLayout(topBarButtonCreator, titleBarReactViewCreator, topBarBackgroundViewCreator, topBarButtonClickListener);
|
|
27
|
+ createLayout(topBarButtonCreator, titleBarReactViewCreator, topBarBackgroundViewCreator, topBarController, topBarButtonClickListener);
|
33
|
28
|
optionsPresenter = new OptionsPresenter(topBarController.getTopBar());
|
34
|
29
|
setContentDescription("StackLayout");
|
35
|
30
|
}
|
36
|
31
|
|
37
|
|
- private void createLayout(ReactViewCreator buttonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarBackgroundViewCreator BackgroundViewCreator, TopBarButtonController.OnClickListener topBarButtonClickListener) {
|
|
32
|
+ private void createLayout(ReactViewCreator buttonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarBackgroundViewCreator BackgroundViewCreator, TopBarController topBarController, TopBarButtonController.OnClickListener topBarButtonClickListener) {
|
38
|
33
|
addView(topBarController.createTopBar(getContext(), buttonCreator, titleBarReactViewCreator, BackgroundViewCreator, topBarButtonClickListener, this), MATCH_PARENT, WRAP_CONTENT);
|
39
|
34
|
}
|
40
|
35
|
|
|
@@ -50,19 +45,6 @@ public class StackLayout extends RelativeLayout {
|
50
|
45
|
optionsPresenter.onChildWillDisappear(disappearing, appearing, childDisappearListener);
|
51
|
46
|
}
|
52
|
47
|
|
53
|
|
- public void initTopTabs(ViewPager viewPager) {
|
54
|
|
- topBarController.initTopTabs(viewPager);
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- public void clearTopTabs() {
|
58
|
|
- topBarController.clearTopTabs();
|
59
|
|
- }
|
60
|
|
-
|
61
|
|
- @RestrictTo(RestrictTo.Scope.TESTS)
|
62
|
|
- public TopBar getTopBar() {
|
63
|
|
- return topBarController.getTopBar();
|
64
|
|
- }
|
65
|
|
-
|
66
|
48
|
public void mergeChildOptions(Options options, Component child) {
|
67
|
49
|
optionsPresenter.mergeChildOptions(options, child);
|
68
|
50
|
}
|