Merge "Adds content description strings"
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/colors.xml b/res/values/colors.xml
index a04e9cd..b44f34b 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -60,4 +60,8 @@
<!-- Background color of pinned header items. -->
<color name="list_item_pinned_header_color">#f5f5f5</color>
+
+ <!-- The default color used for tinting photos when no color can be extracted via Palette,
+ this is Blue Grey 500 -->
+ <color name="quickcontact_default_photo_tint_color">#607D8B</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f756efa..085cacf 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/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 4c11e91..0ef16d9 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -111,6 +111,8 @@
import com.android.contacts.common.model.dataitem.StructuredPostalDataItem;
import com.android.contacts.common.model.dataitem.WebsiteDataItem;
import com.android.contacts.common.util.DateUtils;
+import com.android.contacts.common.util.MaterialColorMapUtils;
+import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
import com.android.contacts.detail.ContactDetailDisplayUtils;
import com.android.contacts.interactions.CalendarInteractionsLoader;
import com.android.contacts.interactions.CallLogInteractionsLoader;
@@ -125,7 +127,7 @@
import com.android.contacts.util.StructuredPostalUtils;
import com.android.contacts.widget.MultiShrinkScroller;
import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListener;
-import com.google.common.annotations.VisibleForTesting;
+
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
@@ -136,10 +138,8 @@
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* Mostly translucent {@link Activity} that shows QuickContact dialog. It loads
@@ -161,7 +161,6 @@
private static final int ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION = 150;
private static final int REQUEST_CODE_CONTACT_EDITOR_ACTIVITY = 1;
- private static final float SYSTEM_BAR_BRIGHTNESS_FACTOR = 0.7f;
private static final int SCRIM_COLOR = Color.argb(0xB2, 0, 0, 0);
private static final String SCHEME_SMSTO = "smsto";
private static final String MIMETYPE_SMS = "vnd.android-dir/mms-sms";
@@ -575,7 +574,7 @@
// header tint before the MultiShrinkScroller has been measured will
// cause incorrect tinting calculations.
if (color != 0) {
- setThemeColor(color);
+ setThemeColor(MaterialColorMapUtils.calculateSecondaryColor(color));
}
}
});
@@ -1154,22 +1153,29 @@
return;
}
final Drawable imageViewDrawable = mPhotoView.getDrawable();
- new AsyncTask<Void, Void, Integer>() {
+ new AsyncTask<Void, Void, MaterialPalette>() {
@Override
- protected Integer doInBackground(Void... params) {
+ protected MaterialPalette doInBackground(Void... params) {
+
if (imageViewDrawable instanceof BitmapDrawable) {
final Bitmap bitmap = ((BitmapDrawable) imageViewDrawable).getBitmap();
- return colorFromBitmap(bitmap);
+ final int primaryColor = colorFromBitmap(bitmap);
+ if (primaryColor != 0) {
+ return MaterialColorMapUtils.calculatePrimaryAndSecondaryColor(
+ primaryColor);
+ }
}
if (imageViewDrawable instanceof LetterTileDrawable) {
- return ((LetterTileDrawable) imageViewDrawable).getColor();
+ final int primaryColor = ((LetterTileDrawable) imageViewDrawable).getColor();
+ return MaterialColorMapUtils.calculateSecondaryColor(primaryColor);
}
- return 0;
+ return MaterialColorMapUtils.calculatePrimaryAndSecondaryColor(
+ getResources().getColor(R.color.quickcontact_default_photo_tint_color));
}
@Override
- protected void onPostExecute(Integer color) {
- super.onPostExecute(color);
+ protected void onPostExecute(MaterialPalette palette) {
+ super.onPostExecute(palette);
if (mHasComputedThemeColor) {
// If we had previously computed a theme color from the contact photo,
// then do not update the theme color. Changing the theme color several
@@ -1182,7 +1188,7 @@
// color needs to be extracted
if (imageViewDrawable == mPhotoView.getDrawable()) {
mHasComputedThemeColor = true;
- setThemeColor(color);
+ setThemeColor(palette);
}
}
}.execute();
@@ -1212,27 +1218,18 @@
}.execute();
}
- private void setThemeColor(int color) {
+ private void setThemeColor(MaterialPalette palette) {
// If the color is invalid, use the predefined default
- if (color == 0) {
- color = getResources().getColor(R.color.actionbar_background_color);
- }
- mScroller.setHeaderTintColor(color);
-
- // Create a darker version of the actionbar color. HSV is device dependent
- // and not perceptually-linear. Therefore, we can't say mStatusBarColor is
- // 70% as bright as the action bar color. We can only say: it is a bit darker.
- final float hsvComponents[] = new float[3];
- Color.colorToHSV(color, hsvComponents);
- hsvComponents[2] *= SYSTEM_BAR_BRIGHTNESS_FACTOR;
- mStatusBarColor = Color.HSVToColor(hsvComponents);
+ final int primaryColor = palette.mPrimaryColor;
+ mScroller.setHeaderTintColor(primaryColor);
+ mStatusBarColor = palette.mSecondaryColor;
updateStatusBarColor();
mColorFilter =
- new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP);
- mContactCard.setColorAndFilter(color, mColorFilter);
- mRecentCard.setColorAndFilter(color, mColorFilter);
- mAboutCard.setColorAndFilter(color, mColorFilter);
+ new PorterDuffColorFilter(primaryColor, PorterDuff.Mode.SRC_ATOP);
+ mContactCard.setColorAndFilter(primaryColor, mColorFilter);
+ mRecentCard.setColorAndFilter(primaryColor, mColorFilter);
+ mAboutCard.setColorAndFilter(primaryColor, mColorFilter);
}
private void updateStatusBarColor() {
@@ -1584,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);
}