Prepared everything for multi-selection and implemented it in the song view for now.

This commit is contained in:
Karim Abou Zeid 2015-05-24 20:33:14 +02:00
commit 8503eb4e36
55 changed files with 348 additions and 108 deletions

View file

@ -11,17 +11,15 @@ public class Album {
public final String artistName;
public final int songCount;
public final int year;
public final String albumArtPath; //used as cache key
public Album(final int id, final String title, final String artistName, final int artistId,
final int songNumber, final int albumYear, final String albumArtPath) {
final int songNumber, final int albumYear) {
this.id = id;
this.title = title;
this.artistName = artistName;
this.artistId = artistId;
songCount = songNumber;
year = albumYear;
this.albumArtPath = albumArtPath != null ? albumArtPath : "";
}
public Album() {
@ -31,6 +29,5 @@ public class Album {
this.artistId = -1;
songCount = -1;
year = -1;
this.albumArtPath = "";
}
}

View file

@ -8,8 +8,8 @@ public class PlaylistSong extends Song {
public final int idInPlayList;
public PlaylistSong(final int id, final int albumId, final int artistId, final String title, final String artistName,
final String albumName, final long duration, final int trackNumber, final int playlistId, final int idInPlayList, final long dateModified) {
super(id, albumId, artistId, title, artistName, albumName, duration, trackNumber, dateModified);
final String albumName, final long duration, final int trackNumber, final int playlistId, final int idInPlayList) {
super(id, albumId, artistId, title, artistName, albumName, duration, trackNumber);
this.playlistId = playlistId;
this.idInPlayList = idInPlayList;
}

View file

@ -1,5 +1,7 @@
package com.kabouzeid.gramophone.model;
import android.text.TextUtils;
import java.io.Serializable;
/**
@ -17,10 +19,9 @@ public class Song implements Serializable {
public final String albumName;
public final long duration;
public final int trackNumber;
public final long dateModified; //used as cache key
public Song(final int id, final int albumId, final int artistId, final String title, final String artistName,
final String albumName, final long duration, final int trackNumber, final long dateModified) {
final String albumName, final long duration, final int trackNumber) {
this.id = id;
this.albumId = albumId;
this.artistId = artistId;
@ -29,7 +30,6 @@ public class Song implements Serializable {
this.albumName = albumName;
this.duration = duration;
this.trackNumber = trackNumber;
this.dateModified = dateModified;
}
public Song() {
@ -41,6 +41,49 @@ public class Song implements Serializable {
this.albumName = "";
this.duration = -1;
this.trackNumber = -1;
this.dateModified = -1;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (albumName == null ? 0 : albumName.hashCode());
result = prime * result + (artistName == null ? 0 : artistName.hashCode());
result = prime * result + (int) duration;
result = prime * result + id;
result = prime * result + (title == null ? 0 : title.hashCode());
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 Song other = (Song) obj;
if (id != other.id) {
return false;
}
if (!TextUtils.equals(albumName, other.albumName)) {
return false;
}
if (!TextUtils.equals(artistName, other.artistName)) {
return false;
}
if (duration != other.duration) {
return false;
}
return TextUtils.equals(title, other.title);
}
@Override
public String toString() {
return title;
}
}