diff --git a/MusicApp/MainActivity.cs b/MusicApp/MainActivity.cs index f6d2a78..b1ccf78 100644 --- a/MusicApp/MainActivity.cs +++ b/MusicApp/MainActivity.cs @@ -766,11 +766,14 @@ namespace MusicApp else FolderBrowse.instance.ListView.SmoothScrollToPosition(0); } - foreach(YoutubeEngine instance in YoutubeEngine.instances) + if(YoutubeEngine.instances != null) { - if (instance.focused) + foreach (YoutubeEngine instance in YoutubeEngine.instances) { - instance.ListView.SmoothScrollToPosition(0); + if (instance.focused) + { + instance.ListView.SmoothScrollToPosition(0); + } } } } diff --git a/MusicApp/Resources/Portable Class/FolderBrowse.cs b/MusicApp/Resources/Portable Class/FolderBrowse.cs index 9f40617..dff7867 100644 --- a/MusicApp/Resources/Portable Class/FolderBrowse.cs +++ b/MusicApp/Resources/Portable Class/FolderBrowse.cs @@ -125,7 +125,6 @@ namespace MusicApp.Resources.Portable_Class listPadding = MainActivity.paddingBot - MainActivity.defaultPaddingBot }; ListAdapter = adapter; - ListView.TextFilterEnabled = true; ListView.ItemClick += ListView_ItemClick; ListView.ItemLongClick += ListView_ItemLongClick; @@ -458,7 +457,7 @@ namespace MusicApp.Resources.Portable_Class public override void OnResume() { base.OnResume(); - if (MainActivity.parcelable != null) + if (MainActivity.parcelable != null && MainActivity.parcelableSender == "FolderBrowse") { ListView.OnRestoreInstanceState(MainActivity.parcelable); MainActivity.parcelable = null; diff --git a/MusicApp/Resources/Portable Class/MusicPlayer.cs b/MusicApp/Resources/Portable Class/MusicPlayer.cs index 3253b1b..1fa2a0f 100644 --- a/MusicApp/Resources/Portable Class/MusicPlayer.cs +++ b/MusicApp/Resources/Portable Class/MusicPlayer.cs @@ -250,9 +250,26 @@ namespace MusicApp.Resources.Portable_Class if(addToQueue) AddToQueue(song); - Player.instance?.UpdateNext(); - + Player.instance?.RefreshPlayer(); ParseNextSong(); + + CoordinatorLayout smallPlayer = MainActivity.instance.FindViewById(Resource.Id.smallPlayer); + smallPlayer.FindViewById(Resource.Id.spTitle).Text = song.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = song.GetArtist(); + smallPlayer.FindViewById(Resource.Id.spPlay).SetImageResource(Resource.Drawable.ic_pause_black_24dp); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + if (!song.IsYt) + { + var songCover = Uri.Parse("content://media/external/audio/albumart"); + var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, song.GetAlbumArt()); + + Picasso.With(Application.Context).Load(nextAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art); + } + else + { + Picasso.With(Application.Context).Load(song.GetAlbum()).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art); + } } public void Play(Song song, bool addToQueue = true, long progress = -1) @@ -328,9 +345,26 @@ namespace MusicApp.Resources.Portable_Class Player.instance.playerView.FindViewById(Resource.Id.playButton).SetImageResource(Resource.Drawable.ic_pause_black_24dp); } - Player.instance?.UpdateNext(); - + Player.instance?.RefreshPlayer(); ParseNextSong(); + + CoordinatorLayout smallPlayer = MainActivity.instance.FindViewById(Resource.Id.smallPlayer); + smallPlayer.FindViewById(Resource.Id.spTitle).Text = song.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = song.GetArtist(); + smallPlayer.FindViewById(Resource.Id.spPlay).SetImageResource(Resource.Drawable.ic_pause_black_24dp); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + if (!song.IsYt) + { + var songCover = Uri.Parse("content://media/external/audio/albumart"); + var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, song.GetAlbumArt()); + + Picasso.With(Application.Context).Load(nextAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art); + } + else + { + Picasso.With(Application.Context).Load(song.GetAlbum()).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art); + } } public async void RandomPlay(List filePath, bool clearQueue) @@ -797,7 +831,8 @@ namespace MusicApp.Resources.Portable_Class private void SleepPause() { - Pause(); + //Pause(); + Stop(); } public static void Swap(int fromPosition, int toPosition) @@ -805,6 +840,7 @@ namespace MusicApp.Resources.Portable_Class queue[fromPosition].queueSlot = fromPosition; for(int i = 0; i < queue.Count; i++) { + Console.WriteLine("&CurrentID = " + CurrentID() + " item id = " + queue[i].queueSlot + " i = " + i + "Item name = " + queue[i].GetName()); if (CurrentID() == queue[i].queueSlot) currentID = i; diff --git a/MusicApp/Resources/Portable Class/RecyclerAdapter.cs b/MusicApp/Resources/Portable Class/RecyclerAdapter.cs index 8542fb2..03f3c5c 100644 --- a/MusicApp/Resources/Portable Class/RecyclerAdapter.cs +++ b/MusicApp/Resources/Portable Class/RecyclerAdapter.cs @@ -182,16 +182,12 @@ namespace MusicApp.Resources.Portable_Class if(fromPosition < toPosition) { for(int i = fromPosition; i < toPosition; i++) - { songList = Swap(songList, i, i + 1); - } } else { for(int i = fromPosition; i > toPosition; i--) - { songList = Swap(songList, i, i - 1); - } } NotifyItemMoved(fromPosition, toPosition); diff --git a/Screenshots/Browse.jpg b/Screenshots/Browse.jpg new file mode 100644 index 0000000..ff1eebc Binary files /dev/null and b/Screenshots/Browse.jpg differ diff --git a/Screenshots/EditMetaData.jpg b/Screenshots/EditMetaData.jpg new file mode 100644 index 0000000..7d03402 Binary files /dev/null and b/Screenshots/EditMetaData.jpg differ diff --git a/Screenshots/Player.jpg b/Screenshots/Player.jpg new file mode 100644 index 0000000..7ea1697 Binary files /dev/null and b/Screenshots/Player.jpg differ diff --git a/Screenshots/Playlists.jpg b/Screenshots/Playlists.jpg new file mode 100644 index 0000000..1df912c Binary files /dev/null and b/Screenshots/Playlists.jpg differ diff --git a/Screenshots/Queue.jpg b/Screenshots/Queue.jpg new file mode 100644 index 0000000..3373bd7 Binary files /dev/null and b/Screenshots/Queue.jpg differ diff --git a/Screenshots/Settings.jpg b/Screenshots/Settings.jpg new file mode 100644 index 0000000..2d5eb1d Binary files /dev/null and b/Screenshots/Settings.jpg differ diff --git a/Screenshots/YoutubeSearch.jpg b/Screenshots/YoutubeSearch.jpg new file mode 100644 index 0000000..5f01453 Binary files /dev/null and b/Screenshots/YoutubeSearch.jpg differ