本文整理汇总了Java中com.bumptech.glide.load.model.LazyHeaders.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java LazyHeaders.Builder方法的具体用法?Java LazyHeaders.Builder怎么用?Java LazyHeaders.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.load.model.LazyHeaders
的用法示例。
在下文中一共展示了LazyHeaders.Builder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cacheImage
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
private void cacheImage(final Image image, final LazyHeaders.Builder header) {
mName = image.getName();
mUri = image.getFileUrl();
saveImage(image);
mRequestManager.load(new GlideUrl(image.getFileUrl(), header.build()))
.downloadOnly(new SimpleTarget<File>() {
@Override
public void onResourceReady(File resource,
GlideAnimation<? super File> glideAnimation) {
if (mSetting.autoDownload()) {
File dir = new File(
Environment.getExternalStorageDirectory().getPath(),
"MoeGallery");
String fileName = image.getName().replace('/', '-');
Utils.copy(resource, dir, fileName);
mImageDataSource.cacheImageUri(mImage.getFileUrl(),
Uri.fromFile(new File(dir, fileName)));
}
loadImage(image, header);
}
});
mImageDataSource.cacheDetail(mImage.getFileUrl(), image);
}
示例2: displayImageReferer
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
public static void displayImageReferer(String url,ImageView imageView,String referer) {
if(url==null){
return;
}
LazyHeaders.Builder builder=new LazyHeaders.Builder().addHeader("User-Agent", UserAgent);
if(referer!=null){
builder.addHeader("Referer", referer);
}
/*
.addHeader("key2", new LazyHeaderFactory() {
@Override
public String buildHeader() {
String expensiveAuthHeader = computeExpensiveAuthHeader();
return expensiveAuthHeader;
}
})
*/
GlideUrl glideUrl = new GlideUrl(url,builder.build());
Glide.with(MainApp.getContext())
.load(glideUrl)
.placeholder(R.drawable.pictures_no)
.thumbnail(0.2f)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imageView);
}
示例3: displayImageReferer
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
public static void displayImageReferer(String url,ImageView imageView,String referer) {
if(url==null){
return;
}
LazyHeaders.Builder builder=new LazyHeaders.Builder().addHeader("User-Agent", UserAgent);
if(referer!=null){
builder.addHeader("Referer", referer);
}
/*
.addHeader("key2", new LazyHeaderFactory() {
@Override
public String buildHeader() {
String expensiveAuthHeader = computeExpensiveAuthHeader();
return expensiveAuthHeader;
}
})
*/
try{
GlideUrl glideUrl = new GlideUrl(url, builder.build());
Glide.with(MainApp.getContext())
.load(glideUrl)
.placeholder(R.drawable.pictures_no)
//.thumbnail(0.2f)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.dontTransform()
.into(imageView);
}catch (Exception e){
}
}
示例4: loadImage
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
private void loadImage(Image image, LazyHeaders.Builder header) {
if (mUri != null && mUri.toLowerCase().endsWith("gif")) {
mGifRequestBuilder.load(new GlideUrl(image.getFileUrl(), header.build()))
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.listener(new MediaRequestListener<GlideUrl, GifDrawable>())
.into(mPhotoView);
} else {
mRequestManager.load(new GlideUrl(image.getFileUrl(), header.build()))
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.listener(new MediaRequestListener<GlideUrl, GlideDrawable>())
.into(mPhotoView);
}
}
示例5: makeGlideUrl
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
public GlideUrl makeGlideUrl(String url){
LazyHeaders.Builder builder = new LazyHeaders.Builder()
.addHeader(AppConfig.HEADER_USER_AGENT, AppConfig.HEADER_USER_AGENT_INFO);
return new GlideUrl(url, builder.build());
}
示例6: header
import com.bumptech.glide.load.model.LazyHeaders; //导入方法依赖的package包/类
private static LazyHeaders.Builder header() {
return new LazyHeaders.Builder().addHeader("User-Agent", OkHttp.USER_AGENT);
}