From 35ecd12f1617f36d8d22fecdabf9c63cbf92599d Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Sat, 24 Feb 2018 11:37:28 -0800 Subject: Cancel Old SpeedDial contact loaders when they are reset. This prevents to many loaders running at the same time and crashing the application for using too many threads at once. Also made a few UI changes: - Change Android nav bar color to #FFF - Move badges down 2dp - Limit badges to 9+ (instead of 99+, added flag to configure this) - search bar no longer has rounded corners when expanded Bug: 72525324 Test: MainActivityOldPeerTest PiperOrigin-RevId: 186894920 Change-Id: I36fc5d8794440b707184d54de427db5910ec5b8e --- .../dialer/app/list/PhoneFavoriteTileView.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'java/com/android/dialer/app/list/PhoneFavoriteTileView.java') diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java index 3b27d3118..3739588ea 100644 --- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java +++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java @@ -32,7 +32,6 @@ import com.android.dialer.app.R; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.callintent.SpeedDialContactType; -import com.android.dialer.common.LogUtil; import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.logging.InteractionEvent; @@ -192,21 +191,17 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { this.position = position; } + private ContactLoader loader; + /** * Send a notification using a {@link ContactLoader} to inform the sync adapter that we are * viewing a particular contact, so that it can download the high-res photo. */ - private static void sendViewNotification(Context context, Uri contactUri) { - ContactLoader loader = new ContactLoader(context, contactUri, true /* postViewNotification */); - loader.registerListener( - 0, - (loader1, contact) -> { - try { - loader1.reset(); - } catch (RuntimeException e) { - LogUtil.e("PhoneFavoriteTileView.onLoadComplete", "error resetting loader", e); - } - }); + private void sendViewNotification(Context context, Uri contactUri) { + if (loader != null) { + loader.cancelLoad(); + } + loader = new ContactLoader(context, contactUri, true /* postViewNotification */); loader.startLoading(); } } -- cgit v1.2.3