summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedView.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-12-20 14:41:35 -0800
committerWinson Chung <winsonc@google.com>2010-12-20 14:49:18 -0800
commita12a2502e6a448d36ab7b8de46de0c1afe40b34f (patch)
tree9fabe3f0f14bbe0db83682616874a9494b5297e3 /src/com/android/launcher2/PagedView.java
parent047379aa61b4719ab38ce595f23732e8f3b1b8e1 (diff)
downloadandroid_packages_apps_Trebuchet-a12a2502e6a448d36ab7b8de46de0c1afe40b34f.tar.gz
android_packages_apps_Trebuchet-a12a2502e6a448d36ab7b8de46de0c1afe40b34f.tar.bz2
android_packages_apps_Trebuchet-a12a2502e6a448d36ab7b8de46de0c1afe40b34f.zip
Saving AllApps page when rotating screen, fixing customization rotate flash.
Change-Id: Idc4b919fa34413578fc07be263aadffb062f6115
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r--src/com/android/launcher2/PagedView.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 8483f959f..68833f9af 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -73,6 +73,7 @@ public abstract class PagedView extends ViewGroup {
protected int mCurrentPage;
protected int mNextPage = INVALID_PAGE;
+ protected int mRestorePage = -1;
protected int mMaxScrollX;
protected Scroller mScroller;
private VelocityTracker mVelocityTracker;
@@ -279,9 +280,8 @@ public abstract class PagedView extends ViewGroup {
mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
updateCurrentPageScroll();
-
- invalidate();
notifyPageSwitchListener();
+ invalidate();
}
protected void notifyPageSwitchListener() {
@@ -1219,22 +1219,6 @@ public abstract class PagedView extends ViewGroup {
invalidate();
}
- @Override
- protected Parcelable onSaveInstanceState() {
- final SavedState state = new SavedState(super.onSaveInstanceState());
- state.currentPage = mCurrentPage;
- return state;
- }
-
- @Override
- protected void onRestoreInstanceState(Parcelable state) {
- SavedState savedState = (SavedState) state;
- super.onRestoreInstanceState(savedState.getSuperState());
- if (savedState.currentPage != -1) {
- mCurrentPage = savedState.currentPage;
- }
- }
-
public void scrollLeft() {
if (mScroller.isFinished()) {
if (mCurrentPage > 0) snapToPage(mCurrentPage - 1);
@@ -1417,6 +1401,10 @@ public abstract class PagedView extends ViewGroup {
}
}
+ public void setRestorePage(int restorePage) {
+ mRestorePage = restorePage;
+ }
+
/**
* This method is called ONLY to synchronize the number of pages that the paged view has.
* To actually fill the pages with information, implement syncPageItems() below. It is
@@ -1443,6 +1431,12 @@ public abstract class PagedView extends ViewGroup {
mDirtyPageContent.add(true);
}
+ // Use the restore page if necessary
+ if (mRestorePage > -1) {
+ mCurrentPage = mRestorePage;
+ mRestorePage = -1;
+ }
+
// Load any pages that are necessary for the current window of views
loadAssociatedPages(mCurrentPage);
mDirtyPageAlpha = true;