summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-07-13 16:44:34 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-07-13 16:45:22 -0700
commit10ad1b9761d27008cb16aaec3bafe752fa891185 (patch)
tree17421f39b69383e5ed3b4d2e483a14d2bbd64ada /src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
parentba162aa7d2a49c09c00ff3184ffda3bea0e55509 (diff)
downloadandroid_packages_apps_Trebuchet-10ad1b9761d27008cb16aaec3bafe752fa891185.tar.gz
android_packages_apps_Trebuchet-10ad1b9761d27008cb16aaec3bafe752fa891185.tar.bz2
android_packages_apps_Trebuchet-10ad1b9761d27008cb16aaec3bafe752fa891185.zip
Fixing Virtual nodes getting wrong screen bounds, when dragging in spring
loaded mode Bug: 29582251 Change-Id: I614d387a9b12d812ebb84c7739e8d9ae1bc057b2
Diffstat (limited to 'src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java')
-rw-r--r--src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
index 73b824bb5..c71307d48 100644
--- a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
+++ b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
@@ -17,6 +17,8 @@
package com.android.launcher3.accessibility;
import android.content.Context;
+import android.graphics.Rect;
+import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.text.TextUtils;
import android.view.View;
@@ -24,15 +26,20 @@ import com.android.launcher3.AppInfo;
import com.android.launcher3.CellLayout;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.ItemInfo;
+import com.android.launcher3.Launcher;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DragType;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.dragndrop.DragLayer;
/**
* Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD on workspace.
*/
public class WorkspaceAccessibilityHelper extends DragAndDropAccessibilityDelegate {
+ private final Rect mTempRect = new Rect();
+ private final int[] mTempCords = new int[2];
+
public WorkspaceAccessibilityHelper(CellLayout layout) {
super(layout);
}
@@ -128,6 +135,25 @@ public class WorkspaceAccessibilityHelper extends DragAndDropAccessibilityDelega
}
@Override
+ protected void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat node) {
+ super.onPopulateNodeForVirtualView(id, node);
+
+
+ // ExploreByTouchHelper does not currently handle view scale.
+ // Update BoundsInScreen to appropriate value.
+ DragLayer dragLayer = Launcher.getLauncher(mView.getContext()).getDragLayer();
+ mTempCords[0] = mTempCords[1] = 0;
+ float scale = dragLayer.getDescendantCoordRelativeToSelf(mView, mTempCords);
+
+ node.getBoundsInParent(mTempRect);
+ mTempRect.left = mTempCords[0] + (int) (mTempRect.left * scale);
+ mTempRect.right = mTempCords[0] + (int) (mTempRect.right * scale);
+ mTempRect.top = mTempCords[1] + (int) (mTempRect.top * scale);
+ mTempRect.bottom = mTempCords[1] + (int) (mTempRect.bottom * scale);
+ node.setBoundsInScreen(mTempRect);
+ }
+
+ @Override
protected String getLocationDescriptionForIconDrop(int id) {
int x = id % mView.getCountX();
int y = id / mView.getCountX();