Fix crahsing on home screen shortcuts
This commit is contained in:
parent
835ec949ba
commit
240874f312
13 changed files with 416 additions and 524 deletions
|
@ -12,23 +12,14 @@
|
|||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model;
|
||||
package code.name.monkey.retromusic.model
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Context
|
||||
import io.reactivex.Observable
|
||||
import java.util.*
|
||||
|
||||
import java.util.ArrayList;
|
||||
abstract class AbsCustomPlaylist(id: Int, name: String) : Playlist(id, name) {
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import io.reactivex.Observable;
|
||||
import kotlinx.android.parcel.Parcelize;
|
||||
|
||||
@Parcelize
|
||||
public abstract class AbsCustomPlaylist extends Playlist {
|
||||
public AbsCustomPlaylist(int id, @NonNull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public abstract Observable<ArrayList<Song>> getSongs(@NonNull Context context);
|
||||
abstract fun getSongs(context: Context): Observable<ArrayList<Song>>
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class Playlist implements Parcelable {
|
||||
public final int id;
|
||||
public final String name;
|
||||
|
||||
public Playlist(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Playlist() {
|
||||
this.id = -1;
|
||||
this.name = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Playlist playlist = (Playlist) o;
|
||||
|
||||
if (id != playlist.id) return false;
|
||||
return name != null ? name.equals(playlist.name) : playlist.name == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Playlist{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.id);
|
||||
dest.writeString(this.name);
|
||||
}
|
||||
|
||||
protected Playlist(Parcel in) {
|
||||
this.id = in.readInt();
|
||||
this.name = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<Playlist> CREATOR = new Creator<Playlist>() {
|
||||
public Playlist createFromParcel(Parcel source) {
|
||||
return new Playlist(source);
|
||||
}
|
||||
|
||||
public Playlist[] newArray(int size) {
|
||||
return new Playlist[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
open class Playlist(val id: Int = -1, val name: String = "") : Parcelable
|
|
@ -15,22 +15,70 @@
|
|||
package code.name.monkey.retromusic.model.smartplaylist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
|
||||
import kotlinx.android.parcel.Parcelize;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.model.AbsCustomPlaylist;
|
||||
|
||||
@Parcelize
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public abstract class AbsSmartPlaylist extends AbsCustomPlaylist {
|
||||
@DrawableRes
|
||||
public final int iconRes;
|
||||
|
||||
public AbsSmartPlaylist(final @NonNull String name, final int iconRes) {
|
||||
public AbsSmartPlaylist(final String name, final int iconRes) {
|
||||
super(-Math.abs(31 * name.hashCode() + (iconRes * name.hashCode() * 31 * 31)), name);
|
||||
this.iconRes = iconRes;
|
||||
}
|
||||
|
||||
public abstract void clear(@NonNull Context context);
|
||||
public AbsSmartPlaylist() {
|
||||
super();
|
||||
this.iconRes = R.drawable.ic_queue_music_white_24dp;
|
||||
}
|
||||
|
||||
public abstract void clear(Context context);
|
||||
|
||||
public boolean isClearable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + iconRes;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable final Object obj) {
|
||||
if (super.equals(obj)) {
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AbsSmartPlaylist other = (AbsSmartPlaylist) obj;
|
||||
return iconRes == other.iconRes;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(this.iconRes);
|
||||
}
|
||||
|
||||
protected AbsSmartPlaylist(Parcel in) {
|
||||
super(in);
|
||||
this.iconRes = in.readInt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.loader.TopAndRecentlyPlayedTracksLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.provider.HistoryStore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class HistoryPlaylist extends AbsSmartPlaylist {
|
||||
|
||||
public HistoryPlaylist(@NonNull Context context) {
|
||||
super(context.getString(R.string.history), R.drawable.ic_access_time_white_24dp);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ArrayList<Song> getSongs(@NonNull Context context) {
|
||||
return TopAndRecentlyPlayedTracksLoader.getRecentlyPlayedTracks(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(@NonNull Context context) {
|
||||
HistoryStore.getInstance(context).clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected HistoryPlaylist(Parcel in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Creator<HistoryPlaylist> CREATOR = new Creator<HistoryPlaylist>() {
|
||||
public HistoryPlaylist createFromParcel(Parcel source) {
|
||||
return new HistoryPlaylist(source);
|
||||
}
|
||||
|
||||
public HistoryPlaylist[] newArray(int size) {
|
||||
return new HistoryPlaylist[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist
|
||||
|
||||
import android.content.Context
|
||||
|
||||
import java.util.ArrayList
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.loaders.TopAndRecentlyPlayedTracksLoader
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.providers.HistoryStore
|
||||
import io.reactivex.Observable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
class HistoryPlaylist(context: Context) : AbsSmartPlaylist(context.getString(R.string.history), R.drawable.ic_access_time_white_24dp) {
|
||||
|
||||
override fun getSongs(context: Context): Observable<ArrayList<Song>> {
|
||||
return TopAndRecentlyPlayedTracksLoader.getRecentlyPlayedTracks(context)
|
||||
}
|
||||
|
||||
override fun clear(context: Context) {
|
||||
HistoryStore.getInstance(context).clear()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.loader.LastAddedLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class LastAddedPlaylist extends AbsSmartPlaylist {
|
||||
|
||||
public LastAddedPlaylist(@NonNull Context context) {
|
||||
super(context.getString(R.string.last_added), R.drawable.ic_library_add_white_24dp);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ArrayList<Song> getSongs(@NonNull Context context) {
|
||||
return LastAddedLoader.getLastAddedSongs(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(@NonNull Context context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClearable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected LastAddedPlaylist(Parcel in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Creator<LastAddedPlaylist> CREATOR = new Creator<LastAddedPlaylist>() {
|
||||
public LastAddedPlaylist createFromParcel(Parcel source) {
|
||||
return new LastAddedPlaylist(source);
|
||||
}
|
||||
|
||||
public LastAddedPlaylist[] newArray(int size) {
|
||||
return new LastAddedPlaylist[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist
|
||||
|
||||
import android.content.Context
|
||||
|
||||
import java.util.ArrayList
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.loaders.LastAddedSongsLoader
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import io.reactivex.Observable
|
||||
|
||||
class LastAddedPlaylist(context: Context) : AbsSmartPlaylist(context.getString(R.string.last_added), R.drawable.ic_library_add_white_24dp) {
|
||||
|
||||
override fun getSongs(context: Context): Observable<ArrayList<Song>> {
|
||||
return LastAddedSongsLoader.getLastAddedSongs(context)
|
||||
}
|
||||
|
||||
override fun clear(context: Context) {}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.loader.TopAndRecentlyPlayedTracksLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.provider.SongPlayCountStore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class MyTopTracksPlaylist extends AbsSmartPlaylist {
|
||||
|
||||
public MyTopTracksPlaylist(@NonNull Context context) {
|
||||
super(context.getString(R.string.my_top_tracks), R.drawable.ic_trending_up_white_24dp);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ArrayList<Song> getSongs(@NonNull Context context) {
|
||||
return TopAndRecentlyPlayedTracksLoader.getTopTracks(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(@NonNull Context context) {
|
||||
SongPlayCountStore.getInstance(context).clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected MyTopTracksPlaylist(Parcel in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Creator<MyTopTracksPlaylist> CREATOR = new Creator<MyTopTracksPlaylist>() {
|
||||
public MyTopTracksPlaylist createFromParcel(Parcel source) {
|
||||
return new MyTopTracksPlaylist(source);
|
||||
}
|
||||
|
||||
public MyTopTracksPlaylist[] newArray(int size) {
|
||||
return new MyTopTracksPlaylist[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist
|
||||
|
||||
import android.content.Context
|
||||
|
||||
import java.util.ArrayList
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.loaders.TopAndRecentlyPlayedTracksLoader
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.providers.SongPlayCountStore
|
||||
import io.reactivex.Observable
|
||||
|
||||
|
||||
class MyTopTracksPlaylist(context: Context) : AbsSmartPlaylist(context.getString(R.string.my_top_tracks), R.drawable.ic_trending_up_white_24dp) {
|
||||
|
||||
override fun getSongs(context: Context): Observable<ArrayList<Song>> {
|
||||
return TopAndRecentlyPlayedTracksLoader.getTopTracks(context)
|
||||
}
|
||||
|
||||
override fun clear(context: Context) {
|
||||
SongPlayCountStore.getInstance(context).clear()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShuffleAllPlaylist extends AbsSmartPlaylist {
|
||||
|
||||
public ShuffleAllPlaylist(@NonNull Context context) {
|
||||
super(context.getString(R.string.action_shuffle_all), R.drawable.ic_shuffle_white_24dp);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ArrayList<Song> getSongs(@NonNull Context context) {
|
||||
return SongLoader.getAllSongs(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(@NonNull Context context) {
|
||||
// Shuffle all is not a real "Smart Playlist"
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected ShuffleAllPlaylist(Parcel in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Creator<ShuffleAllPlaylist> CREATOR = new Creator<ShuffleAllPlaylist>() {
|
||||
public ShuffleAllPlaylist createFromParcel(Parcel source) {
|
||||
return new ShuffleAllPlaylist(source);
|
||||
}
|
||||
|
||||
public ShuffleAllPlaylist[] newArray(int size) {
|
||||
return new ShuffleAllPlaylist[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.model.smartplaylist
|
||||
|
||||
import android.content.Context
|
||||
|
||||
import java.util.ArrayList
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.loaders.SongLoader
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import io.reactivex.Observable
|
||||
|
||||
class ShuffleAllPlaylist(context: Context) : AbsSmartPlaylist(context.getString(R.string.action_shuffle_all), R.drawable.ic_shuffle_white_24dp) {
|
||||
|
||||
|
||||
override fun getSongs(context: Context): Observable<ArrayList<Song>> {
|
||||
return SongLoader.getAllSongs(context)
|
||||
}
|
||||
|
||||
override fun clear(context: Context) {
|
||||
// Shuffle all is not a real "Smart Playlist"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue