summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorDave Hawkey <dhawkey@google.com>2013-09-19 17:16:32 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-19 17:16:32 +0000
commit8c082818a8ee813318e32a667883f73d7b94126a (patch)
tree866ad2c2122203217514d38d26a659492290b58a /src/com/android/launcher3/Launcher.java
parentdbdff6bc7b225255207a46fad8f536b55a18efac (diff)
parenta888158880fea53479447d883391f552604e46b6 (diff)
downloadandroid_packages_apps_Trebuchet-8c082818a8ee813318e32a667883f73d7b94126a.tar.gz
android_packages_apps_Trebuchet-8c082818a8ee813318e32a667883f73d7b94126a.tar.bz2
android_packages_apps_Trebuchet-8c082818a8ee813318e32a667883f73d7b94126a.zip
Merge "Support for dynamically adding/removing -1 screen" into jb-ub-now-indigo-rose
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index aad9b9f35..daf9f096b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -482,6 +482,33 @@ public class Launcher extends Activity
return false;
}
+ /**
+ * To be overridden by subclasses to create the custom content and call
+ * {@link #addToCustomContentPage}. This will only be invoked if
+ * {@link #hasCustomContentToLeft()} is {@code true}.
+ */
+ protected void addCustomContentToLeft() {
+ }
+
+ /**
+ * Invoked by subclasses to signal a change to the {@link #addCustomContentToLeft} value to
+ * ensure the custom content page is added or removed if necessary.
+ */
+ protected void invalidateHasCustomContentToLeft() {
+ if (mWorkspace.getScreenOrder().isEmpty()) {
+ // Not bound yet, wait for bindScreens to be called.
+ return;
+ }
+
+ if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) {
+ // Create the custom content page and call the subclass to populate it.
+ mWorkspace.createCustomContentPage();
+ addCustomContentToLeft();
+ } else if (mWorkspace.hasCustomContent() && !hasCustomContentToLeft()) {
+ mWorkspace.removeCustomContentPage();
+ }
+ }
+
private void updateGlobalIcons() {
boolean searchVisible = false;
boolean voiceVisible = false;
@@ -896,6 +923,9 @@ public class Launcher extends Activity
}
protected void onFinishBindingItems() {
+ if (hasCustomContentToLeft() && mWorkspace.hasCustomContent()) {
+ addCustomContentToLeft();
+ }
}
QSBScroller mQsbScroller = new QSBScroller() {
@@ -3607,7 +3637,8 @@ public class Launcher extends Activity
}
// Create the custom content page (this call updates mDefaultScreen which calls
- // setCurrentPage() so ensure that all pages are added before calling this)
+ // setCurrentPage() so ensure that all pages are added before calling this).
+ // The actual content of the custom page will be added during onFinishBindingItems().
if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) {
mWorkspace.createCustomContentPage();
}