summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-06-11 18:43:26 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-11 18:43:27 (GMT)
commite89cf793ab22fcb8cea3ff94ca981659208446db (patch)
tree221ef35425e683b6a142a4b6ffeee14e003e35a6
parentb2b02b9bd2e0b0da7373125c06f6d67d9758d8fe (diff)
parent45478022977de9025dfc887cc1507d90d15febf8 (diff)
downloadandroid_packages_apps_Trebuchet-e89cf793ab22fcb8cea3ff94ca981659208446db.zip
android_packages_apps_Trebuchet-e89cf793ab22fcb8cea3ff94ca981659208446db.tar.gz
android_packages_apps_Trebuchet-e89cf793ab22fcb8cea3ff94ca981659208446db.tar.bz2
Merge "Tying accessibility drag lifecycle to that of dragController" into ub-launcher3-burnaby
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java24
2 files changed, 14 insertions, 16 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 076a6e6..796de3f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -98,7 +98,6 @@ import android.widget.Toast;
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;
@@ -2470,9 +2469,8 @@ public class Launcher extends Activity
return;
}
- LauncherAccessibilityDelegate delegate =
- LauncherAppState.getInstance().getAccessibilityDelegate();
- if (delegate != null && delegate.onBackPressed()) {
+ if (mDragController.isDragging()) {
+ mDragController.cancelDrag();
return;
}
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.AppInfo;
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 com.android.launcher3.util.Thunk;
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 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate {
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(clickedTarget, loc);
mLauncher.getDragController().completeAccessibleDrag(loc);
- endAccessibleDrag();
if (!TextUtils.isEmpty(confirmation)) {
announceConfirmation(confirmation);
}
@@ -366,22 +367,21 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate {
}
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);