summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-07-31 17:44:43 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-31 17:44:44 +0000
commit707f650c5c9f569f1c4bfe98be00ea77cc24073d (patch)
tree114f3d7e5c0826e9c0059fc102f503bb329b8659 /src/com/android/launcher3/Workspace.java
parent63d7870ea23502f10b74e9c91de9bd8f0bfc0507 (diff)
parent98ca0f7203f66c491a5362c2f4db79547872bdfe (diff)
downloadandroid_packages_apps_Trebuchet-707f650c5c9f569f1c4bfe98be00ea77cc24073d.tar.gz
android_packages_apps_Trebuchet-707f650c5c9f569f1c4bfe98be00ea77cc24073d.tar.bz2
android_packages_apps_Trebuchet-707f650c5c9f569f1c4bfe98be00ea77cc24073d.zip
Merge "Adding hint for launcher to pre-create custom workspace screen." into jb-ub-gel-agar
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6627ec1a1..2d23f362f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -528,19 +528,10 @@ public class Workspace extends SmoothPagedView
return screenId;
}
- public void addCustomContentToLeft(View customContent, CustomContentCallbacks callbacks) {
+ public void createCustomContentPage() {
CellLayout customScreen = (CellLayout)
mLauncher.getLayoutInflater().inflate(R.layout.workspace_screen, null);
- int spanX = customScreen.getCountX();
- int spanY = customScreen.getCountY();
-
- CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY);
- lp.canReorder = false;
- lp.isFullscreen = true;
-
- customScreen.addViewToCellLayout(customContent, 0, 0, lp, true);
-
Rect p = new Rect();
AppWidgetHostView.getDefaultPaddingForWidget(mLauncher, mLauncher.getComponentName(), p);
@@ -549,13 +540,28 @@ public class Workspace extends SmoothPagedView
addFullScreenPage(customScreen);
- mCustomContentCallbacks = callbacks;
-
// Ensure that the current page and default page are maintained.
mDefaultPage++;
setCurrentPage(getCurrentPage() + 1);
}
+ public void addToCustomContentPage(View customContent, CustomContentCallbacks callbacks) {
+ if (getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID) < 0) {
+ throw new RuntimeException("Expected custom content screen to exist");
+ }
+
+ // Add the custom content to the full screen custom page
+ CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
+ int spanX = customScreen.getCountX();
+ int spanY = customScreen.getCountY();
+ CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY);
+ lp.canReorder = false;
+ lp.isFullscreen = true;
+ customScreen.addViewToCellLayout(customContent, 0, 0, lp, true);
+
+ mCustomContentCallbacks = callbacks;
+ }
+
public long commitExtraEmptyScreen() {
CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
@@ -1300,7 +1306,7 @@ public class Workspace extends SmoothPagedView
}
}
- private boolean hasCustomContent() {
+ public boolean hasCustomContent() {
return (mScreenOrder.size() > 0 && mScreenOrder.get(0) == CUSTOM_CONTENT_SCREEN_ID);
}