本文整理汇总了Java中com.bumptech.glide.Registry类的典型用法代码示例。如果您正苦于以下问题:Java Registry类的具体用法?Java Registry怎么用?Java Registry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Registry类属于com.bumptech.glide包,在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(30, TimeUnit.SECONDS)
.connectTimeout(30, TimeUnit.SECONDS)
.addInterceptor(loggingInterceptor)
.build();
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
示例2: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
// デフォルト実装は何もしないらしい
super.registerComponents( context,glide,registry );
// App1を初期化してからOkHttp3Factoryと連動させる
App1.Companion.prepare( context.getApplicationContext() );
App1.Companion.registerGlideComponents(context,glide,registry);
}
示例3: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
super.registerComponents(context, glide, registry);
//Glide默认使用HttpURLConnection做网络请求,在这切换成okhttp请求
registry.replace(GlideUrl.class, InputStream.class,
new OkHttpUrlLoader.Factory(RepositoryUtils.INSTANCE.obtainRepositoryComponent(context).okHttpClient()));
}
示例4: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
registry.replace(
GlideUrl.class,
InputStream.class,
new OkHttpUrlLoader.Factory(
request -> GlobalApplication.getOkHttpClient().newCall(request)
)
);
}
示例5: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.register(Bitmap.class, PalettizedBitmapDrawable.class,
PalettizedBitmapDrawableTranscoder.create(context));
registry.register(Bitmap.class, Palette.class,
PaletteBitmapTranscoder.create());
}
示例6: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
示例7: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.replace(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(context));
}
示例8: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.register(SVG.class, PictureDrawable.class, new SvgDrawableTranscoder())
.append(InputStream.class, SVG.class, new SvgDecoder());
}
示例9: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.append(Api.GifResult.class, InputStream.class, new GiphyModelLoader.Factory());
}
示例10: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
registry.append(Photo.class, InputStream.class, new FlickrModelLoader.Factory());
}
示例11: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
// Default empty impl.
}
示例12: getModelLoaders
import com.bumptech.glide.Registry; //导入依赖的package包/类
List<ModelLoader<File, ?>> getModelLoaders(File file)
throws Registry.NoModelLoaderAvailableException {
return glideContext.getRegistry().getModelLoaders(file);
}
示例13: getSourceEncoder
import com.bumptech.glide.Registry; //导入依赖的package包/类
<X> Encoder<X> getSourceEncoder(X data) throws Registry.NoSourceEncoderAvailableException {
return glideContext.getRegistry().getSourceEncoder(data);
}
示例14: onResourceDecoded
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public Resource<Z> onResourceDecoded(Resource<Z> decoded) {
Class<Z> resourceSubClass = getResourceClass(decoded);
Transformation<Z> appliedTransformation = null;
Resource<Z> transformed = decoded;
if (dataSource != DataSource.RESOURCE_DISK_CACHE) {
appliedTransformation = decodeHelper.getTransformation(resourceSubClass);
transformed = appliedTransformation.transform(glideContext, decoded, width, height);
}
// TODO: Make this the responsibility of the Transformation.
if (!decoded.equals(transformed)) {
decoded.recycle();
}
final EncodeStrategy encodeStrategy;
final ResourceEncoder<Z> encoder;
if (decodeHelper.isResourceEncoderAvailable(transformed)) {
encoder = decodeHelper.getResultEncoder(transformed);
encodeStrategy = encoder.getEncodeStrategy(options);
} else {
encoder = null;
encodeStrategy = EncodeStrategy.NONE;
}
Resource<Z> result = transformed;
boolean isFromAlternateCacheKey = !decodeHelper.isSourceKey(currentSourceKey);
if (diskCacheStrategy.isResourceCacheable(isFromAlternateCacheKey, dataSource,
encodeStrategy)) {
if (encoder == null) {
throw new Registry.NoResultEncoderAvailableException(transformed.get().getClass());
}
final Key key;
if (encodeStrategy == EncodeStrategy.SOURCE) {
key = new DataCacheKey(currentSourceKey, signature);
} else if (encodeStrategy == EncodeStrategy.TRANSFORMED) {
key = new ResourceCacheKey(currentSourceKey, signature, width, height,
appliedTransformation, resourceSubClass, options);
} else {
throw new IllegalArgumentException("Unknown strategy: " + encodeStrategy);
}
LockedResource<Z> lockedResult = LockedResource.obtain(transformed);
deferredEncodeManager.init(key, encoder, lockedResult);
result = lockedResult;
}
return result;
}
示例15: registerComponents
import com.bumptech.glide.Registry; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Registry registry) {
}