类com.bumptech.glide.signature.ObjectKey源码实例Demo

下面列出了怎么用com.bumptech.glide.signature.ObjectKey的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: ToDoList   文件: MainActivity.java
/**
 * Glide图片加载
 */
private void glideLoad(){

    RequestOptions options1 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(MainActivity.this,"head_signature","")))
            .placeholder(R.drawable.default_photo);

    RequestOptions options2 =new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(MainActivity.this,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(MainActivity.this, "path" ,""))
            .apply(options1)
            .into(user_image);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(MainActivity.this, "path" ,""))
            .apply(bitmapTransform(new BlurTransformation(25, 3)))
            .apply(options2)
            .into(nav_bg);
}
 
源代码2 项目: alpha-wallet-android   文件: TokenHolder.java
private void displayTokenIcon()
{
    String correctedAddr = Keys.toChecksumAddress(token.getAddress());
    String tURL = assetDefinition.getTokenImageUrl(token.tokenInfo.chainId, token.getAddress());
    if (TextUtils.isEmpty(tURL))
    {
        tURL = TRUST_ICON_REPO.replace(ICON_REPO_ADDRESS_TOKEN, correctedAddr);
    }

    int fallbackIcon = EthereumNetworkRepository.getChainLogo(token.tokenInfo.chainId);

    Glide.with(getContext().getApplicationContext())
            .load(tURL)
            .signature(new ObjectKey(correctedAddr + "-" + token.tokenInfo.chainId))
            .apply(new RequestOptions().circleCrop())
            .apply(new RequestOptions().placeholder(fallbackIcon))
            .into(icon);

    icon.setVisibility(View.VISIBLE);
}
 
源代码3 项目: science-journal   文件: PictureUtils.java
public static void loadExperimentOverviewImage(
    AppAccount appAccount, ImageView imageView, String experimentOverviewFilePath) {
  imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  String fullPath =
      PictureUtils.getExperimentOverviewFullImagePath(appAccount, experimentOverviewFilePath);
  File file = new File(fullPath);
  Context context = imageView.getContext();
  GlideApp.with(context)
      .load(fullPath)
      .placeholder(R.drawable.experiment_card_placeholder)
      // Create a signature based on the last modified time so that cached images will
      // not be used if the underlying file changes. This may happen if the user has
      // picked an experiment photo from the "edit experiment" page because there is only
      // one filename used for that photo.
      .signature(new ObjectKey(file.getPath() + file.lastModified()))
      .into(imageView);
}
 
源代码4 项目: hipda   文件: GlideHelper.java
public static void loadAvatar(RequestManager glide, ImageView view, String avatarUrl) {
    avatarUrl = Utils.nullToText(avatarUrl);
    String cacheKey = AVATAR_CACHE_KEYS.get(avatarUrl);
    if (cacheKey == null) {
        cacheKey = avatarUrl;
    }
    if (HiSettingsHelper.getInstance().isCircleAvatar()) {
        glide.load(new AvatarModel(avatarUrl))
                .signature(new ObjectKey(cacheKey))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .circleCrop()
                .error(DEFAULT_USER_ICON)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(view);
    } else {
        glide.load(new AvatarModel(avatarUrl))
                .signature(new ObjectKey(cacheKey))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .transform(new CenterCrop(), new RoundedCorners(Utils.dpToPx(4)))
                .error(DEFAULT_USER_ICON)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(view);
    }
}
 
源代码5 项目: mollyim-android   文件: BlurHashModelLoader.java
@Override
public LoadData<BlurHash> buildLoadData(@NonNull BlurHash blurHash,
                                        int width,
                                        int height,
                                        @NonNull Options options)
{
  return new LoadData<>(new ObjectKey(blurHash.getHash()), new BlurDataFetcher(blurHash));
}
 
