Disabled Glides diskcache for album arts and added placeholders to workaround the fact that the lib needs a bit to long to set the error drawable.
This commit is contained in:
parent
ee2b661eb4
commit
d3c6872438
14 changed files with 30 additions and 3 deletions
|
|
@ -14,6 +14,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.afollestad.materialdialogs.util.DialogUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.Request;
|
||||
|
|
@ -65,13 +66,14 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
|
|||
|
||||
resetColors(holder.title, holder.artist, holder.footer);
|
||||
|
||||
|
||||
holder.title.setText(album.title);
|
||||
holder.artist.setText(album.artistName);
|
||||
holder.albumArt.setTag(
|
||||
Glide.with(activity)
|
||||
.loadFromMediaStore(MusicUtil.getAlbumArtUri(album.id))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(R.drawable.default_album_art)
|
||||
.placeholder(R.drawable.default_album_art)
|
||||
.listener(new RequestListener<Uri, GlideDrawable>() {
|
||||
@Override
|
||||
public boolean onException(Exception e, Uri model, Target<GlideDrawable> target, boolean isFirstResource) {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
|
|||
Glide.with(activity)
|
||||
.load(url)
|
||||
.error(R.drawable.default_artist_image)
|
||||
.placeholder(R.drawable.default_artist_image)
|
||||
.into(holder.artistImage);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.model.Album;
|
||||
|
|
@ -60,7 +61,9 @@ public class ArtistAlbumAdapter extends RecyclerView.Adapter<ArtistAlbumAdapter.
|
|||
|
||||
holder.albumArt.setTag(Glide.with(activity)
|
||||
.loadFromMediaStore(MusicUtil.getAlbumArtUri(album.id))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(R.drawable.default_album_art)
|
||||
.placeholder(R.drawable.default_album_art)
|
||||
.into(holder.albumArt)
|
||||
.getRequest()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import android.widget.PopupMenu;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.helper.MenuItemClickHelper;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
|
@ -49,7 +50,9 @@ public class ArtistSongAdapter extends ArrayAdapter<Song> {
|
|||
|
||||
Glide.with(activity)
|
||||
.loadFromMediaStore(MusicUtil.getAlbumArtUri(song.albumId))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(R.drawable.default_album_art)
|
||||
.placeholder(R.drawable.default_album_art)
|
||||
.into(albumArt);
|
||||
|
||||
final ImageView overflowButton = (ImageView) convertView.findViewById(R.id.menu);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import android.widget.PopupMenu;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.helper.MenuItemClickHelper;
|
||||
|
|
@ -64,7 +65,9 @@ public class PlaylistSongAdapter extends RecyclerView.Adapter<PlaylistSongAdapte
|
|||
holder.albumArt.setTag(
|
||||
Glide.with(activity)
|
||||
.loadFromMediaStore(MusicUtil.getAlbumArtUri(song.albumId))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(R.drawable.default_album_art)
|
||||
.placeholder(R.drawable.default_album_art)
|
||||
.into(holder.albumArt)
|
||||
.getRequest()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.afollestad.materialdialogs.ThemeSingleton;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.kabouzeid.gramophone.App;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
|
|
@ -80,7 +81,9 @@ public class SongAdapter extends RecyclerView.Adapter<SongAdapter.ViewHolder> {
|
|||
holder.albumArt.setTag(
|
||||
Glide.with(activity)
|
||||
.loadFromMediaStore(MusicUtil.getAlbumArtUri(song.albumId))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(R.drawable.default_album_art)
|
||||
.placeholder(R.drawable.default_album_art)
|
||||
.into(holder.albumArt)
|
||||
.getRequest()
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue