|
@@ -9,7 +9,6 @@ import android.widget.ScrollView;
|
9
|
9
|
|
10
|
10
|
import com.reactnativenavigation.NavigationApplication;
|
11
|
11
|
import com.reactnativenavigation.views.collapsingToolbar.behaviours.CollapseBehaviour;
|
12
|
|
-import com.reactnativenavigation.views.collapsingToolbar.behaviours.CollapseTitleBarBehaviour;
|
13
|
12
|
import com.reactnativenavigation.views.collapsingToolbar.behaviours.TitleBarHideOnScrollBehaviour;
|
14
|
13
|
|
15
|
14
|
public class CollapseCalculator {
|
|
@@ -123,8 +122,9 @@ public class CollapseCalculator {
|
123
|
122
|
}
|
124
|
123
|
checkCollapseLimits();
|
125
|
124
|
return (isNotCollapsedOrExpended() ||
|
126
|
|
- (canCollapse && isExpendedAndScrollingUp(direction)) ||
|
127
|
|
- (canExpend && isCollapsedAndScrollingDown(direction)));
|
|
125
|
+ (canCollapse && isExpendedAndScrollingUp(direction) && collapseBehaviour.canCollapse(scrollView.getScrollY(), scaledTouchSlop)) ||
|
|
126
|
+ (canExpend && isCollapsedAndScrollingDown(direction) && collapseBehaviour.canExpend(scrollView.getScrollY(), scaledTouchSlop))
|
|
127
|
+ );
|
128
|
128
|
}
|
129
|
129
|
|
130
|
130
|
private boolean isScrolling() {
|
|
@@ -157,14 +157,12 @@ public class CollapseCalculator {
|
157
|
157
|
|
158
|
158
|
private boolean calculateCanCollapse(float currentTopBarTranslation, float finalExpendedTranslation, float finalCollapsedTranslation) {
|
159
|
159
|
return currentTopBarTranslation > finalCollapsedTranslation &&
|
160
|
|
- currentTopBarTranslation <= finalExpendedTranslation &&
|
161
|
|
- (scrollView.getScrollY() <= scaledTouchSlop || (collapseBehaviour instanceof TitleBarHideOnScrollBehaviour || collapseBehaviour instanceof CollapseTitleBarBehaviour));
|
|
160
|
+ currentTopBarTranslation <= finalExpendedTranslation;
|
162
|
161
|
}
|
163
|
162
|
|
164
|
163
|
private boolean calculateCanExpend(float currentTopBarTranslation, float finalExpendedTranslation, float finalCollapsedTranslation) {
|
165
|
164
|
return currentTopBarTranslation >= finalCollapsedTranslation &&
|
166
|
|
- currentTopBarTranslation < finalExpendedTranslation &&
|
167
|
|
- (scrollView.getScrollY() <= scaledTouchSlop || (collapseBehaviour instanceof TitleBarHideOnScrollBehaviour || collapseBehaviour instanceof CollapseTitleBarBehaviour));
|
|
165
|
+ currentTopBarTranslation < finalExpendedTranslation;
|
168
|
166
|
}
|
169
|
167
|
|
170
|
168
|
private boolean isCollapsedAndScrollingDown(Direction direction) {
|