|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.reactnativenavigation.viewcontrollers;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
|
4
|
+import android.content.Context;
|
4
|
5
|
import android.graphics.Color;
|
5
|
6
|
import android.graphics.drawable.ColorDrawable;
|
6
|
7
|
import android.view.View;
|
|
@@ -23,6 +24,9 @@ import com.reactnativenavigation.utils.CommandListenerAdapter;
|
23
|
24
|
import com.reactnativenavigation.utils.ViewUtils;
|
24
|
25
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarBackgroundViewController;
|
25
|
26
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
|
27
|
+import com.reactnativenavigation.views.StackLayout;
|
|
28
|
+import com.reactnativenavigation.views.titlebar.TitleBarReactViewCreator;
|
|
29
|
+import com.reactnativenavigation.views.topbar.TopBar;
|
26
|
30
|
import com.reactnativenavigation.views.topbar.TopBarBackgroundView;
|
27
|
31
|
|
28
|
32
|
import org.json.JSONObject;
|
|
@@ -53,9 +57,17 @@ public class OptionsApplyingTest extends BaseTest {
|
53
|
57
|
(activity1, componentId, componentName) -> view,
|
54
|
58
|
initialNavigationOptions
|
55
|
59
|
);
|
56
|
|
- stackController =
|
57
|
|
- new StackController(activity, new TopBarButtonCreatorMock(), new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewController(activity, new TopBarBackgroundViewCreatorMock()), new TopBarController(), "stack", new Options());
|
|
60
|
+ TopBarController topBarController = new TopBarController() {
|
|
61
|
+ @Override
|
|
62
|
+ protected TopBar createTopBar(Context context, ReactViewCreator buttonCreator, TitleBarReactViewCreator titleBarReactViewCreator, TopBarBackgroundViewController topBarBackgroundViewController, TopBarButtonController.OnClickListener topBarButtonClickListener, StackLayout stackLayout) {
|
|
63
|
+ TopBar topBar = super.createTopBar(context, buttonCreator, titleBarReactViewCreator, topBarBackgroundViewController, topBarButtonClickListener, stackLayout);
|
|
64
|
+ return topBar;
|
|
65
|
+ }
|
|
66
|
+ };
|
|
67
|
+ stackController = new StackController(activity, new TopBarButtonCreatorMock(), new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewController(activity, new TopBarBackgroundViewCreatorMock()), topBarController, "stack", new Options());
|
58
|
68
|
stackController.ensureViewIsCreated();
|
|
69
|
+ stackController.getView().layout(0, 0, 1000, 1000);
|
|
70
|
+ stackController.getTopBar().layout(0, 0, 1000, 100);
|
59
|
71
|
uut.setParentController(stackController);
|
60
|
72
|
}
|
61
|
73
|
|
|
@@ -169,13 +181,13 @@ public class OptionsApplyingTest extends BaseTest {
|
169
|
181
|
uut.options.topBarOptions.title.text = new Text("the title");
|
170
|
182
|
uut.options.topBarOptions.drawBehind = new Bool(false);
|
171
|
183
|
uut.ensureViewIsCreated();
|
|
184
|
+ stackController.ensureViewIsCreated();
|
172
|
185
|
stackController.push(uut, new CommandListenerAdapter() {
|
173
|
186
|
@Override
|
174
|
187
|
public void onSuccess(String childId) {
|
175
|
188
|
uut.onViewAppeared();
|
176
|
|
- RelativeLayout.LayoutParams uutLayoutParams =
|
177
|
|
- (RelativeLayout.LayoutParams) uut.getComponent().asView().getLayoutParams();
|
178
|
|
- assertThat(uutLayoutParams.getRule(BELOW)).isNotEqualTo(0);
|
|
189
|
+ RelativeLayout.LayoutParams uutLayoutParams = (RelativeLayout.LayoutParams) uut.getComponent().asView().getLayoutParams();
|
|
190
|
+ assertThat(uutLayoutParams.topMargin).isNotEqualTo(0);
|
179
|
191
|
|
180
|
192
|
Options opts = new Options();
|
181
|
193
|
opts.topBarOptions.drawBehind = new Bool(true);
|