diff --git a/MusicApp/GlobalSuppressions.cs b/MusicApp/GlobalSuppressions.cs new file mode 100644 index 0000000..dd2f730 --- /dev/null +++ b/MusicApp/GlobalSuppressions.cs @@ -0,0 +1,8 @@ + +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "", Scope = "member", Target = "~P:MusicApp.MainActivity.paddingBot")] + diff --git a/MusicApp/MainActivity.cs b/MusicApp/MainActivity.cs index a2c88d1..1b5a662 100644 --- a/MusicApp/MainActivity.cs +++ b/MusicApp/MainActivity.cs @@ -22,6 +22,18 @@ namespace MusicApp public Android.Support.V7.Widget.Toolbar ToolBar; public IMenu menu; + public static int paddingBot + { + get + { + if (((FrameLayout)instance.FindViewById(Resource.Id.smallPlayer).Parent).Visibility == ViewStates.Gone) + return instance.FindViewById(Resource.Id.bottomView).Height; + else + return instance.FindViewById(Resource.Id.bottomView).Height + ((FrameLayout)instance.FindViewById(Resource.Id.smallPlayer).Parent).Height; + } + } + + protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); @@ -130,7 +142,7 @@ namespace MusicApp FolderTracks.instance.result = null; } - void HideSearch() + public void HideSearch() { if (menu == null) return; diff --git a/MusicApp/MusicApp.csproj b/MusicApp/MusicApp.csproj index 12a19e0..86cada9 100644 --- a/MusicApp/MusicApp.csproj +++ b/MusicApp/MusicApp.csproj @@ -145,6 +145,7 @@ + diff --git a/MusicApp/Resources/Portable Class/Adapter.cs b/MusicApp/Resources/Portable Class/Adapter.cs index 0da8bca..27fd87b 100644 --- a/MusicApp/Resources/Portable Class/Adapter.cs +++ b/MusicApp/Resources/Portable Class/Adapter.cs @@ -1,13 +1,9 @@ using System.Collections.Generic; - using Android.Content; using Android.Views; using Android.Widget; using MusicApp.Resources.values; using Android.Graphics; -using Android.Util; -using System.IO; -using Android.OS; using Android.App; using Square.Picasso; @@ -55,7 +51,7 @@ namespace MusicApp.Resources.Portable_Class Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(holder.AlbumArt); } - convertView.SetBackgroundColor(Color.White); + //convertView.SetBackgroundColor(Color.White); return convertView; } } diff --git a/MusicApp/Resources/Portable Class/Browse.cs b/MusicApp/Resources/Portable Class/Browse.cs index e88d562..9cde7c8 100644 --- a/MusicApp/Resources/Portable Class/Browse.cs +++ b/MusicApp/Resources/Portable Class/Browse.cs @@ -12,6 +12,9 @@ using Android.Content.PM; using Android.Support.V4.App; using Android.Support.V7.App; +using EventArgs = System.EventArgs; +using Square.Picasso; + namespace MusicApp.Resources.Portable_Class { public class Browse : ListFragment @@ -37,12 +40,62 @@ namespace MusicApp.Resources.Portable_Class emptyView = LayoutInflater.Inflate(Resource.Layout.NoSong, null); ListView.EmptyView = emptyView; - if(ListView.Adapter == null) + if (MusicPlayer.isRunning) + { + Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; + + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Visible; + smallPlayer.Visibility = ViewStates.Visible; + smallPlayer.FindViewById(Resource.Id.spTitle).Text = current.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = current.GetArtist(); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, current.GetAlbumArt()); + + Picasso.With(Android.App.Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(art); + + smallPlayer.FindViewById(Resource.Id.spLast).Click += Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click += Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click += Next_Click; + } + + if (ListView.Adapter == null) GetStoragePermission(); } + private void Last_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Previus"); + Activity.StartService(intent); + } + + private void Play_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Pause"); + Activity.StartService(intent); + } + + private void Next_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Next"); + Activity.StartService(intent); + } + public override void OnDestroy() { + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Gone; + smallPlayer.FindViewById(Resource.Id.spLast).Click -= Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click -= Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click -= Next_Click; + if (isEmpty) { ViewGroup rootView = Activity.FindViewById(Android.Resource.Id.Content); @@ -58,7 +111,7 @@ namespace MusicApp.Resources.Portable_Class { View view = base.OnCreateView(inflater, container, savedInstanceState); this.view = view; - view.SetPadding(0, 0, 0, 100); + view.SetPadding(0, 0, 0, MainActivity.paddingBot); return view; } @@ -206,6 +259,9 @@ namespace MusicApp.Resources.Portable_Class Intent intent = new Intent(context, typeof(MusicPlayer)); intent.PutExtra("file", item.GetPath()); context.StartService(intent); + MainActivity.instance.HideTabs(); + MainActivity.instance.HideSearch(); + MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).Commit(); } public static void PlayNext(Song item) diff --git a/MusicApp/Resources/Portable Class/DownloadList.cs b/MusicApp/Resources/Portable Class/DownloadList.cs index 761052f..612e3f9 100644 --- a/MusicApp/Resources/Portable Class/DownloadList.cs +++ b/MusicApp/Resources/Portable Class/DownloadList.cs @@ -11,6 +11,8 @@ using Android.Support.V7.Preferences; using YoutubeExtractor; using System.Linq; using System.Threading.Tasks; +using Square.Picasso; +using System; namespace MusicApp.Resources.Portable_Class { @@ -32,10 +34,59 @@ namespace MusicApp.Resources.Portable_Class ListView.ItemLongClick += ListView_ItemLongClick; ; ListAdapter = null; Activity.AddContentView(emptyView, View.LayoutParameters); + if (MusicPlayer.isRunning) + { + Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; + + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Visible; + smallPlayer.Visibility = ViewStates.Visible; + smallPlayer.FindViewById(Resource.Id.spTitle).Text = current.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = current.GetArtist(); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, current.GetAlbumArt()); + + Picasso.With(Android.App.Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(art); + + smallPlayer.FindViewById(Resource.Id.spLast).Click += Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click += Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click += Next_Click; + } + } + + private void Last_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Previus"); + Activity.StartService(intent); + } + + private void Play_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Pause"); + Activity.StartService(intent); + } + + private void Next_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Next"); + Activity.StartService(intent); } public override void OnDestroy() { + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Gone; + smallPlayer.FindViewById(Resource.Id.spLast).Click -= Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click -= Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click -= Next_Click; + if (isEmpty) { ViewGroup rootView = Activity.FindViewById(Android.Resource.Id.Content); @@ -48,7 +99,10 @@ namespace MusicApp.Resources.Portable_Class public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = base.OnCreateView(inflater, container, savedInstanceState); - view.SetPadding(0, 100, 0, 0); + if (!MusicPlayer.isRunning) + view.SetPadding(0, 100, 0, 0); + else + view.SetPadding(0, 360, 0, 0); return view; } diff --git a/MusicApp/Resources/Portable Class/FolderBrowse.cs b/MusicApp/Resources/Portable Class/FolderBrowse.cs index eb1fff2..ddab14b 100644 --- a/MusicApp/Resources/Portable Class/FolderBrowse.cs +++ b/MusicApp/Resources/Portable Class/FolderBrowse.cs @@ -60,7 +60,7 @@ namespace MusicApp.Resources.Portable_Class { View view = base.OnCreateView(inflater, container, savedInstanceState); this.view = view; - view.SetPadding(0, 0, 0, 100); + view.SetPadding(0, 0, 0, MainActivity.paddingBot); return view; } diff --git a/MusicApp/Resources/Portable Class/FolderTracks.cs b/MusicApp/Resources/Portable Class/FolderTracks.cs index daa3799..4493069 100644 --- a/MusicApp/Resources/Portable Class/FolderTracks.cs +++ b/MusicApp/Resources/Portable Class/FolderTracks.cs @@ -47,7 +47,7 @@ namespace MusicApp.Resources.Portable_Class public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = base.OnCreateView(inflater, container, savedInstanceState); - view.SetPadding(0, 100, 0, 100); + view.SetPadding(0, 100, 0, MainActivity.paddingBot); return view; } diff --git a/MusicApp/Resources/Portable Class/MusicPlayer.cs b/MusicApp/Resources/Portable Class/MusicPlayer.cs index 18e6a89..63746c2 100644 --- a/MusicApp/Resources/Portable Class/MusicPlayer.cs +++ b/MusicApp/Resources/Portable Class/MusicPlayer.cs @@ -237,6 +237,7 @@ namespace MusicApp.Resources.Portable_Class public void AddToQueue(string filePath) { GetTrackSong(filePath, out Song song); + Console.WriteLine("AddToQueue path: " + song.GetPath() + " Before get track song: " + filePath); if (CurrentID() == -1) queue.Add(song); else @@ -263,7 +264,7 @@ namespace MusicApp.Resources.Portable_Class { if (CurrentID() + 1 > queue.Count - 1) { - Stop(); + Pause(); return; } @@ -274,12 +275,28 @@ namespace MusicApp.Resources.Portable_Class async void SwitchQueue(string filePath) { - player.Reset(); + isRunning = true; + + if(player != null) + player.Reset(); InitializePlayer(); await player.SetDataSourceAsync(Application.Context, Uri.Parse(filePath)); player.PrepareAsync(); GetTrackSong(filePath, out Song song); CreateNotification(song.GetName(), song.GetArtist(), song.GetAlbumArt()); + + if (Player.instance != null) + Player.instance.RefreshPlayer(); + + RelativeLayout smallPlayer = MainActivity.instance.FindViewById(Resource.Id.smallPlayer); + smallPlayer.FindViewById(Resource.Id.spTitle).Text = song.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = song.GetArtist(); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + var songCover = Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, song.GetAlbumArt()); + + Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(art); } public static int CurrentID() @@ -353,12 +370,14 @@ namespace MusicApp.Resources.Portable_Class Artist = "Unknow Artist"; if (Album == null) Album = "Unknow Album"; + + break; } } while (musicCursor.MoveToNext()); musicCursor.Close(); } - song = new Song(Title, Artist, Album, AlbumArt, id, path); + song = new Song(Title, Artist, Album, AlbumArt, id, filePath); } async void CreateNotification(string title, string artist, long albumArt = 0, string imageURI = "") diff --git a/MusicApp/Resources/Portable Class/Player.cs b/MusicApp/Resources/Portable Class/Player.cs index c40140b..9a57333 100644 --- a/MusicApp/Resources/Portable Class/Player.cs +++ b/MusicApp/Resources/Portable Class/Player.cs @@ -58,8 +58,8 @@ namespace MusicApp.Resources.Portable_Class async void CreatePlayer() { - if (MusicPlayer.CurrentID() == -1) - await Task.Delay(500); + while (MusicPlayer.CurrentID() == -1) + await Task.Delay(100); MainActivity.instance.ToolBar.Visibility = ViewStates.Gone; MainActivity.instance.FindViewById(Resource.Id.bottomView).Visibility = ViewStates.Gone; @@ -115,6 +115,48 @@ namespace MusicApp.Resources.Portable_Class } } + public async void RefreshPlayer() + { + while (MusicPlayer.CurrentID() == -1) + await Task.Delay(100); + + TextView title = playerView.FindViewById(Resource.Id.playerTitle); + TextView artist = playerView.FindViewById(Resource.Id.playerArtist); + imgView = playerView.FindViewById(Resource.Id.playerAlbum); + + Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; + + title.Text = current.GetName(); + artist.Text = current.GetArtist(); + + var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, current.GetAlbumArt()); + + Picasso.With(Android.App.Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(imgView); + + + bool asNext = MusicPlayer.queue.Count > MusicPlayer.CurrentID() + 1; + if (asNext) + { + Song next = MusicPlayer.queue[MusicPlayer.CurrentID() + 1]; + playerView.FindViewById(Resource.Id.nextTitle).Text = "Next music:"; + playerView.FindViewById(Resource.Id.nextArtist).Text = next.GetName(); + + var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, next.GetAlbumArt()); + + ImageView nextArt = playerView.FindViewById(Resource.Id.nextArt); + Picasso.With(Android.App.Application.Context).Load(nextAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(nextArt); + } + else + { + playerView.FindViewById(Resource.Id.nextTitle).Text = "Next music:"; + playerView.FindViewById(Resource.Id.nextArtist).Text = "Nothing."; + + ImageView nextArt = playerView.FindViewById(Resource.Id.nextArt); + Picasso.With(Android.App.Application.Context).Load(Resource.Drawable.noAlbum).Placeholder(Resource.Drawable.MusicIcon).Into(nextArt); + } + } + private void AddToPlaylist_Click(object sender, EventArgs e) { Browse.act = Activity; diff --git a/MusicApp/Resources/Portable Class/Playlist.cs b/MusicApp/Resources/Portable Class/Playlist.cs index fdeb838..50ea77a 100644 --- a/MusicApp/Resources/Portable Class/Playlist.cs +++ b/MusicApp/Resources/Portable Class/Playlist.cs @@ -11,6 +11,10 @@ using Android.Content.PM; using Android.Support.Design.Widget; using Android; using Android.Net; +using MusicApp.Resources.values; +using Square.Picasso; + +using EventArgs = System.EventArgs; namespace MusicApp.Resources.Portable_Class { @@ -35,10 +39,60 @@ namespace MusicApp.Resources.Portable_Class if(ListView.Adapter == null) GetStoragePermission(); + + if (MusicPlayer.isRunning) + { + Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; + + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Visible; + smallPlayer.Visibility = ViewStates.Visible; + smallPlayer.FindViewById(Resource.Id.spTitle).Text = current.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = current.GetArtist(); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, current.GetAlbumArt()); + + Picasso.With(Android.App.Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(art); + + smallPlayer.FindViewById(Resource.Id.spLast).Click += Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click += Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click += Next_Click; + } + } + + private void Last_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Previus"); + Activity.StartService(intent); + } + + private void Play_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Pause"); + Activity.StartService(intent); + } + + private void Next_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Next"); + Activity.StartService(intent); } public override void OnDestroy() { + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Gone; + smallPlayer.FindViewById(Resource.Id.spLast).Click -= Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click -= Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click -= Next_Click; + if (isEmpty) { ViewGroup rootView = Activity.FindViewById(Android.Resource.Id.Content); @@ -51,7 +105,7 @@ namespace MusicApp.Resources.Portable_Class public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = base.OnCreateView(inflater, container, savedInstanceState); - view.SetPadding(0, 100, 0, 0); + view.SetPadding(0, 100, 0, MainActivity.paddingBot); return view; } diff --git a/MusicApp/Resources/Portable Class/PlaylistTracks.cs b/MusicApp/Resources/Portable Class/PlaylistTracks.cs index ce4b1ef..be35f88 100644 --- a/MusicApp/Resources/Portable Class/PlaylistTracks.cs +++ b/MusicApp/Resources/Portable Class/PlaylistTracks.cs @@ -13,6 +13,9 @@ using Android; using Android.Net; using Android.Support.V7.App; +using EventArgs = System.EventArgs; +using Square.Picasso; + namespace MusicApp.Resources.Portable_Class { public class PlaylistTracks : ListFragment @@ -37,11 +40,61 @@ namespace MusicApp.Resources.Portable_Class PopulateList(); MainActivity.instance.DisplaySearch(1); + + if (MusicPlayer.isRunning) + { + Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; + + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Visible; + smallPlayer.Visibility = ViewStates.Visible; + smallPlayer.FindViewById(Resource.Id.spTitle).Text = current.GetName(); + smallPlayer.FindViewById(Resource.Id.spArtist).Text = current.GetArtist(); + ImageView art = smallPlayer.FindViewById(Resource.Id.spArt); + + var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); + var songAlbumArtUri = ContentUris.WithAppendedId(songCover, current.GetAlbumArt()); + + Picasso.With(Android.App.Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Into(art); + + smallPlayer.FindViewById(Resource.Id.spLast).Click += Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click += Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click += Next_Click; + } + } + + private void Last_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Previus"); + Activity.StartService(intent); + } + + private void Play_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Pause"); + Activity.StartService(intent); + } + + private void Next_Click(object sender, EventArgs e) + { + Intent intent = new Intent(Android.App.Application.Context, typeof(MusicPlayer)); + intent.SetAction("Next"); + Activity.StartService(intent); } public override void OnDestroy() { - if(isEmpty) + RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Gone; + smallPlayer.FindViewById(Resource.Id.spLast).Click -= Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click -= Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click -= Next_Click; + + if (isEmpty) { ViewGroup rootView = Activity.FindViewById(Android.Resource.Id.Content); rootView.RemoveView(emptyView); @@ -61,7 +114,7 @@ namespace MusicApp.Resources.Portable_Class public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = base.OnCreateView(inflater, container, savedInstanceState); - view.SetPadding(0, 100, 0, 100); + view.SetPadding(0, 100, 0, MainActivity.paddingBot); return view; } diff --git a/MusicApp/Resources/Portable Class/Queue.cs b/MusicApp/Resources/Portable Class/Queue.cs index c07b382..e700bf3 100644 --- a/MusicApp/Resources/Portable Class/Queue.cs +++ b/MusicApp/Resources/Portable Class/Queue.cs @@ -32,6 +32,8 @@ namespace MusicApp.Resources.Portable_Class Song current = MusicPlayer.queue[MusicPlayer.CurrentID()]; RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); + FrameLayout parent = (FrameLayout) smallPlayer.Parent; + parent.Visibility = ViewStates.Visible; smallPlayer.Visibility = ViewStates.Visible; smallPlayer.FindViewById(Resource.Id.spTitle).Text = current.GetName(); smallPlayer.FindViewById(Resource.Id.spArtist).Text = current.GetArtist(); @@ -72,7 +74,12 @@ namespace MusicApp.Resources.Portable_Class public override void OnDestroy() { RelativeLayout smallPlayer = Activity.FindViewById(Resource.Id.smallPlayer); - smallPlayer.Visibility = ViewStates.Gone; + FrameLayout parent = (FrameLayout)smallPlayer.Parent; + parent.Visibility = ViewStates.Gone; + smallPlayer.FindViewById(Resource.Id.spLast).Click -= Last_Click; + smallPlayer.FindViewById(Resource.Id.spPlay).Click -= Play_Click; + smallPlayer.FindViewById(Resource.Id.spNext).Click -= Next_Click; + if (isEmpty) { ViewGroup rootView = Activity.FindViewById(Android.Resource.Id.Content); @@ -86,7 +93,7 @@ namespace MusicApp.Resources.Portable_Class { View view = base.OnCreateView(inflater, container, savedInstanceState); this.view = view; - view.SetPadding(0, 100, 0, 100); + view.SetPadding(0, 100, 0, MainActivity.paddingBot); return view; } @@ -107,7 +114,6 @@ namespace MusicApp.Resources.Portable_Class if (adapter == null || adapter.Count == 0) { - view.SetPadding(0, 100, 0, 0); isEmpty = true; Activity.AddContentView(emptyView, View.LayoutParameters); } diff --git a/MusicApp/Resources/Portable Class/TwoLineAdapter.cs b/MusicApp/Resources/Portable Class/TwoLineAdapter.cs index 6d95f95..f08eb6e 100644 --- a/MusicApp/Resources/Portable Class/TwoLineAdapter.cs +++ b/MusicApp/Resources/Portable Class/TwoLineAdapter.cs @@ -44,8 +44,6 @@ namespace MusicApp.Resources.Portable_Class Line1 = { Text = line1[position] }, Line2 = { Text = line2[position].ToString() + ((line2[position] > 1) ? " elements" : " element") }, }; - - convertView.SetBackgroundColor(Color.White); return convertView; } } diff --git a/MusicApp/Resources/Resource.Designer.cs b/MusicApp/Resources/Resource.Designer.cs index 4a8a97f..9293bc2 100644 --- a/MusicApp/Resources/Resource.Designer.cs +++ b/MusicApp/Resources/Resource.Designer.cs @@ -2464,8 +2464,8 @@ namespace MusicApp // aapt resource value: 0x7f07001e public const int add = 2131165214; - // aapt resource value: 0x7f0700c2 - public const int albumArt = 2131165378; + // aapt resource value: 0x7f0700c3 + public const int albumArt = 2131165379; // aapt resource value: 0x7f070058 public const int alertTitle = 2131165272; @@ -2476,8 +2476,8 @@ namespace MusicApp // aapt resource value: 0x7f070023 public const int always = 2131165219; - // aapt resource value: 0x7f0700c3 - public const int artist = 2131165379; + // aapt resource value: 0x7f0700c4 + public const int artist = 2131165380; // aapt resource value: 0x7f07002f public const int auto = 2131165231; @@ -2488,11 +2488,11 @@ namespace MusicApp // aapt resource value: 0x7f070028 public const int bottom = 2131165224; - // aapt resource value: 0x7f07008d - public const int bottomView = 2131165325; + // aapt resource value: 0x7f07008c + public const int bottomView = 2131165324; - // aapt resource value: 0x7f0700c8 - public const int browseLayout = 2131165384; + // aapt resource value: 0x7f0700c9 + public const int browseLayout = 2131165385; // aapt resource value: 0x7f070073 public const int browseList = 2131165299; @@ -2533,8 +2533,8 @@ namespace MusicApp // aapt resource value: 0x7f07004e public const int contentPanel = 2131165262; - // aapt resource value: 0x7f07008c - public const int contentView = 2131165324; + // aapt resource value: 0x7f07008b + public const int contentView = 2131165323; // aapt resource value: 0x7f070078 public const int coordinator = 2131165304; @@ -2572,8 +2572,8 @@ namespace MusicApp // aapt resource value: 0x7f0700b4 public const int downFAB = 2131165364; - // aapt resource value: 0x7f0700c9 - public const int downloadLayout = 2131165385; + // aapt resource value: 0x7f0700ca + public const int downloadLayout = 2131165386; // aapt resource value: 0x7f070066 public const int edit_query = 2131165286; @@ -2665,8 +2665,8 @@ namespace MusicApp // aapt resource value: 0x7f0700a1 public const int line1 = 2131165345; - // aapt resource value: 0x7f0700c4 - public const int line2 = 2131165380; + // aapt resource value: 0x7f0700c5 + public const int line2 = 2131165381; // aapt resource value: 0x7f0700a3 public const int line3 = 2131165347; @@ -2680,8 +2680,8 @@ namespace MusicApp // aapt resource value: 0x7f070048 public const int list_item = 2131165256; - // aapt resource value: 0x7f0700c6 - public const int masked = 2131165382; + // aapt resource value: 0x7f0700c7 + public const int masked = 2131165383; // aapt resource value: 0x7f070095 public const int media_actions = 2131165333; @@ -2695,8 +2695,8 @@ namespace MusicApp // aapt resource value: 0x7f070019 public const int multiply = 2131165209; - // aapt resource value: 0x7f0700c7 - public const int musicLayout = 2131165383; + // aapt resource value: 0x7f0700c8 + public const int musicLayout = 2131165384; // aapt resource value: 0x7f07007d public const int navigation_header_container = 2131165309; @@ -2737,8 +2737,8 @@ namespace MusicApp // aapt resource value: 0x7f070097 public const int notification_main_column_container = 2131165335; - // aapt resource value: 0x7f07008b - public const int pager = 2131165323; + // aapt resource value: 0x7f07008a + public const int pager = 2131165322; // aapt resource value: 0x7f070037 public const int parallax = 2131165239; @@ -2767,8 +2767,8 @@ namespace MusicApp // aapt resource value: 0x7f0700ad public const int playerTitle = 2131165357; - // aapt resource value: 0x7f0700ca - public const int playlistLayout = 2131165386; + // aapt resource value: 0x7f0700cb + public const int playlistLayout = 2131165387; // aapt resource value: 0x7f070074 public const int playlistName = 2131165300; @@ -2851,8 +2851,8 @@ namespace MusicApp // aapt resource value: 0x7f070072 public const int select_dialog_listview = 2131165298; - // aapt resource value: 0x7f0700cb - public const int settings = 2131165387; + // aapt resource value: 0x7f0700cc + public const int settings = 2131165388; // aapt resource value: 0x7f07005c public const int shortcut = 2131165276; @@ -2869,8 +2869,8 @@ namespace MusicApp // aapt resource value: 0x7f070075 public const int smallLabel = 2131165301; - // aapt resource value: 0x7f07008a - public const int smallPlayer = 2131165322; + // aapt resource value: 0x7f07008d + public const int smallPlayer = 2131165325; // aapt resource value: 0x7f07007c public const int snackbar_action = 2131165308; @@ -2890,15 +2890,18 @@ namespace MusicApp // aapt resource value: 0x7f0700be public const int spArtist = 2131165374; - // aapt resource value: 0x7f0700bf - public const int spLast = 2131165375; - // aapt resource value: 0x7f0700c1 - public const int spNext = 2131165377; + public const int spLast = 2131165377; + + // aapt resource value: 0x7f0700bf + public const int spNext = 2131165375; // aapt resource value: 0x7f0700c0 public const int spPlay = 2131165376; + // aapt resource value: 0x7f0700c2 + public const int spProgress = 2131165378; + // aapt resource value: 0x7f0700bd public const int spTitle = 2131165373; @@ -3004,8 +3007,8 @@ namespace MusicApp // aapt resource value: 0x7f07000e public const int view_offset_helper = 2131165198; - // aapt resource value: 0x7f0700c5 - public const int visible = 2131165381; + // aapt resource value: 0x7f0700c6 + public const int visible = 2131165382; // aapt resource value: 0x7f070027 public const int withText = 2131165223; diff --git a/MusicApp/Resources/layout/Main.axml b/MusicApp/Resources/layout/Main.axml index 99b1cf0..91e0a4a 100644 --- a/MusicApp/Resources/layout/Main.axml +++ b/MusicApp/Resources/layout/Main.axml @@ -1,54 +1,61 @@ + - - - - - + android:layout_height="wrap_content"> + + + + android:id="@+id/pager" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + + - - + android:layout_height="56dp" + app:menu="@menu/bottom_items" /> + + + + \ No newline at end of file diff --git a/MusicApp/Resources/layout/SmallPlayer.xml b/MusicApp/Resources/layout/SmallPlayer.xml index 335faa4..611c1a3 100644 --- a/MusicApp/Resources/layout/SmallPlayer.xml +++ b/MusicApp/Resources/layout/SmallPlayer.xml @@ -1,57 +1,75 @@  - - + android:layout_height="70dp" + android:background="#ffffff" + android:id="@+id/smallPlayer" > - - + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" > + - - - + android:layout_gravity="center_vertical" + android:layout_height="wrap_content"> + + + + + + \ No newline at end of file diff --git a/MusicApp/Resources/layout/SongList.xml b/MusicApp/Resources/layout/SongList.xml index 64d4c2a..a66dc85 100644 --- a/MusicApp/Resources/layout/SongList.xml +++ b/MusicApp/Resources/layout/SongList.xml @@ -1,8 +1,7 @@  + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="#000" + android:textSize="16dip" + android:textStyle="bold" /> + android:id="@+id/artist" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="14dip" + android:textColor="#000" /> \ No newline at end of file