Merge ""Invite" part 2"
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/contact_tile_frequent.xml b/res/layout/contact_tile_frequent.xml
index 4ba7396..fc9c04c 100644
--- a/res/layout/contact_tile_frequent.xml
+++ b/res/layout/contact_tile_frequent.xml
@@ -21,27 +21,44 @@
android:paddingRight="16dip"
android:paddingLeft="16dip" >
- <LinearLayout
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <TextView
- android:id="@+id/contact_tile_name"
- android:layout_width="0dip"
- android:layout_height="fill_parent"
- android:layout_weight="1"
- android:textSize="18sp"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:paddingTop="24dip" />
-
<QuickContactBadge
android:id="@+id/contact_tile_quick"
android:layout_width="64dip"
android:layout_height="64dip"
- android:scaleType="centerCrop" />
+ android:scaleType="centerCrop"
+ android:layout_alignParentRight="true" />
- </LinearLayout>
+ <TextView
+ android:id="@+id/contact_tile_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_toLeftOf="@id/contact_tile_quick" />
+
+ <ImageView
+ android:id="@+id/contact_tile_presence"
+ android:layout_width="16dip"
+ android:layout_height="16dip"
+ android:layout_below="@id/contact_tile_name"
+ android:layout_alignParentLeft="true" />
+
+ <TextView
+ android:id="@+id/contact_tile_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="12sp"
+ android:ellipsize="end"
+ android:singleLine="true"
+ android:textColor="#cccccc"
+ android:layout_toRightOf="@id/contact_tile_presence"
+ android:layout_below="@id/contact_tile_name" />
+
+ </RelativeLayout>
</view>
diff --git a/res/layout/contact_tile_starred.xml b/res/layout/contact_tile_starred.xml
index 6cdf213..ba1dff2 100644
--- a/res/layout/contact_tile_starred.xml
+++ b/res/layout/contact_tile_starred.xml
@@ -30,11 +30,36 @@
<View
android:id="@+id/contact_tile_background"
- style="@style/ContactTileStarredTextBackground" />
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/contact_tile_shadowbox_height"
+ android:layout_alignParentBottom="true"
+ style="@style/ContactTileStarredShadowBox" />
+
+ <ImageView
+ android:id="@+id/contact_tile_presence"
+ android:layout_width="16dip"
+ android:layout_height="16dip"
+ android:layout_alignParentBottom="true"
+ android:layout_marginLeft="8dip"
+ android:layout_marginBottom="10dip" />
<TextView
android:id="@+id/contact_tile_name"
- style="@style/ContactTileStarredText" />
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/contact_tile_presence"
+ android:layout_above="@id/contact_tile_presence"
+ android:textColor="@android:color/white"
+ stlye="@style/ContactTileStarredName" />
+
+ <TextView
+ android:id="@+id/contact_tile_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/contact_tile_presence"
+ android:layout_below="@id/contact_tile_name"
+ android:layout_marginLeft="4dip"
+ style="@style/ContactTileStatusText" />
</RelativeLayout>
diff --git a/res/layout/contact_tile_starred_quick_contact.xml b/res/layout/contact_tile_starred_quick_contact.xml
index 241ab54..0fb580e 100644
--- a/res/layout/contact_tile_starred_quick_contact.xml
+++ b/res/layout/contact_tile_starred_quick_contact.xml
@@ -30,11 +30,36 @@
<View
android:id="@+id/contact_tile_background"
- style="@style/ContactTileStarredTextBackground" />
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/contact_tile_shadowbox_height"
+ android:layout_alignParentBottom="true"
+ style="@style/ContactTileStarredShadowBox" />
+
+ <ImageView
+ android:id="@+id/contact_tile_presence"
+ android:layout_width="16dip"
+ android:layout_height="16dip"
+ android:layout_alignParentBottom="true"
+ android:layout_marginLeft="8dip"
+ android:layout_marginBottom="10dip" />
<TextView
android:id="@+id/contact_tile_name"
- style="@style/ContactTileStarredText" />
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@id/contact_tile_presence"
+ android:layout_above="@id/contact_tile_presence"
+ android:textColor="@android:color/white"
+ stlye="@style/ContactTileStarredName" />
+
+ <TextView
+ android:id="@+id/contact_tile_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/contact_tile_presence"
+ android:layout_below="@id/contact_tile_name"
+ android:layout_marginLeft="4dip"
+ style="@style/ContactTileStatusText" />
</RelativeLayout>
diff --git a/res/layout/contact_tile_starred_secondary_target.xml b/res/layout/contact_tile_starred_secondary_target.xml
index a8ae00f..5d4e55e 100644
--- a/res/layout/contact_tile_starred_secondary_target.xml
+++ b/res/layout/contact_tile_starred_secondary_target.xml
@@ -30,24 +30,32 @@
<View
android:id="@+id/contact_tile_background"
- style="@style/ContactTileStarredTextBackground" />
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/contact_tile_shadowbox_height"
+ android:layout_alignParentBottom="true"
+ style="@style/ContactTileStarredShadowBox" />
<LinearLayout
- android:orientation="horizontal"
- style="@style/ContactTileStarredText">
+ android:layout_width="match_parent"
+ android:layout_height="48dip"
+ android:layout_alignParentBottom="true"
+ android:orientation="horizontal" >
<TextView
android:id="@+id/contact_tile_name"
- style="@style/ContactTileStarredText"
android:layout_width="0dip"
- android:layout_weight="2" />
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:layout_marginLeft="8dip"
+ android:textColor="@android:color/white"
+ stlye="@style/ContactTileStarredName" />
<ImageButton
android:id="@+id/contact_tile_secondary_button"
android:src="@drawable/ic_tab_unselected_contacts"
android:layout_height="match_parent"
- android:layout_width="0dip"
- android:layout_weight="1" />
+ android:layout_width="wrap_content" />
</LinearLayout>
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/layout/group_browse_list_item.xml b/res/layout/group_browse_list_item.xml
index d94d444..b829704 100644
--- a/res/layout/group_browse_list_item.xml
+++ b/res/layout/group_browse_list_item.xml
@@ -22,42 +22,13 @@
android:layout_height="wrap_content"
style="@style/GroupBrowseListItem">
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:padding="5dip">
-
- <TextView
- android:id="@+id/label"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:ellipsize="end"
- android:singleLine="true" />
-
- <TextView
- android:id="@+id/account"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"
- android:ellipsize="end"
- android:singleLine="true"
- android:textStyle="italic" />
-
- </LinearLayout>
-
- <ImageView
- android:id="@+id/icon"
- android:scaleType="center"
+ <TextView
+ android:id="@+id/label"
+ android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginRight="20dip"
- android:layout_gravity="center_vertical"
- android:src="@drawable/ic_menu_display_all_holo_light" />
+ android:padding="10dip"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:ellipsize="end"
+ android:singleLine="true" />
</view>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b79bf0f..e155cbc 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -211,4 +211,7 @@
<dimen name="contact_browser_list_left_margin">24dip</dimen>
<dimen name="contact_browser_list_top_margin">8dip</dimen>
<dimen name="contacts_count_right_margin">40dip</dimen>
+
+ <!-- ContactTile Layouts -->
+ <dimen name="contact_tile_shadowbox_height">48dip</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87307ae..75e3249 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>
@@ -1671,4 +1650,14 @@
<!-- Menu item used to show only voicemails in the call log. [CHAR LIMIT=30] -->
<string name="menu_show_voicemails_only">Show voicemails only</string>
+
+ <!-- Used to display as default status when the contact is available for chat [CHAR LIMIT=19] -->
+ <string name="status_available">Available</string>
+
+ <!-- Used to display as default status when the contact is away or idle for chat [CHAR LIMIT=19] -->
+ <string name="status_away">Away</string>
+
+ <!-- Used to display as default status when the contact is busy or Do not disturb for chat [CHAR LIMIT=19] -->
+ <string name="status_busy">Busy</string>
+
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e4b7525..d16590e 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -360,24 +360,20 @@
<item name="android:background">@drawable/list_selector</item>
</style>
- <style name="ContactTileStarredText">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">48dip</item>
- <item name="android:layout_alignParentBottom">true</item>
- <item name="android:layout_alignParentLeft">true</item>
- <item name="android:gravity">center_vertical</item>
- <item name="android:paddingLeft">8dip</item>
+ <style name="ContactTileStarredName">
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
- <item name="android:textColor">@android:color/white</item>
- <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:textSize">16sp</item>
</style>
- <style name="ContactTileStarredTextBackground">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">48dip</item>
- <item name="android:layout_alignParentBottom">true</item>
- <item name="android:layout_alignParentLeft">true</item>
+ <style name="ContactTileStatusText">
+ <item name="android:singleLine">true</item>
+ <item name="android:ellipsize">end</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:textColor">#777777</item>
+ </style>
+
+ <style name="ContactTileStarredShadowBox">
<item name="android:alpha">0.5</item>
<item name="android:background">@android:color/black</item>
</style>
diff --git a/src/com/android/contacts/ContactStatusUtil.java b/src/com/android/contacts/ContactStatusUtil.java
new file mode 100644
index 0000000..4aa24b0
--- /dev/null
+++ b/src/com/android/contacts/ContactStatusUtil.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package com.android.contacts;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.provider.ContactsContract.StatusUpdates;
+
+/**
+ * Provides static function to get default contact status message.
+ */
+public class ContactStatusUtil {
+
+ private static final String TAG = "ContactStatusUtil";
+
+ public static String getStatusString(Context context, int presence) {
+ Resources resources = context.getResources();
+ switch (presence) {
+ case StatusUpdates.AVAILABLE:
+ return resources.getString(R.string.status_available);
+ case StatusUpdates.IDLE:
+ case StatusUpdates.AWAY:
+ return resources.getString(R.string.status_away);
+ case StatusUpdates.DO_NOT_DISTURB:
+ return resources.getString(R.string.status_busy);
+ case StatusUpdates.OFFLINE:
+ case StatusUpdates.INVISIBLE:
+ default:
+ return null;
+ }
+ }
+
+}
diff --git a/src/com/android/contacts/ContactTileLoaderFactory.java b/src/com/android/contacts/ContactTileLoaderFactory.java
index 20ad26e..e90730a 100644
--- a/src/com/android/contacts/ContactTileLoaderFactory.java
+++ b/src/com/android/contacts/ContactTileLoaderFactory.java
@@ -33,13 +33,17 @@
public final static int STARRED = 2;
public final static int PHOTO_URI = 3;
public final static int LOOKUP_KEY = 4;
+ public final static int CONTACT_PRESENCE = 5;
+ public final static int CONTACT_STATUS = 6;
private static final String[] COLUMNS = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.STARRED,
Contacts.PHOTO_URI,
- Contacts.LOOKUP_KEY
+ Contacts.LOOKUP_KEY,
+ Contacts.CONTACT_PRESENCE,
+ Contacts.CONTACT_STATUS,
};
public static CursorLoader createStrequentLoader(Context context) {
diff --git a/src/com/android/contacts/GroupMemberLoader.java b/src/com/android/contacts/GroupMemberLoader.java
index 452c5d0..9605747 100644
--- a/src/com/android/contacts/GroupMemberLoader.java
+++ b/src/com/android/contacts/GroupMemberLoader.java
@@ -53,6 +53,7 @@
Data.LOOKUP_KEY, // 11
Data.PHONETIC_NAME, // 12
Data.HAS_PHONE_NUMBER, // 13
+ Data.CONTACT_STATUS, // 14
};
private final long mGroupId;
@@ -71,6 +72,7 @@
public static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 11;
public static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 12;
public static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 13;
+ public static final int CONTACT_STATUS_COLUMN_INDEX = 14;
public GroupMemberLoader(Context context, long groupId) {
super(context);
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index f83938a..9f64815 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -1012,12 +1012,8 @@
mCallLogQueryHandler.fetchVoicemailOnly();
return true;
}
- case R.id.menu_call_settings_call_log: {
- // Intent is already set.
- return false;
- }
default:
- throw new IllegalArgumentException("unknown menu item: " + item.getItemId());
+ return false;
}
}
diff --git a/src/com/android/contacts/dialpad/DialpadFragment.java b/src/com/android/contacts/dialpad/DialpadFragment.java
index 717db46..6acbc85 100644
--- a/src/com/android/contacts/dialpad/DialpadFragment.java
+++ b/src/com/android/contacts/dialpad/DialpadFragment.java
@@ -1143,8 +1143,9 @@
case R.id.menu_add_wait:
updateDialString(";");
return true;
+ default:
+ return false;
}
- return false;
}
@Override
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 1ec590c..5d9494c 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -625,7 +625,7 @@
}
@Override
- public void onDeleted(Editor removedEditor) {
+ public void onDeleteRequested(Editor removedEditor) {
}
};
@@ -1673,7 +1673,9 @@
}
@Override
- public void onDeleted(Editor removedEditor) {
+ public void onDeleteRequested(Editor removedEditor) {
+ // The picture cannot be deleted, it can only be removed, which is handled by
+ // onRemovePictureChosen()
}
/**
@@ -1697,7 +1699,7 @@
* User has chosen to remove a picture
*/
@Override
- public void onRemovePictureChose() {
+ public void onRemovePictureChosen() {
mEditor.setPhotoBitmap(null);
}
diff --git a/src/com/android/contacts/editor/Editor.java b/src/com/android/contacts/editor/Editor.java
index a70bf3f..423ca94 100644
--- a/src/com/android/contacts/editor/Editor.java
+++ b/src/com/android/contacts/editor/Editor.java
@@ -30,9 +30,9 @@
public interface EditorListener {
/**
- * Called when the given {@link Editor} has been deleted.
+ * Called when the given {@link Editor} is requested to be deleted by the user.
*/
- public void onDeleted(Editor editor);
+ public void onDeleteRequested(Editor editor);
/**
* Called when the given {@link Editor} has a request, for example it
@@ -75,4 +75,14 @@
* allowing advanced editors to persist data in a specific way.
*/
public void onFieldChanged(String column, String value);
+
+ /**
+ * Performs the delete operation for this {@link Editor}.
+ */
+ public void deleteEditor();
+
+ /**
+ * Clears all fields in this {@link Editor}.
+ */
+ public void clearAllFields();
}
diff --git a/src/com/android/contacts/editor/EventFieldEditorView.java b/src/com/android/contacts/editor/EventFieldEditorView.java
index 41d564a..4c5affd 100644
--- a/src/com/android/contacts/editor/EventFieldEditorView.java
+++ b/src/com/android/contacts/editor/EventFieldEditorView.java
@@ -242,4 +242,14 @@
public static int getDefaultHourForBirthday() {
return DEFAULT_HOUR;
}
+
+ @Override
+ public void clearAllFields() {
+ // Update UI
+ mDateView.setText("");
+
+ // Update state
+ final String column = getKind().fieldList.get(0).column;
+ onFieldChanged(column, "");
+ }
}
diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java
index 02aa73f..3b46307 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
@@ -108,14 +106,19 @@
});
}
- /** {@inheritDoc} */
@Override
- public void onDeleted(Editor editor) {
+ public void onDeleteRequested(Editor editor) {
+ // If there is only 1 editor in the section, then don't allow the user to delete it.
+ // Just clear the fields in the editor.
+ if (getEditorCount() == 1) {
+ editor.clearAllFields();
+ } else {
+ // Otherwise it's okay to delete this {@link Editor}
+ editor.deleteEditor();
+ }
updateAddFooterVisible();
- updateSectionVisible();
}
- /** {@inheritDoc} */
@Override
public void onRequest(int request) {
// If a field has become empty or non-empty, then check if another row
@@ -139,13 +142,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/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index 91819a2..5bba2c4 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -75,6 +75,7 @@
private boolean mReadOnly;
private boolean mWasEmpty = true;
private boolean mIsDeletable = true;
+ private boolean mIsAttachedToWindow;
private EditType mType;
@@ -137,14 +138,17 @@
new Handler().post(new Runnable() {
@Override
public void run() {
- // Keep around in model, but mark as deleted
- mEntry.markDeleted();
-
- ((ViewGroup) getParent()).removeView(LabeledEditorView.this);
-
+ // Don't do anything if the view is no longer attached to the window
+ // (This check is needed because when this {@link Runnable} is executed,
+ // we can't guarantee the view is still valid.
+ if (!mIsAttachedToWindow) {
+ return;
+ }
+ // Send the delete request to the listener (which will in turn call
+ // deleteEditor() on this view if the deletion is valid - i.e. this is not
+ // the last {@link Editor} in the section).
if (mListener != null) {
- // Notify listener when present
- mListener.onDeleted(LabeledEditorView.this);
+ mListener.onDeleteRequested(LabeledEditorView.this);
}
}
});
@@ -152,6 +156,29 @@
});
}
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ // Keep track of when the view is attached or detached from the window, so we know it's
+ // safe to remove views (in case the user requests to delete this editor).
+ mIsAttachedToWindow = true;
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mIsAttachedToWindow = false;
+ }
+
+ @Override
+ public void deleteEditor() {
+ // Keep around in model, but mark as deleted
+ mEntry.markDeleted();
+
+ // Remove the view
+ ((ViewGroup) getParent()).removeView(LabeledEditorView.this);
+ }
+
public boolean isReadOnly() {
return mReadOnly;
}
diff --git a/src/com/android/contacts/editor/PhotoActionPopup.java b/src/com/android/contacts/editor/PhotoActionPopup.java
index bc50da9..ac2d64f 100644
--- a/src/com/android/contacts/editor/PhotoActionPopup.java
+++ b/src/com/android/contacts/editor/PhotoActionPopup.java
@@ -83,7 +83,7 @@
listener.onUseAsPrimaryChosen();
break;
case ChoiceListItem.ID_REMOVE:
- listener.onRemovePictureChose();
+ listener.onRemovePictureChosen();
break;
case ChoiceListItem.ID_TAKE_PHOTO:
listener.onTakePhotoChosen();
@@ -131,7 +131,7 @@
public interface Listener {
void onUseAsPrimaryChosen();
- void onRemovePictureChose();
+ void onRemovePictureChosen();
void onTakePhotoChosen();
void onPickFromGalleryChosen();
}
diff --git a/src/com/android/contacts/editor/PhotoEditorView.java b/src/com/android/contacts/editor/PhotoEditorView.java
index 7b86291..b9b8c2c 100644
--- a/src/com/android/contacts/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/editor/PhotoEditorView.java
@@ -183,4 +183,14 @@
public boolean isEmpty() {
return !mHasSetPhoto;
}
+
+ @Override
+ public void deleteEditor() {
+ // Photo is not deletable
+ }
+
+ @Override
+ public void clearAllFields() {
+ resetDefault();
+ }
}
diff --git a/src/com/android/contacts/editor/TextFieldsEditorView.java b/src/com/android/contacts/editor/TextFieldsEditorView.java
index ad1c7b6..0d8aba6 100644
--- a/src/com/android/contacts/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/editor/TextFieldsEditorView.java
@@ -405,4 +405,14 @@
}
}
}
+
+ @Override
+ public void clearAllFields() {
+ if (mFieldEditTexts != null) {
+ for (EditText fieldEditText : mFieldEditTexts) {
+ // Update UI (which will trigger a state change through the {@link TextWatcher})
+ fieldEditText.setText("");
+ }
+ }
+ }
}
diff --git a/src/com/android/contacts/group/GroupBrowseListAdapter.java b/src/com/android/contacts/group/GroupBrowseListAdapter.java
index cc15213..2dd194d 100644
--- a/src/com/android/contacts/group/GroupBrowseListAdapter.java
+++ b/src/com/android/contacts/group/GroupBrowseListAdapter.java
@@ -234,7 +234,6 @@
public static class GroupListItem extends LinearLayout {
private TextView mLabel;
- private TextView mAccount;
private Uri mUri;
public GroupListItem(Context context, AttributeSet attrs, int defStyle) {
@@ -253,12 +252,10 @@
protected void onFinishInflate() {
super.onFinishInflate();
mLabel = (TextView) findViewById(R.id.label);
- mAccount = (TextView) findViewById(R.id.account);
}
public void loadFromGroup(GroupMetaData group) {
mLabel.setText(group.getTitle());
- mAccount.setText(group.getAccountName());
mUri = getGroupUriFromId(group.getGroupId());
}
diff --git a/src/com/android/contacts/list/ContactListAdapter.java b/src/com/android/contacts/list/ContactListAdapter.java
index e51fd5c..7322fc6 100644
--- a/src/com/android/contacts/list/ContactListAdapter.java
+++ b/src/com/android/contacts/list/ContactListAdapter.java
@@ -45,12 +45,13 @@
Contacts.STARRED, // 4
Contacts.CONTACT_PRESENCE, // 5
Contacts.CONTACT_CHAT_CAPABILITY, // 6
- Contacts.PHOTO_ID, // 7
- Contacts.PHOTO_THUMBNAIL_URI, // 8
- Contacts.LOOKUP_KEY, // 9
- Contacts.PHONETIC_NAME, // 10
- Contacts.HAS_PHONE_NUMBER, // 11
- Contacts.IS_USER_PROFILE, // 12
+ Contacts.CONTACT_STATUS, // 7
+ Contacts.PHOTO_ID, // 8
+ Contacts.PHOTO_THUMBNAIL_URI, // 9
+ Contacts.LOOKUP_KEY, // 10
+ Contacts.PHONETIC_NAME, // 11
+ Contacts.HAS_PHONE_NUMBER, // 12
+ Contacts.IS_USER_PROFILE, // 13
};
protected static final String[] PROJECTION_DATA = new String[] {
@@ -61,11 +62,12 @@
Data.STARRED, // 4
Data.CONTACT_PRESENCE, // 5
Data.CONTACT_CHAT_CAPABILITY, // 6
- Data.PHOTO_ID, // 7
- Data.PHOTO_THUMBNAIL_URI, // 8
- Data.LOOKUP_KEY, // 9
- Data.PHONETIC_NAME, // 10
- Data.HAS_PHONE_NUMBER, // 11
+ Data.CONTACT_STATUS, // 7
+ Data.PHOTO_ID, // 8
+ Data.PHOTO_THUMBNAIL_URI, // 9
+ Data.LOOKUP_KEY, // 10
+ Data.PHONETIC_NAME, // 11
+ Data.HAS_PHONE_NUMBER, // 12
};
protected static final String[] FILTER_PROJECTION = new String[] {
@@ -76,13 +78,14 @@
Contacts.STARRED, // 4
Contacts.CONTACT_PRESENCE, // 5
Contacts.CONTACT_CHAT_CAPABILITY, // 6
- Contacts.PHOTO_ID, // 7
- Contacts.PHOTO_THUMBNAIL_URI, // 8
- Contacts.LOOKUP_KEY, // 9
- Contacts.PHONETIC_NAME, // 10
- Contacts.HAS_PHONE_NUMBER, // 11
- Contacts.IS_USER_PROFILE, // 12
- SearchSnippetColumns.SNIPPET, // 13
+ Contacts.CONTACT_STATUS, // 7
+ Contacts.PHOTO_ID, // 8
+ Contacts.PHOTO_THUMBNAIL_URI, // 9
+ Contacts.LOOKUP_KEY, // 10
+ Contacts.PHONETIC_NAME, // 11
+ Contacts.HAS_PHONE_NUMBER, // 12
+ Contacts.IS_USER_PROFILE, // 13
+ SearchSnippetColumns.SNIPPET, // 14
};
protected static final int CONTACT_ID_COLUMN_INDEX = 0;
@@ -92,13 +95,14 @@
protected static final int CONTACT_STARRED_COLUMN_INDEX = 4;
protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 5;
protected static final int CONTACT_CHAT_CAPABILITY_COLUMN_INDEX = 6;
- protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 7;
- protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 8;
- protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 9;
- protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 10;
- protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 11;
- protected static final int CONTACT_IS_USER_PROFILE = 12;
- protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 13;
+ protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 7;
+ protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 8;
+ protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 9;
+ protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 10;
+ protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 11;
+ protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 12;
+ protected static final int CONTACT_IS_USER_PROFILE = 13;
+ protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 14;
private CharSequence mUnknownNameText;
private int mDisplayNameColumnIndex;
@@ -304,9 +308,9 @@
view.showPhoneticName(cursor, CONTACT_PHONETIC_NAME_COLUMN_INDEX);
}
- protected void bindPresence(final ContactListItemView view, Cursor cursor) {
- view.showPresence(cursor, CONTACT_PRESENCE_STATUS_COLUMN_INDEX,
- CONTACT_CHAT_CAPABILITY_COLUMN_INDEX);
+ protected void bindPresenceAndStatusMessage(final ContactListItemView view, Cursor cursor) {
+ view.showPresenceAndStatusMessage(cursor, CONTACT_PRESENCE_STATUS_COLUMN_INDEX,
+ CONTACT_CHAT_CAPABILITY_COLUMN_INDEX, CONTACT_CONTACT_STATUS_COLUMN_INDEX);
}
protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) {
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 4fb6f1d..d69f880 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -17,6 +17,7 @@
package com.android.contacts.list;
import com.android.contacts.ContactPresenceIconUtil;
+import com.android.contacts.ContactStatusUtil;
import com.android.contacts.R;
import com.android.contacts.format.DisplayNameFormatter;
import com.android.contacts.format.PrefixHighlighter;
@@ -916,7 +917,7 @@
mStatusView.setSingleLine(true);
mStatusView.setEllipsize(getTextEllipsis());
mStatusView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
- mStatusView.setText("Put Status here"); // Temporary
+ mStatusView.setTextColor(Color.GRAY);
addView(mStatusView);
}
return mStatusView;
@@ -996,20 +997,33 @@
}
/**
- * Sets the proper icon (star or presence or nothing)
+ * Sets the proper icon (star or presence or nothing) and/or status message.
*/
- public void showPresence(Cursor cursor, int presenceColumnIndex, int capabilityColumnIndex) {
+ public void showPresenceAndStatusMessage(Cursor cursor, int presenceColumnIndex,
+ int capabilityColumnIndex, int contactStatusColumnIndex) {
Drawable icon = null;
+ int presence = 0;
+ int chatCapability = 0;
if (!cursor.isNull(presenceColumnIndex)) {
- int status = cursor.getInt(presenceColumnIndex);
- int chatCapability = 0;
+ presence = cursor.getInt(presenceColumnIndex);
if (capabilityColumnIndex != 0 && !cursor.isNull(presenceColumnIndex)) {
chatCapability = cursor.getInt(capabilityColumnIndex);
}
icon = ContactPresenceIconUtil.getChatCapabilityIcon(
- getContext(), status, chatCapability);
+ getContext(), presence, chatCapability);
}
setPresence(icon);
+
+ String statusMessage = null;
+ if (contactStatusColumnIndex != 0 && !cursor.isNull(contactStatusColumnIndex)) {
+ statusMessage = cursor.getString(contactStatusColumnIndex);
+ }
+ // If there is no status message from the contact, but there was a presence value, then use
+ // the default status message string
+ if (statusMessage == null && presence != 0) {
+ statusMessage = ContactStatusUtil.getStatusString(getContext(), presence);
+ }
+ setStatus(statusMessage);
}
/**
diff --git a/src/com/android/contacts/list/ContactTileAdapter.java b/src/com/android/contacts/list/ContactTileAdapter.java
index 9674960..48a9938 100644
--- a/src/com/android/contacts/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/list/ContactTileAdapter.java
@@ -59,6 +59,8 @@
private int mPhotoUriIndex;
private int mNameIndex;
private int mStarredIndex;
+ private int mPresenceIndex;
+ private int mStatusIndex;
private boolean mIsQuickContactEnabled = false;
@@ -139,12 +141,16 @@
mPhotoUriIndex = GroupMemberLoader.CONTACT_PHOTO_URI_COLUMN_INDEX;
mNameIndex = GroupMemberLoader.CONTACT_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
mStarredIndex = GroupMemberLoader.CONTACT_STARRED_COLUMN_INDEX;
+ mPresenceIndex = GroupMemberLoader.CONTACT_PRESENCE_STATUS_COLUMN_INDEX;
+ mStatusIndex = GroupMemberLoader.CONTACT_STATUS_COLUMN_INDEX;
} else {
mIdIndex = ContactTileLoaderFactory.CONTACT_ID;
mLookupIndex = ContactTileLoaderFactory.LOOKUP_KEY;
mPhotoUriIndex = ContactTileLoaderFactory.PHOTO_URI;
mNameIndex = ContactTileLoaderFactory.DISPLAY_NAME;
mStarredIndex = ContactTileLoaderFactory.STARRED;
+ mPresenceIndex = ContactTileLoaderFactory.CONTACT_PRESENCE;
+ mStatusIndex = ContactTileLoaderFactory.CONTACT_STATUS;
}
}
@@ -192,9 +198,11 @@
ContactEntry contact = new ContactEntry();
contact.name = cursor.getString(mNameIndex);
+ contact.status = cursor.getString(mStatusIndex);
contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null);
contact.lookupKey = ContentUris.withAppendedId(
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
+ contact.presence = cursor.isNull(mPresenceIndex) ? null : cursor.getInt(mPresenceIndex);
return contact;
}
@@ -455,9 +463,11 @@
* Class to hold contact information
*/
public static class ContactEntry {
- public Uri photoUri;
public String name;
+ public String status;
+ public Uri photoUri;
public Uri lookupKey;
+ public Integer presence;
}
private static class ViewTypes {
diff --git a/src/com/android/contacts/list/ContactTileView.java b/src/com/android/contacts/list/ContactTileView.java
index 7981bd1..6374c23 100644
--- a/src/com/android/contacts/list/ContactTileView.java
+++ b/src/com/android/contacts/list/ContactTileView.java
@@ -16,10 +16,13 @@
package com.android.contacts.list;
import com.android.contacts.ContactPhotoManager;
+import com.android.contacts.ContactStatusUtil;
import com.android.contacts.R;
import com.android.contacts.list.ContactTileAdapter.ContactEntry;
import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.Log;
@@ -29,6 +32,9 @@
import android.widget.QuickContactBadge;
import android.widget.TextView;
+import android.provider.ContactsContract.StatusUpdates;
+
+
/**
* A ContactTile displays the contact's picture overlayed with their name
*/
@@ -37,8 +43,10 @@
private Uri mLookupUri;
private ImageView mPhoto;
+ private ImageView mPresence;
private QuickContactBadge mQuickContact;
private TextView mName;
+ private TextView mStatus;
private ContactPhotoManager mPhotoManager = null;
public ContactTileView(Context context, AttributeSet attrs) {
@@ -53,6 +61,8 @@
mQuickContact = (QuickContactBadge) findViewById(R.id.contact_tile_quick);
mPhoto = (ImageView) findViewById(R.id.contact_tile_image);
+ mPresence = (ImageView) findViewById(R.id.contact_tile_presence);
+ mStatus = (TextView) findViewById(R.id.contact_tile_status);
}
public void setPhotoManager(ContactPhotoManager photoManager) {
@@ -68,6 +78,25 @@
mName.setText(entry.name);
mLookupUri = entry.lookupKey;
+ int presenceDrawableResId = (entry.presence == null ? 0 :
+ StatusUpdates.getPresenceIconResourceId(entry.presence));
+
+ if (mPresence != null) {
+ mPresence.setBackgroundResource(presenceDrawableResId);
+ }
+
+ if (mStatus != null) {
+ String statusText;
+ if (entry.presence == null) {
+ statusText = null;
+ } else {
+ statusText =
+ (entry.status != null ? entry.status :
+ ContactStatusUtil.getStatusString(mContext, entry.presence));
+ }
+ mStatus.setText(statusText);
+ }
+
if (mQuickContact != null) {
mQuickContact.assignContactUri(mLookupUri);
mQuickContact.setImageBitmap(null);
diff --git a/src/com/android/contacts/list/DefaultContactListAdapter.java b/src/com/android/contacts/list/DefaultContactListAdapter.java
index c93b544..8b93888 100644
--- a/src/com/android/contacts/list/DefaultContactListAdapter.java
+++ b/src/com/android/contacts/list/DefaultContactListAdapter.java
@@ -234,7 +234,7 @@
}
bindName(view, cursor);
- bindPresence(view, cursor);
+ bindPresenceAndStatusMessage(view, cursor);
if (isSearchMode()) {
bindSearchSnippet(view, cursor);
diff --git a/src/com/android/contacts/list/LegacyContactListAdapter.java b/src/com/android/contacts/list/LegacyContactListAdapter.java
index ffc8fc3..b3ab2af 100644
--- a/src/com/android/contacts/list/LegacyContactListAdapter.java
+++ b/src/com/android/contacts/list/LegacyContactListAdapter.java
@@ -91,6 +91,6 @@
}
protected void bindPresence(final ContactListItemView view, Cursor cursor) {
- view.showPresence(cursor, PERSON_PRESENCE_STATUS_COLUMN_INDEX, 0);
+ view.showPresenceAndStatusMessage(cursor, PERSON_PRESENCE_STATUS_COLUMN_INDEX, 0, 0);
}
}
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));