|
|
@@ -9,14 +9,11 @@ import android.util.Log;
|
|
9
|
9
|
import android.view.Window;
|
|
10
|
10
|
import android.widget.RelativeLayout;
|
|
11
|
11
|
|
|
12
|
|
-import com.reactnativenavigation.animation.VisibilityAnimator;
|
|
13
|
12
|
import com.reactnativenavigation.params.ScreenParams;
|
|
14
|
13
|
import com.reactnativenavigation.params.StyleParams;
|
|
15
|
14
|
import com.reactnativenavigation.params.TitleBarButtonParams;
|
|
16
|
15
|
import com.reactnativenavigation.params.TitleBarLeftButtonParams;
|
|
17
|
16
|
import com.reactnativenavigation.utils.SdkSupports;
|
|
18
|
|
-import com.reactnativenavigation.utils.ViewUtils;
|
|
19
|
|
-import com.reactnativenavigation.views.ScrollDirectionListener;
|
|
20
|
17
|
import com.reactnativenavigation.views.TitleBarBackButtonListener;
|
|
21
|
18
|
import com.reactnativenavigation.views.TopBar;
|
|
22
|
19
|
|
|
|
@@ -25,13 +22,12 @@ import java.util.List;
|
|
25
|
22
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
26
|
23
|
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
27
|
24
|
|
|
28
|
|
-public abstract class Screen extends RelativeLayout implements ScrollDirectionListener.OnScrollChanged {
|
|
|
25
|
+public abstract class Screen extends RelativeLayout {
|
|
29
|
26
|
|
|
30
|
27
|
protected final AppCompatActivity activity;
|
|
31
|
28
|
protected final ScreenParams screenParams;
|
|
32
|
29
|
protected TopBar topBar;
|
|
33
|
30
|
private final TitleBarBackButtonListener titleBarBackButtonListener;
|
|
34
|
|
- private VisibilityAnimator topBarVisibilityAnimator;
|
|
35
|
31
|
|
|
36
|
32
|
public Screen(AppCompatActivity activity, ScreenParams screenParams, TitleBarBackButtonListener titleBarBackButtonListener) {
|
|
37
|
33
|
super(activity);
|
|
|
@@ -59,22 +55,10 @@ public abstract class Screen extends RelativeLayout implements ScrollDirectionLi
|
|
59
|
55
|
|
|
60
|
56
|
private void createTopBar() {
|
|
61
|
57
|
topBar = new TopBar(getContext());
|
|
62
|
|
- createTopBarVisibilityAnimator();
|
|
63
|
58
|
addView(topBar, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
|
|
64
|
59
|
}
|
|
65
|
60
|
|
|
66
|
|
- private void createTopBarVisibilityAnimator() {
|
|
67
|
|
- ViewUtils.runOnPreDraw(topBar, new Runnable() {
|
|
68
|
|
- @Override
|
|
69
|
|
- public void run() {
|
|
70
|
|
- if (topBarVisibilityAnimator == null) {
|
|
71
|
|
- topBarVisibilityAnimator = new VisibilityAnimator(topBar, VisibilityAnimator.HideDirection.Up, topBar.getHeight());
|
|
72
|
|
- }
|
|
73
|
|
- }
|
|
74
|
|
- });
|
|
75
|
|
- }
|
|
76
|
|
-
|
|
77
|
|
- private void setStyle(StyleParams styleParams) {
|
|
|
61
|
+ private void setStyle(ScreenStyleParams styleParams) {
|
|
78
|
62
|
setStatusBarColor(styleParams.statusBarColor);
|
|
79
|
63
|
setNavigationBarColor(styleParams.navigationBarColor);
|
|
80
|
64
|
topBar.setStyle(styleParams);
|
|
|
@@ -122,11 +106,6 @@ public abstract class Screen extends RelativeLayout implements ScrollDirectionLi
|
|
122
|
106
|
Log.d("LOG", "Screen.onDetachedFromWindow " + this);
|
|
123
|
107
|
}
|
|
124
|
108
|
|
|
125
|
|
- @Override
|
|
126
|
|
- public void onScrollChanged(ScrollDirectionListener.Direction direction) {
|
|
127
|
|
- topBarVisibilityAnimator.onScrollChanged(direction);
|
|
128
|
|
- }
|
|
129
|
|
-
|
|
130
|
109
|
public abstract void ensureUnmountOnDetachedFromWindow();
|
|
131
|
110
|
|
|
132
|
111
|
public abstract void preventUnmountOnDetachedFromWindow();
|
|
|
@@ -138,7 +117,7 @@ public abstract class Screen extends RelativeLayout implements ScrollDirectionLi
|
|
138
|
117
|
}
|
|
139
|
118
|
|
|
140
|
119
|
public void setTopBarVisible(boolean visible, boolean animate) {
|
|
141
|
|
- topBarVisibilityAnimator.setVisible(visible, animate);
|
|
|
120
|
+// topBarVisibilityAnimator.setVisible(visible, animate); TODO
|
|
142
|
121
|
}
|
|
143
|
122
|
|
|
144
|
123
|
public void setTitleBarTitle(String title) {
|