Merge pull request #1854 from mcginty/content-description

improve some content descriptions
master
Moxie Marlinspike 2014-08-19 21:00:20 -07:00
commit 40495a2261
4 changed files with 20 additions and 11 deletions

View File

@ -76,6 +76,7 @@
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/touch_highlight_background"
android:contentDescription="@string/conversation_activity__emoji_toggle_description"
android:padding="10dp"/>
<EditText
@ -93,6 +94,7 @@
android:maxLength="1000"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:contentDescription="@string/conversation_activity__compose_description"
android:textColor="?conversation_editor_text_color" />
<ImageButton

View File

@ -34,6 +34,7 @@
android:layout_marginRight="10dp"
android:layout_alignParentLeft="true"
android:cropToPadding="true"
android:contentDescription="@string/conversation_item_received__contact_photo_description"
android:scaleType="centerCrop" />
<View android:id="@+id/triangle_tick"
android:layout_width="12dp"

View File

@ -451,21 +451,25 @@
<string name="conversation_activity__type_message_mms_insecure">Send insecure MMS</string>
<string name="conversation_activity__send">Send</string>
<string name="conversation_activity__remove">Remove</string>
<string name="conversation_activity__window_description">Conversation with %1$s</string>
<string name="conversation_activity__compose_description">Message composition</string>
<string name="conversation_activity__emoji_toggle_description">Toggle emoji keyboard</string>
<!-- conversation_item -->
<string name="conversation_item__mms_image_description">Media message</string>
<string name="conversation_item__play_button_description">Play button</string>
<string name="conversation_item__secure_message_description">Secure message indicator</string>
<string name="conversation_item__secure_message_description">Secure message</string>
<!-- conversation_item_sent -->
<string name="conversation_item_sent__download">Download</string>
<string name="conversation_item_sent__downloading">Downloading</string>
<string name="conversation_item_sent__send_failed_indicator_description">Send Failed Indicator</string>
<string name="conversation_item_sent__send_failed_indicator_description">Send Failed</string>
<string name="conversation_item_sent__pending_approval_description">Pending Approval</string>
<string name="conversation_item_sent__delivered_description">Delivered Indicator</string>
<string name="conversation_item_sent__delivered_description">Delivered</string>
<!-- conversation_item_received -->
<string name="conversation_item_received__download">Download</string>
<string name="conversation_item_received__contact_photo_description">Contact photo</string>
<string name="conversation_item_received__downloading">Downloading</string>
<!-- conversation_fragment_cab -->

View File

@ -625,6 +625,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
}
this.getSupportActionBar().setTitle(title);
getWindow().getDecorView().setContentDescription(getString(R.string.conversation_activity__window_description, title));
if (subtitle != null && !Util.isEmpty(subtitle))
this.getSupportActionBar().setSubtitle(PhoneNumberUtils.formatNumber(subtitle));
@ -712,17 +713,17 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
if (isPushDestination) {
sendButton.setImageDrawable(drawables.getDrawable(0));
setComposeTextHint(getString(R.string.conversation_activity__type_message_push));
setComposeHint(getString(R.string.conversation_activity__type_message_push));
} else if (isSecureDestination) {
sendButton.setImageDrawable(drawables.getDrawable(1));
setComposeTextHint(attachmentManager.isAttachmentPresent() ?
getString(R.string.conversation_activity__type_message_mms_secure) :
getString(R.string.conversation_activity__type_message_sms_secure));
setComposeHint(attachmentManager.isAttachmentPresent() ?
getString(R.string.conversation_activity__type_message_mms_secure) :
getString(R.string.conversation_activity__type_message_sms_secure));
} else {
sendButton.setImageDrawable(drawables.getDrawable(2));
setComposeTextHint((attachmentManager.isAttachmentPresent() || !recipients.isSingleRecipient()) ?
getString(R.string.conversation_activity__type_message_mms_insecure) :
getString(R.string.conversation_activity__type_message_sms_insecure));
setComposeHint((attachmentManager.isAttachmentPresent() || !recipients.isSingleRecipient()) ?
getString(R.string.conversation_activity__type_message_mms_insecure) :
getString(R.string.conversation_activity__type_message_sms_insecure));
}
drawables.recycle();
@ -1210,13 +1211,14 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
this.composeText.setText(text);
}
private void setComposeTextHint(String hint){
private void setComposeHint(String hint){
if (hint == null) {
this.composeText.setHint(null);
} else {
SpannableString span = new SpannableString(hint);
span.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
this.composeText.setHint(span);
this.sendButton.setContentDescription(hint);
}
}