Flash scroll indicators a bit earlier on transitions
Change-Id: I456b61480299b1177d9d275f2cb4459bab02d63e
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 24feb41..0321e3f 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -323,7 +323,7 @@
// a method that subclasses can override to add behavior
protected void onPageBeginMoving() {
- showScrollingIndicator();
+ showScrollingIndicator(false);
}
// a method that subclasses can override to add behavior
@@ -478,6 +478,8 @@
mMaxScrollX = 0;
}
+ updateScrollingIndicatorPosition();
+
setMeasuredDimension(widthSize, heightSize);
}
@@ -1685,11 +1687,11 @@
};
protected void flashScrollingIndicator() {
removeCallbacks(hideScrollingIndicatorRunnable);
- showScrollingIndicator();
+ showScrollingIndicator(false);
postDelayed(hideScrollingIndicatorRunnable, sScrollIndicatorFlashDuration);
}
- protected void showScrollingIndicator() {
+ protected void showScrollingIndicator(boolean immediately) {
if (getChildCount() <= 1) return;
if (!isScrollingIndicatorEnabled()) return;
@@ -1701,9 +1703,13 @@
if (mScrollIndicatorAnimator != null) {
mScrollIndicatorAnimator.cancel();
}
- mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 1f);
- mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeInDuration);
- mScrollIndicatorAnimator.start();
+ if (immediately) {
+ mScrollIndicator.setAlpha(1f);
+ } else {
+ mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 1f);
+ mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeInDuration);
+ mScrollIndicatorAnimator.start();
+ }
}
}
@@ -1762,7 +1768,7 @@
private void updateScrollingIndicatorPosition() {
if (!isScrollingIndicatorEnabled()) return;
-
+ if (mScrollIndicator == null) return;
int numPages = getChildCount();
int pageWidth = getMeasuredWidth();
int maxPageWidth = (numPages * getChildWidth(0)) + ((numPages - 1) * mPageSpacing);