summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2023-02-07 07:02:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-02-07 07:02:45 +0000
commit5adb6255396ce266fa25e57a4319d0a0d9035422 (patch)
treeaa795cc71e644b92397981a0107e4321ac732ebb
parent8057ef6cdaeea8fee0916812aa19579dbb7c8e31 (diff)
parent01e981fafb8b6fb2b02bc95d368ff2b208e47c71 (diff)
Merge "Add strings to announce where the app splits to" into tm-qpr-dev
-rw-r--r--libs/WindowManager/Shell/res/values/strings.xml9
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java29
2 files changed, 34 insertions, 4 deletions
diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml
index 250dac6cbaee..adc65dd7f699 100644
--- a/libs/WindowManager/Shell/res/values/strings.xml
+++ b/libs/WindowManager/Shell/res/values/strings.xml
@@ -100,6 +100,15 @@
<!-- Accessibility action for moving docked stack divider to make the bottom screen full screen [CHAR LIMIT=NONE] -->
<string name="accessibility_action_divider_bottom_full">Bottom full screen</string>
+ <!-- Accessibility label for splitting to the left drop zone [CHAR LIMIT=NONE] -->
+ <string name="accessibility_split_left">Split left</string>
+ <!-- Accessibility label for splitting to the right drop zone [CHAR LIMIT=NONE] -->
+ <string name="accessibility_split_right">Split right</string>
+ <!-- Accessibility label for splitting to the top drop zone [CHAR LIMIT=NONE] -->
+ <string name="accessibility_split_top">Split top</string>
+ <!-- Accessibility label for splitting to the bottom drop zone [CHAR LIMIT=NONE] -->
+ <string name="accessibility_split_bottom">Split bottom</string>
+
<!-- One-Handed Tutorial title [CHAR LIMIT=60] -->
<string name="one_handed_tutorial_title">Using one-handed mode</string>
<!-- One-Handed Tutorial description [CHAR LIMIT=NONE] -->
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java
index 55378a826385..3ade1ed9392f 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java
@@ -22,6 +22,10 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
+import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_BOTTOM;
+import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_LEFT;
+import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_RIGHT;
+import static com.android.wm.shell.draganddrop.DragAndDropPolicy.Target.TYPE_SPLIT_TOP;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -315,6 +319,25 @@ public class DragLayout extends LinearLayout {
// Switching between targets
mDropZoneView1.animateSwitch();
mDropZoneView2.animateSwitch();
+ // Announce for accessibility.
+ switch (target.type) {
+ case TYPE_SPLIT_LEFT:
+ mDropZoneView1.announceForAccessibility(
+ mContext.getString(R.string.accessibility_split_left));
+ break;
+ case TYPE_SPLIT_RIGHT:
+ mDropZoneView2.announceForAccessibility(
+ mContext.getString(R.string.accessibility_split_right));
+ break;
+ case TYPE_SPLIT_TOP:
+ mDropZoneView1.announceForAccessibility(
+ mContext.getString(R.string.accessibility_split_top));
+ break;
+ case TYPE_SPLIT_BOTTOM:
+ mDropZoneView2.announceForAccessibility(
+ mContext.getString(R.string.accessibility_split_bottom));
+ break;
+ }
}
mCurrentTarget = target;
}
@@ -424,12 +447,10 @@ public class DragLayout extends LinearLayout {
}
private void animateHighlight(DragAndDropPolicy.Target target) {
- if (target.type == DragAndDropPolicy.Target.TYPE_SPLIT_LEFT
- || target.type == DragAndDropPolicy.Target.TYPE_SPLIT_TOP) {
+ if (target.type == TYPE_SPLIT_LEFT || target.type == TYPE_SPLIT_TOP) {
mDropZoneView1.setShowingHighlight(true);
mDropZoneView2.setShowingHighlight(false);
- } else if (target.type == DragAndDropPolicy.Target.TYPE_SPLIT_RIGHT
- || target.type == DragAndDropPolicy.Target.TYPE_SPLIT_BOTTOM) {
+ } else if (target.type == TYPE_SPLIT_RIGHT || target.type == TYPE_SPLIT_BOTTOM) {
mDropZoneView1.setShowingHighlight(false);
mDropZoneView2.setShowingHighlight(true);
}