diff --git a/MusicApp/MainActivity.cs b/MusicApp/MainActivity.cs index b4165cf..6ba90cb 100644 --- a/MusicApp/MainActivity.cs +++ b/MusicApp/MainActivity.cs @@ -97,6 +97,18 @@ namespace MusicApp playToCross = GetDrawable(Resource.Drawable.PlayToCross); crossToPlay = GetDrawable(Resource.Drawable.CrossToPlay); + + NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService); + NotificationChannel channel = new NotificationChannel("MusicApp.Channel", "Default Channel", NotificationImportance.Low) + { + Description = "Channel used for download progress and music control notification.", + LockscreenVisibility = NotificationVisibility.Public + }; + channel.EnableVibration(false); + channel.EnableLights(false); + notificationManager.CreateNotificationChannel(channel); + + if (MusicPlayer.queue.Count > 0) ReCreateSmallPlayer(); else diff --git a/MusicApp/MusicApp.csproj b/MusicApp/MusicApp.csproj index 9b81148..ab27888 100644 --- a/MusicApp/MusicApp.csproj +++ b/MusicApp/MusicApp.csproj @@ -83,20 +83,20 @@ ..\packages\Xam.Plugins.Android.ExoPlayer.UI.2.6.0\lib\MonoAndroid\ExoPlayer.UI.dll - - ..\packages\Google.Apis.1.32.1\lib\netstandard1.3\Google.Apis.dll + + ..\packages\Google.Apis.1.32.2\lib\netstandard1.3\Google.Apis.dll - - ..\packages\Google.Apis.Auth.1.32.1\lib\netstandard1.3\Google.Apis.Auth.dll + + ..\packages\Google.Apis.Auth.1.32.2\lib\netstandard1.3\Google.Apis.Auth.dll - - ..\packages\Google.Apis.Auth.1.32.1\lib\netstandard1.3\Google.Apis.Auth.PlatformServices.dll + + ..\packages\Google.Apis.Auth.1.32.2\lib\netstandard1.3\Google.Apis.Auth.PlatformServices.dll - - ..\packages\Google.Apis.Core.1.32.1\lib\netstandard1.3\Google.Apis.Core.dll + + ..\packages\Google.Apis.Core.1.32.2\lib\netstandard1.3\Google.Apis.Core.dll - - ..\packages\Google.Apis.YouTube.v3.1.32.1.1079\lib\netstandard1.3\Google.Apis.YouTube.v3.dll + + ..\packages\Google.Apis.YouTube.v3.1.32.2.1131\lib\netstandard1.3\Google.Apis.YouTube.v3.dll @@ -136,6 +136,9 @@ + + ..\packages\TagLib.Portable.1.0.4\lib\portable-net45+win+wpa81+wp8+MonoAndroid10+xamarinios10+MonoTouch10\TagLib.Portable.dll + ..\packages\Validation.2.4.18\lib\netstandard1.3\Validation.dll diff --git a/MusicApp/Resources/Portable Class/Adapter.cs b/MusicApp/Resources/Portable Class/Adapter.cs index 6af405d..adc0513 100644 --- a/MusicApp/Resources/Portable Class/Adapter.cs +++ b/MusicApp/Resources/Portable Class/Adapter.cs @@ -4,6 +4,7 @@ using Android.Views; using Android.Widget; using MusicApp.Resources.values; using Square.Picasso; +using System; using System.Collections.Generic; namespace MusicApp.Resources.Portable_Class @@ -27,6 +28,9 @@ namespace MusicApp.Resources.Portable_Class if (position > songList.Count || position < 0) return convertView; + if (convertView != null) + convertView.FindViewById(Resource.Id.moreButton).Click -= MoreClick; + if (inflater == null) { inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService); @@ -55,18 +59,22 @@ namespace MusicApp.Resources.Portable_Class if (!holder.more.HasOnClickListeners) { - holder.more.Click += (sender, e) => - { - Queue.instance?.More(songList[position]); - Browse.instance?.More(songList[position]); - YoutubeEngine.instance?.More(songList[position]); - YtPlaylist.instance?.More(position); - PlaylistTracks.instance?.More(songList[position], position); - FolderTracks.instance?.More(songList[position]); - }; + holder.more.Tag = position; + holder.more.Click += MoreClick; } return convertView; } + + private void MoreClick(object sender, EventArgs e) + { + int position = (int)((ImageView)sender).Tag; + Queue.instance?.More(songList[position]); + Browse.instance?.More(songList[position]); + YoutubeEngine.instance?.More(songList[position]); + YtPlaylist.instance?.More(position); + PlaylistTracks.instance?.More(songList[position], position); + FolderTracks.instance?.More(songList[position]); + } } } \ No newline at end of file diff --git a/MusicApp/Resources/Portable Class/Browse.cs b/MusicApp/Resources/Portable Class/Browse.cs index b9234d2..324b414 100644 --- a/MusicApp/Resources/Portable Class/Browse.cs +++ b/MusicApp/Resources/Portable Class/Browse.cs @@ -85,12 +85,14 @@ namespace MusicApp.Resources.Portable_Class int artistID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Artist); int albumID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Album); int thisID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Id); + int youtubeID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Composer); int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data); do { string Artist = musicCursor.GetString(artistID); string Title = musicCursor.GetString(titleID); string Album = musicCursor.GetString(albumID); + string ytID = musicCursor.GetString(youtubeID); long AlbumArt = musicCursor.GetLong(musicCursor.GetColumnIndex(MediaStore.Audio.Albums.InterfaceConsts.AlbumId)); long id = musicCursor.GetLong(thisID); string path = musicCursor.GetString(pathID); @@ -102,7 +104,7 @@ namespace MusicApp.Resources.Portable_Class if (Album == null) Album = "Unknow Album"; - musicList.Add(new Song(Title, Artist, Album, null, AlbumArt, id, path)); + musicList.Add(new Song(Title, Artist, Album, ytID, AlbumArt, id, path)); } while (musicCursor.MoveToNext()); musicCursor.Close(); @@ -145,6 +147,7 @@ namespace MusicApp.Resources.Portable_Class int titleID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Title); int artistID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Artist); int albumID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Album); + int youtubeID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Composer); int thisID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Id); int pathID = musicCursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data); do @@ -152,6 +155,7 @@ namespace MusicApp.Resources.Portable_Class string Artist = musicCursor.GetString(artistID); string Title = musicCursor.GetString(titleID); string Album = musicCursor.GetString(albumID); + string ytID = musicCursor.GetString(youtubeID); long AlbumArt = musicCursor.GetLong(musicCursor.GetColumnIndex(MediaStore.Audio.Albums.InterfaceConsts.AlbumId)); long id = musicCursor.GetLong(thisID); string path = musicCursor.GetString(pathID); @@ -163,7 +167,7 @@ namespace MusicApp.Resources.Portable_Class if (Album == null) Album = "Unknow Album"; - musicList.Add(new Song(Title, Artist, Album, null, AlbumArt, id, path)); + musicList.Add(new Song(Title, Artist, Album, ytID, AlbumArt, id, path)); } while (musicCursor.MoveToNext()); musicCursor.Close(); @@ -371,6 +375,7 @@ namespace MusicApp.Resources.Portable_Class public void EditMetadata(Song item) { + System.Console.WriteLine("&Yt ID : " + item.youtubeID); MainActivity.instance.HideTabs(); Intent intent = new Intent(Android.App.Application.Context, typeof(EditMetaData)); intent.PutExtra("Song", item.ToString()); diff --git a/MusicApp/Resources/Portable Class/EditMetaData.cs b/MusicApp/Resources/Portable Class/EditMetaData.cs index 27028b7..8b5382b 100644 --- a/MusicApp/Resources/Portable Class/EditMetaData.cs +++ b/MusicApp/Resources/Portable Class/EditMetaData.cs @@ -4,20 +4,20 @@ using Android.Content; using Android.Content.PM; using Android.OS; using Android.Provider; +using Android.Runtime; using Android.Support.Design.Widget; using Android.Support.V7.App; -using Android.Support.V7.Widget; using Android.Util; using Android.Views; using Android.Widget; +using System.IO; using MusicApp.Resources.values; using Square.Picasso; -using System; using System.Threading.Tasks; namespace MusicApp.Resources.Portable_Class { - [Activity(Label = "EditMetaData", Theme = "@style/Theme")] + [Activity(Label = "EditMetaData", Theme = "@style/Theme", WindowSoftInputMode = SoftInput.AdjustResize|SoftInput.StateHidden)] public class EditMetaData : AppCompatActivity { public static EditMetaData instance; @@ -25,8 +25,11 @@ namespace MusicApp.Resources.Portable_Class private TextView title, artist, album, youtubeID; private ImageView albumArt; + private Android.Net.Uri artURI; private bool hasPermission = false; private const int RequestCode = 8539; + private const int PickerRequestCode = 9852; + private string[] actions = new string[] { "Pick an album art from storage", "Search for an album art on google" }; protected override void OnCreate(Bundle savedInstanceState) { @@ -41,6 +44,8 @@ namespace MusicApp.Resources.Portable_Class WindowManager.DefaultDisplay.GetMetrics(metrics); ((View)toolbar.Parent.Parent).LayoutParameters.Height = metrics.WidthPixels; toolbar.Parent.RequestLayout(); + toolbar.LayoutParameters.Height = metrics.WidthPixels / 3; + toolbar.RequestLayout(); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); @@ -50,6 +55,7 @@ namespace MusicApp.Resources.Portable_Class album = FindViewById(Resource.Id.metadataAlbum); youtubeID = FindViewById(Resource.Id.metadataYID); albumArt = FindViewById(Resource.Id.metadataArt); + FloatingActionButton fab = FindViewById(Resource.Id.metadataFAB); fab.Click += async (sender, e) => { await ValidateChanges(); }; @@ -57,6 +63,7 @@ namespace MusicApp.Resources.Portable_Class artist.Text = song.GetArtist(); album.Text = song.GetAlbum(); youtubeID.Text = song.youtubeID; + albumArt.Click += AlbumArt_Click; if (song.GetAlbumArt() == -1 || song.IsYt) { @@ -70,19 +77,49 @@ namespace MusicApp.Resources.Portable_Class Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(albumArt); } - - //SetPadding(); } - //async void SetPadding() - //{ - // await Task.Delay(10); - // Console.WriteLine("&Height : " + albumArt.Height); - // FindViewById(Resource.Id.metadataPadding).LayoutParameters.Height = albumArt.Height; - // FindViewById(Resource.Id.metadataPadding).RequestLayout(); - // FindViewById(Resource.Id.metadataPaddingDown).LayoutParameters.Height = albumArt.Height / 3; - // FindViewById(Resource.Id.metadataPaddingDown).RequestLayout(); - //} + private void AlbumArt_Click(object sender, System.EventArgs e) + { + new Android.Support.V7.App.AlertDialog.Builder(this) + .SetTitle("Change Album Art") + .SetItems(actions, (senderAlert, args) => + { + switch(args.Which) + { + case 0: + PickAnAlbumArtLocally(); + break; + case 1: + //Pick from google + break; + default: + break; + } + + }).Show(); + } + + void PickAnAlbumArtLocally() + { + Intent intent = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri); + StartActivityForResult(intent, PickerRequestCode); + } + + protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) + { + base.OnActivityResult(requestCode, resultCode, data); + + if(requestCode == PickerRequestCode) + { + if(resultCode == Result.Ok) + { + Android.Net.Uri uri = data.Data; + Picasso.With(Application.Context).Load(uri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(albumArt); + artURI = uri; + } + } + } public override bool OnOptionsItemSelected(IMenuItem item) { @@ -103,7 +140,7 @@ namespace MusicApp.Resources.Portable_Class async Task ValidateChanges() { - if (song.GetName() == title.Text && song.GetArtist() == artist.Text && song.youtubeID == youtubeID.Text && song.GetAlbum() == album.Text) + if (song.GetName() == title.Text && song.GetArtist() == artist.Text && song.youtubeID == youtubeID.Text && song.GetAlbum() == album.Text && artURI == null) return; const string permission = Manifest.Permission.WriteExternalStorage; @@ -117,18 +154,92 @@ namespace MusicApp.Resources.Portable_Class await Task.Delay(1000); } - Android.Net.Uri itemURI = ContentUris.WithAppendedId(MediaStore.Audio.Media.ExternalContentUri, song.GetID()); - ContentResolver.Delete(itemURI, null, null); - await Task.Delay(10); - ContentValues value = new ContentValues(); - value.Put(MediaStore.Audio.Media.InterfaceConsts.Title, title.Text); - value.Put(MediaStore.Audio.Media.InterfaceConsts.Artist, artist.Text); - value.Put(MediaStore.Audio.Media.InterfaceConsts.Album, album.Text); - value.Put(MediaStore.Audio.Media.InterfaceConsts.Data, song.GetPath()); - //value.Put(MediaStore.Audio.Media.InterfaceConsts.AlbumArt, song.GetAlbumArt()); - value.Put(MediaStore.Audio.Media.InterfaceConsts.IsMusic, true); - Android.Net.Uri uri = ContentResolver.Insert(MediaStore.Audio.Media.ExternalContentUri, value); - SendBroadcast(new Intent(Intent.ActionMediaScannerScanFile, Android.Net.Uri.Parse("file://" + uri))); + //Android.Net.Uri itemURI = ContentUris.WithAppendedId(MediaStore.Audio.Media.ExternalContentUri, song.GetID()); + //ContentResolver.Delete(itemURI, null, null); + //await Task.Delay(10); + //if(song.GetName() != title.Text || song.GetArtist() != artist.Text || song.youtubeID != youtubeID.Text || song.GetAlbum() != album.Text) + //{ + // ContentValues value = new ContentValues(); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Title, title.Text); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Artist, artist.Text); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Album, album.Text); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Data, song.GetPath()); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Composer, song.youtubeID); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.IsMusic, true); + // Android.Net.Uri uri = ContentResolver.Insert(MediaStore.Audio.Media.ExternalContentUri, value); + // SendBroadcast(new Intent(Intent.ActionMediaScannerScanFile, Android.Net.Uri.Parse("file://" + uri))); + //} + //if(artURI != null) + //{ + // Android.Net.Uri path = ContentUris.WithAppendedId(Android.Net.Uri.Parse("content://media/external/audio/albumart"), song.GetAlbumArt()); + // System.Console.WriteLine("&Path : " + path); + // bool albumArtExist = true; + // try + // { + // var inStream = ContentResolver.OpenInputStream(path); + // } + // catch(FileNotFoundException e) + // { + // System.Console.WriteLine("&" + e.Message); + // albumArtExist = false; + // } + + // if(albumArtExist) + // ContentResolver.Delete(path, null, null); + + // await Task.Delay(10); + // ContentValues value = new ContentValues(); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.AlbumId, song.GetAlbumArt()); + // value.Put(MediaStore.Audio.Media.InterfaceConsts.Data, artURI.ToString()); + // Android.Net.Uri uri = ContentResolver.Insert(Android.Net.Uri.Parse("content://media/external/audio/albumart"), value); + // if(uri == null) + // { + // System.Console.WriteLine("&Uri == null"); + // return; + // } + // System.Console.WriteLine("&Art uri : " + artURI.ToString() + " Result URI : " + uri.ToString()); + // SendBroadcast(new Intent(Intent.ActionMediaScannerScanFile, Android.Net.Uri.Parse("file://" + uri))); + // artURI = null; + // Picasso.With(Application.Context).Load(uri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(albumArt); + //} + + + Stream stream = new FileStream(song.GetPath(), FileMode.Open, FileAccess.ReadWrite); + //System.Console.WriteLine("&Read Stream created"); + //Stream writeStream = File.OpenWrite(song.GetPath()); + //System.Console.WriteLine("&Write Stream created"); + var meta = TagLib.File.Create(new TagLib.StreamFileAbstraction(song.GetPath(), stream, stream)); + System.Console.WriteLine("&File created"); + + meta.Tag.Title = title.Text; + meta.Tag.Performers = new string[] { artist.Text }; + meta.Tag.Album = album.Text; + meta.Tag.AmazonId = youtubeID.Text; + + if (artURI != null) + { + TagLib.Picture art = new TagLib.Picture(artURI.ToString()); + meta.Tag.Pictures = new TagLib.IPicture[] { art }; + } + + meta.Save(); + stream.Dispose(); + Android.Media.MediaScannerConnection.ScanFile(this, new string[] { song.GetPath() }, null, null); + + /*TagLib.File file = TagLib.File.Create(); + *TagLib.Picture pic = new TagLib.Picture(); + *pic.Type = TagLib.PictureType.FrontCover; + *pic.Description = "Cover"; + *pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg; + *MemoryStream ms = new MemoryStream(); + *.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); + *ms.Position = 0; + *pic.Data = TagLib.ByteVector.FromStream(ms); + *file.Tag.Pictures = new TagLib.IPicture[] { pic }; + *file.Save(); + *ms.Close(); */ + + Toast.MakeText(this, "Changes saved.", ToastLength.Short).Show(); } diff --git a/MusicApp/Resources/Portable Class/MusicPlayer.cs b/MusicApp/Resources/Portable Class/MusicPlayer.cs index 63cc6c5..60634db 100644 --- a/MusicApp/Resources/Portable Class/MusicPlayer.cs +++ b/MusicApp/Resources/Portable Class/MusicPlayer.cs @@ -5,8 +5,9 @@ using Android.Graphics; using Android.Media; using Android.OS; using Android.Provider; +using Android.Support.V4.App; +using Android.Support.V4.Content; using Android.Support.V4.Media.Session; -using Android.Support.V7.App; using Android.Widget; using Com.Google.Android.Exoplayer2; using Com.Google.Android.Exoplayer2.Extractor; @@ -21,6 +22,7 @@ using System.Linq; using System.Threading.Tasks; using YoutubeExplode; using YoutubeExplode.Models.MediaStreams; +using static Android.Support.V4.Media.App.NotificationCompat; using Uri = Android.Net.Uri; namespace MusicApp.Resources.Portable_Class @@ -162,9 +164,17 @@ namespace MusicApp.Resources.Portable_Class IExtractorsFactory extractorFactory = new DefaultExtractorsFactory(); Handler handler = new Handler(); IMediaSource mediaSource = new ExtractorMediaSource(Uri.Parse(filePath), dataSourceFactory, extractorFactory, handler, null); -#pragma warning disable CS0618 // Type or member is obsolete - var audioFocus = audioManager.RequestAudioFocus(this, Stream.Music, AudioFocus.Gain); -#pragma warning restore CS0618 // Type or member is obsolete + AudioAttributes attributes = new AudioAttributes.Builder() + .SetUsage(AudioUsageKind.Media) + .SetContentType(AudioContentType.Music) + .Build(); + AudioFocusRequestClass focusRequest = new AudioFocusRequestClass.Builder(AudioFocus.Gain) + .SetAudioAttributes(attributes) + .SetAcceptsDelayedFocusGain(true) + .SetOnAudioFocusChangeListener(this) + .Build(); + var audioFocus = audioManager.RequestAudioFocus(focusRequest); + if (audioFocus != AudioFocusRequest.Granted) { Console.WriteLine("Can't Get Audio Focus"); @@ -210,9 +220,16 @@ namespace MusicApp.Resources.Portable_Class IExtractorsFactory extractorFactory = new DefaultExtractorsFactory(); Handler handler = new Handler(); IMediaSource mediaSource = new ExtractorMediaSource(Uri.Parse(song.GetPath()), dataSourceFactory, extractorFactory, handler, null); -#pragma warning disable CS0618 // Type or member is obsolete - var audioFocus = audioManager.RequestAudioFocus(this, Stream.Music, AudioFocus.Gain); -#pragma warning restore CS0618 // Type or member is obsolete + AudioAttributes attributes = new AudioAttributes.Builder() + .SetUsage(AudioUsageKind.Media) + .SetContentType(AudioContentType.Music) + .Build(); + AudioFocusRequestClass focusRequest = new AudioFocusRequestClass.Builder(AudioFocus.Gain) + .SetAudioAttributes(attributes) + .SetAcceptsDelayedFocusGain(true) + .SetOnAudioFocusChangeListener(this) + .Build(); + var audioFocus = audioManager.RequestAudioFocus(focusRequest); if (audioFocus != AudioFocusRequest.Granted) { Console.WriteLine("Can't Get Audio Focus"); @@ -427,7 +444,7 @@ namespace MusicApp.Resources.Portable_Class Uri musicUri = MediaStore.Audio.Media.ExternalContentUri; - CursorLoader cursorLoader = new CursorLoader(Application.Context, musicUri, null, null, null, null); + Android.Content.CursorLoader cursorLoader = new Android.Content.CursorLoader(Application.Context, musicUri, null, null, null, null); ICursor musicCursor = (ICursor)cursorLoader.LoadInBackground(); if (musicCursor != null && musicCursor.MoveToFirst()) @@ -523,8 +540,11 @@ namespace MusicApp.Resources.Portable_Class tmpDefaultIntent.SetAction("Player"); PendingIntent defaultIntent = PendingIntent.GetActivity(Application.Context, 0, tmpDefaultIntent, PendingIntentFlags.UpdateCurrent); -#pragma warning disable CS0618 // Type or member is obsolete - notification = new NotificationCompat.Builder(Application.Context) + Intent tmpCancelIntent = new Intent(Application.Context, typeof(MainActivity)); + tmpCancelIntent.SetAction("Stop"); + PendingIntent cancelIntent = PendingIntent.GetActivity(Application.Context, 0, tmpCancelIntent, PendingIntentFlags.UpdateCurrent); + + notification = new NotificationCompat.Builder(Application.Context, "MusicApp.Channel") .SetVisibility(NotificationCompat.VisibilityPublic) .SetSmallIcon(Resource.Drawable.MusicIcon) @@ -532,16 +552,20 @@ namespace MusicApp.Resources.Portable_Class .AddAction(Resource.Drawable.ic_pause_black_24dp, "Pause", pauseIntent) .AddAction(Resource.Drawable.ic_skip_next_black_24dp, "Next", nextIntent) - .SetStyle(new NotificationCompat.MediaStyle() + .SetStyle(new MediaStyle() .SetShowActionsInCompactView(1) + .SetShowCancelButton(true) + .SetCancelButtonIntent(cancelIntent) .SetMediaSession(mediaSession.SessionToken)) + .SetColor(ContextCompat.GetColor(Application.Context, Resource.Color.notification_icon_bg_color)) .SetContentTitle(title) .SetContentText(artist) .SetLargeIcon(icon) .SetContentIntent(defaultIntent) + .SetDeleteIntent(cancelIntent) .Build(); + ContextCompat.StartForegroundService(Application.Context, new Intent(Application.Context, typeof(MusicPlayer))); StartForeground(notificationID, notification); -#pragma warning restore CS0618 // Type or member is obsolete } public void Pause() @@ -676,15 +700,13 @@ namespace MusicApp.Resources.Portable_Class Console.WriteLine("Error in playback resetting: " + args.Cause); } -#pragma warning disable CS0618 // Type or member is obsolete public void OnPlayerStateChanged(bool playWhenReady, int state) { - if (state == ExoPlayer.StateEnded) + if (state == Com.Google.Android.Exoplayer2.Player.StateEnded) { PlayNext(); } } -#pragma warning restore CS0618 // Type or member is obsolete public void OnPositionDiscontinuity() diff --git a/MusicApp/Resources/Resource.Designer.cs b/MusicApp/Resources/Resource.Designer.cs index 3e382de..2b2e1e3 100644 --- a/MusicApp/Resources/Resource.Designer.cs +++ b/MusicApp/Resources/Resource.Designer.cs @@ -2817,8 +2817,8 @@ namespace MusicApp // aapt resource value: 0x7f080048 public const int SYM = 2131230792; - // aapt resource value: 0x7f0800ce - public const int action0 = 2131230926; + // aapt resource value: 0x7f0800cf + public const int action0 = 2131230927; // aapt resource value: 0x7f080093 public const int action_bar = 2131230867; @@ -2841,17 +2841,17 @@ namespace MusicApp // aapt resource value: 0x7f080071 public const int action_bar_title = 2131230833; - // aapt resource value: 0x7f0800cb - public const int action_container = 2131230923; + // aapt resource value: 0x7f0800cc + public const int action_container = 2131230924; // aapt resource value: 0x7f080094 public const int action_context_bar = 2131230868; - // aapt resource value: 0x7f0800d2 - public const int action_divider = 2131230930; + // aapt resource value: 0x7f0800d3 + public const int action_divider = 2131230931; - // aapt resource value: 0x7f0800cc - public const int action_image = 2131230924; + // aapt resource value: 0x7f0800cd + public const int action_image = 2131230925; // aapt resource value: 0x7f080003 public const int action_menu_divider = 2131230723; @@ -2868,11 +2868,11 @@ namespace MusicApp // aapt resource value: 0x7f080073 public const int action_mode_close_button = 2131230835; - // aapt resource value: 0x7f0800cd - public const int action_text = 2131230925; + // aapt resource value: 0x7f0800ce + public const int action_text = 2131230926; - // aapt resource value: 0x7f0800db - public const int actions = 2131230939; + // aapt resource value: 0x7f0800dc + public const int actions = 2131230940; // aapt resource value: 0x7f080074 public const int activity_chooser_view_content = 2131230836; @@ -2880,8 +2880,8 @@ namespace MusicApp // aapt resource value: 0x7f08003d public const int add = 2131230781; - // aapt resource value: 0x7f080102 - public const int albumArt = 2131230978; + // aapt resource value: 0x7f080103 + public const int albumArt = 2131230979; // aapt resource value: 0x7f080087 public const int alertTitle = 2131230855; @@ -2892,8 +2892,8 @@ namespace MusicApp // aapt resource value: 0x7f080049 public const int always = 2131230793; - // aapt resource value: 0x7f080104 - public const int artist = 2131230980; + // aapt resource value: 0x7f080105 + public const int artist = 2131230981; // aapt resource value: 0x7f080067 public const int async = 2131230823; @@ -2901,8 +2901,8 @@ namespace MusicApp // aapt resource value: 0x7f080055 public const int auto = 2131230805; - // aapt resource value: 0x7f0800b5 - public const int backToolbar = 2131230901; + // aapt resource value: 0x7f0800b6 + public const int backToolbar = 2131230902; // aapt resource value: 0x7f080040 public const int beginning = 2131230784; @@ -2913,11 +2913,11 @@ namespace MusicApp // aapt resource value: 0x7f08004e public const int bottom = 2131230798; - // aapt resource value: 0x7f0800c8 - public const int bottomView = 2131230920; + // aapt resource value: 0x7f0800c9 + public const int bottomView = 2131230921; - // aapt resource value: 0x7f08010c - public const int browseLayout = 2131230988; + // aapt resource value: 0x7f08010d + public const int browseLayout = 2131230989; // aapt resource value: 0x7f0800a3 public const int browseList = 2131230883; @@ -2925,8 +2925,8 @@ namespace MusicApp // aapt resource value: 0x7f08007a public const int buttonPanel = 2131230842; - // aapt resource value: 0x7f0800cf - public const int cancel_action = 2131230927; + // aapt resource value: 0x7f0800d0 + public const int cancel_action = 2131230928; // aapt resource value: 0x7f080056 public const int center = 2131230806; @@ -2940,8 +2940,8 @@ namespace MusicApp // aapt resource value: 0x7f08008a public const int checkbox = 2131230858; - // aapt resource value: 0x7f0800d7 - public const int chronometer = 2131230935; + // aapt resource value: 0x7f0800d8 + public const int chronometer = 2131230936; // aapt resource value: 0x7f08005f public const int clip_horizontal = 2131230815; @@ -2952,17 +2952,20 @@ namespace MusicApp // aapt resource value: 0x7f08004a public const int collapseActionView = 2131230794; + // aapt resource value: 0x7f0800b4 + public const int collapsingToolbar = 2131230900; + // aapt resource value: 0x7f0800a7 public const int container = 2131230887; // aapt resource value: 0x7f08007d public const int contentPanel = 2131230845; - // aapt resource value: 0x7f0800c6 - public const int contentRefresh = 2131230918; - // aapt resource value: 0x7f0800c7 - public const int contentView = 2131230919; + public const int contentRefresh = 2131230919; + + // aapt resource value: 0x7f0800c8 + public const int contentView = 2131230920; // aapt resource value: 0x7f0800a8 public const int coordinator = 2131230888; @@ -2997,23 +3000,23 @@ namespace MusicApp // aapt resource value: 0x7f080031 public const int disableHome = 2131230769; - // aapt resource value: 0x7f0800ec - public const int downFAB = 2131230956; + // aapt resource value: 0x7f0800ed + public const int downFAB = 2131230957; - // aapt resource value: 0x7f08010d - public const int downloadLayout = 2131230989; + // aapt resource value: 0x7f08010e + public const int downloadLayout = 2131230990; // aapt resource value: 0x7f080095 public const int edit_query = 2131230869; - // aapt resource value: 0x7f0800bc - public const int emptyLoadingLayout = 2131230908; + // aapt resource value: 0x7f0800bd + public const int emptyLoadingLayout = 2131230909; // aapt resource value: 0x7f080041 public const int end = 2131230785; - // aapt resource value: 0x7f0800dd - public const int end_padder = 2131230941; + // aapt resource value: 0x7f0800de + public const int end_padder = 2131230942; // aapt resource value: 0x7f080050 public const int enterAlways = 2131230800; @@ -3084,8 +3087,8 @@ namespace MusicApp // aapt resource value: 0x7f080089 public const int expanded_menu = 2131230857; - // aapt resource value: 0x7f0800be - public const int expendChilds = 2131230910; + // aapt resource value: 0x7f0800bf + public const int expendChilds = 2131230911; // aapt resource value: 0x7f080061 public const int fill = 2131230817; @@ -3108,14 +3111,14 @@ namespace MusicApp // aapt resource value: 0x7f08006e public const int fixed_width = 2131230830; - // aapt resource value: 0x7f0800bd - public const int folderList = 2131230909; - - // aapt resource value: 0x7f0800bf - public const int folderName = 2131230911; + // aapt resource value: 0x7f0800be + public const int folderList = 2131230910; // aapt resource value: 0x7f0800c0 - public const int folderUsed = 2131230912; + public const int folderName = 2131230912; + + // aapt resource value: 0x7f0800c1 + public const int folderUsed = 2131230913; // aapt resource value: 0x7f080069 public const int forever = 2131230825; @@ -3132,11 +3135,11 @@ namespace MusicApp // aapt resource value: 0x7f080079 public const int icon = 2131230841; - // aapt resource value: 0x7f0800ed - public const int icon_frame = 2131230957; + // aapt resource value: 0x7f0800ee + public const int icon_frame = 2131230958; - // aapt resource value: 0x7f0800dc - public const int icon_group = 2131230940; + // aapt resource value: 0x7f0800dd + public const int icon_group = 2131230941; // aapt resource value: 0x7f08004b public const int ifRoom = 2131230795; @@ -3144,11 +3147,11 @@ namespace MusicApp // aapt resource value: 0x7f080076 public const int image = 2131230838; - // aapt resource value: 0x7f0800d8 - public const int info = 2131230936; + // aapt resource value: 0x7f0800d9 + public const int info = 2131230937; - // aapt resource value: 0x7f0800e4 - public const int infoPanel = 2131230948; + // aapt resource value: 0x7f0800e5 + public const int infoPanel = 2131230949; // aapt resource value: 0x7f08006a public const int italic = 2131230826; @@ -3159,8 +3162,8 @@ namespace MusicApp // aapt resource value: 0x7f0800a6 public const int largeLabel = 2131230886; - // aapt resource value: 0x7f0800df - public const int lastButton = 2131230943; + // aapt resource value: 0x7f0800e0 + public const int lastButton = 2131230944; // aapt resource value: 0x7f08005a public const int left = 2131230810; @@ -3168,14 +3171,14 @@ namespace MusicApp // aapt resource value: 0x7f080017 public const int line1 = 2131230743; - // aapt resource value: 0x7f080108 - public const int line2 = 2131230984; + // aapt resource value: 0x7f080109 + public const int line2 = 2131230985; // aapt resource value: 0x7f080018 public const int line3 = 2131230744; - // aapt resource value: 0x7f0800ef - public const int list = 2131230959; + // aapt resource value: 0x7f0800f0 + public const int list = 2131230960; // aapt resource value: 0x7f08002e public const int listMode = 2131230766; @@ -3183,38 +3186,38 @@ namespace MusicApp // aapt resource value: 0x7f080078 public const int list_item = 2131230840; - // aapt resource value: 0x7f0800f4 - public const int localPlay = 2131230964; + // aapt resource value: 0x7f0800f5 + public const int localPlay = 2131230965; - // aapt resource value: 0x7f08010a - public const int masked = 2131230986; + // aapt resource value: 0x7f08010b + public const int masked = 2131230987; - // aapt resource value: 0x7f0800d1 - public const int media_actions = 2131230929; + // aapt resource value: 0x7f0800d2 + public const int media_actions = 2131230930; - // aapt resource value: 0x7f080107 - public const int message = 2131230983; - - // aapt resource value: 0x7f0800b9 - public const int metadataAlbum = 2131230905; - - // aapt resource value: 0x7f0800b4 - public const int metadataArt = 2131230900; - - // aapt resource value: 0x7f0800b8 - public const int metadataArtist = 2131230904; - - // aapt resource value: 0x7f0800b6 - public const int metadataCardView = 2131230902; - - // aapt resource value: 0x7f0800bb - public const int metadataFAB = 2131230907; - - // aapt resource value: 0x7f0800b7 - public const int metadataTitle = 2131230903; + // aapt resource value: 0x7f080108 + public const int message = 2131230984; // aapt resource value: 0x7f0800ba - public const int metadataYID = 2131230906; + public const int metadataAlbum = 2131230906; + + // aapt resource value: 0x7f0800b5 + public const int metadataArt = 2131230901; + + // aapt resource value: 0x7f0800b9 + public const int metadataArtist = 2131230905; + + // aapt resource value: 0x7f0800b7 + public const int metadataCardView = 2131230903; + + // aapt resource value: 0x7f0800bc + public const int metadataFAB = 2131230908; + + // aapt resource value: 0x7f0800b8 + public const int metadataTitle = 2131230904; + + // aapt resource value: 0x7f0800bb + public const int metadataYID = 2131230907; // aapt resource value: 0x7f080042 public const int middle = 2131230786; @@ -3222,14 +3225,14 @@ namespace MusicApp // aapt resource value: 0x7f080064 public const int mini = 2131230820; - // aapt resource value: 0x7f080106 - public const int moreButton = 2131230982; + // aapt resource value: 0x7f080107 + public const int moreButton = 2131230983; // aapt resource value: 0x7f080038 public const int multiply = 2131230776; - // aapt resource value: 0x7f08010b - public const int musicLayout = 2131230987; + // aapt resource value: 0x7f08010c + public const int musicLayout = 2131230988; // aapt resource value: 0x7f0800ad public const int navigation_header_container = 2131230893; @@ -3237,23 +3240,23 @@ namespace MusicApp // aapt resource value: 0x7f08004c public const int never = 2131230796; + // aapt resource value: 0x7f0800e9 + public const int nextArt = 2131230953; + + // aapt resource value: 0x7f0800eb + public const int nextArtist = 2131230955; + + // aapt resource value: 0x7f0800e2 + public const int nextButton = 2131230946; + // aapt resource value: 0x7f0800e8 - public const int nextArt = 2131230952; + public const int nextSong = 2131230952; // aapt resource value: 0x7f0800ea - public const int nextArtist = 2131230954; + public const int nextTitle = 2131230954; - // aapt resource value: 0x7f0800e1 - public const int nextButton = 2131230945; - - // aapt resource value: 0x7f0800e7 - public const int nextSong = 2131230951; - - // aapt resource value: 0x7f0800e9 - public const int nextTitle = 2131230953; - - // aapt resource value: 0x7f0800ca - public const int noPlaylist = 2131230922; + // aapt resource value: 0x7f0800cb + public const int noPlaylist = 2131230923; // aapt resource value: 0x7f080033 public const int none = 2131230771; @@ -3261,23 +3264,23 @@ namespace MusicApp // aapt resource value: 0x7f08002f public const int normal = 2131230767; - // aapt resource value: 0x7f0800da - public const int notification_background = 2131230938; + // aapt resource value: 0x7f0800db + public const int notification_background = 2131230939; + + // aapt resource value: 0x7f0800d5 + public const int notification_main_column = 2131230933; // aapt resource value: 0x7f0800d4 - public const int notification_main_column = 2131230932; - - // aapt resource value: 0x7f0800d3 - public const int notification_main_column_container = 2131230931; + public const int notification_main_column_container = 2131230932; // aapt resource value: 0x7f08006b public const int one = 2131230827; - // aapt resource value: 0x7f0800c5 - public const int pager = 2131230917; + // aapt resource value: 0x7f0800c6 + public const int pager = 2131230918; - // aapt resource value: 0x7f0800c4 - public const int pagerRefresh = 2131230916; + // aapt resource value: 0x7f0800c5 + public const int pagerRefresh = 2131230917; // aapt resource value: 0x7f08005d public const int parallax = 2131230813; @@ -3291,26 +3294,26 @@ namespace MusicApp // aapt resource value: 0x7f08005e public const int pin = 2131230814; - // aapt resource value: 0x7f0800e0 - public const int playButton = 2131230944; + // aapt resource value: 0x7f0800e1 + public const int playButton = 2131230945; - // aapt resource value: 0x7f0800de - public const int playerAlbum = 2131230942; + // aapt resource value: 0x7f0800df + public const int playerAlbum = 2131230943; - // aapt resource value: 0x7f0800e6 - public const int playerArtist = 2131230950; + // aapt resource value: 0x7f0800e7 + public const int playerArtist = 2131230951; + + // aapt resource value: 0x7f0800e4 + public const int playerPlaylistAdd = 2131230948; // aapt resource value: 0x7f0800e3 - public const int playerPlaylistAdd = 2131230947; + public const int playerSleep = 2131230947; - // aapt resource value: 0x7f0800e2 - public const int playerSleep = 2131230946; + // aapt resource value: 0x7f0800e6 + public const int playerTitle = 2131230950; - // aapt resource value: 0x7f0800e5 - public const int playerTitle = 2131230949; - - // aapt resource value: 0x7f08010e - public const int playlistLayout = 2131230990; + // aapt resource value: 0x7f08010f + public const int playlistLayout = 2131230991; // aapt resource value: 0x7f0800a4 public const int playlistName = 2131230884; @@ -3321,29 +3324,29 @@ namespace MusicApp // aapt resource value: 0x7f080007 public const int progress_horizontal = 2131230727; - // aapt resource value: 0x7f0800f6 - public const int quickPlay = 2131230966; + // aapt resource value: 0x7f0800f7 + public const int quickPlay = 2131230967; - // aapt resource value: 0x7f0800f3 - public const int quickPlayLinear = 2131230963; + // aapt resource value: 0x7f0800f4 + public const int quickPlayLinear = 2131230964; // aapt resource value: 0x7f08008c public const int radio = 2131230860; - // aapt resource value: 0x7f0800f7 - public const int recycler = 2131230967; + // aapt resource value: 0x7f0800f8 + public const int recycler = 2131230968; - // aapt resource value: 0x7f080101 - public const int reorder = 2131230977; + // aapt resource value: 0x7f080102 + public const int reorder = 2131230978; // aapt resource value: 0x7f08005b public const int right = 2131230811; - // aapt resource value: 0x7f0800d9 - public const int right_icon = 2131230937; + // aapt resource value: 0x7f0800da + public const int right_icon = 2131230938; - // aapt resource value: 0x7f0800d5 - public const int right_side = 2131230933; + // aapt resource value: 0x7f0800d6 + public const int right_side = 2131230934; // aapt resource value: 0x7f08000c public const int save_image_matrix = 2131230732; @@ -3372,8 +3375,8 @@ namespace MusicApp // aapt resource value: 0x7f080066 public const int scrollable = 2131230822; - // aapt resource value: 0x7f0800f8 - public const int search = 2131230968; + // aapt resource value: 0x7f0800f9 + public const int search = 2131230969; // aapt resource value: 0x7f080097 public const int search_badge = 2131230871; @@ -3405,17 +3408,17 @@ namespace MusicApp // aapt resource value: 0x7f0800a0 public const int search_voice_btn = 2131230880; - // aapt resource value: 0x7f0800f0 - public const int seekbar = 2131230960; - // aapt resource value: 0x7f0800f1 - public const int seekbar_value = 2131230961; + public const int seekbar = 2131230961; + + // aapt resource value: 0x7f0800f2 + public const int seekbar_value = 2131230962; // aapt resource value: 0x7f0800a1 public const int select_dialog_listview = 2131230881; - // aapt resource value: 0x7f08010f - public const int settings = 2131230991; + // aapt resource value: 0x7f080110 + public const int settings = 2131230992; // aapt resource value: 0x7f08008b public const int shortcut = 2131230859; @@ -3432,8 +3435,8 @@ namespace MusicApp // aapt resource value: 0x7f0800a5 public const int smallLabel = 2131230885; - // aapt resource value: 0x7f0800c9 - public const int smallPlayer = 2131230921; + // aapt resource value: 0x7f0800ca + public const int smallPlayer = 2131230922; // aapt resource value: 0x7f0800ac public const int snackbar_action = 2131230892; @@ -3444,38 +3447,38 @@ namespace MusicApp // aapt resource value: 0x7f080054 public const int snap = 2131230804; - // aapt resource value: 0x7f0800eb - public const int songTimer = 2131230955; - - // aapt resource value: 0x7f0800fa - public const int spArt = 2131230970; - - // aapt resource value: 0x7f0800fc - public const int spArtist = 2131230972; - - // aapt resource value: 0x7f0800f9 - public const int spContainer = 2131230969; - - // aapt resource value: 0x7f0800ff - public const int spLast = 2131230975; - - // aapt resource value: 0x7f0800fd - public const int spNext = 2131230973; - - // aapt resource value: 0x7f0800fe - public const int spPlay = 2131230974; - - // aapt resource value: 0x7f080100 - public const int spProgress = 2131230976; + // aapt resource value: 0x7f0800ec + public const int songTimer = 2131230956; // aapt resource value: 0x7f0800fb - public const int spTitle = 2131230971; + public const int spArt = 2131230971; + + // aapt resource value: 0x7f0800fd + public const int spArtist = 2131230973; + + // aapt resource value: 0x7f0800fa + public const int spContainer = 2131230970; + + // aapt resource value: 0x7f080100 + public const int spLast = 2131230976; + + // aapt resource value: 0x7f0800fe + public const int spNext = 2131230974; + + // aapt resource value: 0x7f0800ff + public const int spPlay = 2131230975; + + // aapt resource value: 0x7f080101 + public const int spProgress = 2131230977; + + // aapt resource value: 0x7f0800fc + public const int spTitle = 2131230972; // aapt resource value: 0x7f08007b public const int spacer = 2131230843; - // aapt resource value: 0x7f0800ee - public const int spinner = 2131230958; + // aapt resource value: 0x7f0800ef + public const int spinner = 2131230959; // aapt resource value: 0x7f080008 public const int split_action_bar = 2131230728; @@ -3492,8 +3495,8 @@ namespace MusicApp // aapt resource value: 0x7f08005c public const int start = 2131230812; - // aapt resource value: 0x7f0800d0 - public const int status_bar_latest_event_content = 2131230928; + // aapt resource value: 0x7f0800d1 + public const int status_bar_latest_event_content = 2131230929; // aapt resource value: 0x7f08008d public const int submenuarrow = 2131230861; @@ -3504,14 +3507,14 @@ namespace MusicApp // aapt resource value: 0x7f08006f public const int surface_view = 2131230831; - // aapt resource value: 0x7f0800f2 - public const int switchWidget = 2131230962; + // aapt resource value: 0x7f0800f3 + public const int switchWidget = 2131230963; // aapt resource value: 0x7f080030 public const int tabMode = 2131230768; - // aapt resource value: 0x7f0800c2 - public const int tabs = 2131230914; + // aapt resource value: 0x7f0800c3 + public const int tabs = 2131230915; // aapt resource value: 0x7f080019 public const int text = 2131230745; @@ -3522,8 +3525,8 @@ namespace MusicApp // aapt resource value: 0x7f08001a public const int text2 = 2131230746; - // aapt resource value: 0x7f080103 - public const int textLayout = 2131230979; + // aapt resource value: 0x7f080104 + public const int textLayout = 2131230980; // aapt resource value: 0x7f080081 public const int textSpacerNoButtons = 2131230849; @@ -3543,8 +3546,8 @@ namespace MusicApp // aapt resource value: 0x7f080070 public const int texture_view = 2131230832; - // aapt resource value: 0x7f0800d6 - public const int time = 2131230934; + // aapt resource value: 0x7f0800d7 + public const int time = 2131230935; // aapt resource value: 0x7f08001b public const int title = 2131230747; @@ -3555,8 +3558,8 @@ namespace MusicApp // aapt resource value: 0x7f080086 public const int title_template = 2131230854; - // aapt resource value: 0x7f0800c1 - public const int toolbar = 2131230913; + // aapt resource value: 0x7f0800c2 + public const int toolbar = 2131230914; // aapt resource value: 0x7f08004f public const int top = 2131230799; @@ -3594,8 +3597,8 @@ namespace MusicApp // aapt resource value: 0x7f080016 public const int view_offset_helper = 2131230742; - // aapt resource value: 0x7f080109 - public const int visible = 2131230985; + // aapt resource value: 0x7f08010a + public const int visible = 2131230986; // aapt resource value: 0x7f0800a2 public const int webview = 2131230882; @@ -3606,14 +3609,14 @@ namespace MusicApp // aapt resource value: 0x7f08003f public const int wrap_content = 2131230783; - // aapt resource value: 0x7f080105 - public const int youtubeIcon = 2131230981; + // aapt resource value: 0x7f080106 + public const int youtubeIcon = 2131230982; - // aapt resource value: 0x7f0800f5 - public const int ytPlay = 2131230965; + // aapt resource value: 0x7f0800f6 + public const int ytPlay = 2131230966; - // aapt resource value: 0x7f0800c3 - public const int ytProgress = 2131230915; + // aapt resource value: 0x7f0800c4 + public const int ytProgress = 2131230916; static Id() { diff --git a/MusicApp/Resources/layout/EditMetaData.xml b/MusicApp/Resources/layout/EditMetaData.xml index f08ea68..8402652 100644 --- a/MusicApp/Resources/layout/EditMetaData.xml +++ b/MusicApp/Resources/layout/EditMetaData.xml @@ -11,6 +11,7 @@ - \ No newline at end of file diff --git a/MusicApp/packages.config b/MusicApp/packages.config index f775d0c..0aabed6 100644 --- a/MusicApp/packages.config +++ b/MusicApp/packages.config @@ -1,10 +1,10 @@  - - - - + + + + @@ -60,6 +60,7 @@ +