Created CustomPlaylist class, cleaned up some code

This commit is contained in:
Karim Abou Zeid 2017-04-22 15:34:59 +02:00
commit 3232370e47
11 changed files with 70 additions and 56 deletions

View file

@ -0,0 +1,27 @@
package com.kabouzeid.gramophone.model;
import android.content.Context;
import android.os.Parcel;
import android.support.annotation.NonNull;
import java.util.ArrayList;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public abstract class AbsCustomPlaylist extends Playlist {
public AbsCustomPlaylist(int id, String name) {
super(id, name);
}
public AbsCustomPlaylist() {
}
public AbsCustomPlaylist(Parcel in) {
super(in);
}
@NonNull
public abstract ArrayList<Song> getSongs(Context context);
}

View file

@ -6,15 +6,12 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.model.Playlist;
import com.kabouzeid.gramophone.model.Song;
import java.util.ArrayList;
import com.kabouzeid.gramophone.model.AbsCustomPlaylist;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public abstract class AbsSmartPlaylist extends Playlist {
public abstract class AbsSmartPlaylist extends AbsCustomPlaylist {
@DrawableRes
public final int iconRes;
@ -28,8 +25,6 @@ public abstract class AbsSmartPlaylist extends Playlist {
this.iconRes = R.drawable.ic_queue_music_white_24dp;
}
public abstract ArrayList<Song> getSongs(Context context);
public abstract void clear(Context context);
@Override

View file

@ -13,7 +13,7 @@ import java.util.ArrayList;
public class ShuffleAllPlaylist extends AbsSmartPlaylist {
public ShuffleAllPlaylist(@NonNull Context context) {
super(context.getString(R.string.shuffle_all), R.drawable.ic_shuffle_white_24dp);
super(context.getString(R.string.action_shuffle_all), R.drawable.ic_shuffle_white_24dp);
}
@NonNull
@ -24,10 +24,9 @@ public class ShuffleAllPlaylist extends AbsSmartPlaylist {
@Override
public void clear(@NonNull Context context) {
//Can't clear all songs. Don't do anything here?
// Shuffle all is not a real "Smart Playlist"
}
@Override
public int describeContents() {
return 0;