|
@@ -38,14 +38,21 @@ public class CollapsingTopBarReactHeader extends ContentView implements Collapsi
|
38
|
38
|
listener = scrollListener;
|
39
|
39
|
ViewConfiguration vc = ViewConfiguration.get(context);
|
40
|
40
|
mTouchSlop = vc.getScaledTouchSlop();
|
41
|
|
- createVisibilityAnimator(params.reactViewHeight);
|
|
41
|
+ setViewMeasurer(new CollapsingReactHeaderMeasurer(this));
|
|
42
|
+ createVisibilityAnimator(getHeight());
|
42
|
43
|
}
|
43
|
44
|
|
44
|
|
- private void createVisibilityAnimator(int reactViewHeight) {
|
45
|
|
- float height = ViewUtils.convertDpToPixel(reactViewHeight);
|
46
|
|
- visibilityAnimator = new CollapsingTopBarReactHeaderAnimator(this, height * 0.6f, height * 0.60f);
|
47
|
|
- visibilityAnimator.setOnHiddenListener(this);
|
48
|
|
- visibilityAnimator.setOnVisibleListener(this);
|
|
45
|
+ private void createVisibilityAnimator(final int reactViewHeight) {
|
|
46
|
+ ViewUtils.runOnPreDraw(this, new Runnable() {
|
|
47
|
+ @Override
|
|
48
|
+ public void run() {
|
|
49
|
+ final CollapsingTopBarReactHeader header = CollapsingTopBarReactHeader.this;
|
|
50
|
+ float height = ViewUtils.convertDpToPixel(reactViewHeight);
|
|
51
|
+ visibilityAnimator = new CollapsingTopBarReactHeaderAnimator(header, height * 0.6f, height * 0.60f);
|
|
52
|
+ visibilityAnimator.setOnHiddenListener(header);
|
|
53
|
+ visibilityAnimator.setOnVisibleListener(header);
|
|
54
|
+ }
|
|
55
|
+ });
|
49
|
56
|
}
|
50
|
57
|
|
51
|
58
|
public void collapse(float amount) {
|