Search in sources :

Example 1 with PlaylistSong

use of com.kabouzeid.gramophone.model.PlaylistSong in project Phonograph by kabouzeid.

the class PlaylistSongLoader method getPlaylistSongList.

@NonNull
public static ArrayList<PlaylistSong> getPlaylistSongList(@NonNull final Context context, final int playlistId) {
    ArrayList<PlaylistSong> songs = new ArrayList<>();
    Cursor cursor = makePlaylistSongCursor(context, playlistId);
    if (cursor != null && cursor.moveToFirst()) {
        do {
            songs.add(getPlaylistSongFromCursorImpl(cursor, playlistId));
        } while (cursor.moveToNext());
    }
    if (cursor != null) {
        cursor.close();
    }
    return songs;
}
Also used : PlaylistSong(com.kabouzeid.gramophone.model.PlaylistSong) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) NonNull(android.support.annotation.NonNull)

Example 2 with PlaylistSong

use of com.kabouzeid.gramophone.model.PlaylistSong in project Phonograph by kabouzeid.

the class PlaylistSongLoader method getPlaylistSongList.

@NonNull
public static List<PlaylistSong> getPlaylistSongList(@NonNull final Context context, final long playlistId) {
    List<PlaylistSong> songs = new ArrayList<>();
    Cursor cursor = makePlaylistSongCursor(context, playlistId);
    if (cursor != null && cursor.moveToFirst()) {
        do {
            songs.add(getPlaylistSongFromCursorImpl(cursor, playlistId));
        } while (cursor.moveToNext());
    }
    if (cursor != null) {
        cursor.close();
    }
    return songs;
}
Also used : PlaylistSong(com.kabouzeid.gramophone.model.PlaylistSong) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) NonNull(androidx.annotation.NonNull)

Aggregations

Cursor (android.database.Cursor)2 PlaylistSong (com.kabouzeid.gramophone.model.PlaylistSong)2 ArrayList (java.util.ArrayList)2 NonNull (android.support.annotation.NonNull)1 NonNull (androidx.annotation.NonNull)1