Merge "Using content provider to update launcher settings" into ub-launcher3-burnaby
diff --git a/proguard.flags b/proguard.flags
index 5e2c384..7ec488b 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -44,7 +44,7 @@
public void setBrightness(int);
}
--keep class com.android.launcher3.AppsContainerRecyclerView {
+-keep class com.android.launcher3.BaseRecyclerView {
public void setFastScrollerAlpha(float);
public float getFastScrollerAlpha();
}
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index 0ede2fc..d93cdcc 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -16,11 +16,8 @@
package com.android.launcher3;
-import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
-import android.os.Build;
-import android.provider.Settings;
import android.util.AttributeSet;
import com.android.launcher3.compat.UserHandleCompat;
@@ -70,18 +67,8 @@
return source.supportsAppInfoDropTarget() && supportsDrop(getContext(), info);
}
- @SuppressWarnings("deprecation")
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean supportsDrop(Context context, Object info) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return (Settings.Global.getInt(context.getContentResolver(),
- Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) == 1) &&
- (info instanceof AppInfo || info instanceof PendingAddItemInfo);
- } else {
- return (Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0) == 1) &&
- (info instanceof AppInfo || info instanceof PendingAddItemInfo);
- }
+ return info instanceof AppInfo || info instanceof PendingAddItemInfo;
}
@Override
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ba9a96e..d52191b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -98,7 +98,6 @@
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.PagedView.PageSwitchListener;
-import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AppSearchManager;
import com.android.launcher3.compat.AppWidgetManagerCompat;
@@ -2454,9 +2453,8 @@
return;
}
- LauncherAccessibilityDelegate delegate =
- LauncherAppState.getInstance().getAccessibilityDelegate();
- if (delegate != null && delegate.onBackPressed()) {
+ if (mDragController.isDragging()) {
+ mDragController.cancelDrag();
return;
}
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 18832c6..4a85b44 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -567,6 +567,13 @@
public void scrollTo(int x, int y) {
// In free scroll mode, we clamp the scrollX
if (mFreeScroll) {
+ // If the scroller is trying to move to a location beyond the maximum allowed
+ // in the free scroll mode, we make sure to end the scroll operation.
+ if (!mScroller.isFinished() &&
+ (x > mFreeScrollMaxScrollX || x < mFreeScrollMinScrollX)) {
+ forceFinishScroller();
+ }
+
x = Math.min(x, mFreeScrollMaxScrollX);
x = Math.max(x, mFreeScrollMinScrollX);
}
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 3c49ccc..fe7b25e 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -20,6 +20,8 @@
import com.android.launcher3.AppWidgetResizeFrame;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeleteDropTarget;
+import com.android.launcher3.DragController.DragListener;
+import com.android.launcher3.DragSource;
import com.android.launcher3.Folder;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.InfoDropTarget;
@@ -39,7 +41,7 @@
import java.util.ArrayList;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
-public class LauncherAccessibilityDelegate extends AccessibilityDelegate {
+public class LauncherAccessibilityDelegate extends AccessibilityDelegate implements DragListener {
private static final String TAG = "LauncherAccessibilityDelegate";
@@ -328,7 +330,6 @@
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(clickedTarget, loc);
mLauncher.getDragController().completeAccessibleDrag(loc);
- endAccessibleDrag();
if (!TextUtils.isEmpty(confirmation)) {
announceConfirmation(confirmation);
}
@@ -366,22 +367,21 @@
}
mDragSource.enableAccessibleDrag(true);
mDragSource.startDrag(cellInfo, true);
- }
- public boolean onBackPressed() {
- if (isInAccessibleDrag()) {
- cancelAccessibleDrag();
- return true;
+ if (mLauncher.getDragController().isDragging()) {
+ mLauncher.getDragController().addDragListener(this);
}
- return false;
}
- private void cancelAccessibleDrag() {
- mLauncher.getDragController().cancelDrag();
- endAccessibleDrag();
+
+ @Override
+ public void onDragStart(DragSource source, Object info, int dragAction) {
+ // No-op
}
- private void endAccessibleDrag() {
+ @Override
+ public void onDragEnd() {
+ mLauncher.getDragController().removeDragListener(this);
mDragInfo = null;
if (mDragSource != null) {
mDragSource.enableAccessibleDrag(false);