Search in sources :

Example 6 with ContactLoader

use of com.android.contacts.common.model.ContactLoader in project android_packages_apps_Dialer by MoKee.

the class CallerInfoUtils method sendViewNotification.

/**
 * 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.
 */
public static void sendViewNotification(Context context, Uri contactUri) {
    final ContactLoader loader = new ContactLoader(context, contactUri, true);
    loader.registerListener(0, new OnLoadCompleteListener<Contact>() {

        @Override
        public void onLoadComplete(Loader<Contact> loader, Contact contact) {
            try {
                loader.reset();
            } catch (RuntimeException e) {
                LogUtil.e("CallerInfoUtils.onLoadComplete", "Error resetting loader", e);
            }
        }
    });
    loader.startLoading();
}
Also used : ContactLoader(com.android.contacts.common.model.ContactLoader) Contact(com.android.contacts.common.model.Contact)

Example 7 with ContactLoader

use of com.android.contacts.common.model.ContactLoader in project android_packages_apps_Dialer by MoKee.

the class PhoneFavoriteTileView method sendViewNotification.

/**
 * 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 void sendViewNotification(Context context, Uri contactUri) {
    if (loader != null) {
        // Cancels the current load if it's running and clears up any memory if it's using any.
        loader.reset();
    }
    loader = new ContactLoader(context, contactUri, true);
    // Immediately release anything we're holding in memory
    loader.registerListener(0, (loader1, contact) -> loader.reset());
    loader.startLoading();
}
Also used : ContactLoader(com.android.contacts.common.model.ContactLoader)

Aggregations

ContactLoader (com.android.contacts.common.model.ContactLoader)7 Contact (com.android.contacts.common.model.Contact)4 Uri (android.net.Uri)1