|
@@ -1,6 +1,5 @@
|
1
|
1
|
package com.reactnativenavigation.screens;
|
2
|
2
|
|
3
|
|
-import android.support.annotation.NonNull;
|
4
|
3
|
import android.support.design.widget.TabLayout;
|
5
|
4
|
import android.support.v4.view.PagerAdapter;
|
6
|
5
|
import android.support.v4.view.ViewPager;
|
|
@@ -18,13 +17,13 @@ import java.util.List;
|
18
|
17
|
|
19
|
18
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
20
|
19
|
|
21
|
|
-public class TabbedScreen extends Screen {
|
|
20
|
+public class ViewPagerScreen extends Screen {
|
22
|
21
|
|
23
|
22
|
private List<ContentView> contentViews;
|
24
|
23
|
private ViewPager viewPager;
|
25
|
24
|
private ContentViewPagerAdapter adapter;
|
26
|
25
|
|
27
|
|
- public TabbedScreen(AppCompatActivity activity, ScreenParams screenParams, TitleBarBackButtonListener backButtonListener) {
|
|
26
|
+ public ViewPagerScreen(AppCompatActivity activity, ScreenParams screenParams, TitleBarBackButtonListener backButtonListener) {
|
28
|
27
|
super(activity, screenParams, backButtonListener);
|
29
|
28
|
}
|
30
|
29
|
|
|
@@ -42,8 +41,7 @@ public class TabbedScreen extends Screen {
|
42
|
41
|
screenParams.passProps,
|
43
|
42
|
screenParams.navigationParams,
|
44
|
43
|
this);
|
45
|
|
- viewPager.addView(contentView, addBelowTopBar());
|
46
|
|
- contentView.init();
|
|
44
|
+ addContent(contentView);
|
47
|
45
|
contentViews.add(contentView);
|
48
|
46
|
}
|
49
|
47
|
|
|
@@ -52,13 +50,12 @@ public class TabbedScreen extends Screen {
|
52
|
50
|
tabLayout.setupWithViewPager(viewPager);
|
53
|
51
|
}
|
54
|
52
|
|
55
|
|
- @NonNull
|
56
|
|
- private LayoutParams addBelowTopBar() {
|
|
53
|
+ private void addContent(ContentView contentView) {
|
57
|
54
|
LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
58
|
|
- if (!screenParams.styleParams.drawUnderTopBar) {
|
|
55
|
+ if (screenParams.styleParams.drawBelowTopBar) {
|
59
|
56
|
params.addRule(BELOW, topBar.getId());
|
60
|
57
|
}
|
61
|
|
- return params;
|
|
58
|
+ viewPager.addView(contentView, params);
|
62
|
59
|
}
|
63
|
60
|
|
64
|
61
|
@Override
|