Show header to user when fields were hidden since they were read-only.
Bug: 2121692
diff --git a/res/layout/item_contact_editor.xml b/res/layout/item_contact_editor.xml
index c444889..24d612a 100644
--- a/res/layout/item_contact_editor.xml
+++ b/res/layout/item_contact_editor.xml
@@ -4,9 +4,9 @@
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.
@@ -22,14 +22,21 @@
android:fillViewport="true">
<TextView
- android:id="@+id/text_summary"
+ android:id="@+id/edit_read_only"
android:layout_width="fill_parent"
- android:layout_height="0dip" />
+ android:layout_height="wrap_content"
+ android:gravity="center|center_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:paddingTop="5dip"
+ android:paddingBottom="5dip"
+ android:text="@string/edit_read_only"/>
<FrameLayout
android:id="@+id/stub_photo"
android:layout_width="100dip"
android:layout_height="96dip"
+ android:layout_below="@id/edit_read_only"
+ android:layout_alignWithParentIfMissing="true"
android:paddingLeft="12dip"
android:paddingTop="10dip">
@@ -43,10 +50,11 @@
android:id="@+id/edit_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/text_summary"
+ android:layout_below="@id/edit_read_only"
android:layout_toRightOf="@id/stub_photo"
android:layout_marginTop="6dip"
android:layout_marginBottom="4dip"
+ android:layout_alignWithParentIfMissing="true"
layout="@layout/item_generic_editor" />
<LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c033f8c..abe3ca8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -911,6 +911,9 @@
<!-- Single-character overlay for other phone numbers when creating desktop shortcuts -->
<string name="type_short_other">O</string>
+ <!-- In edit dialog, shown if the contact is marked as being read-only -->
+ <string name="edit_read_only">This contact is read-only</string>
+
<!-- Shown as the header title over a collapsible section that, by default, hides
secondary contact detail edit fields, such as birthday. -->
<string name="edit_secondary_collapse">Secondary details</string>
diff --git a/src/com/android/contacts/ui/widget/ContactEditorView.java b/src/com/android/contacts/ui/widget/ContactEditorView.java
index b35eb40..35a32cf 100644
--- a/src/com/android/contacts/ui/widget/ContactEditorView.java
+++ b/src/com/android/contacts/ui/widget/ContactEditorView.java
@@ -56,6 +56,8 @@
public class ContactEditorView extends RelativeLayout implements OnClickListener {
private LayoutInflater mInflater;
+ private TextView mReadOnly;
+
private PhotoEditorView mPhoto;
private GenericEditorView mName;
@@ -89,6 +91,8 @@
final int photoSize = getResources().getDimensionPixelSize(R.dimen.edit_photo_size);
+ mReadOnly = (TextView)findViewById(R.id.edit_read_only);
+
mName = (GenericEditorView)findViewById(R.id.edit_name);
mName.setMinimumHeight(photoSize);
mName.setDeletable(false);
@@ -170,6 +174,8 @@
mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
mPhoto.setVisibility(mHasPhotoEditor ? View.VISIBLE : View.GONE);
+ mReadOnly.setVisibility(source.readOnly ? View.VISIBLE : View.GONE);
+
// Create editor sections for each possible data kind
for (DataKind kind : source.getSortedDataKinds()) {
// Skip kind of not editable