Update playlist details
This commit is contained in:
parent
b43f71cc32
commit
a96e682e2b
3 changed files with 7 additions and 21 deletions
File diff suppressed because one or more lines are too long
|
@ -66,7 +66,7 @@ class PlaylistAdapter(protected val activity: AppCompatActivity, dataSet: ArrayL
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun getPlaylistText(playlist: Playlist): String {
|
protected fun getPlaylistText(playlist: Playlist): String {
|
||||||
return playlist.getInfoString(activity)
|
return MusicUtil.getPlaylistInfoString(activity, getSongs(playlist))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
@ -158,7 +158,7 @@ class PlaylistAdapter(protected val activity: AppCompatActivity, dataSet: ArrayL
|
||||||
return songs
|
return songs
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSongs(playlist: Playlist): ArrayList<Song>? {
|
private fun getSongs(playlist: Playlist): ArrayList<Song> {
|
||||||
val songs = ArrayList<Song>()
|
val songs = ArrayList<Song>()
|
||||||
if (playlist is AbsSmartPlaylist) {
|
if (playlist is AbsSmartPlaylist) {
|
||||||
songs.addAll(playlist.getSongs(activity).blockingFirst())
|
songs.addAll(playlist.getSongs(activity).blockingFirst())
|
||||||
|
|
|
@ -18,12 +18,9 @@ import android.content.Context;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader;
|
|
||||||
import code.name.monkey.retromusic.util.MusicUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karim Abou Zeid (kabouzeid)
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
|
@ -42,19 +39,6 @@ public class Playlist implements Parcelable {
|
||||||
this.name = "";
|
this.name = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public String getInfoString(@NonNull Context context) {
|
|
||||||
int songCount = getSongs(context).size();
|
|
||||||
String songCountString = MusicUtil.getSongCountString(context, songCount);
|
|
||||||
return MusicUtil.buildInfoString(songCountString, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public ArrayList<Song> getSongs(Context context) {
|
|
||||||
// this default implementation covers static playlists
|
|
||||||
return PlaylistSongsLoader.INSTANCE.getPlaylistSongList(context, id).blockingFirst();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
@ -108,4 +92,6 @@ public class Playlist implements Parcelable {
|
||||||
return new Playlist[size];
|
return new Playlist[size];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue