Format fixes on AllAppsTransitionController and VerticalPullDetector
Change-Id: Id1570284da7b69a4d768fe41980ca0522433b6c2
This commit is contained in:
parent
c3dcc77b8e
commit
e8a2b8e1d9
|
@ -25,7 +25,7 @@ import com.android.launcher3.util.TouchController;
|
|||
* 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
|
||||
|
@ -229,6 +229,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param start {@code true} if start of new drag.
|
||||
*/
|
||||
|
@ -342,10 +343,12 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
|
||||
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 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
cleanUpAnimation();
|
||||
mDetector.finishedScrolling();
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
mCurrentAnimation = animationOut;
|
||||
if (start) {
|
||||
mCurrentAnimation.start();
|
||||
|
@ -382,6 +386,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
|
||||
animationOut.addListener(new AnimatorListenerAdapter() {
|
||||
boolean canceled = false;
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
canceled = true;
|
||||
|
@ -397,7 +402,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
cleanUpAnimation();
|
||||
mDetector.finishedScrolling();
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
mCurrentAnimation = animationOut;
|
||||
if (start) {
|
||||
mCurrentAnimation.start();
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.ViewConfiguration;
|
|||
/**
|
||||
* 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 class VerticalPullDetector {
|
|||
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 @@ public class VerticalPullDetector {
|
|||
IDLE,
|
||||
DRAGGING, // onDragStart, onDrag
|
||||
SETTLING // onDragEnd
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
//------------------- ScrollState transition diagram -----------------------------------
|
||||
//
|
||||
|
@ -110,7 +111,9 @@ public class VerticalPullDetector {
|
|||
|
||||
interface Listener {
|
||||
void onDragStart(boolean start);
|
||||
|
||||
boolean onDrag(float displacement, float velocity);
|
||||
|
||||
void onDragEnd(float velocity, boolean fling);
|
||||
}
|
||||
|
||||
|
@ -234,6 +237,7 @@ public class VerticalPullDetector {
|
|||
mListener.onDragEnd(mVelocity, Math.abs(mVelocity) > RELEASE_VELOCITY_PX_MS);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the damped velocity using the two motion events and the previous velocity.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue