private void createAndApplyDefaultImageForUri(ImageView view, Uri uri, int requestedExtent, boolean darkTheme, boolean isCircular, DefaultImageProvider defaultProvider) { DefaultImageRequest request = getDefaultImageRequestFromUri(uri); request.isCircular = isCircular; defaultProvider.applyDefaultImage(view, requestedExtent, darkTheme, request); }
@Override public void preloadPhotosInBackground() { ensureLoaderThread(); mLoaderThread.requestPreloading(); }
public DialerPhoneNumberListAdapter(Context context) { super(context); mCountryIso = GeoUtil.getCurrentCountryIso(context); mVideoCallingEnabled = CallUtil.isVideoEnabled(context); }
/** * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined * automatically. */ public static Intent getCallIntent(String number) { return getCallIntent(getCallUri(number)); }
@Override public void loadThumbnail(ImageView view, long photoId, boolean darkTheme, boolean isCircular, DefaultImageRequest defaultImageRequest, DefaultImageProvider defaultProvider) { if (photoId == 0) { // No photo is needed defaultProvider.applyDefaultImage(view, -1, darkTheme, defaultImageRequest); mPendingRequests.remove(view); } else { if (DEBUG) Log.d(TAG, "loadPhoto request: " + photoId); loadPhotoByIdOrUri(view, Request.createFromThumbnailId(photoId, darkTheme, isCircular, defaultProvider)); } }
/** * Calls {@link #loadPhoto(ImageView, Uri, boolean, boolean, DefaultImageRequest, * DefaultImageProvider)} with {@link #DEFAULT_AVATAR} and with the assumption, that * the image is a thumbnail. * * @param defaultImageRequest {@link DefaultImageRequest} object that specifies how a default * letter tile avatar should be drawn. */ public final void loadDirectoryPhoto(ImageView view, Uri photoUri, boolean darkTheme, boolean isCircular, DefaultImageRequest defaultImageRequest) { loadPhoto(view, photoUri, -1, darkTheme, isCircular, defaultImageRequest, DEFAULT_AVATAR); }
@Override protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) { return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT, DEFAULT_IMAGE_LETTER_SCALE, DEFAULT_IMAGE_LETTER_OFFSET, false); }
private static class BlankDefaultImageProvider extends DefaultImageProvider { private static Drawable sDrawable; @Override public void applyDefaultImage(ImageView view, int extent, boolean darkTheme, DefaultImageRequest defaultImageRequest) { if (sDrawable == null) { Context context = view.getContext(); sDrawable = new ColorDrawable(context.getResources().getColor( R.color.image_placeholder)); } view.setImageDrawable(sDrawable); } }
@Override public boolean shouldCollapseWith(PhoneItem phoneItem, Context context) { return MoreContactUtils.shouldCollapse(Phone.CONTENT_ITEM_TYPE, phoneNumber, Phone.CONTENT_ITEM_TYPE, phoneItem.phoneNumber); }
/** * Calls {@link #loadThumbnail(ImageView, long, boolean, DefaultImageRequest, * DefaultImageProvider)} using the {@link DefaultImageProvider} {@link #DEFAULT_AVATAR}. */ public final void loadThumbnail(ImageView view, long photoId, boolean darkTheme, boolean isCircular, DefaultImageRequest defaultImageRequest) { loadThumbnail(view, photoId, darkTheme, isCircular, defaultImageRequest, DEFAULT_AVATAR); }
public CallIntentBuilder(String number) { this(CallUtil.getCallUri(number)); }
public static Request createFromUri(Uri uri, int requestedExtent, boolean darkTheme, boolean isCircular, DefaultImageProvider defaultProvider) { return new Request(0 /* no ID */, uri, requestedExtent, darkTheme, isCircular, defaultProvider); }
/** * Determines if one of the call capable phone accounts defined supports video calling. * * @param context The context. * @return {@code true} if one of the call capable phone accounts supports video calling, * {@code false} otherwise. */ public static boolean isVideoEnabled(Context context) { return (getVideoCallingAvailability(context) & VIDEO_CALLING_ENABLED) != 0; }
public boolean isVideoEnabled() { if (!mHasCheckedForVideoEnabled) { mIsVideoEnabled = CallUtil.isVideoEnabled(mContext); mHasCheckedForVideoEnabled = true; } return mIsVideoEnabled; }
@Override public void onTrimMemory(int level) { if (DEBUG) Log.d(TAG, "onTrimMemory: " + level); if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) { // Clear the caches. Note all pending requests will be removed too. clear(); } }
/** * Divider uses a list_seperator.xml along with text to denote * the most frequently contacted contacts. */ private TextView getDivider() { return MoreContactUtils.createHeaderView(mContext, R.string.favoritesFrequentContacted); }
private void setDividerPadding(TextView headerTextView, boolean isFirstRow) { MoreContactUtils.setHeaderViewBottomPadding(mContext, headerTextView, isFirstRow); }
/** * Calls {@link #loadPhoto(ImageView, Uri, int, boolean, DefaultImageRequest, * DefaultImageProvider)} with {@link #DEFAULT_AVATAR} and {@code null} display names and * lookup keys. * * @param defaultImageRequest {@link DefaultImageRequest} object that specifies how a default * letter tile avatar should be drawn. */ public final void loadPhoto(ImageView view, Uri photoUri, int requestedExtent, boolean darkTheme, boolean isCircular, DefaultImageRequest defaultImageRequest) { loadPhoto(view, photoUri, requestedExtent, darkTheme, isCircular, defaultImageRequest, DEFAULT_AVATAR); }
@Override protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) { return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT, DEFAULT_IMAGE_LETTER_SCALE, /* offset = */ 0, /* isCircular = */ true); } }
public static Request createFromThumbnailId(long id, boolean darkTheme, boolean isCircular, DefaultImageProvider defaultProvider) { return new Request(id, null /* no URI */, -1, darkTheme, isCircular, defaultProvider); }