summaryrefslogtreecommitdiffstats
path: root/apps/hosted/notification.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-02-27 20:47:44 +0000
committerThomas Martitz <kugel@rockbox.org>2011-02-27 20:47:44 +0000
commit883ff8507e42f7fbba6416e60fb116164219aa5f (patch)
tree3708181c7a19309f02bb4b93d073745c119338a2 /apps/hosted/notification.c
parent952d82b7bd20f1bef7f3c316ebeb71c0d1e6d20b (diff)
downloadrockbox-883ff8507e42f7fbba6416e60fb116164219aa5f.tar.gz
rockbox-883ff8507e42f7fbba6416e60fb116164219aa5f.zip
Android: Show cover art in the widget (including option to hide it).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29437 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/hosted/notification.c')
-rw-r--r--apps/hosted/notification.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/hosted/notification.c b/apps/hosted/notification.c
index 339c92acd3..bde91b039f 100644
--- a/apps/hosted/notification.c
+++ b/apps/hosted/notification.c
@@ -24,6 +24,7 @@
#include "notification.h"
#include "appevents.h"
#include "metadata.h"
+#include "albumart.h"
#include "misc.h"
#include "debug.h"
@@ -33,8 +34,10 @@ extern jobject RockboxService_instance;
static jmethodID updateNotification, finishNotification;
static jobject NotificationManager_instance;
-static jstring title, artist, album;
+static jstring title, artist, album, albumart;
+/* completely arbitrary dimensions. neded for find_albumart() */
+const struct dim dim = { .width = 200, .height = 200 };
#define NZV(a) (a && a[0])
/*
@@ -49,6 +52,7 @@ static void track_changed_callback(void *param)
e->DeleteLocalRef(env_ptr, title);
e->DeleteLocalRef(env_ptr, artist);
e->DeleteLocalRef(env_ptr, album);
+ e->DeleteLocalRef(env_ptr, albumart);
char buf[200];
const char * ptitle = id3->title;
@@ -62,8 +66,12 @@ static void track_changed_callback(void *param)
artist = e->NewStringUTF(env_ptr, id3->artist ?: "");
album = e->NewStringUTF(env_ptr, id3->album ?: "");
+ albumart = NULL;
+ if (find_albumart(id3, buf, sizeof(buf), &dim))
+ albumart = e->NewStringUTF(env_ptr, buf);
+
e->CallVoidMethod(env_ptr, NotificationManager_instance,
- updateNotification, title, artist, album);
+ updateNotification, title, artist, album, albumart);
}
}
@@ -94,6 +102,7 @@ void notification_init(void)
updateNotification = e->GetMethodID(env_ptr, class, "updateNotification",
"(Ljava/lang/String;"
"Ljava/lang/String;"
+ "Ljava/lang/String;"
"Ljava/lang/String;)V");
finishNotification = e->GetMethodID(env_ptr, class, "finishNotification",
"()V");