如何在不使用@GlideModule 的情况下添加超时以在库模块中滑动
How to add timeout to glide in library module without using @GlideModule
我在我的库中使用 Glide 并尝试增加超时
我找到了 but using AppGlideModule
in the library is discouraged
和 LibraryGlideModule
不会生成任何 api 并且不会被库本身消耗。
我想要一种不使用生成的 api 来设置超时的方法。
您可以使用 RequestOptions.timeoutOf(5000)
来更改默认的超时 2500ms
如果您不想使用生成的 api 只是为了超时,这也是一种简单的方法。
完整示例:
Glide.with(context)
.load(url)
.apply(RequestOptions.timeoutOf(5 * 60 * 1000))
.into(imageView)
可以使用这种滑行方式
.timeout(60000)
最终代码示例将是:
Glide.with(imageView.getContext())
.load(finalUrl)
.timeout(60000)
.placeholder(R.drawable.place_holder)
.into(imageView);
我在我的库中使用 Glide 并尝试增加超时
我找到了AppGlideModule
in the library is discouraged
和 LibraryGlideModule
不会生成任何 api 并且不会被库本身消耗。
我想要一种不使用生成的 api 来设置超时的方法。
您可以使用 RequestOptions.timeoutOf(5000)
来更改默认的超时 2500ms
如果您不想使用生成的 api 只是为了超时,这也是一种简单的方法。
完整示例:
Glide.with(context)
.load(url)
.apply(RequestOptions.timeoutOf(5 * 60 * 1000))
.into(imageView)
可以使用这种滑行方式
.timeout(60000)
最终代码示例将是:
Glide.with(imageView.getContext())
.load(finalUrl)
.timeout(60000)
.placeholder(R.drawable.place_holder)
.into(imageView);