summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AppsCustomizeTabHost.java
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-11-21 14:05:46 -0800
committerMichael Jurka <mikejurka@google.com>2011-11-22 17:00:06 -0800
commite326f186af6b00e4ea32849f1527254c669d0600 (patch)
tree60b08e3581cebbf8edec085d2e9bc8ee341c9a3f /src/com/android/launcher2/AppsCustomizeTabHost.java
parent31186d0535ce2147e0d094c1409782d0b1aa5ea0 (diff)
downloadandroid_packages_apps_Trebuchet-e326f186af6b00e4ea32849f1527254c669d0600.tar.gz
android_packages_apps_Trebuchet-e326f186af6b00e4ea32849f1527254c669d0600.tar.bz2
android_packages_apps_Trebuchet-e326f186af6b00e4ea32849f1527254c669d0600.zip
Unload widget previews when launcher is not visible
Can save ~1-2MB of RAM Bug #5104303 Change-Id: I992bec33052f4d2c201e528b5edf384d05960e71
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizeTabHost.java')
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 778d6bc75..2963240fa 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -366,6 +366,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
}
mContent.setVisibility(VISIBLE);
+ if (!toWorkspace) {
+ // Make sure the current page is loaded (we start loading the side pages after the
+ // transition to prevent slowing down the animation)
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
+ }
if (animated && !delayLauncherTransitionUntilLayout) {
enableAndBuildHardwareLayer();
}
@@ -391,6 +396,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null);
mAppsCustomizePane.showAllAppsCling();
+ // Make sure adjacent pages are loaded (we wait until after the transition to
+ // prevent slowing down the animation)
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false);
@@ -398,6 +406,23 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
}
}
+ public void onResume() {
+ if (getVisibility() == VISIBLE) {
+ mContent.setVisibility(VISIBLE);
+ // We unload the widget previews when the UI is hidden, so need to reload pages
+ // Load the current page synchronously, and the neighboring pages asynchronously
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
+ }
+ }
+
+ public void onTrimMemory() {
+ mContent.setVisibility(GONE);
+ // Clear the widget pages of all their subviews - this will trigger the widget previews
+ // to delete their bitmaps
+ mAppsCustomizePane.clearAllWidgetPages();
+ }
+
boolean isTransitioning() {
return mInTransition;
}