summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-10-28 17:55:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-28 17:55:36 -0700
commit3e232794f383662940bf61777cfdb877914eb97b (patch)
treeee4030716ed4ecded3e78aa3c1d8b627f7ff6864
parent8ac3ed8edd99209695096c2d1cbf4a7b0184b190 (diff)
parent76bf5553e083aea1aa91f07d4a9433263501c575 (diff)
downloadandroid_packages_apps_Trebuchet-3e232794f383662940bf61777cfdb877914eb97b.tar.gz
android_packages_apps_Trebuchet-3e232794f383662940bf61777cfdb877914eb97b.tar.bz2
android_packages_apps_Trebuchet-3e232794f383662940bf61777cfdb877914eb97b.zip
am 76bf5553: Merge "A bit of code cleanup (issue 11026590)" into jb-ub-now-jetsonic
* commit '76bf5553e083aea1aa91f07d4a9433263501c575': A bit of code cleanup (issue 11026590)
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/PagedView.java43
2 files changed, 25 insertions, 21 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f35daaade..38fc3b344 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3011,7 +3011,7 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
- mAppsCustomizeContent.pauseScrolling();
+ mAppsCustomizeContent.stopScrolling();
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
@@ -3023,7 +3023,6 @@ public class Launcher extends Activity
onCompleteRunnable.run();
}
mAppsCustomizeContent.updateCurrentPageScroll();
- mAppsCustomizeContent.resumeScrolling();
}
});
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index c154b33c5..3ff987393 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -506,33 +506,39 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
scrollTo(newX, 0);
mScroller.setFinalX(newX);
- mScroller.forceFinished(true);
+ forceFinishScroller();
}
/**
* Called during AllApps/Home transitions to avoid unnecessary work. When that other animation
- * ends, {@link #resumeScrolling()} should be called, along with
- * {@link #updateCurrentPageScroll()} to correctly set the final state and re-enable scrolling.
+ * {@link #updateCurrentPageScroll()} should be called, to correctly set the final state and
+ * re-enable scrolling.
*/
- void pauseScrolling() {
- mScroller.forceFinished(true);
+ void stopScrolling() {
+ mCurrentPage = mNextPage;
+ forceFinishScroller();
}
- /**
- * Enables scrolling again.
- * @see #pauseScrolling()
- */
- void resumeScrolling() {
+ private void abortScrollerAnimation() {
+ mScroller.abortAnimation();
+ // We need to clean up the next page here to avoid computeScrollHelper from
+ // updating current page on the pass.
+ mNextPage = INVALID_PAGE;
}
+
+ private void forceFinishScroller() {
+ mScroller.forceFinished(true);
+ // We need to clean up the next page here to avoid computeScrollHelper from
+ // updating current page on the pass.
+ mNextPage = INVALID_PAGE;
+ }
+
/**
* Sets the current page.
*/
void setCurrentPage(int currentPage) {
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- // We need to clean up the next page here to avoid computeScrollHelper from
- // updating current page on the pass.
- mNextPage = INVALID_PAGE;
+ abortScrollerAnimation();
}
// don't introduce any checks like mCurrentPage == currentPage here-- if we change the
// the default
@@ -1366,7 +1372,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
if (finishedScrolling) {
mTouchState = TOUCH_STATE_REST;
- mScroller.abortAnimation();
+ abortScrollerAnimation();
} else {
if (isTouchPointInViewportWithBuffer((int) mDownMotionX, (int) mDownMotionY)) {
mTouchState = TOUCH_STATE_SCROLLING;
@@ -1665,7 +1671,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
* will be false if being flinged.
*/
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
+ abortScrollerAnimation();
}
// Remember where the motion event started
@@ -1863,7 +1869,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
} else {
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
+ abortScrollerAnimation();
}
float scaleX = getScaleX();
@@ -2327,8 +2333,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (mContentIsRefreshable) {
// Force all scrolling-related behavior to end
- mScroller.forceFinished(true);
- mNextPage = INVALID_PAGE;
+ forceFinishScroller();
// Update all the pages
syncPages();