|
@@ -3,6 +3,7 @@ package com.reactnativenavigation.views.collapsingToolbar;
|
3
|
3
|
import android.content.Context;
|
4
|
4
|
import android.content.res.TypedArray;
|
5
|
5
|
import android.os.Bundle;
|
|
6
|
+import android.support.annotation.Nullable;
|
6
|
7
|
import android.view.View;
|
7
|
8
|
import android.view.ViewGroup;
|
8
|
9
|
import android.widget.ScrollView;
|
|
@@ -20,7 +21,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
20
|
21
|
|
21
|
22
|
public class CollapsingTopBar extends TopBar implements CollapsingView {
|
22
|
23
|
private CollapsingTopBarBackground collapsingTopBarBackground;
|
23
|
|
- private CollapsingTopBarReactHeader header;
|
|
24
|
+ private @Nullable CollapsingTopBarReactHeader header;
|
24
|
25
|
private ScrollListener scrollListener;
|
25
|
26
|
private float finalCollapsedTranslation;
|
26
|
27
|
private final StyleParams styleParams;
|
|
@@ -31,6 +32,7 @@ public class CollapsingTopBar extends TopBar implements CollapsingView {
|
31
|
32
|
@Override
|
32
|
33
|
public void destroy() {
|
33
|
34
|
if (params.hasReactView()) {
|
|
35
|
+ assert header != null;
|
34
|
36
|
header.unmountReactView();
|
35
|
37
|
}
|
36
|
38
|
}
|
|
@@ -83,6 +85,7 @@ public class CollapsingTopBar extends TopBar implements CollapsingView {
|
83
|
85
|
@Override
|
84
|
86
|
public void onDisplay() {
|
85
|
87
|
calculateFinalCollapsedTranslation();
|
|
88
|
+ assert header != null;
|
86
|
89
|
header.setOnDisplayListener(null);
|
87
|
90
|
}
|
88
|
91
|
});
|
|
@@ -141,7 +144,11 @@ public class CollapsingTopBar extends TopBar implements CollapsingView {
|
141
|
144
|
@Override
|
142
|
145
|
public void fling(CollapseAmount amount) {
|
143
|
146
|
if (titleBar instanceof CollapsingTitleBar) {
|
144
|
|
- viewCollapser.fling(amount, (CollapsingTitleBar) titleBar, header);
|
|
147
|
+ if (header != null) {
|
|
148
|
+ viewCollapser.fling(amount, (CollapsingTitleBar) titleBar, header);
|
|
149
|
+ } else {
|
|
150
|
+ viewCollapser.fling(amount, (CollapsingTitleBar) titleBar);
|
|
151
|
+ }
|
145
|
152
|
} else {
|
146
|
153
|
viewCollapser.collapse(amount);
|
147
|
154
|
}
|