Methods Summary |
---|
android.animation.ObjectAnimator | animateBoundScroll()Animates the stack scroll into bounds
float curScroll = getStackScroll();
float newScroll = getBoundedStackScroll(curScroll);
if (Float.compare(newScroll, curScroll) != 0) {
// Start a new scroll animation
animateScroll(curScroll, newScroll, null);
}
return mScrollAnimator;
|
void | animateScroll(float curScroll, float newScroll, java.lang.Runnable postRunnable)Animates the stack scroll
// Finish any current scrolling animations
if (mScrollAnimator != null && mScrollAnimator.isRunning()) {
setStackScroll(mFinalAnimatedScroll);
mScroller.startScroll(0, progressToScrollRange(mFinalAnimatedScroll), 0, 0, 0);
}
stopScroller();
stopBoundScrollAnimation();
mFinalAnimatedScroll = newScroll;
mScrollAnimator = ObjectAnimator.ofFloat(this, "stackScroll", curScroll, newScroll);
mScrollAnimator.setDuration(mConfig.taskStackScrollDuration);
mScrollAnimator.setInterpolator(mConfig.linearOutSlowInInterpolator);
mScrollAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
setStackScroll((Float) animation.getAnimatedValue());
}
});
mScrollAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (postRunnable != null) {
postRunnable.run();
}
mScrollAnimator.removeAllListeners();
}
});
mScrollAnimator.start();
|
public boolean | boundScroll()Bounds the current scroll if necessary
float curScroll = getStackScroll();
float newScroll = getBoundedStackScroll(curScroll);
if (Float.compare(newScroll, curScroll) != 0) {
setStackScroll(newScroll);
return true;
}
return false;
|
public boolean | boundScrollRaw()Bounds the current scroll if necessary, but does not synchronize the stack view with the model.
float curScroll = getStackScroll();
float newScroll = getBoundedStackScroll(curScroll);
if (Float.compare(newScroll, curScroll) != 0) {
setStackScrollRaw(newScroll);
return true;
}
return false;
|
boolean | computeScroll()Called from the view draw, computes the next scroll.
if (mScroller.computeScrollOffset()) {
float scroll = scrollRangeToProgress(mScroller.getCurrY());
setStackScrollRaw(scroll);
if (mCb != null) {
mCb.onScrollChanged(scroll);
}
return true;
}
return false;
|
float | getBoundedStackScroll(float scroll)Returns the bounded stack scroll
return Math.max(mLayoutAlgorithm.mMinScrollP, Math.min(mLayoutAlgorithm.mMaxScrollP, scroll));
|
float | getScrollAmountOutOfBounds(float scroll)Returns the amount that the aboslute value of how much the scroll is out of bounds.
if (scroll < mLayoutAlgorithm.mMinScrollP) {
return Math.abs(scroll - mLayoutAlgorithm.mMinScrollP);
} else if (scroll > mLayoutAlgorithm.mMaxScrollP) {
return Math.abs(scroll - mLayoutAlgorithm.mMaxScrollP);
}
return 0f;
|
public float | getStackScroll()Gets the current stack scroll
return mStackScrollP;
|
boolean | isScrollOutOfBounds()Returns whether the specified scroll is out of bounds
return Float.compare(getScrollAmountOutOfBounds(mStackScrollP), 0f) != 0;
|
boolean | isScrolling()Returns whether the overscroller is scrolling.
return !mScroller.isFinished();
|
int | progressToScrollRange(float p)OverScroller
return (int) (p * mLayoutAlgorithm.mStackVisibleRect.height());
|
void | reset()Resets the task scroller.
mStackScrollP = 0f;
|
float | scrollRangeToProgress(int s)
return (float) s / mLayoutAlgorithm.mStackVisibleRect.height();
|
void | setCallbacks(com.android.systemui.recents.views.TaskStackViewScroller$TaskStackViewScrollerCallbacks cb)Sets the callbacks
mCb = cb;
|
public void | setStackScroll(float s)Sets the current stack scroll
mStackScrollP = s;
if (mCb != null) {
mCb.onScrollChanged(mStackScrollP);
}
|
void | setStackScrollRaw(float s)Sets the current stack scroll without calling the callback.
mStackScrollP = s;
|
public boolean | setStackScrollToInitialState()Sets the current stack scroll to the initial state when you first enter recents.
float prevStackScrollP = mStackScrollP;
setStackScroll(getBoundedStackScroll(mLayoutAlgorithm.mInitialScrollP));
return Float.compare(prevStackScrollP, mStackScrollP) != 0;
|
void | stopBoundScrollAnimation()Aborts any current stack scrolls
Utilities.cancelAnimationWithoutCallbacks(mScrollAnimator);
|
void | stopScroller()Stops the scroller and any current fling.
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
|