diff options
Diffstat (limited to 'apps/hosted/notification.c')
-rw-r--r-- | apps/hosted/notification.c | 13 |
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 @@ | |||
24 | #include "notification.h" | 24 | #include "notification.h" |
25 | #include "appevents.h" | 25 | #include "appevents.h" |
26 | #include "metadata.h" | 26 | #include "metadata.h" |
27 | #include "albumart.h" | ||
27 | #include "misc.h" | 28 | #include "misc.h" |
28 | #include "debug.h" | 29 | #include "debug.h" |
29 | 30 | ||
@@ -33,8 +34,10 @@ extern jobject RockboxService_instance; | |||
33 | 34 | ||
34 | static jmethodID updateNotification, finishNotification; | 35 | static jmethodID updateNotification, finishNotification; |
35 | static jobject NotificationManager_instance; | 36 | static jobject NotificationManager_instance; |
36 | static jstring title, artist, album; | 37 | static jstring title, artist, album, albumart; |
37 | 38 | ||
39 | /* completely arbitrary dimensions. neded for find_albumart() */ | ||
40 | const struct dim dim = { .width = 200, .height = 200 }; | ||
38 | #define NZV(a) (a && a[0]) | 41 | #define NZV(a) (a && a[0]) |
39 | 42 | ||
40 | /* | 43 | /* |
@@ -49,6 +52,7 @@ static void track_changed_callback(void *param) | |||
49 | e->DeleteLocalRef(env_ptr, title); | 52 | e->DeleteLocalRef(env_ptr, title); |
50 | e->DeleteLocalRef(env_ptr, artist); | 53 | e->DeleteLocalRef(env_ptr, artist); |
51 | e->DeleteLocalRef(env_ptr, album); | 54 | e->DeleteLocalRef(env_ptr, album); |
55 | e->DeleteLocalRef(env_ptr, albumart); | ||
52 | 56 | ||
53 | char buf[200]; | 57 | char buf[200]; |
54 | const char * ptitle = id3->title; | 58 | const char * ptitle = id3->title; |
@@ -62,8 +66,12 @@ static void track_changed_callback(void *param) | |||
62 | artist = e->NewStringUTF(env_ptr, id3->artist ?: ""); | 66 | artist = e->NewStringUTF(env_ptr, id3->artist ?: ""); |
63 | album = e->NewStringUTF(env_ptr, id3->album ?: ""); | 67 | album = e->NewStringUTF(env_ptr, id3->album ?: ""); |
64 | 68 | ||
69 | albumart = NULL; | ||
70 | if (find_albumart(id3, buf, sizeof(buf), &dim)) | ||
71 | albumart = e->NewStringUTF(env_ptr, buf); | ||
72 | |||
65 | e->CallVoidMethod(env_ptr, NotificationManager_instance, | 73 | e->CallVoidMethod(env_ptr, NotificationManager_instance, |
66 | updateNotification, title, artist, album); | 74 | updateNotification, title, artist, album, albumart); |
67 | } | 75 | } |
68 | } | 76 | } |
69 | 77 | ||
@@ -94,6 +102,7 @@ void notification_init(void) | |||
94 | updateNotification = e->GetMethodID(env_ptr, class, "updateNotification", | 102 | updateNotification = e->GetMethodID(env_ptr, class, "updateNotification", |
95 | "(Ljava/lang/String;" | 103 | "(Ljava/lang/String;" |
96 | "Ljava/lang/String;" | 104 | "Ljava/lang/String;" |
105 | "Ljava/lang/String;" | ||
97 | "Ljava/lang/String;)V"); | 106 | "Ljava/lang/String;)V"); |
98 | finishNotification = e->GetMethodID(env_ptr, class, "finishNotification", | 107 | finishNotification = e->GetMethodID(env_ptr, class, "finishNotification", |
99 | "()V"); | 108 | "()V"); |