Merge "Rely on tile state for on/off a11y announcement." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
df173b59f6
@@ -515,16 +515,12 @@
|
|||||||
<string name="accessibility_quick_settings_airplane_changed_off">Airplane mode turned off.</string>
|
<string name="accessibility_quick_settings_airplane_changed_off">Airplane mode turned off.</string>
|
||||||
<!-- Announcement made when the airplane mode changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Announcement made when the airplane mode changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_airplane_changed_on">Airplane mode turned on.</string>
|
<string name="accessibility_quick_settings_airplane_changed_on">Airplane mode turned on.</string>
|
||||||
<!-- Content description of the do not disturb tile in quick settings when on in the default priority mode (not shown on the screen). [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="accessibility_quick_settings_dnd_priority_on">Do not disturb on.</string>
|
|
||||||
<!-- Content description of the do not disturb tile in quick settings when on in none (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Content description of the do not disturb tile in quick settings when on in none (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_dnd_none_on">Do not disturb on, total silence.</string>
|
<string name="accessibility_quick_settings_dnd_none_on">total silence</string>
|
||||||
<!-- Content description of the do not disturb tile in quick settings when on in alarms only (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Content description of the do not disturb tile in quick settings when on in alarms only (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_dnd_alarms_on">Do not disturb on, alarms only.</string>
|
<string name="accessibility_quick_settings_dnd_alarms_on">alarms only</string>
|
||||||
<!-- Content description of the do not disturb tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Content description of the do not disturb tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_dnd">Do not disturb.</string>
|
<string name="accessibility_quick_settings_dnd">Do not disturb.</string>
|
||||||
<!-- Content description of the do not disturb tile in quick settings when off (not shown on the screen). [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="accessibility_quick_settings_dnd_off">Do not disturb off.</string>
|
|
||||||
<!-- Announcement made when do not disturb changes to off (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Announcement made when do not disturb changes to off (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_quick_settings_dnd_changed_off">Do not disturb turned off.</string>
|
<string name="accessibility_quick_settings_dnd_changed_off">Do not disturb turned off.</string>
|
||||||
<!-- Announcement made when do not disturb changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
|
<!-- Announcement made when do not disturb changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.content.Intent;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
@@ -131,32 +132,32 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
|
|||||||
}
|
}
|
||||||
state.slash.isSlashed = !enabled;
|
state.slash.isSlashed = !enabled;
|
||||||
state.label = mContext.getString(R.string.quick_settings_bluetooth_label);
|
state.label = mContext.getString(R.string.quick_settings_bluetooth_label);
|
||||||
|
state.secondaryLabel = TextUtils.emptyIfNull(
|
||||||
|
getSecondaryLabel(enabled, connected, state.isTransient));
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (connected) {
|
if (connected) {
|
||||||
state.icon = new BluetoothConnectedTileIcon();
|
state.icon = new BluetoothConnectedTileIcon();
|
||||||
state.contentDescription = mContext.getString(
|
|
||||||
R.string.accessibility_bluetooth_name, state.label);
|
|
||||||
|
|
||||||
state.label = mController.getLastDeviceName();
|
state.label = mController.getLastDeviceName();
|
||||||
|
state.contentDescription =
|
||||||
|
mContext.getString(R.string.accessibility_bluetooth_name, state.label)
|
||||||
|
+ ", " + state.secondaryLabel;
|
||||||
} else if (state.isTransient) {
|
} else if (state.isTransient) {
|
||||||
state.icon = ResourceIcon.get(R.drawable.ic_bluetooth_transient_animation);
|
state.icon = ResourceIcon.get(R.drawable.ic_bluetooth_transient_animation);
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription = state.secondaryLabel;
|
||||||
R.string.accessibility_quick_settings_bluetooth_connecting);
|
|
||||||
} else {
|
} else {
|
||||||
state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
|
state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription = mContext.getString(
|
||||||
R.string.accessibility_quick_settings_bluetooth_on) + ","
|
R.string.accessibility_quick_settings_bluetooth) + ","
|
||||||
+ mContext.getString(R.string.accessibility_not_connected);
|
+ mContext.getString(R.string.accessibility_not_connected);
|
||||||
}
|
}
|
||||||
state.state = Tile.STATE_ACTIVE;
|
state.state = Tile.STATE_ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
|
state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_on);
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription = mContext.getString(
|
||||||
R.string.accessibility_quick_settings_bluetooth_off);
|
R.string.accessibility_quick_settings_bluetooth);
|
||||||
state.state = Tile.STATE_INACTIVE;
|
state.state = Tile.STATE_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.secondaryLabel = getSecondaryLabel(enabled, connected, state.isTransient);
|
|
||||||
state.dualLabelContentDescription = mContext.getResources().getString(
|
state.dualLabelContentDescription = mContext.getResources().getString(
|
||||||
R.string.accessibility_quick_settings_open_settings, getTileLabel());
|
R.string.accessibility_quick_settings_open_settings, getTileLabel());
|
||||||
state.expandedAccessibilityClassName = Switch.class.getName();
|
state.expandedAccessibilityClassName = Switch.class.getName();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import android.provider.Settings.Global;
|
|||||||
import android.service.notification.ZenModeConfig;
|
import android.service.notification.ZenModeConfig;
|
||||||
import android.service.notification.ZenModeConfig.ZenRule;
|
import android.service.notification.ZenModeConfig.ZenRule;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -223,25 +224,27 @@ public class DndTile extends QSTileImpl<BooleanState> {
|
|||||||
state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
||||||
state.slash.isSlashed = !state.value;
|
state.slash.isSlashed = !state.value;
|
||||||
state.label = getTileLabel();
|
state.label = getTileLabel();
|
||||||
state.secondaryLabel = ZenModeConfig.getDescription(mContext,zen != Global.ZEN_MODE_OFF,
|
state.secondaryLabel = TextUtils.emptyIfNull(ZenModeConfig.getDescription(mContext,
|
||||||
mController.getConfig(), false);
|
zen != Global.ZEN_MODE_OFF, mController.getConfig(), false));
|
||||||
state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on);
|
state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on);
|
||||||
checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME);
|
checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME);
|
||||||
switch (zen) {
|
switch (zen) {
|
||||||
case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
|
case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription =
|
||||||
R.string.accessibility_quick_settings_dnd_priority_on) + ", "
|
mContext.getString(R.string.accessibility_quick_settings_dnd) + ", "
|
||||||
+ state.secondaryLabel;
|
+ state.secondaryLabel;
|
||||||
break;
|
break;
|
||||||
case Global.ZEN_MODE_NO_INTERRUPTIONS:
|
case Global.ZEN_MODE_NO_INTERRUPTIONS:
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription =
|
||||||
R.string.accessibility_quick_settings_dnd_none_on) + ", "
|
mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
|
||||||
+ state.secondaryLabel;
|
mContext.getString(R.string.accessibility_quick_settings_dnd_none_on)
|
||||||
|
+ ", " + state.secondaryLabel;
|
||||||
break;
|
break;
|
||||||
case ZEN_MODE_ALARMS:
|
case ZEN_MODE_ALARMS:
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription =
|
||||||
R.string.accessibility_quick_settings_dnd_alarms_on) + ", "
|
mContext.getString(R.string.accessibility_quick_settings_dnd) + ", " +
|
||||||
+ state.secondaryLabel;
|
mContext.getString(R.string.accessibility_quick_settings_dnd_alarms_on)
|
||||||
|
+ ", " + state.secondaryLabel;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
state.contentDescription = mContext.getString(
|
state.contentDescription = mContext.getString(
|
||||||
|
|||||||
Reference in New Issue
Block a user