PlayerHater
PlayerHater copied to clipboard
AlbumArt is not Loading In Notification.
Following is the object of my song which I am playing.
song = new Song() {
@Override
public String getTitle() {
return "Song Name Test";
}
@Override
public String getArtist() {
return "Artist Name Test";
}
@Override
public String getAlbumTitle() {
return "Album Name Test";
}
@Override
public Uri getAlbumArt() {
return Uri.parse("http://m.taazi.com/uploads/thumbs/album_cover.jpg");
}
@Override
public Uri getUri() {
return Uri.parse("http://sound21.mp3slash.net/indian/killdil/%5BSongs.PK%5D%2008%20-%20Kill%20Dil%20-%20Nakhriley.mp3");
}
@Override
public Bundle getExtra() {
return null;
}
};
In notification AlbumArt is not being loaded.
following is the screenshot.
I changed code in "setImageViewUri" funtion TouchableNotificationPlugin.java as following.
protected void setImageViewUri(final int id, final Uri contentUri) {
if (mNotificationView != null && contentUri != null) {
//mNotificationView.setImageViewUri(id, contentUri);
Handler uiHandler = new Handler(Looper.getMainLooper());
uiHandler.post(new Runnable(){
@Override
public void run() {
Picasso.with(getContext()).load(contentUri.toString())
.into(mNotificationView, id, NOTIFICATION_NU, getNotification());
}
});
}
}
I am using Picasso for loading images. Add following in playerhater build file.
dependencies {
compile 'com.squareup.picasso:picasso:2.3.2'
}
@chrisrhoden Could we add this fix into the lib please?
Sure, with a couple changes.
First, I'd rather avoid the dependency on the external library.
Second, I'd want to make sure this doesn't break content:// and android-resource:// URIs.
If you can fix #1 and answer #2, send a pull request and I'll get it merged and released once you sign a contributor agreement.
@chrisrhoden good to see you on project back. :)