diff options
author | Winson Chung <winsonc@google.com> | 2011-11-14 11:39:07 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-11-14 13:29:25 -0800 |
commit | c6f10b906fc9c120cafc81046a42b2434ff635a9 (patch) | |
tree | 94b66501b8acebf2384bc86df5d376da1e9876c2 /src/com/android/launcher2/AppsCustomizeTabHost.java | |
parent | 4db3f7ec76eb16eb999c3233ebed865aca984a53 (diff) | |
download | android_packages_apps_Trebuchet-c6f10b906fc9c120cafc81046a42b2434ff635a9.tar.gz android_packages_apps_Trebuchet-c6f10b906fc9c120cafc81046a42b2434ff635a9.tar.bz2 android_packages_apps_Trebuchet-c6f10b906fc9c120cafc81046a42b2434ff635a9.zip |
Workarounds for a couple crashes. (Bug 5612584, Bug 5613438)
Change-Id: I9669d830a10cc98291737f3f1d561c846c408289
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizeTabHost.java')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 41f8d7e1a..7772f447c 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -202,6 +202,17 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona // Take the visible pages and re-parent them temporarily to mAnimatorBuffer // and then cross fade to the new pages + int[] visiblePageRange = new int[2]; + mAppsCustomizePane.getVisiblePages(visiblePageRange); + if (visiblePageRange[0] == -1 && visiblePageRange[1] == -1) { + // If we can't get the visible page ranges, then just skip the animation + reloadCurrentPage(); + return; + } + ArrayList<View> visiblePages = new ArrayList<View>(); + for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) { + visiblePages.add(mAppsCustomizePane.getPageAt(i)); + } // We want the pages to be rendered in exactly the same way as they were when // their parent was mAppsCustomizePane -- so set the scroll on mAnimationBuffer @@ -209,16 +220,15 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona // parameters to be correct for each of the pages mAnimationBuffer.scrollTo(mAppsCustomizePane.getScrollX(), 0); - int[] visiblePageRange = new int[2]; - mAppsCustomizePane.getVisiblePages(visiblePageRange); - ArrayList<View> visiblePages = new ArrayList<View>(); - for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) { - visiblePages.add(mAppsCustomizePane.getPageAt(i)); - } // mAppsCustomizePane renders its children in reverse order, so // add the pages to mAnimationBuffer in reverse order to match that behavior for (int i = visiblePages.size() - 1; i >= 0; i--) { View child = visiblePages.get(i); + if (child instanceof PagedViewCellLayout) { + ((PagedViewCellLayout) child).resetChildrenOnKeyListeners(); + } else if (child instanceof PagedViewGridLayout) { + ((PagedViewGridLayout) child).resetChildrenOnKeyListeners(); + } PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(false); mAppsCustomizePane.removeView(child); PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(true); |