[Android] Medialibrary: Fix onDeleted callbacks
Geoffrey Métais
git at videolan.org
Wed Sep 5 18:41:08 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 5 18:39:18 2018 +0200| [487a3870090aff51ec4264197b98e284ea03a1f8] | committer: Geoffrey Métais
Medialibrary: Fix onDeleted callbacks
> https://code.videolan.org/videolan/vlc-android/commit/487a3870090aff51ec4264197b98e284ea03a1f8
---
medialibrary/jni/AndroidMediaLibrary.cpp | 9 ++++++++-
medialibrary/jni/medialibrary.cpp | 10 +++++-----
medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 10 +++++-----
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 8ee1c39b4..3722d2f14 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -593,7 +593,14 @@ void AndroidMediaLibrary::onArtistsModified( std::vector<medialibrary::ArtistPtr
void AndroidMediaLibrary::onArtistsDeleted( std::vector<int64_t> ids )
{
-
+ if (m_mediaUpdatedType & (FLAG_MEDIA_UPDATED_AUDIO|FLAG_MEDIA_UPDATED_AUDIO_EMPTY))
+ {
+ JNIEnv *env = getEnv();
+ if (env != NULL || weak_thiz)
+ {
+ env->CallVoidMethod(weak_thiz, p_fields->MediaLibrary.onArtistsDeletedId);
+ }
+ }
}
void AndroidMediaLibrary::onAlbumsAdded( std::vector<medialibrary::AlbumPtr> albums )
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index ade6d1da4..5c30e2eac 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -1818,7 +1818,7 @@ int MediaLibraryJNI_OnLoad(JavaVM *vm, JNIEnv* env)
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onMediaDeletedId,
ml_fields.MediaLibrary.clazz,
- "onMediaDeleted", "([J)V");
+ "onMediaDeleted", "()V");
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onArtistsAddedId,
ml_fields.MediaLibrary.clazz,
@@ -1838,19 +1838,19 @@ int MediaLibraryJNI_OnLoad(JavaVM *vm, JNIEnv* env)
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onArtistsDeletedId,
ml_fields.MediaLibrary.clazz,
- "onArtistsDeleted", "([J)V");
+ "onArtistsDeleted", "()V");
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onAlbumsDeletedId,
ml_fields.MediaLibrary.clazz,
- "onAlbumsDeleted", "([J)V");
+ "onAlbumsDeleted", "()V");
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onGenresDeletedId,
ml_fields.MediaLibrary.clazz,
- "onGenresDeleted", "([J)V");
+ "onGenresDeleted", "()V");
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onPlaylistsDeletedId,
ml_fields.MediaLibrary.clazz,
- "onPlaylistsDeleted", "([J)V");
+ "onPlaylistsDeleted", "()V");
GET_ID(GetMethodID,
ml_fields.MediaLibrary.onArtistsModifiedId,
ml_fields.MediaLibrary.clazz,
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 60291a8c1..703d9c9c8 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -456,7 +456,7 @@ public class Medialibrary {
}
@SuppressWarnings("unused")
- public void onMediaDeleted(long[] ids) {
+ public void onMediaDeleted() {
synchronized (mMediaCbs) {
for (MediaCb cb : mMediaCbs) cb.onMediaDeleted();
}
@@ -477,7 +477,7 @@ public class Medialibrary {
}
@SuppressWarnings("unused")
- public void onArtistsDeleted(long[] ids) {
+ public void onArtistsDeleted() {
synchronized (mArtistsCbs) {
for (ArtistsCb cb : mArtistsCbs) cb.onArtistsDeleted();
}
@@ -498,7 +498,7 @@ public class Medialibrary {
}
@SuppressWarnings("unused")
- public void onAlbumsDeleted(long[] ids) {
+ public void onAlbumsDeleted() {
synchronized (mAlbumsCbs) {
for (AlbumsCb cb : mAlbumsCbs) cb.onAlbumsDeleted();
}
@@ -519,7 +519,7 @@ public class Medialibrary {
}
@SuppressWarnings("unused")
- public void onGenresDeleted(long[] ids) {
+ public void onGenresDeleted() {
synchronized (mGenreCbs) {
for (GenresCb cb : mGenreCbs) cb.onGenresDeleted();
}
@@ -540,7 +540,7 @@ public class Medialibrary {
}
@SuppressWarnings("unused")
- public void onPlaylistsDeleted(long[] ids) {
+ public void onPlaylistsDeleted() {
synchronized (mPlaylistCbs) {
for (PlaylistsCb cb : mPlaylistCbs) cb.onPlaylistsDeleted();
}
More information about the Android
mailing list