summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps/AllAppsTransitionController.java
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2016-08-02 13:31:22 -0700
committerHyunyoung Song <hyunyoungs@google.com>2016-08-02 13:31:22 -0700
commit5b6470679e1d4e66fb15383733d1e36ad08d0d14 (patch)
tree0f3dc97e8e3ca00d81775a2491216cc20eebeb79 /src/com/android/launcher3/allapps/AllAppsTransitionController.java
parent1460475626e069cc8ee9c71057f40e8aabfc676f (diff)
downloadandroid_packages_apps_Trebuchet-5b6470679e1d4e66fb15383733d1e36ad08d0d14.tar.gz
android_packages_apps_Trebuchet-5b6470679e1d4e66fb15383733d1e36ad08d0d14.tar.bz2
android_packages_apps_Trebuchet-5b6470679e1d4e66fb15383733d1e36ad08d0d14.zip
Add container velocity for all apps to be used by the caret
Change-Id: I03479d53eb7203ab4a0515e2bf68b917dfb81f23
Diffstat (limited to 'src/com/android/launcher3/allapps/AllAppsTransitionController.java')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 40244b2ee..eb6c92628 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -78,7 +78,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
private float mShiftRange; // changes depending on the orientation
private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent
- private float mVelocityForCaret;
+ private float mContainerVelocity;
private static final float DEFAULT_SHIFT_RANGE = 10;
@@ -208,7 +208,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
return false; // early termination.
}
- mVelocityForCaret = velocity;
+ mContainerVelocity = velocity;
float shift = Math.min(Math.max(0, mShiftStart + displacement), mShiftRange);
setProgress(shift / mShiftRange);
@@ -305,9 +305,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
/**
- * @param progress value between 0 and 1
+ * @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace
*/
public void setProgress(float progress) {
+ float shiftPrevious = mProgress * mShiftRange;
mProgress = progress;
float shiftCurrent = progress * mShiftRange;
@@ -339,6 +340,15 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
interpolation);
updateCaret(progress);
updateLightStatusBar(shiftCurrent);
+
+ if (!mDetector.isDraggingState()) {
+ mContainerVelocity = mDetector.computeVelocity(shiftCurrent - shiftPrevious,
+ System.currentTimeMillis());
+ }
+ }
+
+ public float getContainerVelocity() {
+ return mContainerVelocity;
}
public float getProgress() {
@@ -361,7 +371,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
return;
}
if (mDetector.isIdleState()) {
- mVelocityForCaret = -VerticalPullDetector.RELEASE_VELOCITY_PX_MS;
preparePull(true);
mAnimationDuration = duration;
mShiftStart = mAppsView.getTranslationY();
@@ -434,7 +443,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
Interpolator interpolator;
if (mDetector.isIdleState()) {
- mVelocityForCaret = VerticalPullDetector.RELEASE_VELOCITY_PX_MS;
preparePull(true);
mAnimationDuration = duration;
mShiftStart = mAppsView.getTranslationY();
@@ -513,7 +521,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
if (0f < shift && shift < 1f && !mLauncher.useVerticalBarLayout()) {
// How fast are we moving as a percentage of the minimum fling velocity?
final float pctOfFlingVelocity = Math.max(-1, Math.min(
- mVelocityForCaret / VerticalPullDetector.RELEASE_VELOCITY_PX_MS, 1));
+ mContainerVelocity / VerticalPullDetector.RELEASE_VELOCITY_PX_MS, 1));
mCaretDrawable.setCaretProgress(pctOfFlingVelocity);