summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Willem Maarse <maarse@google.com>2014-07-15 20:38:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-15 20:35:01 +0000
commitca424c67f3deeb34a870e37a5743f66091961112 (patch)
tree8a1f39c5d925249142092afec65d5f2573480f66
parent4224758a546aafee4f6b6ce932bfb0d7586d8521 (diff)
parent2ff91c46fa6f1b84fb08b6f31499934d30d8a91d (diff)
downloadandroid_packages_apps_Trebuchet-ca424c67f3deeb34a870e37a5743f66091961112.tar.gz
android_packages_apps_Trebuchet-ca424c67f3deeb34a870e37a5743f66091961112.tar.bz2
android_packages_apps_Trebuchet-ca424c67f3deeb34a870e37a5743f66091961112.zip
Merge "Allow custom content to lock the workspace" into ub-now-master
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/Workspace.java12
2 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a85b5b18d..400cd2472 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1089,6 +1089,9 @@ public class Launcher extends Activity
// Custom content scroll progress changed. From 0 (not showing) to 1 (fully showing).
public void onScrollProgressChanged(float progress);
+
+ // Indicates whether the user is allowed to scroll away from the custom content.
+ boolean isScrollingAllowed();
}
protected boolean hasSettings() {
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 48795af13..a8e7580c3 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1159,12 +1159,20 @@ public class Workspace extends SmoothPagedView
(mTouchDownTime - mCustomContentShowTime) > CUSTOM_CONTENT_GESTURE_DELAY;
boolean swipeInIgnoreDirection = isLayoutRtl() ? deltaX < 0 : deltaX > 0;
- if (swipeInIgnoreDirection && getScreenIdForPageIndex(getCurrentPage()) ==
- CUSTOM_CONTENT_SCREEN_ID && passRightSwipesToCustomContent) {
+ boolean onCustomContentScreen =
+ getScreenIdForPageIndex(getCurrentPage()) == CUSTOM_CONTENT_SCREEN_ID;
+ if (swipeInIgnoreDirection && onCustomContentScreen && passRightSwipesToCustomContent) {
// Pass swipes to the right to the custom content page.
return;
}
+ if (onCustomContentScreen && (mCustomContentCallbacks != null)
+ && !mCustomContentCallbacks.isScrollingAllowed()) {
+ // Don't allow workspace scrolling if the current custom content screen doesn't allow
+ // scrolling.
+ return;
+ }
+
if (theta > MAX_SWIPE_ANGLE) {
// Above MAX_SWIPE_ANGLE, we don't want to ever start scrolling the workspace
return;