Java 类com.bumptech.glide.signature.MediaStoreSignature 实例源码

项目:Orin    文件:SongFileAdapter.java   
@SuppressWarnings("ConstantConditions")
protected void loadFileImage(File file, final ViewHolder holder) {
    final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor);
    if (file.isDirectory()) {
        holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
        holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
    } else {
        Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
        Glide.with(activity)
                .load(new AudioFileCover(file.getPath()))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .error(error)
                .placeholder(error)
                .animate(android.R.anim.fade_in)
                .signature(new MediaStoreSignature("", file.lastModified(), 0))
                .into(holder.image);
    }
}
项目:RetroMusicPlayer    文件:SongFileAdapter.java   
@SuppressWarnings("ConstantConditions")
protected void loadFileImage(File file, final ViewHolder holder) {
    final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor);
    if (file.isDirectory()) {
        holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
        holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
    } else {
        Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
        Glide.with(activity)
                .load(new AudioFileCover(file.getPath()))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .error(error)
                .placeholder(error)
                .animate(android.R.anim.fade_in)
                .signature(new MediaStoreSignature("", file.lastModified(), 0))
                .into(holder.image);
    }
}
项目:Phonograph    文件:SongFileAdapter.java   
@SuppressWarnings("ConstantConditions")
protected void loadFileImage(File file, final ViewHolder holder) {
    final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor);
    if (file.isDirectory()) {
        holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
        holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
    } else {
        Drawable error = Util.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
        Glide.with(activity)
                .load(new AudioFileCover(file.getPath()))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .error(error)
                .placeholder(error)
                .animate(android.R.anim.fade_in)
                .signature(new MediaStoreSignature("", file.lastModified(), 0))
                .into(holder.image);
    }
}
项目:GitHub    文件:RecyclerAdapter.java   
@Override
public void onBindViewHolder(ListViewHolder viewHolder, int position) {
  MediaStoreData current = data.get(position);

  Key signature =
      new MediaStoreSignature(current.mimeType, current.dateModified, current.orientation);

  requestBuilder
      .clone()
      .signature(signature)
      .load(current.uri)
      .into(viewHolder.image);
}
项目:GitHub    文件:RecyclerAdapter.java   
@Override
public RequestBuilder<Drawable> getPreloadRequestBuilder(MediaStoreData item) {
  MediaStoreSignature signature =
      new MediaStoreSignature(item.mimeType, item.dateModified, item.orientation);
  return requestBuilder
      .clone()
      .signature(signature)
      .load(item.uri);
}
项目:GitHub    文件:RecyclerAdapter.java   
@Override
public void onBindViewHolder(ListViewHolder viewHolder, int position) {
  MediaStoreData current = data.get(position);

  Key signature =
      new MediaStoreSignature(current.mimeType, current.dateModified, current.orientation);

  requestBuilder
      .clone()
      .signature(signature)
      .load(current.uri)
      .into(viewHolder.image);
}
项目:GitHub    文件:RecyclerAdapter.java   
@NonNull
@Override
public RequestBuilder<GifDrawable> getPreloadRequestBuilder(MediaStoreData item) {
  MediaStoreSignature signature =
      new MediaStoreSignature(item.mimeType, item.dateModified, item.orientation);
  return requestBuilder
      .clone()
      .signature(signature)
      .load(item.uri);
}
项目:PeSanKita-android    文件:RecentPhotoViewRail.java   
@Override
public void onBindItemViewHolder(RecentPhotoViewHolder viewHolder, @NonNull Cursor cursor) {
  viewHolder.imageView.setImageDrawable(null);

  long   id           = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns._ID));
  long   dateTaken    = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_TAKEN));
  long   dateModified = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_MODIFIED));
  String mimeType     = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.MIME_TYPE));
  int    orientation  = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION));

  final Uri uri = Uri.withAppendedPath(baseUri, Long.toString(id));

  Key signature = new MediaStoreSignature(mimeType, dateModified, orientation);

  Glide.with(getContext())
       .fromMediaStore()
       .load(uri)
       .signature(signature)
       .diskCacheStrategy(DiskCacheStrategy.NONE)
       .into(viewHolder.imageView);

  viewHolder.imageView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      if (clickedListener != null) clickedListener.onItemClicked(uri);
    }
  });

}
项目:Cable-Android    文件:RecentPhotoViewRail.java   
@Override
public void onBindItemViewHolder(RecentPhotoViewHolder viewHolder, @NonNull Cursor cursor) {
  viewHolder.imageView.setImageDrawable(null);

  long   id           = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns._ID));
  long   dateTaken    = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_TAKEN));
  long   dateModified = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATE_MODIFIED));
  String mimeType     = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.MIME_TYPE));
  int    orientation  = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION));

  final Uri uri = Uri.withAppendedPath(baseUri, Long.toString(id));

  Key signature = new MediaStoreSignature(mimeType, dateModified, orientation);

  Glide.with(getContext())
       .fromMediaStore()
       .load(uri)
       .signature(signature)
       .diskCacheStrategy(DiskCacheStrategy.NONE)
       .into(viewHolder.imageView);

  viewHolder.imageView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      if (clickedListener != null) clickedListener.onItemClicked(uri);
    }
  });

}
项目:Orin    文件:SongGlideRequest.java   
public static Key createSignature(Song song) {
    return new MediaStoreSignature("", song.dateModified, 0);
}
项目:PictureShow    文件:TimeLineAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder v = null;
    int type = getItem(position).getItemType();
    if(convertView != null) {
        v = (ViewHolder)convertView.getTag();
        if(v == null) {
            v = new ViewHolder();
            v.imgView = convertView.findViewById(R.id.img);
            v.videoIcon = convertView.findViewById(R.id.videoIcon);
        }
    } else {
        convertView = attachActivity.getLayoutInflater().inflate(R.layout.picshow_img_item,null);
        v = new ViewHolder();
        v.imgView = convertView.findViewById(R.id.img);
        v.videoIcon = convertView.findViewById(R.id.videoIcon);
    }
    convertView.setTag(v);
    if(v != null && v.imgView != null) {
        if(thubNailSize != 0) {
            GlideApp.with(attachActivity)
                    .load(getItem(position).getPath())
                    .override(thubNailSize)
                    .placeholder(R.drawable.other)
                    .centerCrop()
                    .dontAnimate()
                    .format(DecodeFormat.PREFER_RGB_565)
                    .into(v.imgView);
        } else {
            GlideApp.with(attachActivity)
                    .load(getItem(position).getPath())
                    .placeholder(R.drawable.other)
                    .centerCrop()
                    .dontAnimate()
                    .format(DecodeFormat.PREFER_RGB_565)
                    .signature(new MediaStoreSignature(type == MediaSetUtils.TYPE_VIDEO ? "video/*" : "image/*"
                            ,getItem(position).getDateToken(), 0))
                    .into(v.imgView);
        }
        if(type == MediaSetUtils.TYPE_VIDEO)
            v.videoIcon.setVisibility(View.VISIBLE);
        else
            v.videoIcon.setVisibility(View.GONE);
    }
    return convertView;
}
项目:RetroMusicPlayer    文件:SongGlideRequest.java   
static Key createSignature(Song song) {
    return new MediaStoreSignature("", song.dateModified, 0);
}
项目:Phonograph    文件:SongGlideRequest.java   
public static Key createSignature(Song song) {
    return new MediaStoreSignature("", song.dateModified, 0);
}