[Android] Medialibrary: folder & video groups equals methods
Geoffrey Métais
git at videolan.org
Tue Oct 8 09:28:10 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Oct 7 18:17:12 2019 +0200| [6777d49514da9a95deb43869a7279bff70fe846c] | committer: Geoffrey Métais
Medialibrary: folder & video groups equals methods
> https://code.videolan.org/videolan/vlc-android/commit/6777d49514da9a95deb43869a7279bff70fe846c
---
.../medialibrary/interfaces/media/AbstractFolder.java | 16 ++++++++++++++++
.../interfaces/media/AbstractVideoGroup.java | 17 +++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractFolder.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractFolder.java
index c578141b0..317d6319f 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractFolder.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractFolder.java
@@ -64,4 +64,20 @@ public abstract class AbstractFolder extends MediaLibraryItem {
super(in);
this.mMrl = in.readString();
}
+
+ public boolean equals(AbstractFolder other) {
+ return mId == other.getId();
+ }
+
+ @Override
+ public boolean equals(MediaLibraryItem other) {
+ if (other instanceof AbstractFolder) return equals((AbstractFolder)other);
+ return super.equals(other);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AbstractFolder) return equals((AbstractFolder)obj);
+ return super.equals(obj);
+ }
}
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractVideoGroup.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractVideoGroup.java
index 87373e61c..5bf8c5bc6 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractVideoGroup.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/AbstractVideoGroup.java
@@ -2,6 +2,7 @@ package org.videolan.medialibrary.interfaces.media;
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.TextUtils;
import org.videolan.medialibrary.MLServiceLocator;
import org.videolan.medialibrary.media.MediaLibraryItem;
@@ -61,4 +62,20 @@ public abstract class AbstractVideoGroup extends MediaLibraryItem {
super(in);
this.mCount = in.readInt();
}
+
+ public boolean equals(AbstractVideoGroup other) {
+ return TextUtils.equals(mTitle, other.getTitle());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AbstractVideoGroup) return equals((AbstractVideoGroup)obj);
+ return super.equals(obj);
+ }
+
+ @Override
+ public boolean equals(MediaLibraryItem other) {
+ if (other instanceof AbstractVideoGroup) return equals((AbstractVideoGroup)other);
+ return super.equals(other);
+ }
}
More information about the Android
mailing list