Guy Carmeli 6 gadus atpakaļ
vecāks
revīzija
42c3250d77

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java Parādīt failu

@@ -249,12 +249,12 @@ public class StackController extends ParentController<StackLayout> {
249 249
 
250 250
     @Override
251 251
     public void setupTopTabsWithViewPager(ViewPager viewPager) {
252
-        getView().initTopTabs(viewPager);
252
+        topBarController.initTopTabs(viewPager);
253 253
     }
254 254
 
255 255
     @Override
256 256
     public void clearTopTabs() {
257
-        getView().clearTopTabs();
257
+        topBarController.clearTopTabs();
258 258
     }
259 259
 
260 260
      NavigationAnimator createAnimator() {
@@ -263,7 +263,7 @@ public class StackController extends ParentController<StackLayout> {
263 263
 
264 264
     @RestrictTo(RestrictTo.Scope.TESTS)
265 265
     TopBar getTopBar() {
266
-        return getView().getTopBar();
266
+        return topBarController.getTopBar();
267 267
     }
268 268
 
269 269
     @RestrictTo(RestrictTo.Scope.TESTS)

+ 2
- 20
lib/android/app/src/main/java/com/reactnativenavigation/views/StackLayout.java Parādīt failu

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