Loading src/com/android/launcher3/DragLayer.java +39 −10 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.view.animation.Interpolator; import android.widget.FrameLayout; import android.widget.TextView; import com.android.launcher3.InsettableFrameLayout.LayoutParams; import com.android.launcher3.util.Thunk; import java.util.ArrayList; Loading Loading @@ -153,6 +152,14 @@ public class DragLayer extends InsettableFrameLayout { return false; } private boolean isEventOverDropTargetBar(MotionEvent ev) { getDescendantRectRelativeToSelf(mLauncher.getSearchBar(), mHitRect); if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) { return true; } return false; } public void setBlockTouch(boolean block) { mBlockTouches = block; } Loading Loading @@ -188,12 +195,18 @@ public class DragLayer extends InsettableFrameLayout { } } getDescendantRectRelativeToSelf(currentFolder, hitRect); if (!isEventOverFolder(currentFolder, ev)) { if (isInAccessibleDrag()) { // Do not close the folder if in drag and drop. if (!isEventOverDropTargetBar(ev)) { return true; } } else { mLauncher.closeFolder(); return true; } } } return false; } Loading Loading @@ -228,11 +241,12 @@ public class DragLayer extends InsettableFrameLayout { getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isTouchExplorationEnabled()) { final int action = ev.getAction(); boolean isOverFolder; boolean isOverFolderOrSearchBar; switch (action) { case MotionEvent.ACTION_HOVER_ENTER: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder) { isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) || (isInAccessibleDrag() && isEventOverDropTargetBar(ev)); if (!isOverFolderOrSearchBar) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; Loading @@ -240,12 +254,13 @@ public class DragLayer extends InsettableFrameLayout { mHoverPointClosesFolder = false; break; case MotionEvent.ACTION_HOVER_MOVE: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder && !mHoverPointClosesFolder) { isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) || (isInAccessibleDrag() && isEventOverDropTargetBar(ev)); if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; } else if (!isOverFolder) { } else if (!isOverFolderOrSearchBar) { return true; } mHoverPointClosesFolder = false; Loading @@ -268,6 +283,12 @@ public class DragLayer extends InsettableFrameLayout { } } private boolean isInAccessibleDrag() { LauncherAccessibilityDelegate delegate = LauncherAppState .getInstance().getAccessibilityDelegate(); return delegate != null && delegate.isInAccessibleDrag(); } @Override public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) { Folder currentFolder = mLauncher.getWorkspace().getOpenFolder(); Loading @@ -275,6 +296,10 @@ public class DragLayer extends InsettableFrameLayout { if (child == currentFolder) { return super.onRequestSendAccessibilityEvent(child, event); } if (isInAccessibleDrag() && child instanceof SearchDropTargetBar) { return super.onRequestSendAccessibilityEvent(child, event); } // Skip propagating onRequestSendAccessibilityEvent all for other children // when a folder is open return false; Loading @@ -288,6 +313,10 @@ public class DragLayer extends InsettableFrameLayout { if (currentFolder != null) { // Only add the folder as a child for accessibility when it is open childrenForAccessibility.add(currentFolder); if (isInAccessibleDrag()) { childrenForAccessibility.add(mLauncher.getSearchBar()); } } else { super.addChildrenForAccessibility(childrenForAccessibility); } Loading src/com/android/launcher3/Folder.java +3 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList for (int i = 0; i < mContent.getChildCount(); i++) { mContent.getPageAt(i).enableAccessibleDrag(enable, CellLayout.FOLDER_ACCESSIBILITY_DRAG); } mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : IMPORTANT_FOR_ACCESSIBILITY_AUTO); mLauncher.getWorkspace().setAddNewPageOnDrag(!enable); } Loading src/com/android/launcher3/FolderPagedView.java +4 −0 Original line number Diff line number Diff line Loading @@ -504,6 +504,10 @@ public class FolderPagedView extends PagedView { } } public int getAllocatedContentSize() { return mAllocatedContentSize; } /** * Reorders the items such that the {@param empty} spot moves to {@param target} */ Loading src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java +11 −5 Original line number Diff line number Diff line Loading @@ -24,23 +24,29 @@ import com.android.launcher3.R; * Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD in a folder. */ public class FolderAccessibilityHelper extends DragAndDropAccessibilityDelegate { /** * 0-index position for the first cell in {@link #mView} in {@link #mParent}. */ private final int mStartPosition; private final FolderPagedView mParent; public FolderAccessibilityHelper(CellLayout layout) { super(layout); FolderPagedView parent = (FolderPagedView) layout.getParent(); mParent = (FolderPagedView) layout.getParent(); int index = parent.indexOfChild(layout); mStartPosition = 1 + index * layout.getCountX() * layout.getCountY(); int index = mParent.indexOfChild(layout); mStartPosition = index * layout.getCountX() * layout.getCountY(); } @Override protected int intersectsValidDropTarget(int id) { return id; return Math.min(id, mParent.getAllocatedContentSize() - mStartPosition - 1); } @Override protected String getLocationDescriptionForIconDrop(int id) { return mContext.getString(R.string.move_to_position, id + mStartPosition); return mContext.getString(R.string.move_to_position, id + mStartPosition + 1); } @Override Loading Loading
src/com/android/launcher3/DragLayer.java +39 −10 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.view.animation.Interpolator; import android.widget.FrameLayout; import android.widget.TextView; import com.android.launcher3.InsettableFrameLayout.LayoutParams; import com.android.launcher3.util.Thunk; import java.util.ArrayList; Loading Loading @@ -153,6 +152,14 @@ public class DragLayer extends InsettableFrameLayout { return false; } private boolean isEventOverDropTargetBar(MotionEvent ev) { getDescendantRectRelativeToSelf(mLauncher.getSearchBar(), mHitRect); if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) { return true; } return false; } public void setBlockTouch(boolean block) { mBlockTouches = block; } Loading Loading @@ -188,12 +195,18 @@ public class DragLayer extends InsettableFrameLayout { } } getDescendantRectRelativeToSelf(currentFolder, hitRect); if (!isEventOverFolder(currentFolder, ev)) { if (isInAccessibleDrag()) { // Do not close the folder if in drag and drop. if (!isEventOverDropTargetBar(ev)) { return true; } } else { mLauncher.closeFolder(); return true; } } } return false; } Loading Loading @@ -228,11 +241,12 @@ public class DragLayer extends InsettableFrameLayout { getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isTouchExplorationEnabled()) { final int action = ev.getAction(); boolean isOverFolder; boolean isOverFolderOrSearchBar; switch (action) { case MotionEvent.ACTION_HOVER_ENTER: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder) { isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) || (isInAccessibleDrag() && isEventOverDropTargetBar(ev)); if (!isOverFolderOrSearchBar) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; Loading @@ -240,12 +254,13 @@ public class DragLayer extends InsettableFrameLayout { mHoverPointClosesFolder = false; break; case MotionEvent.ACTION_HOVER_MOVE: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder && !mHoverPointClosesFolder) { isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) || (isInAccessibleDrag() && isEventOverDropTargetBar(ev)); if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; } else if (!isOverFolder) { } else if (!isOverFolderOrSearchBar) { return true; } mHoverPointClosesFolder = false; Loading @@ -268,6 +283,12 @@ public class DragLayer extends InsettableFrameLayout { } } private boolean isInAccessibleDrag() { LauncherAccessibilityDelegate delegate = LauncherAppState .getInstance().getAccessibilityDelegate(); return delegate != null && delegate.isInAccessibleDrag(); } @Override public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) { Folder currentFolder = mLauncher.getWorkspace().getOpenFolder(); Loading @@ -275,6 +296,10 @@ public class DragLayer extends InsettableFrameLayout { if (child == currentFolder) { return super.onRequestSendAccessibilityEvent(child, event); } if (isInAccessibleDrag() && child instanceof SearchDropTargetBar) { return super.onRequestSendAccessibilityEvent(child, event); } // Skip propagating onRequestSendAccessibilityEvent all for other children // when a folder is open return false; Loading @@ -288,6 +313,10 @@ public class DragLayer extends InsettableFrameLayout { if (currentFolder != null) { // Only add the folder as a child for accessibility when it is open childrenForAccessibility.add(currentFolder); if (isInAccessibleDrag()) { childrenForAccessibility.add(mLauncher.getSearchBar()); } } else { super.addChildrenForAccessibility(childrenForAccessibility); } Loading
src/com/android/launcher3/Folder.java +3 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList for (int i = 0; i < mContent.getChildCount(); i++) { mContent.getPageAt(i).enableAccessibleDrag(enable, CellLayout.FOLDER_ACCESSIBILITY_DRAG); } mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : IMPORTANT_FOR_ACCESSIBILITY_AUTO); mLauncher.getWorkspace().setAddNewPageOnDrag(!enable); } Loading
src/com/android/launcher3/FolderPagedView.java +4 −0 Original line number Diff line number Diff line Loading @@ -504,6 +504,10 @@ public class FolderPagedView extends PagedView { } } public int getAllocatedContentSize() { return mAllocatedContentSize; } /** * Reorders the items such that the {@param empty} spot moves to {@param target} */ Loading
src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java +11 −5 Original line number Diff line number Diff line Loading @@ -24,23 +24,29 @@ import com.android.launcher3.R; * Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD in a folder. */ public class FolderAccessibilityHelper extends DragAndDropAccessibilityDelegate { /** * 0-index position for the first cell in {@link #mView} in {@link #mParent}. */ private final int mStartPosition; private final FolderPagedView mParent; public FolderAccessibilityHelper(CellLayout layout) { super(layout); FolderPagedView parent = (FolderPagedView) layout.getParent(); mParent = (FolderPagedView) layout.getParent(); int index = parent.indexOfChild(layout); mStartPosition = 1 + index * layout.getCountX() * layout.getCountY(); int index = mParent.indexOfChild(layout); mStartPosition = index * layout.getCountX() * layout.getCountY(); } @Override protected int intersectsValidDropTarget(int id) { return id; return Math.min(id, mParent.getAllocatedContentSize() - mStartPosition - 1); } @Override protected String getLocationDescriptionForIconDrop(int id) { return mContext.getString(R.string.move_to_position, id + mStartPosition); return mContext.getString(R.string.move_to_position, id + mStartPosition + 1); } @Override Loading