|
@@ -19,21 +19,27 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
19
|
19
|
@SuppressLint("ViewConstructor")
|
20
|
20
|
public class StackLayout extends RelativeLayout {
|
21
|
21
|
private TopBar topBar;
|
|
22
|
+ private final OptionsPresenter optionsPresenter;
|
22
|
23
|
|
23
|
24
|
public StackLayout(Context context, ReactViewCreator topBarButtonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarButtonController.OnClickListener topBarButtonClickListener) {
|
24
|
25
|
super(context);
|
25
|
|
- topBar = new TopBar(context, topBarButtonCreator, titleBarReactViewCreator, topBarButtonClickListener, this);
|
|
26
|
+ createLayout(topBarButtonCreator, titleBarReactViewCreator, topBarButtonClickListener);
|
|
27
|
+ optionsPresenter = new OptionsPresenter(topBar);
|
|
28
|
+ setContentDescription("StackLayout");
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ private void createLayout(ReactViewCreator topBarButtonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarButtonController.OnClickListener topBarButtonClickListener) {
|
|
32
|
+ topBar = new TopBar(getContext(), topBarButtonCreator, titleBarReactViewCreator, topBarButtonClickListener, this);
|
26
|
33
|
topBar.setId(CompatUtils.generateViewId());
|
27
|
34
|
addView(topBar, MATCH_PARENT, WRAP_CONTENT);
|
28
|
|
- setContentDescription("StackLayout");
|
29
|
35
|
}
|
30
|
36
|
|
31
|
|
- public void applyOptions(Options options) {
|
32
|
|
- new OptionsPresenter(topBar).applyOrientation(options.orientationOptions);
|
|
37
|
+ public void applyChildOptions(Options options) {
|
|
38
|
+ optionsPresenter.applyOrientation(options.orientationOptions);
|
33
|
39
|
}
|
34
|
40
|
|
35
|
|
- public void applyOptions(Options options, Component component) {
|
36
|
|
- new OptionsPresenter(topBar, component).applyOptions(options);
|
|
41
|
+ public void applyChildOptions(Options options, Component child) {
|
|
42
|
+ optionsPresenter.applyChildOptions(options, child);
|
37
|
43
|
}
|
38
|
44
|
|
39
|
45
|
public void onChildWillDisappear(Options disappearing, Options appearing) {
|
|
@@ -56,9 +62,4 @@ public class StackLayout extends RelativeLayout {
|
56
|
62
|
public TopBar getTopBar() {
|
57
|
63
|
return topBar;
|
58
|
64
|
}
|
59
|
|
-
|
60
|
|
- @RestrictTo(RestrictTo.Scope.TESTS)
|
61
|
|
- public void setTopBar(TopBar topBar) {
|
62
|
|
- this.topBar = topBar;
|
63
|
|
- }
|
64
|
65
|
}
|