|
@@ -1,5 +1,7 @@
|
1
|
1
|
package com.reactnativenavigation.presentation;
|
2
|
2
|
|
|
3
|
+import com.reactnativenavigation.anim.BottomTabsAnimator;
|
|
4
|
+import com.reactnativenavigation.parse.AnimationsOptions;
|
3
|
5
|
import com.reactnativenavigation.parse.BottomTabOptions;
|
4
|
6
|
import com.reactnativenavigation.parse.BottomTabsOptions;
|
5
|
7
|
import com.reactnativenavigation.parse.Options;
|
|
@@ -9,14 +11,16 @@ import com.reactnativenavigation.views.BottomTabs;
|
9
|
11
|
public class BottomTabsOptionsPresenter {
|
10
|
12
|
private BottomTabs bottomTabs;
|
11
|
13
|
private BottomTabFinder bottomTabFinder;
|
|
14
|
+ private BottomTabsAnimator animator;
|
12
|
15
|
|
13
|
16
|
public BottomTabsOptionsPresenter(BottomTabs bottomTabs, BottomTabFinder bottomTabFinder) {
|
14
|
17
|
this.bottomTabs = bottomTabs;
|
15
|
18
|
this.bottomTabFinder = bottomTabFinder;
|
|
19
|
+ animator = new BottomTabsAnimator(bottomTabs);
|
16
|
20
|
}
|
17
|
21
|
|
18
|
22
|
public void present(Options options) {
|
19
|
|
- applyBottomTabsOptions(options.bottomTabsOptions);
|
|
23
|
+ applyBottomTabsOptions(options.bottomTabsOptions, options.animationsOptions);
|
20
|
24
|
}
|
21
|
25
|
|
22
|
26
|
public void present(Options options, int tabIndex) {
|
|
@@ -29,7 +33,7 @@ public class BottomTabsOptionsPresenter {
|
29
|
33
|
}
|
30
|
34
|
}
|
31
|
35
|
|
32
|
|
- private void applyBottomTabsOptions(BottomTabsOptions options) {
|
|
36
|
+ private void applyBottomTabsOptions(BottomTabsOptions options, AnimationsOptions animationsOptions) {
|
33
|
37
|
if (options.backgroundColor.hasValue()) {
|
34
|
38
|
bottomTabs.setBackgroundColor(options.backgroundColor.get());
|
35
|
39
|
}
|
|
@@ -50,10 +54,19 @@ public class BottomTabsOptionsPresenter {
|
50
|
54
|
if (tabIndex >= 0) bottomTabs.setCurrentItem(tabIndex);
|
51
|
55
|
}
|
52
|
56
|
if (options.visible.isTrueOrUndefined()) {
|
53
|
|
- bottomTabs.restoreBottomNavigation(options.animate.isTrueOrUndefined());
|
|
57
|
+ if (options.animate.isTrueOrUndefined()) {
|
|
58
|
+ animator.show(animationsOptions);
|
|
59
|
+ } else {
|
|
60
|
+ bottomTabs.restoreBottomNavigation(false);
|
|
61
|
+ }
|
54
|
62
|
}
|
55
|
63
|
if (options.visible.isFalse()) {
|
56
|
|
- bottomTabs.hideBottomNavigation(options.animate.isTrueOrUndefined());
|
|
64
|
+ if (options.animate.isTrueOrUndefined()) {
|
|
65
|
+ animator.hide(animationsOptions);
|
|
66
|
+ } else {
|
|
67
|
+ bottomTabs.hideBottomNavigation(false);
|
|
68
|
+ }
|
57
|
69
|
}
|
58
|
70
|
}
|
|
71
|
+
|
59
|
72
|
}
|