diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/hosted/notification.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/hosted/notification.c b/apps/hosted/notification.c index 3c623aad1d..fa8c286808 100644 --- a/apps/hosted/notification.c +++ b/apps/hosted/notification.c | |||
@@ -30,7 +30,7 @@ extern JNIEnv *env_ptr; | |||
30 | extern jclass RockboxService_class; | 30 | extern jclass RockboxService_class; |
31 | extern jobject RockboxService_instance; | 31 | extern jobject RockboxService_instance; |
32 | 32 | ||
33 | static jmethodID updateNotification; | 33 | static jmethodID updateNotification, finishNotification; |
34 | static jobject NotificationManager_instance; | 34 | static jobject NotificationManager_instance; |
35 | static jstring title, artist, album; | 35 | static jstring title, artist, album; |
36 | 36 | ||
@@ -66,6 +66,16 @@ static void track_changed_callback(void *param) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | /* | ||
70 | * notify about track finishing */ | ||
71 | static void track_finished_callback(void *param) | ||
72 | { | ||
73 | (void)param; | ||
74 | JNIEnv e = *env_ptr; | ||
75 | e->CallVoidMethod(env_ptr, NotificationManager_instance, | ||
76 | finishNotification); | ||
77 | } | ||
78 | |||
69 | void notification_init(void) | 79 | void notification_init(void) |
70 | { | 80 | { |
71 | JNIEnv e = *env_ptr; | 81 | JNIEnv e = *env_ptr; |
@@ -79,6 +89,9 @@ void notification_init(void) | |||
79 | "(Ljava/lang/String;" | 89 | "(Ljava/lang/String;" |
80 | "Ljava/lang/String;" | 90 | "Ljava/lang/String;" |
81 | "Ljava/lang/String;)V"); | 91 | "Ljava/lang/String;)V"); |
92 | finishNotification = e->GetMethodID(env_ptr, class, "finishNotification", | ||
93 | "()V"); | ||
82 | 94 | ||
83 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback); | 95 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback); |
96 | add_event(PLAYBACK_EVENT_TRACK_FINISH, false, track_finished_callback); | ||
84 | } | 97 | } |