/** * Returns an object to load the given {@link Bitmap}. * * <p>It's almost always better to allow Glide to load {@link Bitmap}s than * pass {@link Bitmap}s into Glide. If you have a custom way to obtain {@link Bitmap}s that is * not supported by Glide by default, consider registering a custom * {@link com.bumptech.glide.load.model.ModelLoader} or * {@link com.bumptech.glide.load.ResourceDecoder} instead of using this method. * * <p>The {@link DiskCacheStrategy} is set to {@link DiskCacheStrategy#NONE}. Previous calls to * {@link #apply(BaseRequestOptions)} or previously applied {@link DiskCacheStrategy}s will be * overridden by this method. Applying an {@link DiskCacheStrategy} other than * {@link DiskCacheStrategy#NONE} after calling this method may result in undefined behavior. * * <p>In memory caching relies on Object equality. The contents of the {@link Bitmap}s are not * compared. * * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable Bitmap bitmap) { return loadGeneric(bitmap) .apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); }
/** * Returns a request builder to load the given {@link Drawable}. * * <p>It's almost always better to allow Glide to load {@link Bitmap}s than to pass * {@link Bitmap}s into Glide using this method . If you have a custom way to obtain * {@link Bitmap}s that is not supported by Glide by default, consider registering a custom * {@link com.bumptech.glide.load.model.ModelLoader} or * {@link com.bumptech.glide.load.ResourceDecoder} instead of using this method. * * <p>The {@link DiskCacheStrategy} is set to {@link DiskCacheStrategy#NONE}. Previous calls to * {@link #apply(BaseRequestOptions)} or previously applied {@link DiskCacheStrategy}s will be * overridden by this method. Applying an {@link DiskCacheStrategy} other than * {@link DiskCacheStrategy#NONE} after calling this method may result in undefined behavior. * * <p>In memory caching relies on Object equality. The contents of the {@link Drawable}s are not * compared. * * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable Drawable drawable) { return loadGeneric(drawable) .apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); }
private static RequestBuilder<Bitmap> getRequestBuilder( RequestManager requestManager, int width, int height) { return requestManager .asBitmap() .apply( diskCacheStrategyOf(DiskCacheStrategy.NONE) .useAnimationPool(true) .skipMemoryCache(true) .override(width, height)); }
/** * Returns a request to load the given byte array. * * <p>Note - by default loads for bytes are not cached in either the memory or the disk cache. * * @param model the data to load. * @see #load(Object) */ @NonNull @CheckResult @Override public RequestBuilder<TranscodeType> load(@Nullable byte[] model) { RequestBuilder<TranscodeType> result = loadGeneric(model); if (!result.isDiskCacheStrategySet()) { result = result.apply(diskCacheStrategyOf(DiskCacheStrategy.NONE)); } if (!result.isSkipMemoryCacheSet()) { result = result.apply(skipMemoryCacheOf(true /*skipMemoryCache*/)); } return result; }
public LaunchPoint(Context context, String appTitle, String iconUrl, Intent launchIntent, int launchColor, InstallingLaunchPointListener listener) { clear(context); this.mAppTitle = appTitle; this.mLaunchColor = launchColor; if (launchIntent != null) { this.mLaunchIntent = launchIntent.addFlags(270532608); if (this.mLaunchIntent.getComponent() != null) { this.mComponentName = this.mLaunchIntent.getComponent().flattenToString(); this.mPackageName = this.mLaunchIntent.getComponent().getPackageName(); } } Resources resources = context.getResources(); this.mLaunchColor = ResourcesCompat.getColor(resources, R.color.app_launch_ripple_default_color, null); this.mPackageInstallTime = Util.getInstallTimeForPackage(context, this.mPackageName); this.mListener = listener; this.mIsInitialInstall = true; if (!TextUtils.isEmpty(iconUrl)) { int maxIconSize = resources.getDimensionPixelSize(R.dimen.banner_icon_size); Glide.with(context).asDrawable().apply(RequestOptions.skipMemoryCacheOf(true)).apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE)).load(iconUrl).into(new SimpleTarget<Drawable>(maxIconSize, maxIconSize) { public void onResourceReady(Drawable drawable, Transition<? super Drawable> transition) { InstallingLaunchPointListener launchPointListener = LaunchPoint.this.mListener; if (drawable != null && launchPointListener != null) { LaunchPoint.this.mIconDrawable = drawable; launchPointListener.onInstallingLaunchPointChanged(LaunchPoint.this); } } }); } }