本文整理汇总了Java中com.bumptech.glide.request.target.ViewTarget.setTagId方法的典型用法代码示例。如果您正苦于以下问题:Java ViewTarget.setTagId方法的具体用法?Java ViewTarget.setTagId怎么用?Java ViewTarget.setTagId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.request.target.ViewTarget
的用法示例。
在下文中一共展示了ViewTarget.setTagId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyOptions
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void applyOptions(Context context, GlideBuilder builder) {
ViewTarget.setTagId(R.id.glide_tag_id);
// Apply options to the builder here.
// 默认内存和图片池大小
// MemorySizeCalculator calculator = new MemorySizeCalculator(context);
// int defaultMemoryCacheSize = calculator.getMemoryCacheSize(); // 默认内存大小
// int defaultBitmapPoolSize = calculator.getBitmapPoolSize(); // 默认图片池大小
// builder.setMemoryCache(new LruResourceCache(defaultMemoryCacheSize)); // 该两句无需设置,是默认的
// builder.setBitmapPool(new LruBitmapPool(defaultBitmapPoolSize));
//定义图片的本地磁盘缓存
// File cacheDir = context.getExternalCacheDir();//指定的是数据的缓存地址
// int diskCacheSize = 1024 * 1024 * 1024;//最多可以缓存多少字节的数据
//设置磁盘缓存大小
// builder.setDiskCache(new DiskLruCacheFactory(cacheDir.getPath(), "glide", diskCacheSize));
// 定义缓存大小和位置
if (BaseConfig.sSDCardExist) {
builder.setDiskCache(new ExternalCacheDiskCacheFactory(context, Constants.Dir.IMAGE_CACHE_DIR, extDiskSize)); //外部存储
} else {
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, Constants.Dir.IMAGE_CACHE_DIR, intDiskSize)); //内部存储
}
// 自定义内存和图片池大小
// builder.setMemoryCache(new LruResourceCache(memorySize));
// builder.setBitmapPool(new LruBitmapPool(memorySize));
// builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
}
示例2: onCreate
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
ViewTarget.setTagId(R.id.glide_tag);
isInstallWx = isWXAppInstalledAndSupported();
//alibaba
System.loadLibrary("gnustl_shared");
// System.loadLibrary("ijkffmpeg");//目前使用微博的ijkffmpeg会出现1K再换wifi不重连的情况
System.loadLibrary("qupai-media-thirdparty");
// System.loadLibrary("alivc-media-jni");
System.loadLibrary("qupai-media-jni");
ApplicationGlue.initialize(this);
//Bugly SDK初始化
CrashReport.initCrashReport(getApplicationContext(), "3080098224", false);
}
示例3: applyOptions
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void applyOptions(Context context, GlideBuilder builder) {
//解决setTag问题
ViewTarget.setTagId(R.id.glide_tag_id);
//磁盘缓存
builder.setDiskCache(new DiskLruCacheFactory(AppFileHelper.getAppCachePath(), 50 * 1024 * 1024));
builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
//内存缓存
MemorySizeCalculator calculator = new MemorySizeCalculator(context);
int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
int defaultBitmapPoolSize = calculator.getBitmapPoolSize();
//设置比默认大小大1.5倍的缓存和图片池大小
int customMemoryCacheSize = (int) (1.5 * defaultMemoryCacheSize);
int customBitmapPoolSize = defaultBitmapPoolSize;
KLog.i("poolSize", "bitmapPoolSize >>>>> "
+ android.text.format.Formatter.formatFileSize(context, customBitmapPoolSize)
+ " memorySize>>>>>>>> " +
android.text.format.Formatter.formatFileSize(context, customMemoryCacheSize));
builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));
}
示例4: onCreate
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photogallery);
//为glide设置全局tag id,避免ImageView Tag被glide占用
ViewTarget.setTagId(R.id.glide_request);
mUrls = getIntent().getStringArrayExtra(EXTRA_URLS);
mViewPager = (HackyViewPager) findViewById(R.id.view_pager);
mViewPager.setAdapter(new SamplePagerAdapter());
mViewPager.setCurrentItem(getIntent().getIntExtra(EXTRA_POSITION, 0));
findViewById(R.id.button_original).setOnClickListener(this);
//findViewById(R.id.button_save).setOnClickListener(this);
}
示例5: onCreate
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
getAppComponent();
ViewTarget.setTagId(R.id.glide_tag);
LoggerUtil.init(BuildConfig.DEBUG);
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}
示例6: applyOptions
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void applyOptions(final Context context, GlideBuilder builder) {
ViewTarget.setTagId(R.id.glide_tag_id);
MemorySizeCalculator calculator = new MemorySizeCalculator(context);
int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
int defaultBitmapPoolSize = calculator.getBitmapPoolSize();
int customMemoryCacheSize = (int) (1.2 * defaultMemoryCacheSize);
int customBitmapPoolSize = (int) (1.2 * defaultBitmapPoolSize);
builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, cacheSize100MegaBytes));
}
示例7: onCreate
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
// LeakCanary.install(this);
//为防止出现
// "You must not call setTag() on a view Glide is targeting" on non-root ImageView
//这个问题导致的软件崩溃
ViewTarget.setTagId(R.id.glide_tag);
initComponent();
}
示例8: applyOptions
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void applyOptions(Context context, GlideBuilder builder) {
// set max size of the disk cache for images
builder.setDiskCache(new InternalCacheDiskCacheFactory(
context, App.getAppComponent().getDownloadPreferencesManager()
.getTotalImageCacheSize()));
ViewTarget.setTagId(R.id.tag_glide);
//从默认的RGB_565改为ARGB_8888显示
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
}
示例9: applyOptions
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override
public void applyOptions(final Context context, GlideBuilder builder) {
ViewTarget.setTagId(R.id.glide_loader);
builder.setDiskCache(new DiskLruCacheFactory(new DiskLruCacheFactory.CacheDirectoryGetter
() {
@Override
public File getCacheDirectory() {
return context.getExternalCacheDir();
}
}, DiskCache.Factory.DEFAULT_DISK_CACHE_SIZE));
}
示例10: onCreate
import com.bumptech.glide.request.target.ViewTarget; //导入方法依赖的package包/类
@Override public void onCreate() {
super.onCreate();
ViewTarget.setTagId(R.id._35096552_tag);
}