Merge "Import translations. DO NOT MERGE" into lmp-mr1-dev
diff --git a/res/layout/item_photo_editor_readonly.xml b/res/layout/item_photo_editor_readonly.xml
new file mode 100644
index 0000000..0f9f935
--- /dev/null
+++ b/res/layout/item_photo_editor_readonly.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- A readonly version of item_photo_editor.xml shown in the readonly raw contact editor. -->
+<view class="com.android.contacts.editor.PhotoEditorView"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal" >
+
+    <ImageView
+        android:id="@+id/kind_icon"
+        android:src="@drawable/ic_camera_alt_black_24dp"
+        android:layout_marginTop="8dp"
+        android:contentDescription="@string/photo_section"
+        style="@style/EditKindIconStyle" />
+
+    <!-- Needs 10dp of top padding, in order get a total of 32dp of padding between this view
+        and the previous DataKindSection. Note that EditTexts in other editor.xml files have this
+        padding built in. Similarly, we need to add 4dp of start margin to make up for the padding
+        that an EditText would have in this image's place. -->
+    <ImageView
+        android:id="@+id/photo"
+        android:layout_width="72dip"
+        android:layout_height="72dip"
+        android:cropToPadding="true"
+        android:scaleType="centerCrop"
+        android:layout_marginTop="10dp"
+        android:layout_marginStart="4dp"
+        android:contentDescription="@string/description_contact_photo"
+        android:layout_marginBottom="@dimen/editor_padding_below_photo"
+        android:gravity="start" />
+
+
+    <!-- Don't explicitly set the layout_height in case we need to rely on text wrapping.
+        For one line, we can expect the height to be 32dp with 16dp text size. -->
+    <RadioButton
+        android:id="@+id/primary_checkbox"
+        android:layout_marginStart="12dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="@dimen/editor_delete_button_width"
+        android:layout_marginTop="10dp"
+        android:textSize="@dimen/editor_form_text_size"
+        android:text="@string/primary_photo" />
+</view>
diff --git a/res/layout/item_read_only_field.xml b/res/layout/item_read_only_field.xml
index d4ae179..7a7854b 100644
--- a/res/layout/item_read_only_field.xml
+++ b/res/layout/item_read_only_field.xml
@@ -18,50 +18,42 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical">
+    android:layout_marginEnd="@dimen/editor_delete_button_width"
+    android:layout_marginBottom="@dimen/editor_padding_between_editor_views"
+    android:orientation="horizontal">
 
-    <include
-        android:id="@+id/kind_title_layout"
-        layout="@layout/edit_kind_title" />
-
-    <!-- Shown only when id/kind_title_layout is hidden, dividing a previous item and this item. -->
-    <View
-        android:id="@+id/divider"
-        android:layout_width="match_parent"
-        android:layout_height="1px"
-        android:layout_marginLeft="8dip"
-        android:layout_marginRight="8dip"
-        android:layout_marginStart="8dip"
-        android:layout_marginEnd="8dip"
-        android:background="@color/secondary_header_separator_color" />
+    <ImageView
+        android:id="@+id/kind_icon"
+        style="@style/EditKindIconStyle" />
 
     <LinearLayout
-        android:layout_width="match_parent"
+        android:layout_width="0dp"
+        android:layout_weight="1"
         android:layout_height="wrap_content"
-        android:minHeight="@dimen/editor_min_line_item_height"
-        android:layout_marginLeft="16dip"
-        android:layout_marginRight="16dip"
-        android:layout_marginStart="16dip"
-        android:layout_marginEnd="16dip"
-        android:orientation="horizontal">
-        <TextView
+        android:orientation="vertical">
+
+        <EditText
             android:id="@+id/data"
-            android:layout_width="0px"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:layout_gravity="center_vertical"
-            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:minHeight="@dimen/editor_min_line_item_height"
+            android:textSize="@dimen/editor_form_text_size"
             android:textColor="?android:attr/textColorSecondary"
-            android:singleLine="true"/>
-        <TextView
+            android:singleLine="true"
+            android:saveEnabled="false"
+            android:enabled="false"/>
+
+        <EditText
             android:id="@+id/type"
-            android:layout_width="wrap_content"
+            android:layout_width="@dimen/editor_type_label_width"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textSize="@dimen/editor_form_text_size"
             android:textColor="?android:attr/textColorSecondary"
-            android:textAllCaps="true"
-            android:singleLine="true"/>
+            android:minHeight="@dimen/editor_min_line_item_height"
+            android:singleLine="true"
+            android:saveEnabled="false"
+            android:enabled="false"/>
+
     </LinearLayout>
 
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/raw_contact_readonly_editor_view.xml b/res/layout/raw_contact_readonly_editor_view.xml
index 797162d..a1eab90 100644
--- a/res/layout/raw_contact_readonly_editor_view.xml
+++ b/res/layout/raw_contact_readonly_editor_view.xml
@@ -19,46 +19,51 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    android:paddingTop="@dimen/editor_padding_top"
-    android:paddingBottom="32dip">
+    android:paddingTop="@dimen/editor_padding_top">
 
     <include
         layout="@layout/editor_account_header" />
 
