com.bumptech.glide.signature.MediaStoreSignature Java Examples
The following examples show how to use
com.bumptech.glide.signature.MediaStoreSignature.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SongFileAdapter.java From Music-Player with GNU General Public License v3.0 | 6 votes |
@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 = ImageUtil.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); } }
Example #2
Source File: SongFileAdapter.java From Orin with GNU General Public License v3.0 | 6 votes |
@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); } }
Example #3
Source File: SongFileAdapter.java From RetroMusicPlayer with GNU General Public License v3.0 | 6 votes |
@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); } }
Example #4
Source File: SongFileAdapter.java From VinylMusicPlayer with GNU General Public License v3.0 | 6 votes |
@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 = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor); GlideApp.with(activity) .load(new AudioFileCover(file.getPath())) .transition(GenericTransitionOptions.with(android.R.anim.fade_in)) .apply(new RequestOptions() .diskCacheStrategy(DiskCacheStrategy.NONE) .error(error) .placeholder(error) .signature(new MediaStoreSignature("", file.lastModified(), 0))) .into(holder.image); } }
Example #5
Source File: RecentPhotoViewRail.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@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); GlideApp.with(getContext().getApplicationContext()) .load(uri) .signature(signature) .diskCacheStrategy(DiskCacheStrategy.NONE) .into(viewHolder.imageView); viewHolder.imageView.setOnClickListener(v -> { if (clickedListener != null) clickedListener.onItemClicked(uri); }); }
Example #6
Source File: SongFileAdapter.java From Phonograph with GNU General Public License v3.0 | 6 votes |
@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 = ImageUtil.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); } }
Example #7
Source File: RecentPhotoViewRail.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public void onBindItemViewHolder(RecentPhotoViewHolder viewHolder, @NonNull Cursor cursor) { viewHolder.imageView.setImageDrawable(null); String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATA)); 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)); String bucketId = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.BUCKET_ID)); int orientation = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION)); long size = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.SIZE)); int width = cursor.getInt(cursor.getColumnIndexOrThrow(getWidthColumn(orientation))); int height = cursor.getInt(cursor.getColumnIndexOrThrow(getHeightColumn(orientation))); final Uri uri = Uri.fromFile(new File(path)); Key signature = new MediaStoreSignature(mimeType, dateModified, orientation); GlideApp.with(getContext().getApplicationContext()) .load(uri) .signature(signature) .diskCacheStrategy(DiskCacheStrategy.NONE) .transition(DrawableTransitionOptions.withCrossFade()) .into(viewHolder.imageView); viewHolder.imageView.setOnClickListener(v -> { if (clickedListener != null) clickedListener.onItemClicked(uri, mimeType, bucketId, dateTaken, width, height, size); }); }
Example #8
Source File: FilmstripItemBase.java From Camera2 with Apache License 2.0 | 5 votes |
protected final Key generateSignature(FilmstripItemData data) { // Per Glide docs, make default mime type be the empty String String mimeType = (data.getMimeType() == null) ? "" : data.getMimeType(); long modTimeSeconds = (data.getLastModifiedDate() == null) ? 0 : data.getLastModifiedDate().getTime() / 1000; return new MediaStoreSignature(mimeType, modTimeSeconds, data.getOrientation()); }
Example #9
Source File: SongGlideRequest.java From Music-Player with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #10
Source File: SongGlideRequest.java From MusicPlayer with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #11
Source File: SongGlideRequest.java From Orin with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #12
Source File: SongGlideRequest.java From RetroMusicPlayer with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #13
Source File: VinylGlideExtension.java From VinylMusicPlayer with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #14
Source File: SongGlideRequest.java From Phonograph with GNU General Public License v3.0 | 4 votes |
public static Key createSignature(Song song) { return new MediaStoreSignature("", song.dateModified, 0); }
Example #15
Source File: RequestManager.java From giffun with Apache License 2.0 | 2 votes |
/** * Returns a request builder that uses {@link android.provider.MediaStore.Images.Thumbnails} and * {@link android.provider.MediaStore.Video.Thumbnails} to retrieve pre-generated thumbnails for the given uri if * available and uses the given additional data to build a unique signature for cache invalidation. * * @see #loadFromMediaStore(Uri) * @see #load(Uri) * @see GenericRequestBuilder#signature(Key) * @see MediaStoreSignature * * @deprecated Use {@link #loadFromMediaStore(Uri)}, * {@link MediaStoreSignature}, and * {@link DrawableRequestBuilder#signature(Key)} instead. Scheduled to be * removed in Glide 4.0. * @param uri The uri representing the media. * @param mimeType The mime type of the media store media. Ok to default to empty string "". See * {@link android.provider.MediaStore.Images.ImageColumns#MIME_TYPE} or * {@link android.provider.MediaStore.Video.VideoColumns#MIME_TYPE}. * @param dateModified The date modified time of the media store media. Ok to default to 0. See * {@link android.provider.MediaStore.Images.ImageColumns#DATE_MODIFIED} or * {@link android.provider.MediaStore.Video.VideoColumns#DATE_MODIFIED}. * @param orientation The orientation of the media store media. Ok to default to 0. See * {@link android.provider.MediaStore.Images.ImageColumns#ORIENTATION}. */ @Deprecated public DrawableTypeRequest<Uri> loadFromMediaStore(Uri uri, String mimeType, long dateModified, int orientation) { Key signature = new MediaStoreSignature(mimeType, dateModified, orientation); return (DrawableTypeRequest<Uri>) loadFromMediaStore(uri).signature(signature); }