diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-04-24 11:44:51 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-04-28 16:06:46 -0700 |
commit | e9b651eef1b9f3647eba94f833bff3fc52f5956b (patch) | |
tree | 3eac92b3f856164308b1aaa8dd28c9f0d1befdf4 /src/com/android/launcher3/Workspace.java | |
parent | 559d90d0dafbac1d97a1e6f18062309831a25d51 (diff) | |
download | android_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.tar.gz android_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.tar.bz2 android_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.zip |
Enabling accessibility drag and drop in folder
> Moving DragAndDropAccessibilityDelegate to a separate class
> Using getFocusedVirtualView() instead of using DownX and downY
> Updating various accessibility strings
Bug: 19776741
Change-Id: I85c2551d4d6172c30702e68f41b114bb999655b6
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 2efd20739..07d1c98f1 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -60,6 +60,7 @@ import android.widget.TextView; import com.android.launcher3.FolderIcon.FolderRingAnimator; import com.android.launcher3.Launcher.CustomContentCallbacks; import com.android.launcher3.Launcher.LauncherOverlay; +import com.android.launcher3.LauncherAccessibilityDelegate.AccessibilityDragSource; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.UninstallDropTarget.UninstallSource; import com.android.launcher3.compat.UserHandleCompat; @@ -82,7 +83,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class Workspace extends SmoothPagedView implements DropTarget, DragSource, DragScroller, View.OnTouchListener, DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener, - Insettable, UninstallSource { + Insettable, UninstallSource, AccessibilityDragSource { private static final String TAG = "Launcher.Workspace"; private static final int CHILDREN_OUTLINE_FADE_OUT_DELAY = 0; @@ -125,6 +126,7 @@ public class Workspace extends SmoothPagedView @Thunk Runnable mRemoveEmptyScreenRunnable; @Thunk boolean mDeferRemoveExtraEmptyScreen = false; + @Thunk boolean mAddNewPageOnDrag = true; /** * CellInfo for the cell that is currently being dragged @@ -390,7 +392,7 @@ public class Workspace extends SmoothPagedView post(new Runnable() { @Override public void run() { - if (mIsDragOccuring) { + if (mIsDragOccuring && mAddNewPageOnDrag) { mDeferRemoveExtraEmptyScreen = false; addExtraEmptyScreenOnDrag(); } @@ -398,6 +400,9 @@ public class Workspace extends SmoothPagedView }); } + public void setAddNewPageOnDrag(boolean addPage) { + mAddNewPageOnDrag = addPage; + } public void deferRemoveExtraEmptyScreen() { mDeferRemoveExtraEmptyScreen = true; @@ -562,7 +567,7 @@ public class Workspace extends SmoothPagedView LauncherAccessibilityDelegate delegate = LauncherAppState.getInstance().getAccessibilityDelegate(); if (delegate != null && delegate.isInAccessibleDrag()) { - newScreen.enableAccessibleDrag(true); + newScreen.enableAccessibleDrag(true, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG); } return screenId; } @@ -1601,10 +1606,11 @@ public class Workspace extends SmoothPagedView } @TargetApi(Build.VERSION_CODES.LOLLIPOP) + @Override public void enableAccessibleDrag(boolean enable) { for (int i = 0; i < getChildCount(); i++) { CellLayout child = (CellLayout) getChildAt(i); - child.enableAccessibleDrag(enable); + child.enableAccessibleDrag(enable, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG); } if (enable) { @@ -1615,7 +1621,8 @@ public class Workspace extends SmoothPagedView setOnClickListener(mLauncher); } mLauncher.getSearchBar().enableAccessibleDrag(enable); - mLauncher.getHotseat().getLayout().enableAccessibleDrag(enable); + mLauncher.getHotseat().getLayout() + .enableAccessibleDrag(enable, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG); } public boolean hasCustomContent() { @@ -2262,6 +2269,7 @@ public class Workspace extends SmoothPagedView startDrag(cellInfo, false); } + @Override public void startDrag(CellLayout.CellInfo cellInfo, boolean accessible) { View child = cellInfo.cell; @@ -2625,6 +2633,9 @@ public class Workspace extends SmoothPagedView return false; } + @Override + public void prepareAccessibilityDrop() { } + public void onDrop(final DragObject d) { mDragViewVisualCenter = d.getVisualCenter(mDragViewVisualCenter); CellLayout dropTargetLayout = mDropToLayout; |