use of vip.kuaifan.weiui.extend.integration.glide.load.Options in project weiui by kuaifan.
the class RequestOptions method clone.
/**
* Returns a copy of this request builder with all of the options put so far on this builder.
*
* <p> This method returns a "deep" copy in that all non-immutable arguments are copied such that
* changes to one builder will not affect the other builder. However, in addition to immutable
* arguments, the current model is not copied copied so changes to the model will affect both
* builders. </p>
*
* <p> Even if this object was locked, the cloned object returned from this method will not be
* locked. </p>
*/
@SuppressWarnings({ "unchecked", // we don't want to throw to be user friendly
"PMD.CloneThrowsCloneNotSupportedException" })
@CheckResult
@Override
public RequestOptions clone() {
try {
RequestOptions result = (RequestOptions) super.clone();
result.options = new Options();
result.options.putAll(options);
result.transformations = new HashMap<>();
result.transformations.putAll(transformations);
result.isLocked = false;
result.isAutoCloneEnabled = false;
return result;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
use of vip.kuaifan.weiui.extend.integration.glide.load.Options in project weiui by kuaifan.
the class DecodeJob method runLoadPath.
private <Data, ResourceType> Resource<R> runLoadPath(Data data, DataSource dataSource, LoadPath<Data, ResourceType, R> path) throws GlideException {
Options options = getOptionsWithHardwareConfig(dataSource);
DataRewinder<Data> rewinder = glideContext.getRegistry().getRewinder(data);
try {
// ResourceType in DecodeCallback below is required for compilation to work with gradle.
return path.load(rewinder, options, width, height, new DecodeCallback<ResourceType>(dataSource));
} finally {
rewinder.cleanup();
}
}
use of vip.kuaifan.weiui.extend.integration.glide.load.Options in project weiui by kuaifan.
the class DecodeJob method getOptionsWithHardwareConfig.
@NonNull
private Options getOptionsWithHardwareConfig(DataSource dataSource) {
Options options = this.options;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return options;
}
if (options.get(Downsampler.ALLOW_HARDWARE_CONFIG) != null) {
return options;
}
if (dataSource == DataSource.RESOURCE_DISK_CACHE || decodeHelper.isScaleOnlyOrNoTransform()) {
options = new Options();
options.putAll(this.options);
options.set(Downsampler.ALLOW_HARDWARE_CONFIG, true);
}
return options;
}
Aggregations