A11y bug fixes for editor
am: 34047d2d07

Change-Id: I7e9af7ee6f1e1efc87c098124fcf54796674cf12
diff --git a/res/layout/item_read_only_field.xml b/res/layout/item_read_only_field.xml
index e5444a4..8c77eee 100644
--- a/res/layout/item_read_only_field.xml
+++ b/res/layout/item_read_only_field.xml
@@ -16,9 +16,10 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/read_only_row"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginEnd="@dimen/editor_delete_button_width"
+    android:focusableInTouchMode="true"
     android:layout_marginBottom="@dimen/editor_padding_between_read_only_editor_views"
     android:orientation="horizontal">
 
@@ -41,9 +42,7 @@
             android:textSize="@dimen/editor_form_text_size"
             android:textColor="?android:attr/textColorSecondary"
             android:singleLine="true"
-            android:saveEnabled="false"
-            android:textAlignment="viewStart"
-            android:enabled="false"/>
+            android:textAlignment="viewStart"/>
 
         <TextView
             android:id="@+id/type"
@@ -52,9 +51,7 @@
             android:textSize="@dimen/editor_form_text_size"
             android:textColor="?android:attr/textColorSecondary"
             android:singleLine="true"
-            android:saveEnabled="false"
-            android:textAlignment="viewStart"
-            android:enabled="false"/>
+            android:textAlignment="viewStart"/>
 
     </LinearLayout>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f20a54c..026753b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -851,6 +851,9 @@
     <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for changing the contact photo. [CHAR LIMIT=30] -->
     <string name="editor_change_photo_content_description">Change photo</string>
 
+    <!-- Accessibility content description, describes the image as being the photo for the contact the user is viewing. [CHAR LIMIT=NONE] -->
+    <string name="editor_contact_photo_content_description">Contact photo</string>
+
     <!-- Toast message displayed when the editor fails to load for a contacts. [CHAR LIMIT=NONE] -->
     <string name="editor_failed_to_load">Failed to open editor.</string>
 
diff --git a/src/com/android/contacts/editor/PhotoEditorView.java b/src/com/android/contacts/editor/PhotoEditorView.java
index 5283009..4e55171 100644
--- a/src/com/android/contacts/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/editor/PhotoEditorView.java
@@ -116,10 +116,14 @@
             mPhotoIcon.setVisibility(View.GONE);
             mPhotoIconOverlay.setVisibility(View.GONE);
             mPhotoTouchInterceptOverlay.setClickable(false);
+            mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
+                    R.string.editor_contact_photo_content_description));
         } else {
             mPhotoIcon.setVisibility(View.VISIBLE);
             mPhotoIconOverlay.setVisibility(View.VISIBLE);
             mPhotoTouchInterceptOverlay.setOnClickListener(this);
+            mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
+                    R.string.editor_change_photo_content_description));
         }
     }
 
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index 8df7c37..8e177e4 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -685,10 +685,8 @@
 
     private void bindData(Drawable icon, String iconContentDescription, CharSequence data,
             CharSequence type, boolean isFirstEntry, boolean forceLTR) {
-        final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-        final View field = inflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
-                false);
+        final View field = mLayoutInflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
+                /* attachToRoot */ false);
         if (isFirstEntry) {
             final ImageView imageView = (ImageView) field.findViewById(R.id.kind_icon);
             imageView.setImageDrawable(icon);
@@ -749,8 +747,7 @@
 
         // Set the content description
         mAccountHeaderContainer.setContentDescription(
-                EditorUiUtils.getAccountInfoContentDescription(primaryText,
-                        secondaryText));
+                EditorUiUtils.getAccountInfoContentDescription(secondaryText, primaryText));
     }
 
     private void addAccountSelector(final RawContactDelta rawContactDelta) {