Replaced Ion with Glide. Big performance boost, and should also fix the FCs many people get because of recycled bitmaps. Fixed the ripple flickering by using ?selectableItemBackground on Lollipop again instead of custom ripple. Search is broken for now, remake in progress.
This commit is contained in:
parent
c75ab6bf15
commit
ee2b661eb4
34 changed files with 448 additions and 667 deletions
|
|
@ -1,16 +1,9 @@
|
|||
package com.kabouzeid.gramophone.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.koushikdutta.ion.Ion;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class Album implements SearchEntry {
|
||||
public class Album {
|
||||
|
||||
public final int id;
|
||||
public int artistId;
|
||||
|
|
@ -36,31 +29,4 @@ public class Album implements SearchEntry {
|
|||
songCount = -1;
|
||||
year = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubTitle() {
|
||||
return artistName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(final Context context, final ImageView imageView) {
|
||||
imageView.setImageResource(R.drawable.default_album_art);
|
||||
imageView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Ion.with(context)
|
||||
.load(MusicUtil.getAlbumArtUri(id).toString())
|
||||
.withBitmap()
|
||||
.resize(imageView.getWidth(), imageView.getHeight())
|
||||
.centerCrop()
|
||||
.error(R.drawable.default_album_art)
|
||||
.intoImageView(imageView);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,9 @@
|
|||
package com.kabouzeid.gramophone.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistThumbnailUrlLoader;
|
||||
import com.koushikdutta.ion.Ion;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class Artist implements SearchEntry {
|
||||
public class Artist {
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final int albumCount;
|
||||
|
|
@ -29,36 +22,4 @@ public class Artist implements SearchEntry {
|
|||
songCount = -1;
|
||||
albumCount = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubTitle() {
|
||||
return songCount + " Songs | " + albumCount + " Albums";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(final Context context, final ImageView imageView) {
|
||||
imageView.setImageResource(R.drawable.default_artist_image);
|
||||
LastFMArtistThumbnailUrlLoader.loadArtistThumbnailUrl(context, name, false, new LastFMArtistThumbnailUrlLoader.ArtistThumbnailUrlLoaderCallback() {
|
||||
@Override
|
||||
public void onArtistThumbnailUrlLoaded(final String url) {
|
||||
imageView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Ion.with(context)
|
||||
.load(url)
|
||||
.withBitmap()
|
||||
.resize(imageView.getWidth(), imageView.getHeight())
|
||||
.centerCrop()
|
||||
.error(R.drawable.default_artist_image)
|
||||
.intoImageView(imageView);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package com.kabouzeid.gramophone.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public interface SearchEntry {
|
||||
String getTitle();
|
||||
|
||||
String getSubTitle();
|
||||
|
||||
void loadImage(Context context, ImageView imageView);
|
||||
}
|
||||
|
|
@ -1,14 +1,11 @@
|
|||
package com.kabouzeid.gramophone.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class Song implements Serializable, SearchEntry {
|
||||
public class Song implements Serializable {
|
||||
|
||||
public int id;
|
||||
public final int albumId;
|
||||
|
|
@ -41,19 +38,4 @@ public class Song implements Serializable, SearchEntry {
|
|||
this.duration = -1;
|
||||
this.trackNumber = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubTitle() {
|
||||
return artistName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(Context context, ImageView imageView) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue