PlayerHater icon indicating copy to clipboard operation
PlayerHater copied to clipboard

AlbumArt is not Loading In Notification.

Open djahmednawaz opened this issue 10 years ago • 4 comments

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. device-2014-11-21-172246

djahmednawaz avatar Nov 21 '14 12:11 djahmednawaz

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'
}

djahmednawaz avatar Dec 22 '14 09:12 djahmednawaz

@chrisrhoden Could we add this fix into the lib please?

danvass avatar Sep 30 '15 12:09 danvass

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.

cqr avatar Sep 30 '15 12:09 cqr

@chrisrhoden good to see you on project back. :)

Anawaz avatar Sep 30 '15 13:09 Anawaz