Merge "Improve accessibility for stars and settings"

This commit is contained in:
Jorge Lugo 2011-07-15 15:21:44 -07:00 committed by Android (Google) Code Review
commit 1086830bae
6 changed files with 68 additions and 22 deletions

View File

@ -33,6 +33,7 @@
android:id="@+id/account_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_exchange_username_label"
android:inputType="textEmailAddress"
android:imeOptions="actionDone" />
</TableRow>
@ -47,6 +48,7 @@
android:id="@+id/account_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_password_label"
android:inputType="textPassword"
android:imeOptions="actionDone" />
</TableRow>
@ -62,6 +64,7 @@
android:id="@+id/account_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_exchange_server_label"
android:inputType="textUri"
android:imeOptions="actionDone" />
</TableRow>

View File

@ -33,6 +33,7 @@
android:id="@+id/account_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_username_label"
android:inputType="textEmailAddress"
android:imeOptions="actionDone" />
</TableRow>
@ -47,6 +48,7 @@
android:id="@+id/account_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_password_label"
android:inputType="textPassword"
android:imeOptions="actionDone" />
</TableRow>
@ -64,6 +66,7 @@
android:id="@+id/account_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_pop_server_label"
android:inputType="textUri"
android:imeOptions="actionDone" />
</TableRow>
@ -77,7 +80,8 @@
<Spinner
android:id="@+id/account_security_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_security_label" />
</TableRow>
<TableRow
android:paddingTop="16dip" >
@ -90,6 +94,7 @@
android:id="@+id/account_port"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_port_label"
android:inputType="number"
android:imeOptions="actionDone" />
</TableRow>
@ -104,7 +109,8 @@
<Spinner
android:id="@+id/account_delete_policy"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_delete_policy_label" />
</TableRow>
<TableRow
android:id="@+id/imap_path_prefix_section"
@ -118,6 +124,7 @@
android:id="@+id/imap_path_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/account_setup_incoming_imap_path_prefix_label"
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
android:inputType="text"
android:imeOptions="actionDone" />

View File

@ -32,7 +32,8 @@
android:inputType="textEmailAddress"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_exchange_username_label" />
<TextView
android:text="@string/account_setup_incoming_password_label"
android:layout_height="wrap_content"
@ -58,7 +59,8 @@
android:inputType="textUri"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_exchange_server_label" />
<CheckBox
android:id="@+id/account_ssl"
android:layout_height="wrap_content"

View File

@ -28,10 +28,11 @@
android:textColor="?android:attr/textColorPrimary" />
<EditText
android:id="@+id/account_username"
android:inputType="textEmailAddress"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_username_label"
android:inputType="textEmailAddress"
android:imeOptions="actionDone" />
<TextView
android:text="@string/account_setup_incoming_password_label"
android:layout_height="wrap_content"
@ -40,10 +41,11 @@
android:textColor="?android:attr/textColorPrimary" />
<EditText
android:id="@+id/account_password"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_password_label"
android:inputType="textPassword"
android:imeOptions="actionDone" />
<!-- This text may be changed in code if the server is IMAP, etc. -->
<TextView
android:id="@+id/account_server_label"
@ -53,12 +55,14 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<!-- Note: we use inputType=textUri as the closest approximation to a server name -->
<!-- This contentDescription may be changed in code if the server is IMAP, etc. -->
<EditText
android:id="@+id/account_server"
android:inputType="textUri"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_pop_server_label"
android:inputType="textUri"
android:imeOptions="actionDone" />
<TextView
android:text="@string/account_setup_incoming_port_label"
android:layout_height="wrap_content"
@ -67,10 +71,11 @@
android:textColor="?android:attr/textColorPrimary" />
<EditText
android:id="@+id/account_port"
android:inputType="number"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_port_label"
android:inputType="number"
android:imeOptions="actionDone" />
<TextView
android:text="@string/account_setup_incoming_security_label"
android:layout_height="wrap_content"
@ -80,7 +85,8 @@
<Spinner
android:id="@+id/account_security_type"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_security_label" />
<TextView
android:id="@+id/account_delete_policy_label"
android:text="@string/account_setup_incoming_delete_policy_label"
@ -91,7 +97,8 @@
<Spinner
android:id="@+id/account_delete_policy"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_delete_policy_label" />
<LinearLayout
android:id="@+id/imap_path_prefix_section"
android:layout_width="match_parent"
@ -105,10 +112,11 @@
android:textColor="?android:attr/textColorPrimary" />
<EditText
android:id="@+id/imap_path_prefix"
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
inputType="text"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:contentDescription="@string/account_setup_incoming_imap_path_prefix_label"
android:hint="@string/account_setup_incoming_imap_path_prefix_hint"
android:inputType="text"
android:imeOptions="actionDone" />
</LinearLayout>
</LinearLayout>

View File

@ -26,6 +26,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
@ -258,6 +259,19 @@ public class MessageViewFragment extends MessageViewFragmentBase
enableReplyForwardButtons(Mailbox.isMailboxTypeReplyAndForwardable(mailboxType));
}
/**
* Sets the content description for the star icon based on whether it's currently starred.
*/
private void setStarContentDescription(boolean isFavorite) {
if (isFavorite) {
mFavoriteIcon.setContentDescription(
mContext.getResources().getString(R.string.remove_star_action));
} else {
mFavoriteIcon.setContentDescription(
mContext.getResources().getString(R.string.set_star_action));
}
}
/**
* Toggle favorite status and write back to provider
*/
@ -269,6 +283,10 @@ public class MessageViewFragment extends MessageViewFragmentBase
boolean newFavorite = ! message.mFlagFavorite;
mFavoriteIcon.setImageDrawable(newFavorite ? mFavoriteIconOn : mFavoriteIconOff);
// Handle accessibility event
setStarContentDescription(newFavorite);
mFavoriteIcon.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
// Update provider
message.mFlagFavorite = newFavorite;
getController().setMessageFavorite(message.mId, newFavorite);
@ -434,6 +452,10 @@ public class MessageViewFragment extends MessageViewFragmentBase
@Override
protected void onPostLoadBody() {
onMarkMessageAsRead(true);
// Initialize star content description for accessibility
Message message = getMessage();
setStarContentDescription(message.mFlagFavorite);
}
@Override

View File

@ -286,9 +286,13 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment {
mBaseScheme = account.mHostAuthRecv.mProtocol;
if (HostAuth.SCHEME_POP3.equals(mBaseScheme)) {
mServerLabelView.setText(R.string.account_setup_incoming_pop_server_label);
mServerView.setContentDescription(
getResources().getString(R.string.account_setup_incoming_pop_server_label));
mImapPathPrefixSectionView.setVisibility(View.GONE);
} else if (HostAuth.SCHEME_IMAP.equals(mBaseScheme)) {
mServerLabelView.setText(R.string.account_setup_incoming_imap_server_label);
mServerView.setContentDescription(
getResources().getString(R.string.account_setup_incoming_imap_server_label));
mDeletePolicyLabelView.setVisibility(View.GONE);
mDeletePolicyView.setVisibility(View.GONE);
} else {