summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-04-24 11:44:51 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-04-28 16:06:46 -0700
commite9b651eef1b9f3647eba94f833bff3fc52f5956b (patch)
tree3eac92b3f856164308b1aaa8dd28c9f0d1befdf4 /src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java
parent559d90d0dafbac1d97a1e6f18062309831a25d51 (diff)
downloadandroid_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.tar.gz
android_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.tar.bz2
android_packages_apps_Trebuchet-e9b651eef1b9f3647eba94f833bff3fc52f5956b.zip
Enabling accessibility drag and drop in folder
> Moving DragAndDropAccessibilityDelegate to a separate class > Using getFocusedVirtualView() instead of using DownX and downY > Updating various accessibility strings Bug: 19776741 Change-Id: I85c2551d4d6172c30702e68f41b114bb999655b6
Diffstat (limited to 'src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java')
-rw-r--r--src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java b/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java
new file mode 100644
index 000000000..fc105b4a4
--- /dev/null
+++ b/src/com/android/launcher3/accessibility/FolderAccessibilityHelper.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.accessibility;
+
+import com.android.launcher3.CellLayout;
+import com.android.launcher3.FolderPagedView;
+import com.android.launcher3.R;
+
+/**
+ * Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD in a folder.
+ */
+public class FolderAccessibilityHelper extends DragAndDropAccessibilityDelegate {
+ private final int mStartPosition;
+
+ public FolderAccessibilityHelper(CellLayout layout) {
+ super(layout);
+ FolderPagedView parent = (FolderPagedView) layout.getParent();
+
+ int index = parent.indexOfChild(layout);
+ mStartPosition = 1 + index * layout.getCountX() * layout.getCountY();
+ }
+ @Override
+ protected int intersectsValidDropTarget(int id) {
+ return id;
+ }
+
+ @Override
+ protected String getLocationDescriptionForIconDrop(int id) {
+ return mContext.getString(R.string.move_to_position, id + mStartPosition);
+ }
+
+ @Override
+ protected String getConfirmationForIconDrop(int id) {
+ return mContext.getString(R.string.item_moved);
+ }
+}