summaryrefslogtreecommitdiffstats
path: root/src/com/android/mail/photomanager/LetterTileProvider.java
diff options
context:
space:
mode:
authorMark Wei <markwei@google.com>2013-08-21 20:37:44 -0700
committerMark Wei <markwei@google.com>2013-09-13 13:27:14 -0700
commita8301e2eb5a083a73f58331279c86e8ec7b11a48 (patch)
tree09bb5e94bb3d5356aa8d71d36685a718eade1985 /src/com/android/mail/photomanager/LetterTileProvider.java
parent75a4eb5455e2fd94db41aab22a5f2614f7bf707b (diff)
downloadandroid_packages_apps_UnifiedEmail-a8301e2eb5a083a73f58331279c86e8ec7b11a48.tar.gz
android_packages_apps_UnifiedEmail-a8301e2eb5a083a73f58331279c86e8ec7b11a48.tar.bz2
android_packages_apps_UnifiedEmail-a8301e2eb5a083a73f58331279c86e8ec7b11a48.zip
Use Drawables for senders image. Less animation jank, less GC jank, less memory.
Protip: When testing sender images, go to your Sent folder. Tons of senders images appear because you are most likely to talk to people in your address book. Rewrite UI to use modular Drawables. It's much easier to understand, since Drawables with different functionality can be composed. Flipping animation is 10x smoother. Handles quick double-tap on senders image correctly. Letter tiles are not allocated bitmaps anymore. They simply draw a rect and a letter to the canvas. We are no longer allocating large bitmaps for every list item. We reuse Bitmaps whenever possible the same way that attachment previews do. Much smaller 339KB cache since we don't share with attachment previews anymore, just enough to fit 10 off-screen contact images. Bug: 10429228 Change-Id: I463b63520d881eefe3974dccf295366831adaf9e
Diffstat (limited to 'src/com/android/mail/photomanager/LetterTileProvider.java')
-rw-r--r--src/com/android/mail/photomanager/LetterTileProvider.java33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/com/android/mail/photomanager/LetterTileProvider.java b/src/com/android/mail/photomanager/LetterTileProvider.java
index bc282230e..0cb75057d 100644
--- a/src/com/android/mail/photomanager/LetterTileProvider.java
+++ b/src/com/android/mail/photomanager/LetterTileProvider.java
@@ -29,12 +29,8 @@ import android.text.TextPaint;
import android.text.TextUtils;
import com.android.mail.R;
-import com.android.mail.photomanager.ContactPhotoManager.ContactIdentifier;
-import com.android.mail.photomanager.PhotoManager.DefaultImageProvider;
-import com.android.mail.photomanager.PhotoManager.PhotoIdentifier;
-import com.android.mail.ui.DividedImageCanvas;
-import com.android.mail.ui.ImageCanvas;
import com.android.mail.ui.ImageCanvas.Dimensions;
+import com.android.mail.utils.BitmapUtil;
import com.android.mail.utils.LogTag;
import com.android.mail.utils.LogUtils;
@@ -46,7 +42,8 @@ import com.android.mail.utils.LogUtils;
* tile. If there is no English alphabet character (or digit), it creates a
* bitmap with the default contact avatar.
*/
-public class LetterTileProvider implements DefaultImageProvider {
+@Deprecated
+public class LetterTileProvider {
private static final String TAG = LogTag.getLogTag();
private final Bitmap mDefaultBitmap;
private final Bitmap[] mBitmapBackgroundCache;
@@ -89,30 +86,6 @@ public class LetterTileProvider implements DefaultImageProvider {
mDefaultColor = res.getColor(R.color.letter_tile_default_color);
}
- @Override
- public void applyDefaultImage(PhotoIdentifier id, ImageCanvas view, int extent) {
- ContactIdentifier contactIdentifier = (ContactIdentifier) id;
- DividedImageCanvas dividedImageView = (DividedImageCanvas) view;
-
- final String displayName = contactIdentifier.name;
- final String address = (String) contactIdentifier.getKey();
-
- // don't apply again if existing letter is there (and valid)
- if (dividedImageView.hasImageFor(address)) {
- return;
- }
-
- dividedImageView.getDesiredDimensions(address, mDims);
-
- final Bitmap bitmap = getLetterTile(mDims, displayName, address);
-
- if (bitmap == null) {
- return;
- }
-
- dividedImageView.addDivisionImage(bitmap, address);
- }
-
public Bitmap getLetterTile(final Dimensions dimensions, final String displayName,
final String address) {
final String display = !TextUtils.isEmpty(displayName) ? displayName : address;