History log of /packages/apps/UnifiedEmail/src/com/android/mail/bitmap/AbstractAvatarDrawable.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c12da4a53eee911765975f0d8afe62f749806b60 25-Sep-2014 Jin Cao <jinyan@google.com> Prevent contact icons from cropping

The main issue is caused by DecodeTask when the decoded bitmap
is bigger than the desired size. In some situations, the algorithm
will crop the decoded bitmap down to the desired size.

Since the size returned from the API is always capped at 96px by
96px, we can just use that when building our bitmap buffer size
so that DecodeTask will rarely (I say rarely because it's possible
for the user to upload a 10px by 10px contact photo, but that is
extremely rare considering how big 96x96 is) have to crop the
resulting image when decoding. The destination (either ImageView
or an image drawable) will then scale the image accordingly.

I also noticed a LOT of overlap between AccountAvatarDrawable
and ContactDrawable, so I refactored them into a common base
class and allow child classes to override default drawable.

b/17319292

Change-Id: I96b9fe39769e434fb45cebe11f9699d3259960df
/packages/apps/UnifiedEmail/src/com/android/mail/bitmap/AbstractAvatarDrawable.java