+    <!-- Want 16dp of apparent top padding. Since EditText has 10dp of inset/padding built in,
+        only set marginTop=6dp. -->
     <LinearLayout
-        android:layout_height="wrap_content"
         android:layout_width="match_parent"
-        android:orientation="horizontal"
-        android:paddingTop="8dip"
-        android:paddingLeft="16dip"
-        android:paddingStart="16dip">
+        android:layout_height="wrap_content"
+        android:minHeight="@dimen/editor_min_line_item_height"
+        android:layout_marginBottom="@dimen/editor_padding_between_editor_views"
+        android:layout_marginTop="6dp"
+        android:orientation="horizontal">
 
-        <TextView android:id="@+id/read_only_name"
-            android:layout_width="0dip"
+        <ImageView
+            android:id="@+id/kind_icon"
+            android:src="@drawable/ic_person_black_24dp"
+            android:contentDescription="@string/header_name_entry"
+            style="@style/EditKindIconStyle" />
+
+        <EditText
+            android:id="@+id/read_only_name"
+            android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:gravity="center_vertical"
+            android:layout_marginRight="@dimen/editor_delete_button_width"
             android:singleLine="true"
-            android:ellipsize="end"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="?android:attr/textColorSecondary" />
-
-        <include
-            android:id="@+id/edit_photo"
-            android:layout_marginRight="8dip"
-            android:layout_marginEnd="8dip"
-            layout="@layout/item_photo_editor" />
+            android:textSize="@dimen/editor_form_text_size"
+            android:textColor="?android:attr/textColorSecondary"
+            android:enabled="false"/>
 
     </LinearLayout>
 
+    <include
+        android:id="@+id/edit_photo"
+        layout="@layout/item_photo_editor_readonly" />
+
     <Button
         android:id="@+id/button_edit_externally"
         android:text="@string/edit_contact"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="13dip"
-        android:layout_marginBottom="13dip"
-        android:layout_marginLeft="13dip"
+        android:layout_marginTop="10dp"
+        android:layout_marginBottom="@dimen/editor_padding_below_photo"
+        android:layout_marginEnd="13dip"
         android:layout_marginStart="13dip"/>
 
     <LinearLayout android:id="@+id/sect_general"
diff --git a/res/layout/structured_name_editor_view.xml b/res/layout/structured_name_editor_view.xml
index b6d6eca..2b0ee7b 100644
--- a/res/layout/structured_name_editor_view.xml
+++ b/res/layout/structured_name_editor_view.xml
@@ -32,6 +32,7 @@
     <ImageView
         android:id="@+id/kind_icon"
         android:src="@drawable/ic_person_black_24dp"
+        android:contentDescription="@string/header_name_entry"
         style="@style/EditKindIconStyle" />
 
     <include
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index df01b1a..1a77057 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -37,6 +37,9 @@
     <!-- Minimum height of a row in the Editor -->
     <dimen name="editor_min_line_item_height">48dip</dimen>
 
+    <!-- Width of the delete button (X) in the raw contact editor -->
+    <dimen name="editor_delete_button_width">48dp</dimen>
+
     <!-- The height and width of the delete button should be the same size as an editor row -->
     <dimen name="editor_delete_button_size">@dimen/editor_min_line_item_height</dimen>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0ce4786..d0aebf6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -708,6 +708,12 @@
     <string name="header_event_entry">Event</string>
     <!-- Header for the Relation entry [CHAR LIMIT=40] -->
     <string name="header_relation_entry">Relation</string>
+    <!-- Content description for the name fields header entry [CHAR LIMIT=NONE] -->
+    <string name="header_name_entry">Name section</string>
+    <!-- Content description for the email fields header entry [CHAR LIMIT=NONE] -->
+    <string name="header_email_entry">Email section</string>
+    <!-- Content description for the phone fields header entry [CHAR LIMIT=NONE] -->
+    <string name="header_phone_entry">Phone section</string>
 
     <!-- Content description for directions secondary button [CHAR LIMIT=NONE] -->
     <string name="content_description_directions">directions to location</string>
diff --git a/src/com/android/contacts/editor/PhotoEditorView.java b/src/com/android/contacts/editor/PhotoEditorView.java
index b967b26..7c7cf66 100644
--- a/src/com/android/contacts/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/editor/PhotoEditorView.java
@@ -82,14 +82,17 @@
         mPhotoImageView = (ImageView) findViewById(R.id.photo);
         mPrimaryCheckBox = (RadioButton) findViewById(R.id.primary_checkbox);
         mChangeButton = (Button) findViewById(R.id.change_button);
