2016-06-06 14:19:02 -07:00
|
|
|
package com.android.launcher3.allapps;
|
|
|
|
|
|
|
|
|
|
import android.animation.Animator;
|
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
|
import android.animation.AnimatorSet;
|
|
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
2016-06-08 16:29:32 -07:00
|
|
|
import android.view.animation.AccelerateInterpolator;
|
2016-06-15 16:45:48 -07:00
|
|
|
import android.view.animation.DecelerateInterpolator;
|
2016-06-06 14:19:02 -07:00
|
|
|
import android.view.animation.Interpolator;
|
|
|
|
|
|
2016-06-08 16:29:32 -07:00
|
|
|
import com.android.launcher3.CellLayout;
|
2016-06-15 16:45:48 -07:00
|
|
|
import com.android.launcher3.DeviceProfile;
|
2016-06-06 14:19:02 -07:00
|
|
|
import com.android.launcher3.Hotseat;
|
|
|
|
|
import com.android.launcher3.Launcher;
|
|
|
|
|
import com.android.launcher3.LauncherAnimUtils;
|
2016-06-08 16:29:32 -07:00
|
|
|
import com.android.launcher3.PagedView;
|
2016-06-09 12:08:22 -07:00
|
|
|
import com.android.launcher3.Workspace;
|
2016-06-20 10:53:52 -07:00
|
|
|
import com.android.launcher3.Workspace.Direction;
|
2016-06-06 14:19:02 -07:00
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
public class AllAppsTransitionController implements TouchController, VerticalPullDetector.Listener {
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "AllAppsTrans";
|
|
|
|
|
private static final boolean DBG = false;
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private final Interpolator mAccelInterpolator = new AccelerateInterpolator(2f);
|
|
|
|
|
private final Interpolator mDecelInterpolator = new DecelerateInterpolator(1f);
|
2016-06-08 16:29:32 -07:00
|
|
|
|
|
|
|
|
private static final float ANIMATION_DURATION = 2000;
|
2016-06-15 16:45:48 -07:00
|
|
|
public static final float ALL_APPS_FINAL_ALPHA = .8f;
|
|
|
|
|
|
|
|
|
|
private static final float PARALLAX_COEFFICIENT = .125f;
|
2016-06-06 14:19:02 -07:00
|
|
|
|
|
|
|
|
private AllAppsContainerView mAppsView;
|
2016-06-09 12:08:22 -07:00
|
|
|
private Workspace mWorkspace;
|
2016-06-06 14:19:02 -07:00
|
|
|
private Hotseat mHotseat;
|
2016-06-20 13:54:42 -07:00
|
|
|
private float mHotseatBackgroundAlpha;
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private float mStatusBarHeight;
|
2016-06-06 14:19:02 -07:00
|
|
|
|
|
|
|
|
private final Launcher mLauncher;
|
|
|
|
|
private final VerticalPullDetector mDetector;
|
|
|
|
|
|
|
|
|
|
// Animation in this class is controlled by a single variable {@link mProgressTransY}.
|
|
|
|
|
// Visually, it represents top y coordinate of the all apps container. Using the
|
|
|
|
|
// {@link mTranslation} as the denominator, this fraction value ranges in [0, 1].
|
|
|
|
|
private float mProgressTransY; // numerator
|
|
|
|
|
private float mTranslation = -1; // denominator
|
|
|
|
|
|
2016-06-13 12:38:32 -07:00
|
|
|
private static final float RECATCH_REJECTION_FRACTION = .0875f;
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
// Used in landscape.
|
|
|
|
|
private static final float BAZEL_PULL_UP_HEIGHT = 60;
|
|
|
|
|
|
2016-06-08 16:29:32 -07:00
|
|
|
private long mAnimationDuration;
|
2016-06-06 14:19:02 -07:00
|
|
|
private float mCurY;
|
|
|
|
|
|
|
|
|
|
private AnimatorSet mCurrentAnimation;
|
2016-06-10 12:00:02 -07:00
|
|
|
private boolean mNoIntercept;
|
2016-06-06 14:19:02 -07:00
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private boolean mLightStatusBar;
|
|
|
|
|
|
|
|
|
|
// At the end of scroll settling, this class also sets the state of the launcher.
|
|
|
|
|
// If it's already set,do not call the #mLauncher.setXXX method.
|
|
|
|
|
private boolean mStateAlreadyChanged;
|
|
|
|
|
|
2016-06-06 14:19:02 -07:00
|
|
|
public AllAppsTransitionController(Launcher launcher) {
|
|
|
|
|
mLauncher = launcher;
|
|
|
|
|
mDetector = new VerticalPullDetector(launcher);
|
|
|
|
|
mDetector.setListener(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
|
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
2016-06-10 12:00:02 -07:00
|
|
|
mNoIntercept = false;
|
|
|
|
|
if (mLauncher.getWorkspace().isInOverviewMode() || mLauncher.isWidgetsViewVisible()) {
|
|
|
|
|
mNoIntercept = true;
|
2016-06-13 12:38:32 -07:00
|
|
|
} else if (mLauncher.isAllAppsVisible() &&
|
2016-06-10 12:00:02 -07:00
|
|
|
!mAppsView.shouldContainerScroll(ev.getX(), ev.getY())) {
|
|
|
|
|
mNoIntercept = true;
|
2016-06-15 16:45:48 -07:00
|
|
|
} else if (!mLauncher.isAllAppsVisible() && !shouldPossiblyIntercept(ev)) {
|
|
|
|
|
mNoIntercept = true;
|
2016-06-13 12:38:32 -07:00
|
|
|
} else {
|
|
|
|
|
mDetector.setDetectableScrollConditions(mLauncher.isAllAppsVisible() /* down */,
|
|
|
|
|
isInDisallowRecatchTopZone(), isInDisallowRecatchBottomZone());
|
2016-06-10 12:00:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mNoIntercept) {
|
|
|
|
|
return false;
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
mDetector.onTouchEvent(ev);
|
2016-06-13 12:38:32 -07:00
|
|
|
return mDetector.shouldIntercept();
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private boolean shouldPossiblyIntercept(MotionEvent ev) {
|
|
|
|
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
|
|
|
|
if (mDetector.isRestingState()) {
|
|
|
|
|
if (mLauncher.getDragLayer().isEventOverHotseat(ev) && !grid.isLandscape) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (ev.getY() > mLauncher.getDeviceProfile().heightPx - BAZEL_PULL_UP_HEIGHT &&
|
|
|
|
|
grid.isLandscape) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 14:19:02 -07:00
|
|
|
@Override
|
|
|
|
|
public boolean onTouchEvent(MotionEvent ev) {
|
|
|
|
|
return mDetector.onTouchEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-13 12:38:32 -07:00
|
|
|
private boolean isInDisallowRecatchTopZone() {
|
|
|
|
|
return mProgressTransY / mTranslation < RECATCH_REJECTION_FRACTION;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isInDisallowRecatchBottomZone() {
|
|
|
|
|
return mProgressTransY / mTranslation > 1 - RECATCH_REJECTION_FRACTION;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 14:19:02 -07:00
|
|
|
@Override
|
|
|
|
|
public void onScrollStart(boolean start) {
|
|
|
|
|
cancelAnimation();
|
|
|
|
|
mCurrentAnimation = LauncherAnimUtils.createAnimatorSet();
|
|
|
|
|
preparePull(start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param start {@code true} if start of new drag.
|
|
|
|
|
*/
|
|
|
|
|
public void preparePull(boolean start) {
|
2016-06-20 13:54:42 -07:00
|
|
|
// Initialize values that should not change until #onScrollEnd
|
|
|
|
|
mCurY = mAppsView.getTranslationY();
|
|
|
|
|
mStatusBarHeight = mLauncher.getDragLayer().getInsets().top;
|
2016-06-08 16:29:32 -07:00
|
|
|
mHotseat.setVisibility(View.VISIBLE);
|
|
|
|
|
mHotseat.bringToFront();
|
2016-06-06 14:19:02 -07:00
|
|
|
if (start) {
|
|
|
|
|
if (!mLauncher.isAllAppsVisible()) {
|
2016-06-15 16:45:48 -07:00
|
|
|
mLauncher.tryAndUpdatePredictedApps();
|
2016-06-20 13:54:42 -07:00
|
|
|
mHotseatBackgroundAlpha = mHotseat.getBackground().getAlpha() / 255f;
|
|
|
|
|
mHotseat.setBackgroundTransparent(true /* transparent */);
|
2016-06-06 14:19:02 -07:00
|
|
|
mAppsView.setVisibility(View.VISIBLE);
|
|
|
|
|
mAppsView.getContentView().setVisibility(View.VISIBLE);
|
2016-06-08 16:29:32 -07:00
|
|
|
mAppsView.getContentView().setBackground(null);
|
|
|
|
|
mAppsView.getRevealView().setVisibility(View.VISIBLE);
|
2016-06-20 13:54:42 -07:00
|
|
|
mAppsView.getRevealView().setAlpha(mHotseatBackgroundAlpha);
|
2016-06-06 14:19:02 -07:00
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
DeviceProfile grid= mLauncher.getDeviceProfile();
|
|
|
|
|
if (!grid.isLandscape) {
|
2016-06-06 14:19:02 -07:00
|
|
|
mTranslation = mHotseat.getTop();
|
2016-06-15 16:45:48 -07:00
|
|
|
} else {
|
|
|
|
|
mTranslation = mHotseat.getBottom();
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
2016-06-15 16:45:48 -07:00
|
|
|
setProgress(mTranslation);
|
2016-06-06 14:19:02 -07:00
|
|
|
} else {
|
2016-06-09 12:08:22 -07:00
|
|
|
// TODO: get rid of this workaround to override state change by workspace transition
|
|
|
|
|
mWorkspace.onLauncherTransitionPrepare(mLauncher, false, false);
|
|
|
|
|
View child = ((CellLayout) mWorkspace.getChildAt(mWorkspace.getNextPage()))
|
|
|
|
|
.getShortcutsAndWidgets();
|
|
|
|
|
child.setVisibility(View.VISIBLE);
|
|
|
|
|
child.setAlpha(1f);
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private void updateLightStatusBar(float progress) {
|
|
|
|
|
boolean enable = (progress < mStatusBarHeight / 2);
|
|
|
|
|
// Already set correctly
|
|
|
|
|
if (mLightStatusBar == enable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-06-06 14:19:02 -07:00
|
|
|
int systemUiFlags = mLauncher.getWindow().getDecorView().getSystemUiVisibility();
|
|
|
|
|
if (enable) {
|
|
|
|
|
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
|
|
|
|
|
& ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
|
|
|
|
|
|
|
|
|
}
|
2016-06-15 16:45:48 -07:00
|
|
|
mLightStatusBar = enable;
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onScroll(float displacement, float velocity) {
|
|
|
|
|
if (mAppsView == null) {
|
|
|
|
|
return false; // early termination.
|
|
|
|
|
}
|
|
|
|
|
if (0 <= mCurY + displacement && mCurY + displacement < mTranslation) {
|
|
|
|
|
setProgress(mCurY + displacement);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param progress y value of the border between hotseat and all apps
|
|
|
|
|
*/
|
|
|
|
|
public void setProgress(float progress) {
|
2016-06-15 16:45:48 -07:00
|
|
|
updateLightStatusBar(progress);
|
2016-06-06 14:19:02 -07:00
|
|
|
mProgressTransY = progress;
|
|
|
|
|
float alpha = calcAlphaAllApps(progress);
|
2016-06-08 16:29:32 -07:00
|
|
|
float workspaceHotseatAlpha = 1 - alpha;
|
|
|
|
|
|
2016-06-20 13:54:42 -07:00
|
|
|
mAppsView.getRevealView().setAlpha(Math.min(ALL_APPS_FINAL_ALPHA, Math.max(mHotseatBackgroundAlpha,
|
2016-06-15 16:45:48 -07:00
|
|
|
mDecelInterpolator.getInterpolation(alpha))));
|
2016-06-08 16:29:32 -07:00
|
|
|
mAppsView.getContentView().setAlpha(alpha);
|
|
|
|
|
mAppsView.setTranslationY(progress);
|
2016-06-20 10:53:52 -07:00
|
|
|
mWorkspace.setWorkspaceTranslation(Direction.Y,
|
2016-06-15 16:45:48 -07:00
|
|
|
PARALLAX_COEFFICIENT *(-mTranslation + progress),
|
|
|
|
|
mAccelInterpolator.getInterpolation(workspaceHotseatAlpha));
|
2016-06-20 10:53:52 -07:00
|
|
|
mWorkspace.setHotseatTranslation(Direction.Y, -mTranslation + progress,
|
2016-06-09 12:08:22 -07:00
|
|
|
mAccelInterpolator.getInterpolation(workspaceHotseatAlpha));
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getProgress() {
|
|
|
|
|
return mProgressTransY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float calcAlphaAllApps(float progress) {
|
2016-06-08 16:29:32 -07:00
|
|
|
return ((mTranslation - progress)/mTranslation);
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onScrollEnd(float velocity, boolean fling) {
|
|
|
|
|
if (mAppsView == null) {
|
|
|
|
|
return; // early termination.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fling) {
|
|
|
|
|
if (velocity < 0) {
|
|
|
|
|
calculateDuration(velocity, mAppsView.getTranslationY());
|
2016-06-15 16:45:48 -07:00
|
|
|
animateToAllApps(mCurrentAnimation, mAnimationDuration);
|
2016-06-06 14:19:02 -07:00
|
|
|
} else {
|
|
|
|
|
calculateDuration(velocity, Math.abs(mTranslation - mAppsView.getTranslationY()));
|
2016-06-15 16:45:48 -07:00
|
|
|
animateToWorkspace(mCurrentAnimation, mAnimationDuration);
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
// snap to top or bottom using the release velocity
|
|
|
|
|
} else {
|
|
|
|
|
if (mAppsView.getTranslationY() > mTranslation / 2) {
|
|
|
|
|
calculateDuration(velocity, Math.abs(mTranslation - mAppsView.getTranslationY()));
|
2016-06-15 16:45:48 -07:00
|
|
|
animateToWorkspace(mCurrentAnimation, mAnimationDuration);
|
2016-06-06 14:19:02 -07:00
|
|
|
} else {
|
|
|
|
|
calculateDuration(velocity, Math.abs(mAppsView.getTranslationY()));
|
2016-06-15 16:45:48 -07:00
|
|
|
animateToAllApps(mCurrentAnimation, mAnimationDuration);
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
2016-06-15 16:45:48 -07:00
|
|
|
mCurrentAnimation.start();
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void calculateDuration(float velocity, float disp) {
|
|
|
|
|
// TODO: make these values constants after tuning.
|
2016-06-15 16:45:48 -07:00
|
|
|
float velocityDivisor = Math.max(1.5f, Math.abs(0.5f * velocity));
|
2016-06-06 14:19:02 -07:00
|
|
|
float travelDistance = Math.max(0.2f, disp / mTranslation);
|
2016-06-08 16:29:32 -07:00
|
|
|
mAnimationDuration = (long) Math.max(100, ANIMATION_DURATION / velocityDivisor * travelDistance);
|
|
|
|
|
if (DBG) {
|
|
|
|
|
Log.d(TAG, String.format("calculateDuration=%d, v=%f, d=%f", mAnimationDuration, velocity, disp));
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-08 16:29:32 -07:00
|
|
|
public void animateToAllApps(AnimatorSet animationOut, long duration) {
|
2016-06-20 13:54:42 -07:00
|
|
|
if (animationOut == null){
|
2016-06-06 14:19:02 -07:00
|
|
|
return;
|
|
|
|
|
}
|
2016-06-13 12:38:32 -07:00
|
|
|
if (mDetector.isRestingState()) {
|
2016-06-06 14:19:02 -07:00
|
|
|
preparePull(true);
|
2016-06-08 16:29:32 -07:00
|
|
|
mAnimationDuration = duration;
|
2016-06-15 16:45:48 -07:00
|
|
|
mStateAlreadyChanged = true;
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
mCurY = mAppsView.getTranslationY();
|
|
|
|
|
final float fromAllAppsTop = mAppsView.getTranslationY();
|
|
|
|
|
final float toAllAppsTop = 0;
|
|
|
|
|
|
|
|
|
|
ObjectAnimator driftAndAlpha = ObjectAnimator.ofFloat(this, "progress",
|
|
|
|
|
fromAllAppsTop, toAllAppsTop);
|
2016-06-08 16:29:32 -07:00
|
|
|
driftAndAlpha.setDuration(mAnimationDuration);
|
|
|
|
|
driftAndAlpha.setInterpolator(new PagedView.ScrollInterpolator());
|
2016-06-06 14:19:02 -07:00
|
|
|
animationOut.play(driftAndAlpha);
|
|
|
|
|
|
|
|
|
|
animationOut.addListener(new AnimatorListenerAdapter() {
|
|
|
|
|
boolean canceled = false;
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationCancel(Animator animation) {
|
|
|
|
|
canceled = true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
if (canceled) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
finishPullUp();
|
|
|
|
|
cleanUpAnimation();
|
|
|
|
|
mDetector.finishedScrolling();
|
|
|
|
|
}
|
|
|
|
|
}});
|
|
|
|
|
mCurrentAnimation = animationOut;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-08 16:29:32 -07:00
|
|
|
public void animateToWorkspace(AnimatorSet animationOut, long duration) {
|
2016-06-20 13:54:42 -07:00
|
|
|
if (animationOut == null){
|
2016-06-06 14:19:02 -07:00
|
|
|
return;
|
|
|
|
|
}
|
2016-06-13 12:38:32 -07:00
|
|
|
if(mDetector.isRestingState()) {
|
2016-06-06 14:19:02 -07:00
|
|
|
preparePull(true);
|
2016-06-08 16:29:32 -07:00
|
|
|
mAnimationDuration = duration;
|
2016-06-15 16:45:48 -07:00
|
|
|
mStateAlreadyChanged = true;
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
final float fromAllAppsTop = mAppsView.getTranslationY();
|
|
|
|
|
final float toAllAppsTop = mTranslation;
|
|
|
|
|
|
|
|
|
|
ObjectAnimator driftAndAlpha = ObjectAnimator.ofFloat(this, "progress",
|
|
|
|
|
fromAllAppsTop, toAllAppsTop);
|
2016-06-08 16:29:32 -07:00
|
|
|
driftAndAlpha.setDuration(mAnimationDuration);
|
|
|
|
|
driftAndAlpha.setInterpolator(new PagedView.ScrollInterpolator());
|
2016-06-06 14:19:02 -07:00
|
|
|
animationOut.play(driftAndAlpha);
|
|
|
|
|
|
|
|
|
|
animationOut.addListener(new AnimatorListenerAdapter() {
|
|
|
|
|
boolean canceled = false;
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationCancel(Animator animation) {
|
|
|
|
|
canceled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
if (canceled) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
finishPullDown();
|
|
|
|
|
cleanUpAnimation();
|
|
|
|
|
mDetector.finishedScrolling();
|
|
|
|
|
}
|
|
|
|
|
}});
|
|
|
|
|
mCurrentAnimation = animationOut;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 16:45:48 -07:00
|
|
|
private void finishPullUp() {
|
|
|
|
|
mHotseat.setVisibility(View.INVISIBLE);
|
|
|
|
|
setProgress(0f);
|
|
|
|
|
if (!mStateAlreadyChanged) {
|
|
|
|
|
mLauncher.showAppsView(false /* animated */, true /* resetListToTop */,
|
|
|
|
|
false /* updatePredictedApps */, false /* focusSearchBar */);
|
|
|
|
|
}
|
|
|
|
|
mStateAlreadyChanged = false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 14:19:02 -07:00
|
|
|
public void finishPullDown() {
|
2016-06-15 16:45:48 -07:00
|
|
|
if (mHotseat.getBackground() != null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-06-06 14:19:02 -07:00
|
|
|
mAppsView.setVisibility(View.INVISIBLE);
|
2016-06-20 13:54:42 -07:00
|
|
|
mHotseat.setBackgroundTransparent(false /* transparent */);
|
2016-06-06 14:19:02 -07:00
|
|
|
mHotseat.setVisibility(View.VISIBLE);
|
|
|
|
|
setProgress(mTranslation);
|
2016-06-15 16:45:48 -07:00
|
|
|
if (!mStateAlreadyChanged) {
|
|
|
|
|
mLauncher.showWorkspace(false);
|
|
|
|
|
}
|
|
|
|
|
mStateAlreadyChanged = false;
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cancelAnimation() {
|
|
|
|
|
if (mCurrentAnimation != null) {
|
|
|
|
|
mCurrentAnimation.cancel();
|
|
|
|
|
mCurrentAnimation = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cleanUpAnimation() {
|
|
|
|
|
mCurrentAnimation = null;
|
|
|
|
|
}
|
2016-06-20 13:54:42 -07:00
|
|
|
|
|
|
|
|
public void setupViews(AllAppsContainerView appsView, Hotseat hotseat, Workspace workspace) {
|
|
|
|
|
mAppsView = appsView;
|
|
|
|
|
mHotseat = hotseat;
|
|
|
|
|
mWorkspace = workspace;
|
|
|
|
|
}
|
2016-06-06 14:19:02 -07:00
|
|
|
}
|