summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop/DragLayer.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-05-15 13:55:57 -0700
committerSunny Goyal <sunnygoyal@google.com>2018-05-16 13:11:00 -0700
commitde7532154259ed79d7ed6d2fcc9e82ff2860a5a3 (patch)
treea8865d45fd1ce0b2dc6d01beee460e34b35d27a3 /src/com/android/launcher3/dragndrop/DragLayer.java
parent6ae02c6a61e2d2c7014bd5f8b2a0266c5b802245 (diff)
downloadpackages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.tar.gz
packages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.tar.bz2
packages_apps_Trebuchet-de7532154259ed79d7ed6d2fcc9e82ff2860a5a3.zip
Fixing wrong accessibility focus when opening a floating view
> Using common logic for announcing a floating view for widgets and folders Bug: 79091095 Bug: 79748886 Change-Id: Ibb3fe48e68e724f50d69f51a03d3b35ad0baf625
Diffstat (limited to 'src/com/android/launcher3/dragndrop/DragLayer.java')
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java51
1 files changed, 15 insertions, 36 deletions
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 7fef904c2..53e9e2dac 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -28,8 +28,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -126,18 +124,6 @@ public class DragLayer extends BaseDragLayer<Launcher> {
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
}
- public boolean isEventOverHotseat(MotionEvent ev) {
- return isEventOverView(mActivity.getHotseat(), ev);
- }
-
- private boolean isEventOverFolder(Folder folder, MotionEvent ev) {
- return isEventOverView(folder, ev);
- }
-
- private boolean isEventOverDropTargetBar(MotionEvent ev) {
- return isEventOverView(mActivity.getDropTargetBar(), ev);
- }
-
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
ViewScrim scrim = ViewScrim.get(child);
@@ -157,24 +143,29 @@ public class DragLayer extends BaseDragLayer<Launcher> {
return super.findActiveController(ev);
}
+ private boolean isEventOverAccessibleDropTargetBar(MotionEvent ev) {
+ return isInAccessibleDrag() && isEventOverView(mActivity.getDropTargetBar(), ev);
+ }
+
@Override
public boolean onInterceptHoverEvent(MotionEvent ev) {
if (mActivity == null || mActivity.getWorkspace() == null) {
return false;
}
- Folder currentFolder = Folder.getOpen(mActivity);
- if (currentFolder == null) {
+ AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
+ if (!(topView instanceof Folder)) {
return false;
} else {
AccessibilityManager accessibilityManager = (AccessibilityManager)
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isTouchExplorationEnabled()) {
+ Folder currentFolder = (Folder) topView;
final int action = ev.getAction();
boolean isOverFolderOrSearchBar;
switch (action) {
case MotionEvent.ACTION_HOVER_ENTER:
- isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) ||
- (isInAccessibleDrag() && isEventOverDropTargetBar(ev));
+ isOverFolderOrSearchBar = isEventOverView(topView, ev) ||
+ isEventOverAccessibleDropTargetBar(ev);
if (!isOverFolderOrSearchBar) {
sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
mHoverPointClosesFolder = true;
@@ -183,8 +174,8 @@ public class DragLayer extends BaseDragLayer<Launcher> {
mHoverPointClosesFolder = false;
break;
case MotionEvent.ACTION_HOVER_MOVE:
- isOverFolderOrSearchBar = isEventOverFolder(currentFolder, ev) ||
- (isInAccessibleDrag() && isEventOverDropTargetBar(ev));
+ isOverFolderOrSearchBar = isEventOverView(topView, ev) ||
+ isEventOverAccessibleDropTargetBar(ev);
if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) {
sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
mHoverPointClosesFolder = true;
@@ -219,18 +210,8 @@ public class DragLayer extends BaseDragLayer<Launcher> {
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
- // Shortcuts can appear above folder
- View topView = AbstractFloatingView.getTopOpenView(mActivity);
- if (topView != null) {
- if (child == topView) {
- return super.onRequestSendAccessibilityEvent(child, event);
- }
- if (isInAccessibleDrag() && child instanceof DropTargetBar) {
- return super.onRequestSendAccessibilityEvent(child, event);
- }
- // Skip propagating onRequestSendAccessibilityEvent for all other children
- // which are not topView
- return false;
+ if (isInAccessibleDrag() && child instanceof DropTargetBar) {
+ return true;
}
return super.onRequestSendAccessibilityEvent(child, event);
}
@@ -239,11 +220,9 @@ public class DragLayer extends BaseDragLayer<Launcher> {
public void addChildrenForAccessibility(ArrayList<View> childrenForAccessibility) {
View topView = AbstractFloatingView.getTopOpenView(mActivity);
if (topView != null) {
- // Only add the top view as a child for accessibility when it is open
- childrenForAccessibility.add(topView);
-
+ addAccessibleChildToList(topView, childrenForAccessibility);
if (isInAccessibleDrag()) {
- childrenForAccessibility.add(mActivity.getDropTargetBar());
+ addAccessibleChildToList(mActivity.getDropTargetBar(), childrenForAccessibility);
}
} else {
super.addChildrenForAccessibility(childrenForAccessibility);