Protecting QSB scroll while transition animation is running.
During transition animation the qorkspace scroll changes while the actual workspace UI is mostly stable. This causes the QSB to animate while the pages are not changing. Bug: 30229069 Change-Id: I66ec41276c0e26164d20da6a5e0e251975390428
This commit is contained in:
parent
4dcb831382
commit
c553c33ae6
|
@ -53,11 +53,9 @@ import android.view.MotionEvent;
|
|||
import android.view.View;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.Space;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.Launcher.CustomContentCallbacks;
|
||||
|
@ -315,6 +313,7 @@ public class Workspace extends PagedView
|
|||
// Total over scrollX in the overlay direction.
|
||||
private float mOverlayTranslation;
|
||||
private int mFirstPageScrollX;
|
||||
private boolean mIgnoreQsbScroll;
|
||||
|
||||
// Handles workspace state transitions
|
||||
private WorkspaceStateTransitionAnimation mStateTransitionAnimation;
|
||||
|
@ -1395,9 +1394,11 @@ public class Workspace extends PagedView
|
|||
}
|
||||
|
||||
private void onWorkspaceOverallScrollChanged() {
|
||||
if (!mIgnoreQsbScroll) {
|
||||
mLauncher.getQsbContainer().setTranslationX(
|
||||
mOverlayTranslation + mFirstPageScrollX - getScrollX());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||
|
@ -1805,6 +1806,33 @@ public class Workspace extends PagedView
|
|||
super.onLayout(changed, left, top, right, bottom);
|
||||
mFirstPageScrollX = getScrollForPage(0);
|
||||
onWorkspaceOverallScrollChanged();
|
||||
|
||||
final LayoutTransition transition = getLayoutTransition();
|
||||
// If the transition is running defer updating max scroll, as some empty pages could
|
||||
// still be present, and a max scroll change could cause sudden jumps in scroll.
|
||||
if (transition != null && transition.isRunning()) {
|
||||
transition.addTransitionListener(new LayoutTransition.TransitionListener() {
|
||||
|
||||
@Override
|
||||
public void startTransition(LayoutTransition transition, ViewGroup container,
|
||||
View view, int transitionType) {
|
||||
mIgnoreQsbScroll = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransition(LayoutTransition transition, ViewGroup container,
|
||||
View view, int transitionType) {
|
||||
// Wait until all transitions are complete.
|
||||
if (!transition.isRunning()) {
|
||||
mIgnoreQsbScroll = false;
|
||||
transition.removeTransitionListener(this);
|
||||
mFirstPageScrollX = getScrollForPage(0);
|
||||
onWorkspaceOverallScrollChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue