diff options
| -rw-r--r-- | packages/SystemUI/res/layout/volume_ringer_drawer.xml | 8 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java | 40 |
2 files changed, 30 insertions, 18 deletions
diff --git a/packages/SystemUI/res/layout/volume_ringer_drawer.xml b/packages/SystemUI/res/layout/volume_ringer_drawer.xml index 9b6c92c71e5d..1112bcdbd14d 100644 --- a/packages/SystemUI/res/layout/volume_ringer_drawer.xml +++ b/packages/SystemUI/res/layout/volume_ringer_drawer.xml @@ -59,7 +59,7 @@ android:id="@+id/volume_drawer_vibrate" android:layout_width="@dimen/volume_ringer_drawer_item_size" android:layout_height="@dimen/volume_ringer_drawer_item_size" - android:description="@string/volume_ringer_hint_vibrate" + android:contentDescription="@string/volume_ringer_hint_vibrate" android:gravity="center"> <ImageView @@ -76,7 +76,7 @@ android:id="@+id/volume_drawer_mute" android:layout_width="@dimen/volume_ringer_drawer_item_size" android:layout_height="@dimen/volume_ringer_drawer_item_size" - android:description="@string/volume_ringer_hint_mute" + android:contentDescription="@string/volume_ringer_hint_mute" android:gravity="center"> <ImageView @@ -93,7 +93,7 @@ android:id="@+id/volume_drawer_normal" android:layout_width="@dimen/volume_ringer_drawer_item_size" android:layout_height="@dimen/volume_ringer_drawer_item_size" - android:description="@string/volume_ringer_hint_unmute" + android:contentDescription="@string/volume_ringer_hint_unmute" android:gravity="center"> <ImageView @@ -117,7 +117,7 @@ android:layout_width="@dimen/volume_ringer_drawer_item_size" android:layout_height="@dimen/volume_ringer_drawer_item_size" android:layout_gravity="bottom|right" - android:description="@string/volume_ringer_change" + android:contentDescription="@string/volume_ringer_change" android:background="@drawable/volume_drawer_selection_bg"> <ImageView diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 961822a598e7..228b9c3da319 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -932,6 +932,13 @@ public class VolumeDialogImpl implements VolumeDialog, .start(); } + // When the ringer drawer is open, tapping the currently selected ringer will set the ringer + // to the current ringer mode. Change the content description to that, instead of the 'tap + // to change ringer mode' default. + mSelectedRingerContainer.setContentDescription( + mContext.getString(getStringDescriptionResourceForRingerMode( + mState.ringerModeInternal))); + mIsRingerDrawerOpen = true; } @@ -976,6 +983,11 @@ public class VolumeDialogImpl implements VolumeDialog, .translationY(0f) .start(); + // When the drawer is closed, tapping the selected ringer drawer will open it, allowing the + // user to change the ringer. + mSelectedRingerContainer.setContentDescription( + mContext.getString(R.string.volume_ringer_change)); + mIsRingerDrawerOpen = false; } @@ -1464,20 +1476,8 @@ public class VolumeDialogImpl implements VolumeDialog, } private void addAccessibilityDescription(View view, int currState, String hintLabel) { - int currStateResId; - switch (currState) { - case RINGER_MODE_SILENT: - currStateResId = R.string.volume_ringer_status_silent; - break; - case RINGER_MODE_VIBRATE: - currStateResId = R.string.volume_ringer_status_vibrate; - break; - case RINGER_MODE_NORMAL: - default: - currStateResId = R.string.volume_ringer_status_normal; - } - - view.setContentDescription(mContext.getString(currStateResId)); + view.setContentDescription( + mContext.getString(getStringDescriptionResourceForRingerMode(currState))); view.setAccessibilityDelegate(new AccessibilityDelegate() { public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); @@ -1487,6 +1487,18 @@ public class VolumeDialogImpl implements VolumeDialog, }); } + private int getStringDescriptionResourceForRingerMode(int mode) { + switch (mode) { + case RINGER_MODE_SILENT: + return R.string.volume_ringer_status_silent; + case RINGER_MODE_VIBRATE: + return R.string.volume_ringer_status_vibrate; + case RINGER_MODE_NORMAL: + default: + return R.string.volume_ringer_status_normal; + } + } + /** * Toggles enable state of views in a VolumeRow (not including seekbar or icon) * Hides/shows zen icon |