[Android] Improve MediaLibraryItem equals

Geoffrey Métais git at videolan.org
Tue Dec 13 16:22:32 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Dec 13 10:14:58 2016 +0100| [b8544adba0c8b1c72790440b15b1b550ae51fa95] | committer: Geoffrey Métais

Improve MediaLibraryItem equals

> https://code.videolan.org/videolan/vlc-android/commit/b8544adba0c8b1c72790440b15b1b550ae51fa95
---

 .../src/org/videolan/medialibrary/media/MediaLibraryItem.java       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaLibraryItem.java b/medialibrary/src/org/videolan/medialibrary/media/MediaLibraryItem.java
index 9f878d4..f8d8f23 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaLibraryItem.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaLibraryItem.java
@@ -107,8 +107,12 @@ public abstract class MediaLibraryItem implements Parcelable {
             return false;
         if (getItemType() != other.getItemType())
             return false;
+        if (mId != 0)
+            return mId == other.getId();
         if (getItemType() == TYPE_DUMMY)
             return TextUtils.equals(getTitle(), other.getTitle());
-        return mId == other.getId();
+        if (getItemType() == TYPE_MEDIA)
+            return TextUtils.equals(((MediaWrapper)this).getLocation(), ((MediaWrapper)other).getLocation());
+        return false;
     }
 }



More information about the Android mailing list