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


Java DiskCacheStrategy类代码示例

本文整理汇总了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);
        }
    }
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:24,代码来源:MainActivity.java

示例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();
        }
    }
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:20,代码来源:MyOnPageChangeListeger.java

示例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);
            }
        });
    }
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:20,代码来源:AnimeActivity.java

示例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);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:22,代码来源:MovieResultsAdapter.java

示例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);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:SingleRecipientNotificationBuilder.java

示例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);
  }
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:17,代码来源:UserTagView.java

示例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();
            }
        }
    });
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:22,代码来源:FastImageViewModule.java

示例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());
    }
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:26,代码来源:ImageActivity.java

示例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;
}
 
开发者ID:BlueYangDroid,项目名称:MvpPlus,代码行数:31,代码来源:GlideImageLoaderStrategy.java

示例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);
	}
}
 
开发者ID:EduardoVernier,项目名称:bikedeboa-android,代码行数:24,代码来源:BindingAdapters.java

示例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();


}
 
开发者ID:jenly1314,项目名称:KingTV,代码行数:18,代码来源:RecommendAdapter.java

示例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);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:26,代码来源:UserInterestQuanAdapter.java

示例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;
    }
 
开发者ID:Shuanghua,项目名称:LikeGank,代码行数:17,代码来源:ImageItemBinder.java

示例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);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:20,代码来源:BangumiIndexAdapter.java

示例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);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:26,代码来源:VideoRelatedAdapter.java


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