diff options
author | Adam Cohen <adamcohen@google.com> | 2013-06-11 12:48:00 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2013-06-11 14:57:43 -0700 |
commit | 66a01fd24bde7c94ea892b007df7f79fbaa43d80 (patch) | |
tree | 93e1878f8abd6b9bbc9aaa8dde8c7c73bcb36e5c /src/com/android/launcher3 | |
parent | ecf33e4819d0c4b019706edd456ed14a6a0f200c (diff) | |
download | android_packages_apps_Trebuchet-66a01fd24bde7c94ea892b007df7f79fbaa43d80.tar.gz android_packages_apps_Trebuchet-66a01fd24bde7c94ea892b007df7f79fbaa43d80.tar.bz2 android_packages_apps_Trebuchet-66a01fd24bde7c94ea892b007df7f79fbaa43d80.zip |
Add API to launcher to insert a custom page to the left of workspace
Change-Id: I85a4e096aab9bfcb1de74f04075bcabcb7e3262f
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 34 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 6 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index bb264d60a..25b1fd483 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -826,6 +826,34 @@ public class Launcher extends Activity mDragController.resetLastGestureUpTime(); } + protected void onFinishBindingItems() { + } + + // Add a fullscreen unpadded view to the workspace to the left all other screens. + public void addCustomContentToLeft(View customContent) { + CellLayout customScreen = (CellLayout) + getLayoutInflater().inflate(R.layout.workspace_custom_content, null); + + int spanX = customScreen.getCountX(); + int spanY = customScreen.getCountY(); + + CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY); + lp.canReorder = false; + + customScreen.addViewToCellLayout(customContent, 0, 0, lp, true); + + mWorkspace.addView(customScreen, 0); + + // We don't want to change the current or the default screen + mWorkspace.post(new Runnable() { + @Override + public void run() { + mWorkspace.incrementDefaultScreen(); + mWorkspace.setCurrentPage(mWorkspace.getCurrentPage() + 1); + } + }); + } + @Override public Object onRetainNonConfigurationInstance() { // Flag the loader to stop early before switching @@ -3617,6 +3645,12 @@ public class Launcher extends Activity mWorkspace.stripDuplicateApps(); mIntentsOnWorkspaceFromUpgradePath = mWorkspace.stripDuplicateApps(); } + mWorkspace.post(new Runnable() { + @Override + public void run() { + onFinishBindingItems(); + } + }); } private boolean canRunNewAppsAnimation() { diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index d600e9ef6..e51931298 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -398,6 +398,12 @@ public class Workspace extends SmoothPagedView UninstallShortcutReceiver.disableAndFlushUninstallQueue(getContext()); } + // Just a hack so that if a custom content screen is added to the left, we adjust the + // default screen accordingly so that it stays the same. + void incrementDefaultScreen() { + mDefaultPage++; + } + /** * Initializes various states for this workspace. */ |