Browse Source

Topbar (#2382)

* readme

* doc

* topbar fix

* rm doc

* options presenter fix

* rm userless stuff
Roman Kozlov 7 years ago
parent
commit
3bb5574ccc

+ 3
- 2
lib/android/app/src/main/java/com/reactnativenavigation/anim/StackAnimator.java View File

12
 import android.view.WindowManager;
12
 import android.view.WindowManager;
13
 import android.view.animation.AccelerateInterpolator;
13
 import android.view.animation.AccelerateInterpolator;
14
 import android.view.animation.DecelerateInterpolator;
14
 import android.view.animation.DecelerateInterpolator;
15
+import android.widget.LinearLayout;
15
 
16
 
16
 import com.reactnativenavigation.views.TopBar;
17
 import com.reactnativenavigation.views.TopBar;
17
 
18
 
118
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
119
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
119
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
120
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
120
             int val = (Integer) valueAnimator.getAnimatedValue();
121
             int val = (Integer) valueAnimator.getAnimatedValue();
121
-            ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
122
+			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
122
             layoutParams.height = val;
123
             layoutParams.height = val;
123
             container.setLayoutParams(layoutParams);
124
             container.setLayoutParams(layoutParams);
124
         });
125
         });
164
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
165
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
165
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
166
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
166
             int val = (Integer) valueAnimator.getAnimatedValue();
167
             int val = (Integer) valueAnimator.getAnimatedValue();
167
-            ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
168
+			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
168
             layoutParams.height = val;
169
             layoutParams.height = val;
169
             container.setLayoutParams(layoutParams);
170
             container.setLayoutParams(layoutParams);
170
         });
171
         });

+ 4
- 8
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java View File

26
 	}
26
 	}
27
 
27
 
28
 	private void start() {
28
 	private void start() {
29
-		setEventListener(new ReactRootView.ReactRootViewEventListener() {
30
-
31
-			@Override
32
-			public void onAttachedToReactInstance(final ReactRootView reactRootView) {
33
-				reactRootView.setEventListener(null);
34
-				isAttachedToReactInstance = true;
35
-			}
36
-		});
29
+		setEventListener(reactRootView -> {
30
+            reactRootView.setEventListener(null);
31
+            isAttachedToReactInstance = true;
32
+        });
37
 		final Bundle opts = new Bundle();
33
 		final Bundle opts = new Bundle();
38
 		opts.putString("containerId", containerId);
34
 		opts.putString("containerId", containerId);
39
 		startReactApplication(reactInstanceManager, containerName, opts);
35
 		startReactApplication(reactInstanceManager, containerName, opts);

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java View File

89
 	@Override
89
 	@Override
90
 	public void mergeNavigationOptions(NavigationOptions options) {
90
 	public void mergeNavigationOptions(NavigationOptions options) {
91
 		navigationOptions.mergeWith(options);
91
 		navigationOptions.mergeWith(options);
92
-        container.applyOptions(options);
92
+        container.applyOptions(navigationOptions);
93
 	}
93
 	}
94
 
94
 
95
 	NavigationOptions getNavigationOptions() {
95
 	NavigationOptions getNavigationOptions() {

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerLayout.java View File

21
 		super(context);
21
 		super(context);
22
 		this.topBar = new TopBar(context);
22
 		this.topBar = new TopBar(context);
23
 		this.reactView = reactView;
23
 		this.reactView = reactView;
24
-        optionsPresenter = new OptionsPresenter(topBar, this);
24
+        optionsPresenter = new OptionsPresenter(topBar, reactView.asView());
25
         initViews();
25
         initViews();
26
 	}
26
 	}
27
 
27
 
61
         optionsPresenter.applyOptions(options);
61
         optionsPresenter.applyOptions(options);
62
     }
62
     }
63
 
63
 
64
-    @Override
64
+	@Override
65
     @RestrictTo(RestrictTo.Scope.TESTS)
65
     @RestrictTo(RestrictTo.Scope.TESTS)
66
     public TopBar getTopBar() {
66
     public TopBar getTopBar() {
67
         return topBar;
67
         return topBar;

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java View File

27
         topBar = new TopBar(context);
27
         topBar = new TopBar(context);
28
         this.tabs = tabs;
28
         this.tabs = tabs;
29
         viewPager = new TopTabsViewPager(context, tabs);
29
         viewPager = new TopTabsViewPager(context, tabs);
30
-        optionsPresenter = new OptionsPresenter(topBar, this);
30
+        optionsPresenter = new OptionsPresenter(topBar, viewPager);
31
         initViews();
31
         initViews();
32
     }
32
     }
33
 
33
 

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerLayout.java View File

16
     public TestContainerLayout(final Context context) {
16
     public TestContainerLayout(final Context context) {
17
 		super(context);
17
 		super(context);
18
         topBar = new TopBar(context);
18
         topBar = new TopBar(context);
19
-        optionsPresenter = new OptionsPresenter(topBar, this);
19
+        optionsPresenter = new OptionsPresenter(topBar, new View(context));
20
     }
20
     }
21
 
21
 
22
     public TopBar getTopBar() {
22
     public TopBar getTopBar() {