本文整理汇总了Java中com.bumptech.glide.load.model.ModelLoaderFactory.teardown方法的典型用法代码示例。如果您正苦于以下问题:Java ModelLoaderFactory.teardown方法的具体用法?Java ModelLoaderFactory.teardown怎么用?Java ModelLoaderFactory.teardown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.load.model.ModelLoaderFactory
的用法示例。
在下文中一共展示了ModelLoaderFactory.teardown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import com.bumptech.glide.load.model.ModelLoaderFactory; //导入方法依赖的package包/类
/**
* Use the given factory to build a {@link ModelLoader} for models of the given class. Generally the best use of
* this method is to replace one of the default factories or add an implementation for other similar low level
* models. Typically the {@link ModelRequest#using(StreamModelLoader)} or
* {@link ModelRequest#using(FileDescriptorModelLoader)} syntax is preferred because it directly links the model
* with the ModelLoader being used to load it. Any factory replaced by the given factory will have its
* {@link ModelLoaderFactory#teardown()}} method called.
*
* <p>
* Note - If a factory already exists for the given class, it will be replaced. If that factory is not being
* used for any other model class, {@link ModelLoaderFactory#teardown()}
* will be called.
* </p>
*
* <p>
* Note - The factory must not be an anonymous inner class of an Activity or another object that cannot be
* retained statically.
* </p>
*
* @see ModelRequest#using(FileDescriptorModelLoader)
* @see ModelRequest#using(StreamModelLoader)
*
* @param modelClass The model class.
* @param resourceClass The resource class the model loader will translate the model type into.
* @param factory The factory to use.
* @param <T> The type of the model.
* @param <Y> the type of the resource.
*/
public <T, Y> void register(Class<T> modelClass, Class<Y> resourceClass, ModelLoaderFactory<T, Y> factory) {
ModelLoaderFactory<T, Y> removed = loaderFactory.register(modelClass, resourceClass, factory);
if (removed != null) {
removed.teardown();
}
}
示例2: unregister
import com.bumptech.glide.load.model.ModelLoaderFactory; //导入方法依赖的package包/类
/**
* Removes any {@link ModelLoaderFactory} registered for the given model and resource classes if one exists. If a
* {@link ModelLoaderFactory} is removed, its {@link ModelLoaderFactory#teardown()}} method will be called.
*
* @param modelClass The model class.
* @param resourceClass The resource class.
* @param <T> The type of the model.
* @param <Y> The type of the resource.
*/
public <T, Y> void unregister(Class<T> modelClass, Class<Y> resourceClass) {
ModelLoaderFactory<T, Y> removed = loaderFactory.unregister(modelClass, resourceClass);
if (removed != null) {
removed.teardown();
}
}