Adding hint for launcher to pre-create custom workspace screen.
Change-Id: I150fb8b6ff13053bf4b0b49f2b510630ed50714a
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 321c4e7..e84c708 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -444,6 +444,11 @@
sPausedFromUserAction = true;
}
+ /** To be overriden by subclasses to hint to Launcher that we have custom content */
+ protected boolean hasCustomContentToLeft() {
+ return false;
+ }
+
private void updateGlobalIcons() {
boolean searchVisible = false;
boolean voiceVisible = false;
@@ -868,13 +873,13 @@
}
// Add a fullscreen unpadded view to the workspace to the left all other screens.
- public QSBScroller addCustomContentToLeft(View customContent) {
- return addCustomContentToLeft(customContent, null);
+ public QSBScroller addToCustomContentPage(View customContent) {
+ return addToCustomContentPage(customContent, null);
}
- public QSBScroller addCustomContentToLeft(View customContent,
+ public QSBScroller addToCustomContentPage(View customContent,
CustomContentCallbacks callbacks) {
- mWorkspace.addCustomContentToLeft(customContent, callbacks);
+ mWorkspace.addToCustomContentPage(customContent, callbacks);
return mQsbScroller;
}
@@ -3718,6 +3723,11 @@
mSavedState = null;
}
+ // Create the custom content page here before onLayout to prevent flashing
+ if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) {
+ mWorkspace.createCustomContentPage();
+ }
+
mWorkspace.restoreInstanceStateForRemainingPages();
// If we received the result of any pending adds while the loader was running (e.g. the