源代码6 项目: ToDoList   文件: ClockRecyclerViewAdapter.java
@Override
public void onBindViewHolder(ClockRecyclerViewAdapter.ViewHolder ViewHolder, int i) {

    RequestOptions options2 =new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .skipMemoryCache(true)
            .signature(new ObjectKey(SPUtils.get(context,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    ViewHolder.clock_title.setText(tomatoList.get(tomatoList.size()-1-i).getTitle());
    ViewHolder.work_time.setText(tomatoList.get(tomatoList.size()-1-i).getWorkLength() + " 分钟");
    ViewHolder.clock_card_bg.setImageBitmap(BitmapUtils.readBitMap(context,tomatoList.get(tomatoList.size()-1-i).getImgId()));

}
 
源代码7 项目: ToDoList   文件: TodoRecyclerViewAdapter.java
@Override
public void onBindViewHolder(TodoRecyclerViewAdapter.ViewHolder ViewHolder, int i) {

    RequestOptions options2 =new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .skipMemoryCache(true)
            .signature(new ObjectKey(SPUtils.get(context,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    ViewHolder.todo_title.setText(todosList.get(todosList.size()-1-i).getTitle());
    ViewHolder.todo_desc.setText(todosList.get(todosList.size()-1-i).getDesc());
    ViewHolder.todo_date.setText(todosList.get(todosList.size()-1-i).getDate() + " "+ todosList.get(todosList.size()-1-i).getTime());
    ViewHolder.card_background.setImageBitmap(BitmapUtils.readBitMap(context, todosList.get(todosList.size()-1-i).getImgId()));


    if (todosList.get(todosList.size()-1-i).getIsRepeat() == 1){
        ViewHolder.isRepeat.setText("重复");
        ViewHolder.isRepeat.setTextSize(TypedValue.COMPLEX_UNIT_SP,10);
    }else {
        ViewHolder.isRepeat.setText("单次");
        ViewHolder.isRepeat.setTextSize(TypedValue.COMPLEX_UNIT_SP,10);
    }

    if(todosList.get(todosList.size()-1-i).getRemindTime() <= System.currentTimeMillis() ){
        ViewHolder.timelineView.setMarker(context.getResources().getDrawable(R.drawable.ic_marker));
    }else {
        ViewHolder.timelineView.setMarker(context.getResources().getDrawable(R.drawable.round));
    }


}
 
源代码8 项目: ToDoList   文件: UserDataActivity.java
/**
 * Glide图片加载
 */
private void glideLoad(){

    RequestOptions options_1 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(UserDataActivity.this,"head_signature","")))
            .placeholder(R.drawable.default_photo);

    RequestOptions options_2 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(UserDataActivity.this,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(options_1)
            .into(toolbar_userhead);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(options_1)
            .into(user_head);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(bitmapTransform(new BlurTransformation(25, 3)))
            .apply(options_2)
            .into(top_bg);
}
 
源代码9 项目: science-journal   文件: PictureUtils.java
public static void loadExperimentImage(
    Context context,
    ImageView view,
    AppAccount appAccount,
    String experimentId,
    String relativeFilePath,
    boolean scale) {
  if (isDestroyed(context)) {
    if (Log.isLoggable(TAG, Log.ERROR)) {
      Log.e(TAG, "Trying to load image for destroyed context");
    }
    // Nothing we can do, return
    return;
  }
  File file =
      FileMetadataUtil.getInstance()
          .getExperimentFile(appAccount, experimentId, relativeFilePath);
  if (scale) {
    // Use last modified time as part of the signature to force a glide cache refresh.
    GlideApp.with(context)
        .load(file.getAbsolutePath())
        .placeholder(R.drawable.placeholder)
        .signature(new ObjectKey(file.getPath() + file.lastModified()))
        .centerCrop()
        // caches only the final image, after reducing the resolution
        .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
        .into(view);
  } else {
    // Use last modified time as part of the signature to force a glide cache refresh.
    GlideApp.with(context)
        .load(file.getAbsolutePath())
        .placeholder(R.drawable.placeholder)
        .signature(new ObjectKey(file.getPath() + file.lastModified()))
        .fitCenter()
        // caches only the final image, after reducing the resolution
        .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
        .into(view);
  }
}
 
源代码10 项目: SoloPi   文件: AppIconGlideModule.java
@Nullable
@Override
public LoadData<ByteBuffer> buildLoadData(@NonNull String origin, int width, int height, @NonNull Options options) {
    return new LoadData<>(new ObjectKey(origin),new ApkIconFetcher(context, origin.substring(8)));
}
 
源代码11 项目: leafpicrevived   文件: Media.java
public ObjectKey getSignature() {
    return new ObjectKey(getDateModified() + getPath() + getOrientation());
}
 
源代码12 项目: MusicPlayer   文件: AudioFileCoverLoader.java
@Nullable
@Override
public LoadData<InputStream> buildLoadData(@NonNull AudioFileCover audioFileCover, int width, int height, @NonNull Options options) {
    return new LoadData<InputStream>(new ObjectKey(audioFileCover.filePath),new AudioFileCoverFetcher(audioFileCover));
}
 
源代码13 项目: MusicPlayer   文件: ArtistSignatureUtil.java
public ObjectKey getArtistSignature(String artistName, boolean isLoadOriginal, int whichImage) {
    String value = String.valueOf(getArtistSignatureRaw(artistName));
    return new ObjectKey(artistName+"_"+"original="+isLoadOriginal+"_"+"pos="+whichImage+"_"+String.valueOf(getArtistSignatureRaw(artistName)));
}
 
源代码14 项目: Camera-Roll-Android-App   文件: AlbumItem.java
public Key getGlideSignature() {
    File file = new File(getPath());
    String lastModified = String.valueOf(file.lastModified());
    return new ObjectKey(lastModified);
}
 
源代码15 项目: VinylMusicPlayer   文件: AudioFileCoverLoader.java
@Override
public LoadData<InputStream> buildLoadData(@NonNull AudioFileCover model, int width, int height,
                                           @NonNull Options options) {
    return new LoadData<>(new ObjectKey(model.filePath), new AudioFileCoverFetcher(model));
}
 
源代码16 项目: VinylMusicPlayer   文件: ArtistImageLoader.java
@Override
public LoadData<InputStream> buildLoadData(@NonNull ArtistImage model, int width, int height,
                                           @NonNull Options options) {
    return new LoadData<>(new ObjectKey(model.artistName), new ArtistImageFetcher(context, deezerClient, okhttp, model));
}
 
源代码17 项目: VinylMusicPlayer   文件: ArtistSignatureUtil.java
public ObjectKey getArtistSignature(String artistName) {
    return new ObjectKey(String.valueOf(getArtistSignatureRaw(artistName)));
}
 
源代码18 项目: hipda   文件: OkHttpUrlLoader.java
@Override
public LoadData<InputStream> buildLoadData(@NonNull GlideUrl model, int width, int height, @NonNull Options options) {
    return new LoadData<>(new ObjectKey(model), new ImageStreamFetcher(client, model));
}
 
源代码19 项目: hipda   文件: AvatarLoader.java
@Override
public LoadData<InputStream> buildLoadData(@NonNull AvatarModel model, int width, int height, @NonNull Options options) {
    return new LoadData<>(new ObjectKey(model), new AvatarStreamFetcher(client, model));
}
 
 类所在包
 同包方法