当前位置: 首页>>代码示例>>Java>>正文


Java StreamModelLoader类代码示例

本文整理汇总了Java中com.bumptech.glide.load.model.stream.StreamModelLoader的典型用法代码示例。如果您正苦于以下问题:Java StreamModelLoader类的具体用法?Java StreamModelLoader怎么用?Java StreamModelLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StreamModelLoader类属于com.bumptech.glide.load.model.stream包,在下文中一共展示了StreamModelLoader类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCache

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
/**
 * load cache image with Glide
 */
private void loadCache(Context ctx, ImageLoader img) {
    Glide.with(ctx).using(new StreamModelLoader<String>() {
        @Override
        public DataFetcher<InputStream> getResourceFetcher(final String model, int i, int i1) {
            return new DataFetcher<InputStream>() {
                @Override
                public InputStream loadData(Priority priority) throws Exception {
                    throw new IOException();
                }

                @Override
                public void cleanup() {

                }

                @Override
                public String getId() {
                    return model;
                }

                @Override
                public void cancel() {

                }
            };
        }
    }).load(img.getUrl()).placeholder(img.getPlaceHolder()).diskCacheStrategy(DiskCacheStrategy.ALL).into(img.getImgView());
}
 
开发者ID:Alex-Jerry,项目名称:LLApp,代码行数:32,代码来源:GlideImageLoaderStrategy.java

示例2: clearCacheSyncAndHackNetwork

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
private void clearCacheSyncAndHackNetwork() {
	// TODO only for testing: clear all caches before anything is loaded to always have a clean slate
	Glide.get(TestActivity.this).clearMemory();
	final CountDownLatch latch = new CountDownLatch(1);
	new Thread() {
		@Override public void run() {
			Glide.get(TestActivity.this).clearDiskCache();
			latch.countDown();
		}
	}.start();
	try {
		latch.await(); // never do this in production
	} catch (InterruptedException e) {
		e.printStackTrace();
	}

	// TODO only for debug: override default Url handler to fail sometimes (50%)
	Glide.get(this).register(GlideUrl.class, InputStream.class, new ModelLoaderFactory<GlideUrl, InputStream>() {
		Random random = new Random(0);
		@Override public ModelLoader<GlideUrl, InputStream> build(Context context, GenericLoaderFactory factories) {
			return new StreamModelLoader<GlideUrl>() {
				@Override public DataFetcher<InputStream> getResourceFetcher(GlideUrl url, int width, int height) {
					return random.nextBoolean()? new HttpUrlFetcher(url) : new NetworkDisablingFetcher(url);
				}
			};
		}
		@Override public void teardown() {
		}
	});
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:31,代码来源:TestActivity.java

示例3: build

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
@Override
public StreamModelLoader<DecryptableUri> build(Context context, GenericLoaderFactory factories) {
  return new DecryptableStreamUriLoader(context);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:5,代码来源:DecryptableStreamUriLoader.java

示例4: build

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
@Override
public StreamModelLoader<AttachmentModel> build(Context context, GenericLoaderFactory factories) {
  return new AttachmentStreamUriLoader(context);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:5,代码来源:AttachmentStreamUriLoader.java

示例5: build

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
@Override
public StreamModelLoader<ContactPhotoUri> build(Context context, GenericLoaderFactory factories) {
  return new ContactPhotoUriLoader(context);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:5,代码来源:ContactPhotoUriLoader.java

示例6: build

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
@Override public StreamModelLoader<Attachment> build(Context context, GenericLoaderFactory factories) {
	return new AttachmentLoader(context);
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:4,代码来源:AttachmentLoader.java

示例7: using

import com.bumptech.glide.load.model.stream.StreamModelLoader; //导入依赖的package包/类
/**
 * Set the {@link ModelLoader} to use for for a new load where the model loader translates from a model to an
 * {@link InputStream} resource for loading images.
 *
 * @param modelLoader The model loader to use.
 * @param <T> The type of the model.
 * @return A new {@link ImageModelRequest}.
 */
public <T> ImageModelRequest<T> using(final StreamModelLoader<T> modelLoader) {
    return new ImageModelRequest<T>(context, modelLoader, glide);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:12,代码来源:ModelRequest.java


注:本文中的com.bumptech.glide.load.model.stream.StreamModelLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。