Fix "Add new" strings in contact editor
- Instead of using type-specific strings like "Add new
phone number" just use "Add new" since we have labels
for kind sections now.
Change-Id: I0e386ae29330193fec18b62f3949c46e095a872c
diff --git a/res/layout-sw580dp/item_kind_section.xml b/res/layout-sw580dp/item_kind_section.xml
deleted file mode 100644
index 5ff2da2..0000000
--- a/res/layout-sw580dp/item_kind_section.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- the body surrounding all editors for a specific kind -->
-
-<com.android.contacts.editor.KindSectionView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="@dimen/editor_field_bottom_padding"
- android:orientation="vertical">
-
- <include
- android:id="@+id/kind_title_layout"
- layout="@layout/edit_kind_title" />
-
- <LinearLayout
- android:id="@+id/kind_editors"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" />
-
- <include
- android:id="@+id/add_field_footer"
- layout="@layout/edit_add_field" />
-
-</com.android.contacts.editor.KindSectionView>
diff --git a/res/layout/edit_add_field.xml b/res/layout/edit_add_field.xml
index f6bc631..31ea05d 100644
--- a/res/layout/edit_add_field.xml
+++ b/res/layout/edit_add_field.xml
@@ -26,5 +26,6 @@
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorTertiary" />
+ android:textColor="?android:attr/textColorTertiary"
+ android:text="@string/add_new_entry_for_section" />
</FrameLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 03c4102..8a97c27 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1381,29 +1381,8 @@
<!-- The add field button shown in the editor under each editable Raw Contact [CHAR LIMIT=30] -->
<string name="add_field">Add another field</string>
- <!-- The editable field hint text to add a new phone number to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_phone">Add new phone number</string>
-
- <!-- The editable field hint text to add a new email to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_email">Add new email</string>
-
- <!-- The editable field hint text to add a new IM account to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_im">Add new IM account</string>
-
- <!-- The editable field hint text to add a new postal address to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_address">Add new address</string>
-
- <!-- The editable field hint text to add a new note to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_note">Add new note</string>
-
- <!-- The editable field hint text to add a new website to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_website">Add new website</string>
-
- <!-- The editable field hint text to add a new event to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_event">Add new event</string>
-
- <!-- The editable field hint text to add a relationship field to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
- <string name="add_relationship">Add new relationship</string>
+ <!-- The button to add another entry of a specific data type (i.e. email, phone, address) to a contact in the Raw Contact Editor [CHAR LIMIT=22] -->
+ <string name="add_new_entry_for_section">Add new</string>
<!-- Attbution of a contact status update, when the time of update is unknown -->
<string name="contact_status_update_attribution">via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>
diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java
index 02aa73f..c4da9fa 100644
--- a/src/com/android/contacts/editor/KindSectionView.java
+++ b/src/com/android/contacts/editor/KindSectionView.java
@@ -46,7 +46,6 @@
private TextView mTitle;
private ViewGroup mEditors;
private View mAddFieldFooter;
- private TextView mAddFieldText;
private String mTitleString;
private DataKind mKind;
@@ -96,7 +95,6 @@
mTitle = (TextView) findViewById(R.id.kind_title);
mEditors = (ViewGroup) findViewById(R.id.kind_editors);
- mAddFieldText = (TextView) findViewById(R.id.add_text);
mAddFieldFooter = findViewById(R.id.add_field_footer);
mAddFieldFooter.setOnClickListener(new OnClickListener() {
@Override
@@ -139,13 +137,6 @@
: getResources().getString(kind.titleRes);
mTitle.setText(mTitleString.toUpperCase());
- // Set "add field" footer message according to MIME type. Some MIME types
- // can only have max 1 field, so the resource ID will be -1 if these sections
- // should not have an "Add field" option.
- if (kind.addNewFieldTextResourceId != -1) {
- mAddFieldText.setText(getResources().getString(kind.addNewFieldTextResourceId));
- }
-
rebuildFromState();
updateAddFooterVisible();
updateSectionVisible();
diff --git a/src/com/android/contacts/model/BaseAccountType.java b/src/com/android/contacts/model/BaseAccountType.java
index c2e8a53..547a488 100644
--- a/src/com/android/contacts/model/BaseAccountType.java
+++ b/src/com/android/contacts/model/BaseAccountType.java
@@ -100,7 +100,7 @@
protected DataKind addDataKindStructuredName(Context context) {
DataKind kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
R.string.nameLabelsGroup, -1, -1, true, R.layout.structured_name_editor_view,
- android.R.style.TextAppearance_Medium, -1));
+ android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -130,7 +130,7 @@
protected DataKind addDataKindDisplayName(Context context) {
DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME,
R.string.nameLabelsGroup, -1, -1, true, R.layout.text_fields_editor_view,
- android.R.style.TextAppearance_Medium, -1));
+ android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -171,7 +171,7 @@
protected DataKind addDataKindPhoneticName(Context context) {
DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME,
R.string.name_phonetic, -1, -1, true, R.layout.phonetic_name_editor_view,
- android.R.style.TextAppearance_Medium, -1));
+ android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -191,7 +191,7 @@
protected DataKind addDataKindNickname(Context context) {
DataKind kind = addKind(new DataKind(Nickname.CONTENT_ITEM_TYPE,
R.string.nicknameLabelsGroup, -1, 115, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium, -1));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.isList = false;
kind.actionHeader = new SimpleInflater(R.string.nicknameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -208,8 +208,7 @@
protected DataKind addDataKindPhone(Context context) {
DataKind kind = addKind(new DataKind(Phone.CONTENT_ITEM_TYPE, R.string.phoneLabelsGroup,
android.R.drawable.sym_action_call, 10, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_phone));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.iconAltRes = R.drawable.sym_action_sms;
kind.actionHeader = new PhoneActionInflater();
kind.actionAltHeader = new PhoneActionAltInflater();
@@ -249,8 +248,7 @@
protected DataKind addDataKindEmail(Context context) {
DataKind kind = addKind(new DataKind(Email.CONTENT_ITEM_TYPE, R.string.emailLabelsGroup,
R.drawable.sym_action_email_holo_light, 15, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_email));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new EmailActionInflater();
kind.actionBody = new SimpleInflater(Email.DATA);
kind.typeColumn = Email.TYPE;
@@ -271,8 +269,7 @@
protected DataKind addDataKindStructuredPostal(Context context) {
DataKind kind = addKind(new DataKind(StructuredPostal.CONTENT_ITEM_TYPE,
R.string.postalLabelsGroup, R.drawable.sym_action_show_map_holo_light, 25,
- true, R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_address));
+ true, R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new PostalActionInflater();
kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
kind.typeColumn = StructuredPostal.TYPE;
@@ -294,8 +291,7 @@
protected DataKind addDataKindIm(Context context) {
DataKind kind = addKind(new DataKind(Im.CONTENT_ITEM_TYPE, R.string.imLabelsGroup,
R.drawable.sym_action_talk_holo_light, 20, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_im));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new ImActionInflater();
kind.actionBody = new SimpleInflater(Im.DATA);
@@ -327,7 +323,7 @@
protected DataKind addDataKindOrganization(Context context) {
DataKind kind = addKind(new DataKind(Organization.CONTENT_ITEM_TYPE,
R.string.organizationLabelsGroup, -1, 5, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium, -1));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(Organization.COMPANY);
kind.actionBody = new SimpleInflater(Organization.TITLE);
kind.isList = false;
@@ -343,7 +339,7 @@
protected DataKind addDataKindPhoto(Context context) {
DataKind kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true, -1,
- android.R.style.TextAppearance_Medium, -1));
+ android.R.style.TextAppearance_Medium));
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
return kind;
@@ -352,8 +348,7 @@
protected DataKind addDataKindNote(Context context) {
DataKind kind = addKind(new DataKind(Note.CONTENT_ITEM_TYPE,
R.string.label_notes, -1, 110, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_note));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.isList = false;
kind.actionHeader = new SimpleInflater(R.string.label_notes);
kind.actionBody = new SimpleInflater(Note.NOTE);
@@ -366,8 +361,7 @@
protected DataKind addDataKindWebsite(Context context) {
DataKind kind = addKind(new DataKind(Website.CONTENT_ITEM_TYPE,
R.string.websiteLabelsGroup, R.drawable.sym_action_goto_website_holo_light, 120,
- true, R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_website));
+ true, R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
kind.actionBody = new SimpleInflater(Website.URL);
kind.defaultValues = new ContentValues();
@@ -390,8 +384,7 @@
// intent-filters in the Phone app's manifest.
DataKind kind = addKind(new DataKind(SipAddress.CONTENT_ITEM_TYPE,
R.string.label_sip_address, android.R.drawable.sym_action_call, 130, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- -1));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.isList = false;
kind.actionHeader = new SimpleInflater(R.string.label_sip_address);
@@ -407,7 +400,7 @@
DataKind kind = getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE);
kind = addKind(new DataKind(GroupMembership.CONTENT_ITEM_TYPE,
R.string.groupsLabel, android.R.drawable.sym_contact_card, 999, true, -1,
- android.R.style.TextAppearance_Medium, -1));
+ android.R.style.TextAppearance_Medium));
kind.isList = false;
kind.fieldList = Lists.newArrayList();
diff --git a/src/com/android/contacts/model/DataKind.java b/src/com/android/contacts/model/DataKind.java
index 52769c3..40f6f99 100644
--- a/src/com/android/contacts/model/DataKind.java
+++ b/src/com/android/contacts/model/DataKind.java
@@ -63,13 +63,6 @@
public final int textAppearanceResourceId;
/**
- * String resource id for the "add field" footer. This is equal to -1 if it
- * is not applicable to add a new field to this class (i.e. for a structured
- * name because a user should only have one structured name).
- */
- public final int addNewFieldTextResourceId;
-
- /**
* If this is a date field, this specifies the format of the date when saving. The
* date includes year, month and day. If this is not a date field or the date field is not
* editable, this value should be ignored.
@@ -86,12 +79,10 @@
public DataKind() {
editorLayoutResourceId = R.layout.text_fields_editor_view;
textAppearanceResourceId = android.R.style.TextAppearance_Medium;
- addNewFieldTextResourceId = -1;
}
public DataKind(String mimeType, int titleRes, int iconRes, int weight, boolean editable,
- int editorLayoutResourceId, int textAppearanceResourceId,
- int addNewFieldTextResourceId) {
+ int editorLayoutResourceId, int textAppearanceResourceId) {
this.mimeType = mimeType;
this.titleRes = titleRes;
this.iconRes = iconRes;
@@ -101,6 +92,5 @@
this.typeOverallMax = -1;
this.editorLayoutResourceId = editorLayoutResourceId;
this.textAppearanceResourceId = textAppearanceResourceId;
- this.addNewFieldTextResourceId = addNewFieldTextResourceId;
}
}
\ No newline at end of file
diff --git a/src/com/android/contacts/model/ExchangeAccountType.java b/src/com/android/contacts/model/ExchangeAccountType.java
index 5b007aa..240df47 100644
--- a/src/com/android/contacts/model/ExchangeAccountType.java
+++ b/src/com/android/contacts/model/ExchangeAccountType.java
@@ -65,7 +65,7 @@
protected DataKind addDataKindStructuredName(Context context) {
DataKind kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
R.string.nameLabelsGroup, -1, -1, true,
- R.layout.structured_name_editor_view, android.R.style.TextAppearance_Medium, -1));
+ R.layout.structured_name_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -95,7 +95,7 @@
protected DataKind addDataKindDisplayName(Context context) {
DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME,
R.string.nameLabelsGroup, -1, -1, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium, -1));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
boolean displayOrderPrimary =
context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
@@ -129,7 +129,7 @@
protected DataKind addDataKindPhoneticName(Context context) {
DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME,
R.string.name_phonetic, -1, -1, true,
- R.layout.phonetic_name_editor_view, android.R.style.TextAppearance_Medium, -1));
+ R.layout.phonetic_name_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
kind.actionBody = new SimpleInflater(Nickname.NAME);
@@ -295,8 +295,7 @@
protected DataKind addDataKindEvent(Context context) {
DataKind kind = addKind(
new DataKind(Event.CONTENT_ITEM_TYPE, R.string.eventLabelsGroup, -1, 150, true,
- R.layout.event_field_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_event));
+ R.layout.event_field_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new EventActionInflater();
kind.actionBody = new SimpleInflater(Event.START_DATE);
diff --git a/src/com/android/contacts/model/GoogleAccountType.java b/src/com/android/contacts/model/GoogleAccountType.java
index 982cf79..fd0eea4 100644
--- a/src/com/android/contacts/model/GoogleAccountType.java
+++ b/src/com/android/contacts/model/GoogleAccountType.java
@@ -100,8 +100,7 @@
private DataKind addDataKindRelation(Context context) {
DataKind kind = addKind(new DataKind(Relation.CONTENT_ITEM_TYPE,
R.string.relationLabelsGroup, -1, 160, true,
- R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_relationship));
+ R.layout.text_fields_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new RelationActionInflater();
kind.actionBody = new SimpleInflater(Relation.NAME);
@@ -137,8 +136,7 @@
private DataKind addDataKindEvent(Context context) {
DataKind kind = addKind(new DataKind(Event.CONTENT_ITEM_TYPE,
R.string.eventLabelsGroup, -1, 150, true,
- R.layout.event_field_editor_view, android.R.style.TextAppearance_Medium,
- R.string.add_event));
+ R.layout.event_field_editor_view, android.R.style.TextAppearance_Medium));
kind.actionHeader = new EventActionInflater();
kind.actionBody = new SimpleInflater(Event.START_DATE);
diff --git a/tests/src/com/android/contacts/EntityModifierTests.java b/tests/src/com/android/contacts/EntityModifierTests.java
index b36465b..cf6fefe 100644
--- a/tests/src/com/android/contacts/EntityModifierTests.java
+++ b/tests/src/com/android/contacts/EntityModifierTests.java
@@ -90,14 +90,14 @@
this.accountType = TEST_ACCOUNT_TYPE;
final DataKind nameKind = new DataKind(StructuredName.CONTENT_ITEM_TYPE,
- R.string.nameLabelsGroup, -1, -1, true, -1, -1, -1);
+ R.string.nameLabelsGroup, -1, -1, true, -1, -1);
nameKind.typeOverallMax = 1;
addKind(nameKind);
// Phone allows maximum 2 home, 1 work, and unlimited other, with
// constraint of 5 numbers maximum.
final DataKind phoneKind = new DataKind(
- Phone.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1, -1);
+ Phone.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1);
phoneKind.typeOverallMax = 5;
phoneKind.typeColumn = Phone.TYPE;
@@ -115,7 +115,7 @@
// Email is unlimited
final DataKind emailKind = new DataKind(
- Email.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1, -1);
+ Email.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1);
emailKind.typeOverallMax = -1;
emailKind.fieldList = Lists.newArrayList();
emailKind.fieldList.add(new EditField(Email.DATA, -1, -1));
@@ -123,7 +123,7 @@
// IM is only one
final DataKind imKind = new DataKind(Im.CONTENT_ITEM_TYPE, -1, -1, 10,
- true, -1, -1, -1);
+ true, -1, -1);
imKind.typeOverallMax = 1;
imKind.fieldList = Lists.newArrayList();
imKind.fieldList.add(new EditField(Im.DATA, -1, -1));
@@ -131,7 +131,7 @@
// Organization is only one
final DataKind orgKind = new DataKind(
- Organization.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1, -1);
+ Organization.CONTENT_ITEM_TYPE, -1, -1, 10, true, -1, -1);
orgKind.typeOverallMax = 1;
orgKind.fieldList = Lists.newArrayList();
orgKind.fieldList.add(new EditField(Organization.COMPANY, -1, -1));