本文整理汇总了Java中com.bumptech.glide.load.engine.DiskCacheStrategy类的典型用法代码示例。如果您正苦于以下问题:Java DiskCacheStrategy类的具体用法?Java DiskCacheStrategy怎么用?Java DiskCacheStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DiskCacheStrategy类属于com.bumptech.glide.load.engine包,在下文中一共展示了DiskCacheStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadProfileOnDrawer
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
private void loadProfileOnDrawer() {
if(mUser != null) {
LinearLayout linearLayout = (LinearLayout) mNavigationView.getHeaderView(0); //LinearLayout Index
ImageView mImageViewProfile = linearLayout.findViewById(R.id.main_imageview_user_photo);
TextView mTextViewUsername = linearLayout.findViewById(R.id.main_textview_username);
TextView mTextViewTextEmail = linearLayout.findViewById(R.id.main_textview_user_email);
mTextViewTextEmail.setText(mUser.getEmail());
mTextViewUsername.setText(mUser.getUsername());
GlideApp.with(this)
.load(mUser.getPhotoUrl())
.apply(RequestOptions.circleCropTransform())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(mImageViewProfile);
//Test
if (mIdlingResource != null)
mIdlingResource.setIdleState(true);
}
}
示例2: onPageScrolled
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {//arg1:当前页面的位置,也就是position; arg2:当前页面偏移的百分比; arg3当前页面偏移的像素位置
PlayMusicActivity activity = weakActivity.get();
if (null != activity) {
activity.mPositionOffset = positionOffset;
if (position == 0) {//解决第一次进入的时候没有显示模糊效果
Glide.with(MyApplication.mContext)//底部的模糊效果
.load(activity.mList.get(position).getAlbumpic_big())
.bitmapTransform(new BlurTransformation(activity, 99))
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.crossFade()
.into(activity.mImgBg);
//首次进入获取正在播放歌曲的信息
activity.songNamePlaying = activity.mList.get(0).getSongname();
activity.singerNamePlaying = activity.mList.get(0).getSingername();
activity.showIsLike();
}
}
}
示例3: setUpBanner
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
private void setUpBanner() {
if(mBanner != null) {
Glide.with(this)
.load(mBanner)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.centerCrop()
.into(mBannerImage);
mBannerImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AnimeActivity.this, ImagePreviewActivity.class);
intent.putExtra(ImagePreviewActivity.IMAGE_SOURCE, mBanner);
TransitionHelper.startSharedImageTransition(AnimeActivity.this, view, getString(R.string.transition_image_preview), intent);
}
});
}
}
示例4: onBindViewHolder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
SearchMovieInfo.DataBean.ItemsBean itemsBean = movies.get(position);
Glide.with(getContext())
.load(itemsBean.getCover())
.centerCrop()
.dontAnimate()
.placeholder(R.drawable.ico_user_default)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(itemViewHolder.mImage);
itemViewHolder.mTitle.setText(itemsBean.getTitle());
}
super.onBindViewHolder(holder, position);
}
示例5: getBigPicture
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
private Bitmap getBigPicture(@NonNull MasterSecret masterSecret,
@NonNull SlideDeck slideDeck)
{
try {
@SuppressWarnings("ConstantConditions")
Uri uri = slideDeck.getThumbnailSlide().getThumbnailUri();
return Glide.with(context)
.load(new DecryptableStreamUriLoader.DecryptableUri(masterSecret, uri))
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(500, 500)
.get();
} catch (InterruptedException | ExecutionException e) {
throw new AssertionError(e);
}
}
示例6: setUpWithInfo
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
public void setUpWithInfo(Activity activity, String name, int mid, String avatarUrl) {
this.activity = activity;
this.name = name;
this.mid = mid;
this.avatarUrl = avatarUrl;
this.setUserName(name);
Glide.with(getContext())
.load(this.avatarUrl)
.centerCrop()
.dontAnimate()
.placeholder(R.drawable.ico_user_default)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(avatarView);
}
示例7: preload
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@ReactMethod
public void preload(final ReadableArray sources) {
final Activity activity = getCurrentActivity();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < sources.size(); i++) {
final ReadableMap source = sources.getMap(i);
final GlideUrl glideUrl = FastImageViewConverter.glideUrl(source);
final Priority priority = FastImageViewConverter.priority(source);
Glide
.with(activity.getApplicationContext())
.load(glideUrl)
.priority(priority)
.placeholder(TRANSPARENT_DRAWABLE)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.preload();
}
}
});
}
示例8: onCreate
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
image = (Image) getIntent().getSerializableExtra(EXTRA_IMAGE);
if (image == null) {
finish();
} else {
TouchImageView imageView = findViewById(R.id.activity_image_image);
Glide.with(this)
.load(image.getUrl())
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.into(imageView);
setTitle(image.getName());
}
}
示例9: getDrawableRequestBuilder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
/**
* DrawableRequestBuilder 的通行配置
* @param ctx 上下文
* @param img ImageLoader封装器
* @param typeRequest url or resource
* @param <T> String or Integer
* @return DrawableRequestBuilder<T>
*/
private <T> DrawableRequestBuilder<T> getDrawableRequestBuilder(Context ctx, ImageLoader img, DrawableTypeRequest<T> typeRequest) {
DrawableRequestBuilder<T> builder = typeRequest
.placeholder(img.placeHolder)
.error(img.errorHolder)
.diskCacheStrategy(DiskCacheStrategy.ALL);
// transform image type
int transType = img.transType;
if (transType == LoaderConfig.TRANS_CIRCLE) {
builder = builder.transform(new GlideCircleTransform(ctx));
} else if (transType == LoaderConfig.TRANS_ROUND) {
builder = builder.transform(new GlideRoundTransform(ctx));
}
// SCALE type
if (img.scaleType == LoaderConfig.SCALE_CENTER_CROP) {
builder = builder.centerCrop();
} else if (img.scaleType == LoaderConfig.SCALE_FIT_CENTER) {
builder = builder.fitCenter();
}
return builder;
}
示例10: loadImage
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@BindingAdapter({"imageAddress"})
public static void loadImage(final ImageView imageView, final String imageAddress) {
if (imageAddress != null && imageAddress.startsWith("https://s3.amazonaws.com/bikedeboa/")) {
Context context = imageView.getContext();
// Hopefully the thumbnail is already disk cached and no requests are made
DrawableRequestBuilder<String> thumbnailRequest = Glide
.with(context)
.load(imageAddress.replace("images/", "images/thumbs/"))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.transform(new BlurTransformation(context));
Glide.with(context)
.load(imageAddress)
.thumbnail(thumbnailRequest)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.priority(Priority.HIGH)
.into(imageView);
}
}
示例11: setData
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
public void setData(final Recommend.RoomBean data) {
super.setData(data);
Glide.with(getContext()).load(data.getIcon()).error(R.drawable.default_recommend_icon).crossFade().centerCrop().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv);
tvCategroy.setText(data.getName());
tvMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startLive(getContext(),data.getName(),data.getSlug());
}
});
adapter.setListData(data.getList());
adapter.notifyDataSetChanged();
}
示例12: onBindViewHolder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
UserInterestQuanInfo.DataBean.ResultBean resultBean = userInterestQuans.get(position);
Glide.with(getContext())
.load(resultBean.getThumb())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.into(itemViewHolder.mImage);
itemViewHolder.mTitle.setText(resultBean.getName());
itemViewHolder.mDesc.setText(resultBean.getDesc());
itemViewHolder.mPostNickName.setText(resultBean.getPost_nickname() + ":");
itemViewHolder.mPostCount.setText(String.valueOf(resultBean.getPost_count()));
itemViewHolder.mMemberNickName.setText(resultBean.getMember_nickname() + ":");
itemViewHolder.mMemberCount.setText(String.valueOf(resultBean.getMember_count()));
}
super.onBindViewHolder(holder, position);
}
示例13: onBindViewHolder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
protected void onBindViewHolder(@NonNull MeiziHolder holder, @NonNull Content data) {
Glide.with(mContext)
.load(data.url)
.placeholder(R.mipmap.ic_bg_fuli)
.diskCacheStrategy(DiskCacheStrategy.RESULT)
.into(holder.mImageView);
// Glide.with(context)
// .load(data.url + URL_MEIZI_DIMENSION)
// .placeholder(R.mipmap.ic_bg_fuli)
// .diskCacheStrategy(DiskCacheStrategy.RESULT)
// .into(holder.mImageView);
holder.position = getPosition(holder);
holder.url = data.url;
}
示例14: onBindViewHolder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
BangumiIndexInfo.ResultBean.CategoryBean categoryBean = categorys.get(position);
Glide.with(getContext())
.load(categoryBean.getCover())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.dontAnimate()
.into(itemViewHolder.mImageView);
itemViewHolder.mTextView.setText(categoryBean.getTag_name());
}
super.onBindViewHolder(holder, position);
}
示例15: onBindViewHolder
import com.bumptech.glide.load.engine.DiskCacheStrategy; //导入依赖的package包/类
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
VideoDetailsInfo.DataBean.RelatesBean relatesBean = relates.get(position);
Glide.with(getContext())
.load(relatesBean.getPic())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.dontAnimate()
.into(itemViewHolder.mVideoPic);
itemViewHolder.mVideoTitle.setText(relatesBean.getTitle());
itemViewHolder.mVideoPlayNum.setText(
NumberUtil.converString(relatesBean.getStat().getView()));
itemViewHolder.mVideoReviewNum.setText(
NumberUtil.converString(relatesBean.getStat().getDanmaku()));
itemViewHolder.mUpName.setText(relatesBean.getOwner().getName());
}
super.onBindViewHolder(holder, position);
}