diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-05-11 18:54:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-11 18:54:11 +0000 |
commit | 484d56b4750c84351496ed95b4473d2eb2fc43cf (patch) | |
tree | ff0645711e93b396f7d540fd507f519a594a2747 /src/com/android/launcher3/accessibility | |
parent | 9c6e175a1863855cefc298b800d8d1982f38efeb (diff) | |
parent | ccc414bb1e18206d2a3d8d797070278bdb286354 (diff) | |
download | android_packages_apps_Trebuchet-484d56b4750c84351496ed95b4473d2eb2fc43cf.tar.gz android_packages_apps_Trebuchet-484d56b4750c84351496ed95b4473d2eb2fc43cf.tar.bz2 android_packages_apps_Trebuchet-484d56b4750c84351496ed95b4473d2eb2fc43cf.zip |
Merge "Accessibility: Folder drag and drop fixes" into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/accessibility')
-rw-r--r-- | src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java b/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java index fc105b4a4..ff9989036 100644 --- a/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java +++ b/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java @@ -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 |