/** * Attempts to always load a {@link File} containing the resource, either using a file path * obtained from the media store (for local images/videos), or using Glide's disk cache * (for remote images/videos). * * <p>For remote content, prefer {@link #downloadOnly()}. * * @return A new request builder for obtaining File paths to content. */ @NonNull @CheckResult public RequestBuilder<File> asFile() { return as(File.class).apply(skipMemoryCacheOf(true)); }
/** * 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; }
/** * Attempts to always load a {@link File} containing the resource, either using a file path * obtained from the media store (for local images/videos), or using Glide's disk cache * (for remote images/videos). * * <p>For remote content, prefer {@link #downloadOnly()}. * * @return A new request builder for obtaining File paths to content. */ public RequestBuilder<File> asFile() { return as(File.class).apply(skipMemoryCacheOf(true)); }
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); } } }); } }