diff --git a/app/src/main/java/com/kabouzeid/gramophone/adapter/AbsMultiSelectAdapter.java b/app/src/main/java/com/kabouzeid/gramophone/adapter/AbsMultiSelectAdapter.java index e24165ef..d2d07873 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/adapter/AbsMultiSelectAdapter.java +++ b/app/src/main/java/com/kabouzeid/gramophone/adapter/AbsMultiSelectAdapter.java @@ -27,10 +27,15 @@ public abstract class AbsMultiSelectAdapter 1) cab.setTitle(String.valueOf(size)); } } diff --git a/app/src/main/java/com/kabouzeid/gramophone/model/Album.java b/app/src/main/java/com/kabouzeid/gramophone/model/Album.java index f3a000d0..5ebf3844 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/model/Album.java +++ b/app/src/main/java/com/kabouzeid/gramophone/model/Album.java @@ -1,5 +1,7 @@ package com.kabouzeid.gramophone.model; +import android.text.TextUtils; + /** * @author Karim Abou Zeid (kabouzeid) */ @@ -30,4 +32,48 @@ public class Album { songCount = -1; year = -1; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + id; + result = prime * result + (title == null ? 0 : title.hashCode()); + result = prime * result + (artistName == null ? 0 : artistName.hashCode()); + result = prime * result + songCount; + result = prime * result + year; + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Album other = (Album) obj; + if (id != other.id) { + return false; + } + if (!TextUtils.equals(title, other.title)) { + return false; + } + if (!TextUtils.equals(artistName, other.artistName)) { + return false; + } + if (songCount != other.songCount) { + return false; + } + return year == other.year; + } + + @Override + public String toString() { + return title; + } }