Merge "Add tile added/removed announcements" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
02151de444
@@ -2253,6 +2253,12 @@
|
|||||||
<!-- Accessibility description indicating the currently selected tile's position. Only used for tiles that are currently in use [CHAR LIMIT=NONE] -->
|
<!-- Accessibility description indicating the currently selected tile's position. Only used for tiles that are currently in use [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_qs_edit_position">Position <xliff:g id="position" example="5">%1$d</xliff:g></string>
|
<string name="accessibility_qs_edit_position">Position <xliff:g id="position" example="5">%1$d</xliff:g></string>
|
||||||
|
|
||||||
|
<!-- Accessibility announcement after a tile has been added [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_qs_edit_tile_added">Tile added</string>
|
||||||
|
|
||||||
|
<!-- Accessibility announcement after a tile has been added [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_qs_edit_tile_removed">Tile removed</string>
|
||||||
|
|
||||||
<!-- Accessibility label for window when QS editing is happening [CHAR LIMIT=NONE] -->
|
<!-- Accessibility label for window when QS editing is happening [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_desc_quick_settings_edit">Quick settings editor.</string>
|
<string name="accessibility_desc_quick_settings_edit">Quick settings editor.</string>
|
||||||
|
|
||||||
|
|||||||
@@ -441,15 +441,17 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
|
|||||||
return position > mEditIndex;
|
return position > mEditIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFromPosition(int position) {
|
private boolean addFromPosition(int position) {
|
||||||
if (!canAddFromPosition(position)) return;
|
if (!canAddFromPosition(position)) return false;
|
||||||
move(position, mEditIndex);
|
move(position, mEditIndex);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeFromPosition(int position) {
|
private boolean removeFromPosition(int position) {
|
||||||
if (!canRemoveFromPosition(position)) return;
|
if (!canRemoveFromPosition(position)) return false;
|
||||||
TileInfo info = mTiles.get(position);
|
TileInfo info = mTiles.get(position);
|
||||||
move(position, info.isSystem ? mEditIndex : mTileDividerIndex);
|
move(position, info.isSystem ? mEditIndex : mTileDividerIndex);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpanSizeLookup getSizeLookup() {
|
public SpanSizeLookup getSizeLookup() {
|
||||||
@@ -578,11 +580,17 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void add() {
|
private void add() {
|
||||||
addFromPosition(getLayoutPosition());
|
if (addFromPosition(getLayoutPosition())) {
|
||||||
|
itemView.announceForAccessibility(
|
||||||
|
itemView.getContext().getText(R.string.accessibility_qs_edit_tile_added));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void remove() {
|
private void remove() {
|
||||||
removeFromPosition(getLayoutPosition());
|
if (removeFromPosition(getLayoutPosition())) {
|
||||||
|
itemView.announceForAccessibility(
|
||||||
|
itemView.getContext().getText(R.string.accessibility_qs_edit_tile_removed));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isCurrentTile() {
|
boolean isCurrentTile() {
|
||||||
|
|||||||
Reference in New Issue
Block a user