diff options
author | Winson Chung <winsonc@google.com> | 2011-10-20 13:58:30 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-10-20 18:18:14 -0700 |
commit | 097e6c71b12ad1fdc9beba5f74c466521508df9d (patch) | |
tree | 5687cf811e7e29367fe0b6ee3310e5035e7106b5 /src/com | |
parent | dd3a3d9cf94b80c356ca1d9ca62a3b90e0d56c5c (diff) | |
download | android_packages_apps_Trebuchet-097e6c71b12ad1fdc9beba5f74c466521508df9d.tar.gz android_packages_apps_Trebuchet-097e6c71b12ad1fdc9beba5f74c466521508df9d.tar.bz2 android_packages_apps_Trebuchet-097e6c71b12ad1fdc9beba5f74c466521508df9d.zip |
Adding additional checks to prevent launcher crash when we can't compose animation buffer. (Bug: 5478481)
Change-Id: I5671bffab8626b4e2224ef4c174204a5a3b68f97
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 8d67e5d66..688ea152d 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -167,6 +167,14 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona mAppsCustomizePane.hideScrollingIndicator(false); } + private void reloadCurrentPage() { + if (!LauncherApplication.isScreenLarge()) { + mAppsCustomizePane.flashScrollingIndicator(); + } + mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage()); + mAppsCustomizePane.requestFocus(); + } + private void onTabChangedEnd(AppsCustomizePagedView.ContentType type) { mAppsCustomizePane.setContentType(type); } @@ -188,6 +196,12 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona post(new Runnable() { @Override public void run() { + if (mAppsCustomizePane.getMeasuredWidth() <= 0 || + mAppsCustomizePane.getMeasuredHeight() <= 0) { + reloadCurrentPage(); + return; + } + // Setup the animation buffer Bitmap b = Bitmap.createBitmap(mAppsCustomizePane.getMeasuredWidth(), mAppsCustomizePane.getMeasuredHeight(), Bitmap.Config.ARGB_8888); @@ -217,12 +231,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona inAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - if (!LauncherApplication.isScreenLarge()) { - mAppsCustomizePane.flashScrollingIndicator(); - } - mAppsCustomizePane.loadAssociatedPages( - mAppsCustomizePane.getCurrentPage()); - mAppsCustomizePane.requestFocus(); + reloadCurrentPage(); } }); AnimatorSet animSet = new AnimatorSet(); |