Tweaking accessibility actions for dock divider.
- Adding tl_full/70%/50%/30%/rb_full Bug: 27724715 Change-Id: Ie3125ec81e6463696cf56640c6b86f9cfcbda945
This commit is contained in:
@@ -330,6 +330,14 @@ public class DividerSnapAlgorithm {
|
||||
return snapTarget;
|
||||
}
|
||||
|
||||
public boolean isFirstSplitTargetAvailable() {
|
||||
return mFirstSplitTarget != mMiddleTarget;
|
||||
}
|
||||
|
||||
public boolean isLastSplitTargetAvailable() {
|
||||
return mLastSplitTarget != mMiddleTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycles through all non-dismiss targets with a stepping of {@param increment}. It moves left
|
||||
* if {@param increment} is negative and moves right otherwise.
|
||||
|
||||
@@ -63,9 +63,10 @@
|
||||
<item type="id" name="is_clicked_heads_up_tag" />
|
||||
|
||||
<!-- Accessibility actions for the docked stack divider -->
|
||||
<item type="id" name="action_move_left" />
|
||||
<item type="id" name="action_move_right" />
|
||||
<item type="id" name="action_move_up" />
|
||||
<item type="id" name="action_move_down" />
|
||||
<item type="id" name="action_move_tl_full" />
|
||||
<item type="id" name="action_move_tl_70" />
|
||||
<item type="id" name="action_move_tl_50" />
|
||||
<item type="id" name="action_move_tl_30" />
|
||||
<item type="id" name="action_move_rb_full" />
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -1580,17 +1580,27 @@
|
||||
<!-- Accessibility label for the divider that separates the windows in split-screen mode [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_divider">Split-screen divider</string>
|
||||
|
||||
<!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_move_down">Move down</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the left screen full screen [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_left_full">Left full screen</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the left screen 70% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_left_70">Left 70%</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the left screen 50% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_left_50">Left 50%</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the left screen 30% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_left_30">Left 30%</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the right screen full screen [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_right_full">Right full screen</string>
|
||||
|
||||
<!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_move_up">Move up</string>
|
||||
|
||||
<!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_move_left">Move left</string>
|
||||
|
||||
<!-- Accessibility action for moving down the docked stack divider [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_move_right">Move right</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the top screen full screen [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_top_full">Top full screen</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the top screen 70% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_top_70">Top 70%</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the top screen 50% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_top_50">Top 50%</string>
|
||||
<!-- Accessibility action for moving docked stack divider to make the top screen 30% [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_action_divider_top_30">Top 30%</string>
|
||||
<!-- 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 description of a QS tile while editing positions [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_qs_edit_tile_label">Position <xliff:g id="position" example="2">%1$d</xliff:g>, <xliff:g id="tile_name" example="Wi-Fi">%2$s</xliff:g>. Double tap to edit.</string>
|
||||
|
||||
@@ -154,31 +154,62 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info);
|
||||
if (isHorizontalDivision()) {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_up,
|
||||
mContext.getString(R.string.accessibility_action_divider_move_up)));
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_down,
|
||||
mContext.getString(R.string.accessibility_action_divider_move_down)));
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
|
||||
mContext.getString(R.string.accessibility_action_divider_top_full)));
|
||||
if (mSnapAlgorithm.isFirstSplitTargetAvailable()) {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
|
||||
mContext.getString(R.string.accessibility_action_divider_top_70)));
|
||||
}
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
|
||||
mContext.getString(R.string.accessibility_action_divider_top_50)));
|
||||
if (mSnapAlgorithm.isLastSplitTargetAvailable()) {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
|
||||
mContext.getString(R.string.accessibility_action_divider_top_30)));
|
||||
}
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
|
||||
mContext.getString(R.string.accessibility_action_divider_bottom_full)));
|
||||
} else {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_left,
|
||||
mContext.getString(R.string.accessibility_action_divider_move_left)));
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_right,
|
||||
mContext.getString(R.string.accessibility_action_divider_move_right)));
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
|
||||
mContext.getString(R.string.accessibility_action_divider_left_full)));
|
||||
if (mSnapAlgorithm.isFirstSplitTargetAvailable()) {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
|
||||
mContext.getString(R.string.accessibility_action_divider_left_70)));
|
||||
}
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
|
||||
mContext.getString(R.string.accessibility_action_divider_left_50)));
|
||||
if (mSnapAlgorithm.isLastSplitTargetAvailable()) {
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
|
||||
mContext.getString(R.string.accessibility_action_divider_left_30)));
|
||||
}
|
||||
info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
|
||||
mContext.getString(R.string.accessibility_action_divider_right_full)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performAccessibilityAction(View host, int action, Bundle args) {
|
||||
if (action == R.id.action_move_up || action == R.id.action_move_down
|
||||
|| action == R.id.action_move_left || action == R.id.action_move_right) {
|
||||
int position = getCurrentPosition();
|
||||
SnapTarget currentTarget = mSnapAlgorithm.calculateSnapTarget(
|
||||
position, 0 /* velocity */);
|
||||
SnapTarget nextTarget =
|
||||
action == R.id.action_move_up || action == R.id.action_move_left
|
||||
? mSnapAlgorithm.getPreviousTarget(currentTarget)
|
||||
: mSnapAlgorithm.getNextTarget(currentTarget);
|
||||
int currentPosition = getCurrentPosition();
|
||||
SnapTarget nextTarget = null;
|
||||
switch (action) {
|
||||
case R.id.action_move_tl_full:
|
||||
nextTarget = mSnapAlgorithm.getDismissEndTarget();
|
||||
break;
|
||||
case R.id.action_move_tl_70:
|
||||
nextTarget = mSnapAlgorithm.getLastSplitTarget();
|
||||
break;
|
||||
case R.id.action_move_tl_50:
|
||||
nextTarget = mSnapAlgorithm.getMiddleTarget();
|
||||
break;
|
||||
case R.id.action_move_tl_30:
|
||||
nextTarget = mSnapAlgorithm.getFirstSplitTarget();
|
||||
break;
|
||||
case R.id.action_move_rb_full:
|
||||
nextTarget = mSnapAlgorithm.getDismissStartTarget();
|
||||
break;
|
||||
}
|
||||
if (nextTarget != null) {
|
||||
startDragging(true /* animate */, false /* touching */);
|
||||
stopDragging(getCurrentPosition(), nextTarget, 250, Interpolators.FAST_OUT_SLOW_IN);
|
||||
stopDragging(currentPosition, nextTarget, 250, Interpolators.FAST_OUT_SLOW_IN);
|
||||
return true;
|
||||
}
|
||||
return super.performAccessibilityAction(host, action, args);
|
||||
|
||||
Reference in New Issue
Block a user