All apps container should not intercept touch during animation.

b/28917826
> When all apps container is settling near either the bottom or top
end, touch event should not be intercepted.

Change-Id: I8aee6cea52e844c4615b92b15f8ef7247236a25b
This commit is contained in:
Hyunyoung Song
2016-06-13 12:38:32 -07:00
parent f4cbb1428a
commit 35ea6591a7
2 changed files with 66 additions and 23 deletions

View File

@@ -54,6 +54,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
private float mProgressTransY; // numerator
private float mTranslation = -1; // denominator
private static final float RECATCH_REJECTION_FRACTION = .0875f;
private long mAnimationDuration;
private float mCurY;
@@ -73,19 +75,19 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
mNoIntercept = false;
if (mLauncher.getWorkspace().isInOverviewMode() || mLauncher.isWidgetsViewVisible()) {
mNoIntercept = true;
}
if (mLauncher.isAllAppsVisible() &&
} else if (mLauncher.isAllAppsVisible() &&
!mAppsView.shouldContainerScroll(ev.getX(), ev.getY())) {
mNoIntercept = true;
} else {
mDetector.setDetectableScrollConditions(mLauncher.isAllAppsVisible() /* down */,
isInDisallowRecatchTopZone(), isInDisallowRecatchBottomZone());
}
}
if (mNoIntercept) {
return false;
} else {
mDetector.setScrollDirectionDown(mLauncher.isAllAppsVisible());
}
mDetector.onTouchEvent(ev);
return mDetector.mScrolling;
return mDetector.shouldIntercept();
}
@Override
@@ -93,6 +95,14 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
return mDetector.onTouchEvent(ev);
}
private boolean isInDisallowRecatchTopZone() {
return mProgressTransY / mTranslation < RECATCH_REJECTION_FRACTION;
}
private boolean isInDisallowRecatchBottomZone() {
return mProgressTransY / mTranslation > 1 - RECATCH_REJECTION_FRACTION;
}
private void init() {
if (mAppsView != null) {
return;
@@ -267,7 +277,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){
return;
}
if (!mDetector.mScrolling) {
if (mDetector.isRestingState()) {
preparePull(true);
mAnimationDuration = duration;
}
@@ -311,7 +321,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){
return;
}
if(!mDetector.mScrolling) {
if(mDetector.isRestingState()) {
preparePull(true);
mAnimationDuration = duration;
}