Beispiel #1
0
        /// <summary>
        /// Return the Song Id of the entry referenced by the next SongIndex
        /// </summary>
        /// <returns></returns>
        protected override int NextIndexedSongIdentity()
        {
            int nextSongIndex = -1;

            if (SongIndex == -1)
            {
                nextSongIndex = (PlaylistItems[0] as AlbumPlaylistItem).Album.Songs[0].Id;
            }
            else
            {
                int playlistIndex  = GetGroupFromTag(SongIndex);
                int albumSongIndex = GetChildFromTag(SongIndex);

                AlbumPlaylistItem currentPlaylistItem = ( AlbumPlaylistItem )PlaylistItems[playlistIndex];

                if (albumSongIndex < (currentPlaylistItem.Album.Songs.Count - 1))
                {
                    nextSongIndex = currentPlaylistItem.Album.Songs[albumSongIndex + 1].Id;
                }
                else if (playlistIndex < (PlaylistItems.Count - 1))
                {
                    nextSongIndex = (PlaylistItems[playlistIndex + 1] as AlbumPlaylistItem).Album.Songs[0].Id;
                }
            }

            return(nextSongIndex);
        }
        /// <summary>
        /// Called when an AlbumPlaylistItem has been clicked
        /// </summary>
        /// <param name="albumPlaylist"></param>
        /// <param name="albumPlaylistItem"></param>
        public void AlbumPlaylistItemClicked(AlbumPlaylist albumPlaylist, AlbumPlaylistItem albumPlaylistItem)
        {
            AlertDialog dialogue = null;

            // Create the listview and its adapter
            View     customView = LayoutInflater.FromContext(Context).Inflate(Resource.Layout.album_songs_popup, null);
            ListView songView   = customView.FindViewById <ListView>(Resource.Id.songsList);

            songView.Adapter = new SongsDisplayAdapter(Context, songView, albumPlaylistItem.Album.Songs, albumPlaylist.InProgressSong?.Id ?? -1,
                                                       clickAction: () => dialogue.Dismiss());

            // Create and show the dialogue
            dialogue = new AlertDialog.Builder(Context)
                       .SetView(customView)
                       .Create();

            dialogue.Show();
        }