-        mChangeButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (mListener != null) {
-                    mListener.onRequest(EditorListener.REQUEST_PICK_PHOTO);
+        mPrimaryCheckBox = (RadioButton) findViewById(R.id.primary_checkbox);
+        if (mChangeButton != null) {
+            mChangeButton.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if (mListener != null) {
+                        mListener.onRequest(EditorListener.REQUEST_PICK_PHOTO);
+                    }
                 }
-            }
-        });
+            });
+        }
         // Turn off own state management. We do this ourselves on rotation.
         mPrimaryCheckBox.setSaveEnabled(false);
         mPrimaryCheckBox.setOnClickListener(new OnClickListener() {
diff --git a/src/com/android/contacts/editor/RawContactReadOnlyEditorView.java b/src/com/android/contacts/editor/RawContactReadOnlyEditorView.java
index 36e96a2..7901093 100644
--- a/src/com/android/contacts/editor/RawContactReadOnlyEditorView.java
+++ b/src/com/android/contacts/editor/RawContactReadOnlyEditorView.java
@@ -19,6 +19,7 @@
 import android.content.ContentUris;
 import android.content.Context;
 import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -181,7 +182,6 @@
                 mContext.getString(R.string.missing_name));
 
         if (type.getEditContactActivityClassName() != null) {
-            mAccountContainer.setBackgroundDrawable(null);
             mAccountContainer.setEnabled(false);
             mEditExternallyButton.setVisibility(View.VISIBLE);
         } else {
@@ -197,7 +197,9 @@
 
         final Resources res = mContext.getResources();
         // Phones
-        ArrayList<ValuesDelta> phones = state.getMimeEntries(Phone.CONTENT_ITEM_TYPE);
+        final ArrayList<ValuesDelta> phones = state.getMimeEntries(Phone.CONTENT_ITEM_TYPE);
+        final Drawable phoneDrawable = getResources().getDrawable(R.drawable.ic_phone_24dp);
+        final String phoneContentDescription = res.getString(R.string.header_phone_entry);
         if (phones != null) {
             boolean isFirstPhoneBound = true;
             for (ValuesDelta phone : phones) {
@@ -213,14 +215,16 @@
                     phoneType = Phone.getTypeLabel(
                             res, phone.getPhoneType(), phone.getPhoneLabel());
                 }
-                bindData(mContext.getText(R.string.phoneLabelsGroup), formattedNumber,
-                        phoneType, isFirstPhoneBound, true);
+                bindData(phoneDrawable, phoneContentDescription, formattedNumber, phoneType,
+                        isFirstPhoneBound, true);
                 isFirstPhoneBound = false;
             }
         }
 
         // Emails
-        ArrayList<ValuesDelta> emails = state.getMimeEntries(Email.CONTENT_ITEM_TYPE);
+        final ArrayList<ValuesDelta> emails = state.getMimeEntries(Email.CONTENT_ITEM_TYPE);
+        final Drawable emailDrawable = getResources().getDrawable(R.drawable.ic_email_24dp);
+        final String emailContentDescription = res.getString(R.string.header_email_entry);
         if (emails != null) {
             boolean isFirstEmailBound = true;
             for (ValuesDelta email : emails) {
@@ -233,7 +237,7 @@
                     emailType = Email.getTypeLabel(
                             res, email.getEmailType(), email.getEmailLabel());
                 }
-                bindData(mContext.getText(R.string.emailLabelsGroup), emailAddress, emailType,
+                bindData(emailDrawable, emailContentDescription, emailAddress, emailType,
                         isFirstEmailBound);
                 isFirstEmailBound = false;
             }
@@ -247,23 +251,22 @@
         }
     }
 
-    private void bindData(CharSequence titleText, CharSequence data, CharSequence type,
-            boolean isFirstEntry) {
-        bindData(titleText, data, type, isFirstEntry, false);
+    private void bindData(Drawable icon, String iconContentDescription, CharSequence data,
+            CharSequence type, boolean isFirstEntry) {
+        bindData(icon, iconContentDescription, data, type, isFirstEntry, false);
     }
 
-    private void bindData(CharSequence titleText, CharSequence data, CharSequence type,
-            boolean isFirstEntry, boolean forceLTR) {
+    private void bindData(Drawable icon, String iconContentDescription, CharSequence data,
+            CharSequence type, boolean isFirstEntry, boolean forceLTR) {
         final View field = mInflater.inflate(R.layout.item_read_only_field, mGeneral, false);
-        final View divider = field.findViewById(R.id.divider);
         if (isFirstEntry) {
-            final TextView titleView = (TextView) field.findViewById(R.id.kind_title);
-            titleView.setText(titleText);
-            divider.setVisibility(View.GONE);
+            final ImageView imageView = (ImageView) field.findViewById(R.id.kind_icon);
+            imageView.setImageDrawable(icon);
+            imageView.setContentDescription(iconContentDescription);
         } else {
-            View titleContainer = field.findViewById(R.id.kind_title_layout);
-            titleContainer.setVisibility(View.GONE);
-            divider.setVisibility(View.VISIBLE);
+            final ImageView imageView = (ImageView) field.findViewById(R.id.kind_icon);
+            imageView.setVisibility(View.INVISIBLE);
+            imageView.setContentDescription(null);
         }
         final TextView dataView = (TextView) field.findViewById(R.id.data);
         dataView.setText(data);