Use default-corp photos in QC for corps
Also use higher resolution default-avatar images. Now
that we have 720dp photos we no longer need to use the
CENTER scale type. Instead use the CENTER_CROP scale type.
Bug: 16630102
Change-Id: I81db0c0c862d939a18f067bb566a1193b57577c4
diff --git a/res/drawable-hdpi/default_avatar_white.png b/res/drawable-hdpi/default_avatar_white.png
deleted file mode 100644
index 711286c..0000000
--- a/res/drawable-hdpi/default_avatar_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/generic_business_white_540dp.png b/res/drawable-hdpi/generic_business_white_540dp.png
new file mode 100644
index 0000000..14665ff
--- /dev/null
+++ b/res/drawable-hdpi/generic_business_white_540dp.png
Binary files differ
diff --git a/res/drawable-hdpi/person_white_540dp.png b/res/drawable-hdpi/person_white_540dp.png
new file mode 100644
index 0000000..fc168ef
--- /dev/null
+++ b/res/drawable-hdpi/person_white_540dp.png
Binary files differ
diff --git a/res/drawable-mdpi/default_avatar_white.png b/res/drawable-mdpi/default_avatar_white.png
deleted file mode 100644
index 0983eb0..0000000
--- a/res/drawable-mdpi/default_avatar_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/generic_business_white_540dp.png b/res/drawable-mdpi/generic_business_white_540dp.png
new file mode 100644
index 0000000..b4023b8
--- /dev/null
+++ b/res/drawable-mdpi/generic_business_white_540dp.png
Binary files differ
diff --git a/res/drawable-mdpi/person_white_540dp.png b/res/drawable-mdpi/person_white_540dp.png
new file mode 100644
index 0000000..053e8b6
--- /dev/null
+++ b/res/drawable-mdpi/person_white_540dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/default_avatar_white.png b/res/drawable-xhdpi/default_avatar_white.png
deleted file mode 100644
index f645ff2..0000000
--- a/res/drawable-xhdpi/default_avatar_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/generic_business_white_540dp.png b/res/drawable-xhdpi/generic_business_white_540dp.png
new file mode 100644
index 0000000..4f38ea7
--- /dev/null
+++ b/res/drawable-xhdpi/generic_business_white_540dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/person_white_540dp.png b/res/drawable-xhdpi/person_white_540dp.png
new file mode 100644
index 0000000..1713727
--- /dev/null
+++ b/res/drawable-xhdpi/person_white_540dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/default_avatar_white.png b/res/drawable-xxhdpi/default_avatar_white.png
deleted file mode 100644
index b92f026..0000000
--- a/res/drawable-xxhdpi/default_avatar_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/generic_business_white_540dp.png b/res/drawable-xxhdpi/generic_business_white_540dp.png
new file mode 100644
index 0000000..ada66e7
--- /dev/null
+++ b/res/drawable-xxhdpi/generic_business_white_540dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/person_white_540dp.png b/res/drawable-xxhdpi/person_white_540dp.png
new file mode 100644
index 0000000..16df17e
--- /dev/null
+++ b/res/drawable-xxhdpi/person_white_540dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/generic_business_white_540dp.png b/res/drawable-xxxhdpi/generic_business_white_540dp.png
new file mode 100644
index 0000000..c8ee719
--- /dev/null
+++ b/res/drawable-xxxhdpi/generic_business_white_540dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/person_white_540dp.png b/res/drawable-xxxhdpi/person_white_540dp.png
new file mode 100644
index 0000000..763597d
--- /dev/null
+++ b/res/drawable-xxxhdpi/person_white_540dp.png
Binary files differ
diff --git a/res/drawable/default_avatar_white.xml b/res/drawable/default_avatar_white.xml
deleted file mode 100644
index 9bc5cbf..0000000
--- a/res/drawable/default_avatar_white.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<inset
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/default_avatar_white"
- android:insetRight="102dp"
- android:insetLeft="102dp" />
\ No newline at end of file
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 4d66e37..f486b1f 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -135,6 +135,8 @@
import com.android.contacts.util.StructuredPostalUtils;
import com.android.contacts.widget.MultiShrinkScroller;
import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListener;
+import com.android.contacts.widget.QuickContactImageView;
+
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
@@ -197,7 +199,7 @@
private int mStatusBarColor;
private boolean mHasAlreadyBeenOpened;
- private ImageView mPhotoView;
+ private QuickContactImageView mPhotoView;
private ExpandingEntryCardView mContactCard;
private ExpandingEntryCardView mNoContactDetailsCard;
private ExpandingEntryCardView mRecentCard;
@@ -580,7 +582,7 @@
mAboutCard.setOnClickListener(mEntryClickHandler);
mAboutCard.setOnCreateContextMenuListener(mEntryContextMenuListener);
- mPhotoView = (ImageView) findViewById(R.id.photo);
+ mPhotoView = (QuickContactImageView) findViewById(R.id.photo);
final View transparentView = findViewById(R.id.transparent_view);
if (mScroller != null) {
transparentView.setOnClickListener(new OnClickListener() {
@@ -776,6 +778,7 @@
Trace.endSection();
Trace.beginSection("Set display photo & name");
+ mPhotoView.setIsBusiness(mContactData.isDisplayNameFromOrganization());
mPhotoSetter.setupContactPhoto(data, mPhotoView);
extractAndApplyTintFromPhotoViewAsynchronously();
analyzeWhitenessOfPhotoAsynchronously();
diff --git a/src/com/android/contacts/widget/QuickContactImageView.java b/src/com/android/contacts/widget/QuickContactImageView.java
index 987b27d..ff9e799 100644
--- a/src/com/android/contacts/widget/QuickContactImageView.java
+++ b/src/com/android/contacts/widget/QuickContactImageView.java
@@ -23,6 +23,7 @@
public class QuickContactImageView extends ImageView {
private Drawable mOriginalDrawable;
+ private boolean mIsBusiness;
public QuickContactImageView(Context context) {
this(context, null);
@@ -54,6 +55,10 @@
return mOriginalDrawable instanceof LetterTileDrawable;
}
+ public void setIsBusiness(boolean isBusiness) {
+ mIsBusiness = isBusiness;
+ }
+
@Override
public void setImageDrawable(Drawable drawable) {
// There is no way to avoid all this casting. Blending modes aren't equally
@@ -61,11 +66,14 @@
final BitmapDrawable bitmapDrawable;
if (drawable == null || drawable instanceof BitmapDrawable) {
bitmapDrawable = (BitmapDrawable) drawable;
- setScaleType(ScaleType.CENTER_CROP);
} else if (drawable instanceof LetterTileDrawable) {
- bitmapDrawable = (BitmapDrawable) getResources().getDrawable(
- R.drawable.default_avatar_white);
- setScaleType(ScaleType.CENTER);
+ if (!mIsBusiness) {
+ bitmapDrawable = (BitmapDrawable) getResources().getDrawable(
+ R.drawable.person_white_540dp);
+ } else {
+ bitmapDrawable = (BitmapDrawable) getResources().getDrawable(
+ R.drawable.generic_business_white_540dp);
+ }
} else {
throw new IllegalArgumentException("Does not support this type of drawable");