diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-07-14 03:31:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-07-14 03:31:09 +0000 |
commit | c3dcc77b8ed9e1b5784eb1cfe6814909cf03b604 (patch) | |
tree | 819ec08dce6844be679a78f3b6077732febded60 /src | |
parent | 50f251bfc842c7403d4a69787f492cf9d2ab348b (diff) | |
parent | 10ad1b9761d27008cb16aaec3bafe752fa891185 (diff) | |
download | android_packages_apps_Trebuchet-c3dcc77b8ed9e1b5784eb1cfe6814909cf03b604.tar.gz android_packages_apps_Trebuchet-c3dcc77b8ed9e1b5784eb1cfe6814909cf03b604.tar.bz2 android_packages_apps_Trebuchet-c3dcc77b8ed9e1b5784eb1cfe6814909cf03b604.zip |
Merge "Fixing Virtual nodes getting wrong screen bounds, when dragging in spring loaded mode" into ub-launcher3-calgary
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java | 26 |
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(); |