Format fixes on AllAppsTransitionController and VerticalPullDetector
Change-Id: Id1570284da7b69a4d768fe41980ca0522433b6c2
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index e7108a1..41e8518 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -25,11 +25,11 @@
* Handles AllApps view transition.
* 1) Slides all apps view using direct manipulation
* 2) When finger is released, animate to either top or bottom accordingly.
- *
+ * <p/>
* Algorithm:
* If release velocity > THRES1, snap according to the direction of movement.
* If release velocity < THRES1, snap according to either top or bottom depending on whether it's
- * closer to top or closer to the page indicator.
+ * closer to top or closer to the page indicator.
*/
public class AllAppsTransitionController implements TouchController, VerticalPullDetector.Listener,
View.OnLayoutChangeListener {
@@ -229,6 +229,7 @@
}
}
}
+
/**
* @param start {@code true} if start of new drag.
*/
@@ -309,7 +310,7 @@
}
private float calcAlphaAllApps(float progress) {
- return ((mShiftRange - progress)/ mShiftRange);
+ return ((mShiftRange - progress) / mShiftRange);
}
private void calculateDuration(float velocity, float disp) {
@@ -323,7 +324,7 @@
}
public void animateToAllApps(AnimatorSet animationOut, long duration, boolean start) {
- if (animationOut == null){
+ if (animationOut == null) {
return;
}
if (mDetector.isIdleState()) {
@@ -342,10 +343,12 @@
animationOut.addListener(new AnimatorListenerAdapter() {
boolean canceled = false;
+
@Override
public void onAnimationCancel(Animator animation) {
canceled = true;
}
+
@Override
public void onAnimationEnd(Animator animation) {
if (canceled) {
@@ -355,7 +358,8 @@
cleanUpAnimation();
mDetector.finishedScrolling();
}
- }});
+ }
+ });
mCurrentAnimation = animationOut;
if (start) {
mCurrentAnimation.start();
@@ -363,10 +367,10 @@
}
public void animateToWorkspace(AnimatorSet animationOut, long duration, boolean start) {
- if (animationOut == null){
+ if (animationOut == null) {
return;
}
- if(mDetector.isIdleState()) {
+ if (mDetector.isIdleState()) {
preparePull(true);
mAnimationDuration = duration;
mShiftStart = mAppsView.getTranslationY();
@@ -381,23 +385,25 @@
animationOut.play(driftAndAlpha);
animationOut.addListener(new AnimatorListenerAdapter() {
- boolean canceled = false;
- @Override
- public void onAnimationCancel(Animator animation) {
- canceled = true;
- setProgress(mShiftCurrent);
- }
+ boolean canceled = false;
- @Override
- public void onAnimationEnd(Animator animation) {
- if (canceled) {
- return;
- } else {
- finishPullDown();
- cleanUpAnimation();
- mDetector.finishedScrolling();
- }
- }});
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ canceled = true;
+ setProgress(mShiftCurrent);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (canceled) {
+ return;
+ } else {
+ finishPullDown();
+ cleanUpAnimation();
+ mDetector.finishedScrolling();
+ }
+ }
+ });
mCurrentAnimation = animationOut;
if (start) {
mCurrentAnimation.start();
@@ -438,7 +444,7 @@
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
float prevShiftRatio = mShiftCurrent / mShiftRange;
if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) {
mShiftRange = top;
diff --git a/src/com/android/launcher3/allapps/VerticalPullDetector.java b/src/com/android/launcher3/allapps/VerticalPullDetector.java
index b058ad2..0e8ba7f 100644
--- a/src/com/android/launcher3/allapps/VerticalPullDetector.java
+++ b/src/com/android/launcher3/allapps/VerticalPullDetector.java
@@ -8,7 +8,7 @@
/**
* One dimensional scroll gesture detector for all apps container pull up interaction.
* Client (e.g., AllAppsTransitionController) of this class can register a listener.
- *
+ * <p/>
* Features that this gesture detector can support.
*/
public class VerticalPullDetector {
@@ -23,7 +23,6 @@
public static final int DIRECTION_DOWN = 1 << 1;
public static final int DIRECTION_BOTH = DIRECTION_DOWN | DIRECTION_UP;
-
/**
* The minimum release velocity in pixels per millisecond that triggers fling..
*/
@@ -42,7 +41,9 @@
IDLE,
DRAGGING, // onDragStart, onDrag
SETTLING // onDragEnd
- };
+ }
+
+ ;
//------------------- ScrollState transition diagram -----------------------------------
//
@@ -108,9 +109,11 @@
mListener = l;
}
- interface Listener{
+ interface Listener {
void onDragStart(boolean start);
+
boolean onDrag(float displacement, float velocity);
+
void onDragEnd(float velocity, boolean fling);
}
@@ -137,7 +140,7 @@
}
// Check if the client is interested in scroll in current direction.
if (((mScrollConditions & DIRECTION_DOWN) > 0 && mDisplacementY > 0) ||
- ((mScrollConditions & DIRECTION_UP) > 0 && mDisplacementY < 0)) {
+ ((mScrollConditions & DIRECTION_UP) > 0 && mDisplacementY < 0)) {
return true;
}
return false;
@@ -234,6 +237,7 @@
mListener.onDragEnd(mVelocity, Math.abs(mVelocity) > RELEASE_VELOCITY_PX_MS);
}
+
/**
* Computes the damped velocity using the two motion events and the previous velocity.
*/