Merge "Bug fix: QSB sometimes gets stuck to transparent." into ub-launcher3-master

This commit is contained in:
Sunny Goyal
2016-11-30 17:50:01 +00:00
committed by Android (Google) Code Review
5 changed files with 35 additions and 22 deletions

View File

@@ -364,7 +364,6 @@ public class FastBitmapDrawable extends Drawable {
private AnimatorSet cancelAnimator(AnimatorSet animator) {
if (animator != null) {
animator.removeAllListeners();
animator.cancel();
}
return null;

View File

@@ -215,9 +215,18 @@ public class PinchAnimationManager {
view.setVisibility(View.VISIBLE);
} else {
animator.addListener(new AnimatorListenerAdapter() {
private boolean mCancelled = false;
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.INVISIBLE);
if (!mCancelled) {
view.setVisibility(View.INVISIBLE);
}
}
});
}
@@ -226,7 +235,6 @@ public class PinchAnimationManager {
private void startAnimator(int index, Animator animator, long duration) {
if (mAnimators[index] != null) {
mAnimators[index].removeAllListeners();
mAnimators[index].cancel();
}
mAnimators[index] = animator;

View File

@@ -356,7 +356,8 @@ public class WorkspaceStateTransitionAnimation {
cl.setShortcutAndWidgetAlpha(finalAlpha);
}
if (Workspace.isQsbContainerPage(i)) {
if (Workspace.isQsbContainerPage(i) &&
states.stateIsNormal && mWorkspaceFadeInAdjacentScreens) {
if (animated) {
Animator anim = mWorkspace.mQsbAlphaController
.animateAlphaAtIndex(finalAlpha, Workspace.QSB_ALPHA_INDEX_PAGE_SCROLL);
@@ -372,8 +373,6 @@ public class WorkspaceStateTransitionAnimation {
final ViewGroup overviewPanel = mLauncher.getOverviewPanel();
final View qsbContainer = mLauncher.getQsbContainer();
Animator qsbAlphaAnimation = mWorkspace.mQsbAlphaController
.animateAlphaAtIndex(finalQsbAlpha, Workspace.QSB_ALPHA_INDEX_STATE_CHANGE);
@@ -395,7 +394,7 @@ public class WorkspaceStateTransitionAnimation {
// For animation optimization, we may need to provide the Launcher transition
// with a set of views on which to force build and manage layers in certain scenarios.
layerViews.addView(overviewPanel);
layerViews.addView(qsbContainer);
layerViews.addView(mLauncher.getQsbContainer());
layerViews.addView(mLauncher.getHotseat());
layerViews.addView(mWorkspace.getPageIndicator());

View File

@@ -188,7 +188,6 @@ public class AllAppsBackgroundDrawable extends Drawable {
private ObjectAnimator cancelAnimator(ObjectAnimator animator) {
if (animator != null) {
animator.removeAllListeners();
animator.cancel();
}
return null;

View File

@@ -72,18 +72,6 @@ public class PageIndicatorDots extends PageIndicator {
}
};
/**
* Listener for keep running the animation until the final state is reached.
*/
private final AnimatorListenerAdapter mAnimCycleListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimator = null;
animateToPosition(mFinalPosition);
}
};
private final Paint mCirclePaint;
private final float mDotRadius;
private final int mActiveColor;
@@ -163,7 +151,7 @@ public class PageIndicatorDots extends PageIndicator {
float positionForThisAnim = mCurrentPosition > mFinalPosition ?
mCurrentPosition - SHIFT_PER_ANIMATION : mCurrentPosition + SHIFT_PER_ANIMATION;
mAnimator = ObjectAnimator.ofFloat(this, CURRENT_POSITION, positionForThisAnim);
mAnimator.addListener(mAnimCycleListener);
mAnimator.addListener(new AnimationCycleListener());
mAnimator.setDuration(ANIMATION_DURATION);
mAnimator.start();
}
@@ -171,7 +159,6 @@ public class PageIndicatorDots extends PageIndicator {
public void stopAllAnimations() {
if (mAnimator != null) {
mAnimator.removeAllListeners();
mAnimator.cancel();
mAnimator = null;
}
@@ -326,4 +313,25 @@ public class PageIndicatorDots extends PageIndicator {
}
}
}
/**
* Listener for keep running the animation until the final state is reached.
*/
private class AnimationCycleListener extends AnimatorListenerAdapter {
private boolean mCancelled = false;
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
if (!mCancelled) {
mAnimator = null;
animateToPosition(mFinalPosition);
}
}
}
}