Search in sources :

Example 1 with Options

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);
    }
}
Also used : GifOptions(vip.kuaifan.weiui.extend.integration.glide.load.resource.gif.GifOptions) Options(vip.kuaifan.weiui.extend.integration.glide.load.Options) CheckResult(android.support.annotation.CheckResult)

Example 2 with Options

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();
    }
}
Also used : Options(vip.kuaifan.weiui.extend.integration.glide.load.Options)

Example 3 with Options

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;
}
Also used : Options(vip.kuaifan.weiui.extend.integration.glide.load.Options) NonNull(android.support.annotation.NonNull)

Aggregations

Options (vip.kuaifan.weiui.extend.integration.glide.load.Options)3 CheckResult (android.support.annotation.CheckResult)1 NonNull (android.support.annotation.NonNull)1 GifOptions (vip.kuaifan.weiui.extend.integration.glide.load.resource.gif.GifOptions)1