<!-- Accessibility text for filmstrip delete button [CHAR_LIMIT=NONE] -->
<string name="delete_button_description">Delete</string>
+ <!-- Accessibility announcement when option button changes on screen after tap, e.g. from flash auto to flash off [CHAR_LIMIT=NONE] -->
+ <string name="button_change_announcement">Button is now %s</string>
+
<!-- Text shown in camera settings list for toggling photo location on or off [CHAR LIMIT=25] -->
<string name="setting_location">Location</string>
<!-- Text shown in camera settings list for selecting the size of photos that will be captured [CHAR LIMIT=25] -->
public void setState(int state, boolean callListener) {
mState = state;
setImageResource(mImageIds[mState]);
- setContentDescription(getResources().getString(mDescIds[mState]));
- // TODO get talkback to announce the current button state
- //sendAccessibilityEvent(AccessibilityEvent.CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION);
+ String oldContentDescription = String.valueOf(getContentDescription());
+ String newContentDescription = getResources().getString(mDescIds[mState]);
+ if (oldContentDescription != null && !oldContentDescription.isEmpty()
+ && !oldContentDescription.equals(newContentDescription)) {
+ setContentDescription(newContentDescription);
+ String announceChange = getResources().getString(
+ R.string.button_change_announcement, newContentDescription);
+ announceForAccessibility(announceChange);
+ }
super.setImageLevel(mLevel);
if (callListener && mOnStateChangeListener != null) {
mOnStateChangeListener.stateChanged(this, getState());