本文整理匯總了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();
}
}