當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。