diff options
author | Matt Garnes <matt@cyngn.com> | 2014-06-12 15:07:36 -0700 |
---|---|---|
committer | Matt Garnes <matt@cyngn.com> | 2014-06-17 19:02:28 -0700 |
commit | 8ca6c2a3d078aab3746a59a123b5a100bca6a2df (patch) | |
tree | 10649ceed0f93812ec7574af178aafb68c581d13 /src/com/android/launcher3/Workspace.java | |
parent | 56db21e5af4c17f9308ceb07b0f3ab651743b5cd (diff) | |
download | android_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.tar.gz android_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.tar.bz2 android_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.zip |
Add a custom home screen to Trebuchet.
Scrolling to the left will now open a custom home screen that can be
used to display information provided by the system or third parties
via an API.
Change-Id: I62991c0634b686ca875d04fa118695050731ba7e
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 008dc1527..c67ca9395 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1255,7 +1255,8 @@ public class Workspace extends SmoothPagedView super.notifyPageSwitchListener(); Launcher.setScreen(getNextPage()); - if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) { + int ccIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID); + if (hasCustomContent() && getNextPage() == ccIndex && !mCustomContentShowing) { mCustomContentShowing = true; if (mCustomContentCallbacks != null) { @@ -1263,7 +1264,7 @@ public class Workspace extends SmoothPagedView mCustomContentShowTime = System.currentTimeMillis(); mLauncher.updateVoiceButtonProxyVisible(false); } - } else if (hasCustomContent() && mCustomContentShowing) { + } else if (hasCustomContent() && getNextPage() != ccIndex && mCustomContentShowing) { mCustomContentShowing = false; if (mCustomContentCallbacks != null) { mCustomContentCallbacks.onHide(); @@ -1826,12 +1827,17 @@ public class Workspace extends SmoothPagedView // them mLastSetWallpaperOffsetSteps = 0f; + moveAwayFromCustomContentIfRequired(); + } + + public void moveAwayFromCustomContentIfRequired() { // Never resume to the custom page if GEL integration is enabled. int customPageIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID); // mCustomContentShowing can be lost if the Activity is recreated, // So make sure it is set to the right value. mCustomContentShowing = mCustomContentShowing - || (customPageIndex == getCurrentPage() && hasCustomContent()); + || (customPageIndex == getCurrentPage() + && hasCustomContent()); if (mCustomContentShowing && mLauncher.isGelIntegrationEnabled()) { moveToScreen((customPageIndex + 1), true); } @@ -1844,6 +1850,8 @@ public class Workspace extends SmoothPagedView mWallpaperOffset.jumpToFinal(); } super.onLayout(changed, left, top, right, bottom); + + moveAwayFromCustomContentIfRequired(); } @Override @@ -4187,7 +4195,12 @@ public class Workspace extends SmoothPagedView } public int getCurrentPageOffsetFromCustomContent() { - return getNextPage() - numCustomPages(); + int numCustomPages = numCustomPages(); + // Special case where the Gel Integration page must be counted below + if(mLauncher.isGelIntegrationEnabled() && mLauncher.isGelIntegrationSupported()) { + numCustomPages += 1; + } + return getNextPage() - numCustomPages; } /** |