From e464115c984ed0c7415c2103d6127f17b590e579 Mon Sep 17 00:00:00 2001 From: Christine Chen Date: Mon, 30 Sep 2013 15:14:08 -0700 Subject: Scales the contact photo to fit notification icon Bug: 11007879 Change-Id: Ide32f725bedc80095edd067ea531f0c07e18ffa3 --- InCallUI/src/com/android/incallui/StatusBarNotifier.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 89d074463..1690c5494 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -329,15 +329,24 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { * Gets a large icon from the contact info object to display in the notification. */ private Bitmap getLargeIconToDisplay(ContactCacheEntry contactInfo, boolean isConference) { + Bitmap largeIcon = null; if (isConference) { - return BitmapFactory.decodeResource(mContext.getResources(), + largeIcon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.picture_conference); } if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) { - return ((BitmapDrawable) contactInfo.photo).getBitmap(); + largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap(); } - return null; + if (largeIcon != null) { + final int height = (int) mContext.getResources().getDimension( + android.R.dimen.notification_large_icon_height); + final int width = (int) mContext.getResources().getDimension( + android.R.dimen.notification_large_icon_width); + largeIcon = Bitmap.createScaledBitmap(largeIcon, width, height, false); + } + + return largeIcon; } /** -- cgit v1.2.3