|
@@ -11,6 +11,7 @@ import com.reactnativenavigation.params.SlidingOverlayParams.Position;
|
11
|
11
|
import com.reactnativenavigation.screens.Screen;
|
12
|
12
|
import com.reactnativenavigation.utils.ViewUtils;
|
13
|
13
|
import com.reactnativenavigation.views.ContentView;
|
|
14
|
+import com.reactnativenavigation.views.utils.ViewMeasurer;
|
14
|
15
|
|
15
|
16
|
public class SlidingOverlay {
|
16
|
17
|
|
|
@@ -47,21 +48,22 @@ public class SlidingOverlay {
|
47
|
48
|
view = createSlidingOverlayView(params);
|
48
|
49
|
parent.addView(view);
|
49
|
50
|
|
50
|
|
- final PeekingAnimator animator = new PeekingAnimator(view, params.position, true);
|
51
|
|
- animator.addListener(new AnimatorListenerAdapter() {
|
52
|
|
- @Override
|
53
|
|
- public void onAnimationCancel(Animator animator) {
|
54
|
|
- onSlidingOverlayShown(view);
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- @Override
|
58
|
|
- public void onAnimationEnd(Animator animator) {
|
59
|
|
- onSlidingOverlayShown(view);
|
60
|
|
- }
|
61
|
|
- });
|
62
|
51
|
view.setOnDisplayListener(new Screen.OnDisplayListener() {
|
63
|
52
|
@Override
|
64
|
53
|
public void onDisplay() {
|
|
54
|
+ final PeekingAnimator animator = new PeekingAnimator(view, params.position, true);
|
|
55
|
+ animator.addListener(new AnimatorListenerAdapter() {
|
|
56
|
+ @Override
|
|
57
|
+ public void onAnimationCancel(Animator animator) {
|
|
58
|
+ onSlidingOverlayShown(view);
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ @Override
|
|
62
|
+ public void onAnimationEnd(Animator animator) {
|
|
63
|
+ onSlidingOverlayShown(view);
|
|
64
|
+ }
|
|
65
|
+ });
|
|
66
|
+
|
65
|
67
|
view.setVisibility(View.VISIBLE);
|
66
|
68
|
visibilityState = VisibilityState.AnimateShow;
|
67
|
69
|
animator.animate();
|
|
@@ -106,12 +108,11 @@ public class SlidingOverlay {
|
106
|
108
|
}
|
107
|
109
|
|
108
|
110
|
protected ContentView createSlidingOverlayView(SlidingOverlayParams params) {
|
109
|
|
- final float heightPixels = ViewUtils.convertDpToPixel(100);
|
110
|
|
-
|
111
|
|
- final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, (int) heightPixels);
|
|
111
|
+ final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
112
|
112
|
lp.addRule(params.position == Position.Top ? RelativeLayout.ALIGN_PARENT_TOP : RelativeLayout.ALIGN_PARENT_BOTTOM);
|
113
|
113
|
|
114
|
114
|
final ContentView view = new ContentView(parent.getContext(), params.screenInstanceId, params.navigationParams);
|
|
115
|
+ view.setViewMeasurer(new OverlayViewMeasurer(view));
|
115
|
116
|
view.setLayoutParams(lp);
|
116
|
117
|
view.setVisibility(View.INVISIBLE);
|
117
|
118
|
return view;
|