Merge "Use MaterialColorMapUtils"
diff --git a/res/drawable-hdpi/ic_add_to_circles_black_24.png b/res/drawable-hdpi/ic_add_to_circles_black_24.png
new file mode 100644
index 0000000..6eb1fcc
--- /dev/null
+++ b/res/drawable-hdpi/ic_add_to_circles_black_24.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_google_plus_24dp.png b/res/drawable-hdpi/ic_google_plus_24dp.png
new file mode 100644
index 0000000..af17f2b
--- /dev/null
+++ b/res/drawable-hdpi/ic_google_plus_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_hangout_24dp.png b/res/drawable-hdpi/ic_hangout_24dp.png
new file mode 100644
index 0000000..496a2a0
--- /dev/null
+++ b/res/drawable-hdpi/ic_hangout_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_hangout_video_24dp.png b/res/drawable-hdpi/ic_hangout_video_24dp.png
new file mode 100644
index 0000000..0825a15
--- /dev/null
+++ b/res/drawable-hdpi/ic_hangout_video_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_add_to_circles_black_24.png b/res/drawable-mdpi/ic_add_to_circles_black_24.png
new file mode 100644
index 0000000..fbffc97
--- /dev/null
+++ b/res/drawable-mdpi/ic_add_to_circles_black_24.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_google_plus_24dp.png b/res/drawable-mdpi/ic_google_plus_24dp.png
new file mode 100644
index 0000000..d8eacf0
--- /dev/null
+++ b/res/drawable-mdpi/ic_google_plus_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_hangout_24dp.png b/res/drawable-mdpi/ic_hangout_24dp.png
new file mode 100644
index 0000000..1b0acfd
--- /dev/null
+++ b/res/drawable-mdpi/ic_hangout_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_hangout_video_24dp.png b/res/drawable-mdpi/ic_hangout_video_24dp.png
new file mode 100644
index 0000000..b54b1cb
--- /dev/null
+++ b/res/drawable-mdpi/ic_hangout_video_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_add_to_circles_black_24.png b/res/drawable-xhdpi/ic_add_to_circles_black_24.png
new file mode 100644
index 0000000..79116b5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_add_to_circles_black_24.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_google_plus_24dp.png b/res/drawable-xhdpi/ic_google_plus_24dp.png
new file mode 100644
index 0000000..ea352d3
--- /dev/null
+++ b/res/drawable-xhdpi/ic_google_plus_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_hangout_24dp.png b/res/drawable-xhdpi/ic_hangout_24dp.png
new file mode 100644
index 0000000..0cd7795
--- /dev/null
+++ b/res/drawable-xhdpi/ic_hangout_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_hangout_video_24dp.png b/res/drawable-xhdpi/ic_hangout_video_24dp.png
new file mode 100644
index 0000000..97b984c
--- /dev/null
+++ b/res/drawable-xhdpi/ic_hangout_video_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_add_to_circles_black_24.png b/res/drawable-xxhdpi/ic_add_to_circles_black_24.png
new file mode 100644
index 0000000..23a2084
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_add_to_circles_black_24.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_google_plus_24dp.png b/res/drawable-xxhdpi/ic_google_plus_24dp.png
new file mode 100644
index 0000000..933cd62
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_google_plus_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_hangout_24dp.png b/res/drawable-xxhdpi/ic_hangout_24dp.png
new file mode 100644
index 0000000..16858d1
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_hangout_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_hangout_video_24dp.png b/res/drawable-xxhdpi/ic_hangout_video_24dp.png
new file mode 100644
index 0000000..4183c76
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_hangout_video_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_google_plus_24dp.png b/res/drawable-xxxhdpi/ic_google_plus_24dp.png
new file mode 100644
index 0000000..dcd6c97
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_google_plus_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_hangout_24dp.png b/res/drawable-xxxhdpi/ic_hangout_24dp.png
new file mode 100644
index 0000000..4bfdb0d
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_hangout_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_hangout_video_24dp.png b/res/drawable-xxxhdpi/ic_hangout_video_24dp.png
new file mode 100644
index 0000000..f1be2e7
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_hangout_video_24dp.png
Binary files differ
diff --git a/res/layout/expanding_entry_card_item.xml b/res/layout/expanding_entry_card_item.xml
index 46fc8cb..99738a6 100644
--- a/res/layout/expanding_entry_card_item.xml
+++ b/res/layout/expanding_entry_card_item.xml
@@ -26,11 +26,12 @@
<ImageView
android:id="@+id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="@dimen/expanding_entry_card_item_icon_height"
+ android:layout_height="@dimen/expanding_entry_card_item_icon_width"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
- android:layout_marginEnd="@dimen/expanding_entry_card_item_image_spacing" />
+ android:layout_marginEnd="@dimen/expanding_entry_card_item_image_spacing"
+ android:scaleType="fitCenter" />
<TextView
android:id="@+id/header"
diff --git a/res/menu-sw600dp/people_options.xml b/res/menu-sw600dp/people_options.xml
deleted file mode 100644
index 931b456..0000000
--- a/res/menu-sw600dp/people_options.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:id="@+id/menu_search"
- android:icon="@drawable/ic_ab_search"
- android:title="@string/menu_search"
- android:showAsAction="ifRoom" />
-
- <!-- Added orderInCategory to keep the following buttons at the end of the menu
- Buttons will be added in the order added/inflated. Ordered buttons will be added
- at the end according to the orderInCategory. This setup insures that the buttons below
- will be the last buttons in the menu regardless of how many buttons are added
- -->
- <item
- android:id="@+id/menu_contacts_filter"
- android:orderInCategory="1"
- android:title="@string/menu_contacts_filter" />
-
- <item
- android:id="@+id/menu_import_export"
- android:orderInCategory="2"
- android:title="@string/menu_import_export" />
-
- <item
- android:id="@+id/menu_clear_frequents"
- android:orderInCategory="3"
- android:title="@string/menu_clear_frequents" />
-
- <item
- android:id="@+id/menu_accounts"
- android:orderInCategory="4"
- android:title="@string/menu_accounts" />
-
- <item
- android:id="@+id/menu_settings"
- android:orderInCategory="5"
- android:title="@string/menu_settings" />
-
- <item
- android:id="@+id/menu_help"
- android:orderInCategory="6"
- android:title="@string/menu_help" />
-
- <item
- android:id="@+id/export_database"
- android:title="@string/menu_export_database"
- android:visible="false"
- android:showAsAction="never" />
-</menu>
diff --git a/res/menu-sw600dp/view_contact.xml b/res/menu-sw600dp/view_contact.xml
deleted file mode 100644
index 5437dec..0000000
--- a/res/menu-sw600dp/view_contact.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:id="@+id/menu_edit"
- android:icon="@drawable/ic_menu_compose_holo_light"
- android:title="@string/menu_editContact"
- android:alphabeticShortcut="e"
- android:showAsAction="always"/>
-
- <item
- android:id="@+id/menu_share"
- android:title="@string/menu_share"
- android:alphabeticShortcut="s" />
-
- <item
- android:id="@+id/menu_delete"
- android:title="@string/menu_deleteContact" />
-
- <item
- android:id="@+id/menu_create_contact_shortcut"
- android:title="@string/menu_create_contact_shortcut" />
-
-</menu>
diff --git a/res/menu-sw600dp/view_group.xml b/res/menu-sw600dp/view_group.xml
deleted file mode 100644
index b61588c..0000000
--- a/res/menu-sw600dp/view_group.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:id="@+id/menu_edit_group"
- android:icon="@drawable/ic_menu_compose_holo_light"
- android:title="@string/menu_editGroup"
- android:alphabeticShortcut="e"
- android:showAsAction="always" />
-
- <item
- android:id="@+id/menu_delete_group"
- android:title="@string/menu_deleteGroup" />
-</menu>
diff --git a/res/menu/people_options.xml b/res/menu/people_options.xml
index 4aae1a1..a7802f0 100644
--- a/res/menu/people_options.xml
+++ b/res/menu/people_options.xml
@@ -17,6 +17,7 @@
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_ab_search"
+ android:title="@string/menu_search"
android:showAsAction="ifRoom" />
<item
diff --git a/res/menu/quickcontact.xml b/res/menu/quickcontact.xml
index 34a6a10..13caa59 100644
--- a/res/menu/quickcontact.xml
+++ b/res/menu/quickcontact.xml
@@ -15,13 +15,14 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Icon and titles are set in code for menu_star and menu_edit -->
+
<item
android:id="@+id/menu_star"
android:showAsAction="always" />
<item
android:id="@+id/menu_edit"
- android:icon="@drawable/ic_create_24dp"
android:showAsAction="always" />
<item
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ce04992..0e296fe 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -186,4 +186,6 @@
<dimen name="people_activity_card_elevation">2dp</dimen>
+ <dimen name="expanding_entry_card_item_icon_height">24dp</dimen>
+ <dimen name="expanding_entry_card_item_icon_width">24dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9bd4621..772d21e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -326,6 +326,9 @@
<!-- The menu item to share the currently viewed contact [CHAR LIMIT=30] -->
<string name="menu_share">Share</string>
+ <!-- The menu item to add the the currently viewed contact to your contacts [CHAR LIMIT=30] -->
+ <string name="menu_add_contact">Add to contacts</string>
+
<!-- Dialog title when picking the application to share a contact with. -->
<string name="share_via">Share contact via</string>
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index 1a4051e..2b2f032 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -131,8 +131,10 @@
private boolean mIsExpanded = false;
private int mCollapsedEntriesCount;
private ExpandingEntryCardViewListener mListener;
- private List<Entry> mEntries;
- private List<View> mEntryViews;
+ private List<List<Entry>> mEntries;
+ private int mNumEntries = 0;
+ private boolean mAllEntriesInflated = false;
+ private List<List<View>> mEntryViews;
private LinearLayout mEntriesViewGroup;
private final Drawable mCollapseArrowDrawable;
private final Drawable mExpandArrowDrawable;
@@ -179,21 +181,31 @@
*
* @param entries The Entry list to display.
*/
- public void initialize(List<Entry> entries, int numInitialVisibleEntries,
+ public void initialize(List<List<Entry>> entries, int numInitialVisibleEntries,
boolean isExpanded, ExpandingEntryCardViewListener listener) {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
mIsExpanded = isExpanded;
+ mEntryViews = new ArrayList<List<View>>(entries.size());
mEntries = entries;
- mEntryViews = new ArrayList<View>(entries.size());
- mCollapsedEntriesCount = Math.min(numInitialVisibleEntries, entries.size());
+ for (List<Entry> entryList : mEntries) {
+ mNumEntries += entryList.size();
+ mEntryViews.add(new ArrayList<View>());
+ }
+ mCollapsedEntriesCount = Math.min(numInitialVisibleEntries, mNumEntries);
+ // Only show the head of each entry list if the initial visible number falls between the
+ // number of lists and the total number of entries
+ if (mCollapsedEntriesCount > mEntries.size()) {
+ mCollapsedEntriesCount = mEntries.size();
+ }
mListener = listener;
if (mIsExpanded) {
updateExpandCollapseButton(getCollapseButtonText());
+ inflateAllEntries(layoutInflater);
} else {
updateExpandCollapseButton(getExpandButtonText());
+ inflateInitialEntries(layoutInflater);
}
- inflateViewsIfNeeded(layoutInflater);
insertEntriesIntoViewGroup();
applyColor();
}
@@ -229,17 +241,21 @@
private void insertEntriesIntoViewGroup() {
mEntriesViewGroup.removeAllViews();
- for (int i = 0; i < mCollapsedEntriesCount; ++i) {
- addEntry(mEntryViews.get(i));
- }
+
if (mIsExpanded) {
- for (int i = mCollapsedEntriesCount; i < mEntryViews.size(); ++i) {
- addEntry(mEntryViews.get(i));
+ for (List<View> viewList : mEntryViews) {
+ for (View view : viewList) {
+ addEntry(view);
+ }
+ }
+ } else {
+ for (int i = 0; i < mCollapsedEntriesCount; i++) {
+ addEntry(mEntryViews.get(i).get(0));
}
}
removeView(mExpandCollapseButton);
- if (mCollapsedEntriesCount < mEntries.size()
+ if (mCollapsedEntriesCount < mNumEntries
&& mExpandCollapseButton.getParent() == null) {
addView(mExpandCollapseButton, -1);
}
@@ -290,16 +306,37 @@
}
/**
- * Lazily inflate the number of views currently needed, and bind data from
- * mEntries into these views.
+ * Inflates the initial entries to be shown.
*/
- private void inflateViewsIfNeeded(LayoutInflater layoutInflater) {
- final int viewsToInflate = mIsExpanded ? mEntries.size() : mCollapsedEntriesCount;
- for (int i = mEntryViews.size(); i < viewsToInflate; i++) {
- mEntryViews.add(createEntryView(layoutInflater, mEntries.get(i)));
+ private void inflateInitialEntries(LayoutInflater layoutInflater) {
+ // If the number of collapsed entries equals total entries, inflate all
+ if (mCollapsedEntriesCount == mNumEntries) {
+ inflateAllEntries(layoutInflater);
+ } else {
+ // Otherwise inflate the top entry from each list
+ for (int i = 0; i < mCollapsedEntriesCount; i++) {
+ mEntryViews.get(i).add(createEntryView(layoutInflater, mEntries.get(i).get(0)));
+ }
}
}
+ /**
+ * Inflates all entries.
+ */
+ private void inflateAllEntries(LayoutInflater layoutInflater) {
+ if (mAllEntriesInflated) {
+ return;
+ }
+ for (int i = 0; i < mEntries.size(); i++) {
+ List<Entry> entryList = mEntries.get(i);
+ List<View> viewList = mEntryViews.get(i);
+ for (int j = viewList.size(); j < entryList.size(); j++) {
+ viewList.add(createEntryView(layoutInflater, entryList.get(j)));
+ }
+ }
+ mAllEntriesInflated = true;
+ }
+
public void setColorAndFilter(int color, ColorFilter colorFilter) {
mThemeColor = color;
mThemeColorFilter = colorFilter;
@@ -323,10 +360,12 @@
// Entry icons
if (mEntries != null) {
- for (Entry entry : mEntries) {
- Drawable icon = entry.getIcon();
- if (icon != null) {
- icon.setColorFilter(mThemeColorFilter);
+ for (List<Entry> entryList : mEntries) {
+ for (Entry entry : entryList) {
+ Drawable icon = entry.getIcon();
+ if (icon != null) {
+ icon.setColorFilter(mThemeColorFilter);
+ }
}
}
}
@@ -412,7 +451,7 @@
mIsExpanded = true;
// In order to insert new entries, we may need to inflate them for the first time
- inflateViewsIfNeeded(LayoutInflater.from(getContext()));
+ inflateAllEntries(LayoutInflater.from(getContext()));
insertEntriesIntoViewGroup();
updateExpandCollapseButton(getCollapseButtonText());
@@ -447,7 +486,7 @@
if (mCollapsedEntriesCount == 0) {
return 0;
}
- final View bottomCollapsedView = mEntryViews.get(mCollapsedEntriesCount - 1);
+ final View bottomCollapsedView = mEntryViews.get(mCollapsedEntriesCount - 1).get(0);
return bottomCollapsedView.getTop() + bottomCollapsedView.getHeight();
}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 0411152..0ef16d9 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -60,6 +60,7 @@
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DisplayNameSources;
import android.provider.ContactsContract.DataUsageFeedback;
import android.provider.ContactsContract.QuickContact;
@@ -171,6 +172,13 @@
@SuppressWarnings("deprecation")
private static final String LEGACY_AUTHORITY = android.provider.Contacts.AUTHORITY;
+ private static final String MIMETYPE_GPLUS_PROFILE =
+ "vnd.android.cursor.item/vnd.googleplus.profile";
+ private static final String INTENT_DATA_GPLUS_PROFILE_ADD_TO_CIRCLE = "Add to circle";
+ private static final String MIMETYPE_HANGOUTS =
+ "vnd.android.cursor.item/vnd.googleplus.profile.comm";
+ private static final String INTENT_DATA_HANGOUTS_VIDEO = "Start video call";
+
private Uri mLookupUri;
private String[] mExcludeMimes;
private int mExtraMode;
@@ -780,46 +788,21 @@
private void populateContactAndAboutCard() {
Trace.beginSection("bind contact card");
- final List<Entry> contactCardEntries = new ArrayList<>();
- final List<Entry> aboutCardEntries = new ArrayList<>();
+ final List<List<Entry>> contactCardEntries = new ArrayList<>();
+ final List<List<Entry>> aboutCardEntries = new ArrayList<>();
- int topContactIndex = 0;
for (int i = 0; i < mDataItemsList.size(); ++i) {
final List<DataItem> dataItemsByMimeType = mDataItemsList.get(i);
final DataItem topDataItem = dataItemsByMimeType.get(0);
if (ABOUT_CARD_MIMETYPES.contains(topDataItem.getMimeType())) {
- aboutCardEntries.addAll(dataItemsToEntries(mDataItemsList.get(i)));
+ List<Entry> aboutEntries = dataItemsToEntries(mDataItemsList.get(i));
+ if (aboutEntries.size() > 0) {
+ aboutCardEntries.add(aboutEntries);
+ }
} else {
- // Add most used to the top of the contact card
- final Entry topEntry = dataItemToEntry(topDataItem);
- if (topEntry != null) {
- contactCardEntries.add(topContactIndex++, dataItemToEntry(topDataItem));
- }
- // TODO merge SMS into secondary action
- if (topDataItem instanceof PhoneDataItem) {
- final PhoneDataItem phone = (PhoneDataItem) topDataItem;
- Intent smsIntent = null;
- if (mSmsComponent != null) {
- smsIntent = new Intent(Intent.ACTION_SENDTO,
- Uri.fromParts(CallUtil.SCHEME_SMSTO, phone.getNumber(), null));
- smsIntent.setComponent(mSmsComponent);
- }
- final int dataId = phone.getId() > Integer.MAX_VALUE ?
- -1 : (int) phone.getId();
- contactCardEntries.add(topContactIndex++,
- new Entry(dataId,
- getResources().getDrawable(R.drawable.ic_message_24dp),
- getResources().getString(R.string.send_message),
- /* subHeader = */ null,
- /* text = */ phone.buildDataString(
- this, topDataItem.getDataKind()),
- smsIntent,
- /* isEditable = */ false));
- }
- // Add the rest of the entries to the bottom of the card
- if (dataItemsByMimeType.size() > 1) {
- contactCardEntries.addAll(dataItemsToEntries(
- dataItemsByMimeType.subList(1, dataItemsByMimeType.size())));
+ List<Entry> contactEntries = dataItemsToEntries(mDataItemsList.get(i));
+ if (contactEntries.size() > 0) {
+ contactCardEntries.add(contactEntries);
}
}
}
@@ -1074,9 +1057,39 @@
header = dataItem.buildDataStringForDisplay(this, kind);
text = kind.typeColumn;
intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(Uri.parse(dataItem.buildDataString(this, kind)),
- dataItem.getMimeType());
- icon = ResolveCache.getInstance(this).getIcon(dataItem.getMimeType(), intent);
+ final Uri uri = ContentUris.withAppendedId(Data.CONTENT_URI, dataItem.getId());
+ intent.setDataAndType(uri, dataItem.getMimeType());
+
+ if (intent != null) {
+ final String mimetype = intent.getType();
+
+ // Attempt to use known icons for known 3p types. Otherwise default to ResolveCache
+ switch (mimetype) {
+ case MIMETYPE_GPLUS_PROFILE:
+ if (INTENT_DATA_GPLUS_PROFILE_ADD_TO_CIRCLE.equals(
+ intent.getDataString())) {
+ icon = getResources().getDrawable(
+ R.drawable.ic_add_to_circles_black_24);
+ } else {
+ icon = getResources().getDrawable(R.drawable.ic_google_plus_24dp);
+ }
+ break;
+ case MIMETYPE_HANGOUTS:
+ if (INTENT_DATA_HANGOUTS_VIDEO.equals(intent.getDataString())) {
+ icon = getResources().getDrawable(R.drawable.ic_hangout_video_24dp);
+ } else {
+ icon = getResources().getDrawable(R.drawable.ic_hangout_24dp);
+ }
+ break;
+ default:
+ icon = ResolveCache.getInstance(this).getIcon(
+ dataItem.getMimeType(), intent);
+ // Call mutate to create a new Drawable.ConstantState for color filtering
+ if (icon != null) {
+ icon.mutate();
+ }
+ }
+ }
}
if (intent != null) {
@@ -1106,6 +1119,26 @@
if (entry != null) {
entries.add(entry);
}
+ // TODO merge secondary intents
+ if (dataItem instanceof PhoneDataItem) {
+ final PhoneDataItem phone = (PhoneDataItem) dataItem;
+ Intent smsIntent = null;
+ if (mSmsComponent != null) {
+ smsIntent = new Intent(Intent.ACTION_SENDTO,
+ Uri.fromParts(CallUtil.SCHEME_SMSTO, phone.getNumber(), null));
+ smsIntent.setComponent(mSmsComponent);
+ }
+ final int dataId = dataItem.getId() > Integer.MAX_VALUE ?
+ -1 : (int) dataItem.getId();
+ entries.add(new Entry(dataId,
+ getResources().getDrawable(R.drawable.ic_message_24dp),
+ getResources().getString(R.string.send_message),
+ /* subHeader = */ null,
+ /* text = */ phone.buildDataString(this,
+ dataItem.getDataKind()),
+ smsIntent,
+ /* isEditable = */ false));
+ }
}
return entries;
}
@@ -1392,8 +1425,11 @@
}
});
+
+ List<List<Entry>> interactionsWrapper = new ArrayList<>();
+ interactionsWrapper.add(contactInteractionsToEntries(allInteractions));
if (allInteractions.size() > 0) {
- mRecentCard.initialize(contactInteractionsToEntries(allInteractions),
+ mRecentCard.initialize(interactionsWrapper,
/* numInitialVisibleEntries = */ MIN_NUM_COLLAPSED_RECENT_ENTRIES_SHOWN,
/* isExpanded = */ false, mExpandingEntryCardViewListener);
mRecentCard.setVisibility(View.VISIBLE);
@@ -1545,8 +1581,10 @@
if (DirectoryContactUtil.isDirectoryContact(mContactData) || InvisibleContactUtil
.isInvisibleAndAddable(mContactData, this)) {
editMenuItem.setIcon(R.drawable.ic_person_add_tinted_24dp);
+ editMenuItem.setTitle(R.string.menu_add_contact);
} else if (isContactEditable()) {
editMenuItem.setIcon(R.drawable.ic_create_24dp);
+ editMenuItem.setTitle(R.string.menu_editContact);
} else {
editMenuItem.setVisible(false);
}