diff options
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 12 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 12 |
4 files changed, 24 insertions, 5 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index d4cd6a2be..c56de07b2 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -69,6 +69,8 @@ <uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" /> <uses-permission android:name="com.android.launcher3.permission.RECEIVE_LAUNCH_BROADCASTS" /> + <uses-feature android:name="android.software.managed_profiles" android:required="false"/> + <application android:name="com.android.launcher3.LauncherApplication" android:label="@string/application_name" diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 54d7e506e..57dcea044 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -66,11 +66,11 @@ public class BubbleTextView extends TextView { private float mSlop; private int mTextColor; - private boolean mCustomShadowsEnabled = true; + private final boolean mCustomShadowsEnabled; private boolean mIsTextVisible; private boolean mBackgroundSizeChanged; - private Drawable mBackground; + private final Drawable mBackground; private boolean mStayPressed; private CheckLongPressHelper mLongPressHelper; @@ -96,6 +96,13 @@ public class BubbleTextView extends TextView { mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, true); a.recycle(); + if (mCustomShadowsEnabled) { + // Draw the background itself as the parent is drawn twice. + mBackground = getBackground(); + setBackground(null); + } else { + mBackground = null; + } init(); } @@ -110,7 +117,6 @@ public class BubbleTextView extends TextView { private void init() { mLongPressHelper = new CheckLongPressHelper(this); - mBackground = getBackground(); mOutlineHelper = HolographicOutlineHelper.obtain(getContext()); if (mCustomShadowsEnabled) { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 0b0796826..951b5d459 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; |