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 {
|
||||
return playlist.getInfoString(activity)
|
||||
return MusicUtil.getPlaylistInfoString(activity, getSongs(playlist))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
|
@ -158,7 +158,7 @@ class PlaylistAdapter(protected val activity: AppCompatActivity, dataSet: ArrayL
|
|||
return songs
|
||||
}
|
||||
|
||||
private fun getSongs(playlist: Playlist): ArrayList<Song>? {
|
||||
private fun getSongs(playlist: Playlist): ArrayList<Song> {
|
||||
val songs = ArrayList<Song>()
|
||||
if (playlist is AbsSmartPlaylist) {
|
||||
songs.addAll(playlist.getSongs(activity).blockingFirst())
|
||||
|
|
|
@ -18,12 +18,9 @@ import android.content.Context;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader;
|
||||
import code.name.monkey.retromusic.util.MusicUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
|
@ -42,19 +39,6 @@ public class Playlist implements Parcelable {
|
|||
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
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -108,4 +92,6 @@ public class Playlist implements Parcelable {
|
|||
return new Playlist[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue