From 9f4cd60672d5a87e4668ff6594566589ce9c6a67 Mon Sep 17 00:00:00 2001 From: Gboy9155 <32224410+Gboy9155@users.noreply.github.com> Date: Fri, 15 Dec 2017 19:49:32 +0100 Subject: [PATCH] more button --- MusicApp/MainActivity.cs | 5 + MusicApp/MusicApp.csproj | 3 + MusicApp/Resources/Portable Class/Adapter.cs | 12 ++ MusicApp/Resources/Portable Class/Browse.cs | 26 ++-- .../Resources/Portable Class/FolderBrowse.cs | 32 ++--- .../Resources/Portable Class/FolderTracks.cs | 10 +- MusicApp/Resources/Portable Class/Playlist.cs | 5 +- .../Portable Class/PlaylistTracks.cs | 13 +- MusicApp/Resources/Portable Class/Queue.cs | 14 +- .../Resources/Portable Class/YoutubeEngine.cs | 5 +- .../Resources/Portable Class/YtPlaylists.cs | 24 ++-- MusicApp/Resources/Resource.Designer.cs | 98 +++++++------ .../drawable/ic_more_vert_black_24dp.png | Bin 0 -> 132 bytes MusicApp/Resources/layout/Main.axml | 135 +++++++++--------- MusicApp/Resources/layout/SongList.xml | 71 +++++---- MusicApp/Resources/values/Holder.cs | 2 + 16 files changed, 258 insertions(+), 197 deletions(-) create mode 100644 MusicApp/Resources/drawable/ic_more_vert_black_24dp.png diff --git a/MusicApp/MainActivity.cs b/MusicApp/MainActivity.cs index 7de0dc2..e2da1a5 100644 --- a/MusicApp/MainActivity.cs +++ b/MusicApp/MainActivity.cs @@ -734,5 +734,10 @@ namespace MusicApp Browse.instance?.PopulateList(); Playlist.instance?.PopulateView(); } + + public void Transition(int Resource, Android.Support.V4.App.Fragment fragment, bool backStack) + { + SupportFragmentManager.BeginTransaction().Replace(Resource, fragment).AddToBackStack(null).Commit(); + } } } \ No newline at end of file diff --git a/MusicApp/MusicApp.csproj b/MusicApp/MusicApp.csproj index ce0ac2b..01439e5 100644 --- a/MusicApp/MusicApp.csproj +++ b/MusicApp/MusicApp.csproj @@ -412,6 +412,9 @@ Designer + + + diff --git a/MusicApp/Resources/Portable Class/Adapter.cs b/MusicApp/Resources/Portable Class/Adapter.cs index 7253288..374a637 100644 --- a/MusicApp/Resources/Portable Class/Adapter.cs +++ b/MusicApp/Resources/Portable Class/Adapter.cs @@ -55,7 +55,19 @@ namespace MusicApp.Resources.Portable_Class if (!songList[position].isParsed) { + } + 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]); + }; } return convertView; diff --git a/MusicApp/Resources/Portable Class/Browse.cs b/MusicApp/Resources/Portable Class/Browse.cs index 33358c9..7efe07c 100644 --- a/MusicApp/Resources/Portable Class/Browse.cs +++ b/MusicApp/Resources/Portable Class/Browse.cs @@ -1,16 +1,13 @@ -using Android.OS; -using System.Collections.Generic; -using Android.Widget; +using Android.Content; using Android.Database; +using Android.OS; using Android.Provider; -using MusicApp.Resources.values; -using Android.Content; -using Android; -using Android.Support.Design.Widget; -using Android.Views; -using Android.Content.PM; using Android.Support.V4.App; using Android.Support.V7.App; +using Android.Views; +using Android.Widget; +using MusicApp.Resources.values; +using System.Collections.Generic; namespace MusicApp.Resources.Portable_Class { @@ -145,15 +142,20 @@ namespace MusicApp.Resources.Portable_Class Play(item); } - public void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) + private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { Song item = musicList[e.Position]; if (result != null) item = result[e.Position]; + More(item); + } + + public void More(Song item) + { AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle("Pick an action"); - builder.SetItems(actions, (senderAlert, args) => + builder.SetItems(actions, (senderAlert, args) => { switch (args.Which) { @@ -174,7 +176,7 @@ namespace MusicApp.Resources.Portable_Class } }); builder.Show(); - } + } public static void Play(Song item) { diff --git a/MusicApp/Resources/Portable Class/FolderBrowse.cs b/MusicApp/Resources/Portable Class/FolderBrowse.cs index ddab14b..d9db1ba 100644 --- a/MusicApp/Resources/Portable Class/FolderBrowse.cs +++ b/MusicApp/Resources/Portable Class/FolderBrowse.cs @@ -1,17 +1,15 @@ -using Android.OS; -using System.Collections.Generic; -using Android.Widget; -using Android.Net; -using Android.Database; -using Android.Provider; -using MusicApp.Resources.values; +using Android; using Android.Content; -using Android; -using Android.Support.Design.Widget; -using Android.Views; using Android.Content.PM; +using Android.Database; +using Android.Net; +using Android.OS; +using Android.Provider; using Android.Support.V4.App; using Android.Support.V7.App; +using Android.Views; +using Android.Widget; +using System.Collections.Generic; namespace MusicApp.Resources.Portable_Class { @@ -123,8 +121,13 @@ namespace MusicApp.Resources.Portable_Class private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { - string path = paths[e.Position]; - string displayPath = pathDisplay[e.Position]; + More(e.Position); + } + + public void More(int position) + { + string path = paths[position]; + string displayPath = pathDisplay[position]; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle("Pick an action"); @@ -156,10 +159,7 @@ namespace MusicApp.Resources.Portable_Class act.SupportActionBar.Title = displayPath; MainActivity.instance.HideTabs(); - FragmentTransaction transaction = FragmentManager.BeginTransaction(); - transaction.Replace(Resource.Id.contentView, FolderTracks.NewInstance(path)); - transaction.AddToBackStack(null); - transaction.Commit(); + MainActivity.instance.Transition(Resource.Id.contentView, FolderTracks.NewInstance(path), true); } public void GetPlaylist(string item) diff --git a/MusicApp/Resources/Portable Class/FolderTracks.cs b/MusicApp/Resources/Portable Class/FolderTracks.cs index 231e932..f38d9e6 100644 --- a/MusicApp/Resources/Portable Class/FolderTracks.cs +++ b/MusicApp/Resources/Portable Class/FolderTracks.cs @@ -138,12 +138,18 @@ namespace MusicApp.Resources.Portable_Class private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { - Browse.act = Activity; - Browse.inflater = LayoutInflater; Song item = tracks[e.Position]; if (result != null) item = result[e.Position]; + More(item); + } + + public void More(Song item) + { + Browse.act = Activity; + Browse.inflater = LayoutInflater; + AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle("Pick an action"); builder.SetItems(actions, (senderAlert, args) => diff --git a/MusicApp/Resources/Portable Class/Playlist.cs b/MusicApp/Resources/Portable Class/Playlist.cs index 855e0af..6f6ac8a 100644 --- a/MusicApp/Resources/Portable Class/Playlist.cs +++ b/MusicApp/Resources/Portable Class/Playlist.cs @@ -127,10 +127,7 @@ namespace MusicApp.Resources.Portable_Class act.SupportActionBar.Title = playList[e.Position]; MainActivity.instance.HideTabs(); - FragmentTransaction transaction = FragmentManager.BeginTransaction(); - transaction.Replace(Resource.Id.contentView, PlaylistTracks.NewInstance(playlistId[e.Position])); - transaction.AddToBackStack(null); - transaction.Commit(); + MainActivity.instance.Transition(Resource.Id.contentView, PlaylistTracks.NewInstance(playlistId[e.Position]), true); } private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) diff --git a/MusicApp/Resources/Portable Class/PlaylistTracks.cs b/MusicApp/Resources/Portable Class/PlaylistTracks.cs index 67acfb5..ce6c276 100644 --- a/MusicApp/Resources/Portable Class/PlaylistTracks.cs +++ b/MusicApp/Resources/Portable Class/PlaylistTracks.cs @@ -203,12 +203,17 @@ namespace MusicApp.Resources.Portable_Class private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { - List action = actions.ToList(); - Song item = tracks[e.Position]; if (result != null) item = result[e.Position]; + More(item, e.Position); + } + + public void More(Song item, int position) + { + List action = actions.ToList(); + if (!item.IsYt) { Browse.act = Activity; @@ -251,9 +256,9 @@ namespace MusicApp.Resources.Portable_Class RemoveFromPlaylist(item); else { - string ytTrackID = ytTracksIDs[e.Position]; + string ytTrackID = ytTracksIDs[position]; if (ytTracksIdsResult != null) - ytTrackID = ytTracksIdsResult[e.Position]; + ytTrackID = ytTracksIdsResult[position]; YoutubeEngine.RemoveFromPlaylist(ytTrackID); RemoveFromYtPlaylist(item, ytTrackID); diff --git a/MusicApp/Resources/Portable Class/Queue.cs b/MusicApp/Resources/Portable Class/Queue.cs index e6aa8f3..3f80a47 100644 --- a/MusicApp/Resources/Portable Class/Queue.cs +++ b/MusicApp/Resources/Portable Class/Queue.cs @@ -1,5 +1,4 @@ -using Android.Content; -using Android.OS; +using Android.OS; using Android.Support.V4.App; using Android.Views; using Android.Widget; @@ -58,6 +57,7 @@ namespace MusicApp.Resources.Portable_Class ListAdapter = adapter; ListView.TextFilterEnabled = true; ListView.ItemClick += ListView_ItemClick; + ListView.ItemLongClick += ListView_ItemLongClick; if (adapter == null || adapter.Count == 0) @@ -78,5 +78,15 @@ namespace MusicApp.Resources.Portable_Class MusicPlayer.instance.SwitchQueue(item); } + + private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) + { + More(MusicPlayer.queue[e.Position]); + } + + public void More(Song item) + { + Toast.MakeText(Android.App.Application.Context, "Comming Soon", ToastLength.Short).Show(); + } } } \ No newline at end of file diff --git a/MusicApp/Resources/Portable Class/YoutubeEngine.cs b/MusicApp/Resources/Portable Class/YoutubeEngine.cs index f9bdf98..2bf1f46 100644 --- a/MusicApp/Resources/Portable Class/YoutubeEngine.cs +++ b/MusicApp/Resources/Portable Class/YoutubeEngine.cs @@ -122,7 +122,11 @@ namespace MusicApp.Resources.Portable_Class private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { Song item = result[e.Position]; + More(item); + } + public void More(Song item) + { AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle("Pick an action"); builder.SetItems(actions, (senderAlert, args) => @@ -149,7 +153,6 @@ namespace MusicApp.Resources.Portable_Class } }); builder.Show(); - } public static async void Play(string videoID) diff --git a/MusicApp/Resources/Portable Class/YtPlaylists.cs b/MusicApp/Resources/Portable Class/YtPlaylists.cs index 876e6b5..27ee37e 100644 --- a/MusicApp/Resources/Portable Class/YtPlaylists.cs +++ b/MusicApp/Resources/Portable Class/YtPlaylists.cs @@ -1,7 +1,5 @@ -using Android.Net; -using Android.OS; +using Android.OS; using Android.Support.V4.App; -using Android.Support.V4.View; using Android.Support.V7.App; using Android.Views; using Android.Widget; @@ -9,9 +7,7 @@ using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3.Data; using Java.Util; using MusicApp.Resources.values; -using System; using System.Collections.Generic; -using System.Threading.Tasks; namespace MusicApp.Resources.Portable_Class { @@ -146,13 +142,15 @@ namespace MusicApp.Resources.Portable_Class act.SupportActionBar.Title = playlists[e.Position].GetName(); MainActivity.instance.HideTabs(); - FragmentTransaction transaction = FragmentManager.BeginTransaction(); - transaction.Replace(Resource.Id.contentView, PlaylistTracks.NewInstance(playlists[e.Position].GetPath())); - transaction.AddToBackStack(null); - transaction.Commit(); + MainActivity.instance.Transition(Resource.Id.contentView, PlaylistTracks.NewInstance(playlists[e.Position].GetPath()), true); } private void ListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) + { + More(e.Position); + } + + public void More(int position) { AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle("Pick an action"); @@ -161,16 +159,16 @@ namespace MusicApp.Resources.Portable_Class switch (args.Which) { case 0: - RandomPlay(playlists[e.Position].GetPath()); + RandomPlay(playlists[position].GetPath()); break; case 1: - Rename(e.Position, playlists[e.Position].GetPath()); + Rename(position, playlists[position].GetPath()); break; case 2: - RemovePlaylist(e.Position, playlists[e.Position].GetPath()); + RemovePlaylist(position, playlists[position].GetPath()); break; case 3: - DownloadPlaylist(playlists[e.Position].GetPath()); + DownloadPlaylist(playlists[position].GetPath()); break; default: break; diff --git a/MusicApp/Resources/Resource.Designer.cs b/MusicApp/Resources/Resource.Designer.cs index 799820e..1ce8c39 100644 --- a/MusicApp/Resources/Resource.Designer.cs +++ b/MusicApp/Resources/Resource.Designer.cs @@ -2427,82 +2427,85 @@ namespace MusicApp public const int ic_expand_more_black_24dp = 2130837609; // aapt resource value: 0x7f02006a - public const int ic_pause_black_24dp = 2130837610; + public const int ic_more_vert_black_24dp = 2130837610; // aapt resource value: 0x7f02006b - public const int ic_play_arrow_black_24dp = 2130837611; + public const int ic_pause_black_24dp = 2130837611; // aapt resource value: 0x7f02006c - public const int ic_playlist_add_white_24dp = 2130837612; + public const int ic_play_arrow_black_24dp = 2130837612; // aapt resource value: 0x7f02006d - public const int ic_query_builder_black_24dp = 2130837613; + public const int ic_playlist_add_white_24dp = 2130837613; // aapt resource value: 0x7f02006e - public const int ic_skip_next_black_24dp = 2130837614; + public const int ic_query_builder_black_24dp = 2130837614; // aapt resource value: 0x7f02006f - public const int ic_skip_previous_black_24dp = 2130837615; + public const int ic_skip_next_black_24dp = 2130837615; // aapt resource value: 0x7f020070 - public const int ic_timer_white_24dp = 2130837616; + public const int ic_skip_previous_black_24dp = 2130837616; // aapt resource value: 0x7f020071 - public const int MusicIcon = 2130837617; + public const int ic_timer_white_24dp = 2130837617; // aapt resource value: 0x7f020072 - public const int navigation_empty_icon = 2130837618; + public const int MusicIcon = 2130837618; // aapt resource value: 0x7f020073 - public const int noAlbum = 2130837619; + public const int navigation_empty_icon = 2130837619; // aapt resource value: 0x7f020074 - public const int notification_action_background = 2130837620; + public const int noAlbum = 2130837620; // aapt resource value: 0x7f020075 - public const int notification_bg = 2130837621; + public const int notification_action_background = 2130837621; // aapt resource value: 0x7f020076 - public const int notification_bg_low = 2130837622; + public const int notification_bg = 2130837622; // aapt resource value: 0x7f020077 - public const int notification_bg_low_normal = 2130837623; + public const int notification_bg_low = 2130837623; // aapt resource value: 0x7f020078 - public const int notification_bg_low_pressed = 2130837624; + public const int notification_bg_low_normal = 2130837624; // aapt resource value: 0x7f020079 - public const int notification_bg_normal = 2130837625; + public const int notification_bg_low_pressed = 2130837625; // aapt resource value: 0x7f02007a - public const int notification_bg_normal_pressed = 2130837626; + public const int notification_bg_normal = 2130837626; // aapt resource value: 0x7f02007b - public const int notification_icon_background = 2130837627; - - // aapt resource value: 0x7f020082 - public const int notification_template_icon_bg = 2130837634; - - // aapt resource value: 0x7f020083 - public const int notification_template_icon_low_bg = 2130837635; + public const int notification_bg_normal_pressed = 2130837627; // aapt resource value: 0x7f02007c - public const int notification_tile_bg = 2130837628; + public const int notification_icon_background = 2130837628; + + // aapt resource value: 0x7f020083 + public const int notification_template_icon_bg = 2130837635; + + // aapt resource value: 0x7f020084 + public const int notification_template_icon_low_bg = 2130837636; // aapt resource value: 0x7f02007d - public const int notify_panel_notification_icon_bg = 2130837629; + public const int notification_tile_bg = 2130837629; // aapt resource value: 0x7f02007e - public const int PlaylistPlay = 2130837630; + public const int notify_panel_notification_icon_bg = 2130837630; // aapt resource value: 0x7f02007f - public const int PlaylistPlayIcon = 2130837631; + public const int PlaylistPlay = 2130837631; // aapt resource value: 0x7f020080 - public const int search = 2130837632; + public const int PlaylistPlayIcon = 2130837632; // aapt resource value: 0x7f020081 - public const int settings = 2130837633; + public const int search = 2130837633; + + // aapt resource value: 0x7f020082 + public const int settings = 2130837634; static Drawable() { @@ -2607,8 +2610,8 @@ namespace MusicApp // aapt resource value: 0x7f0800a5 public const int bottomView = 2131230885; - // aapt resource value: 0x7f0800e3 - public const int browseLayout = 2131230947; + // aapt resource value: 0x7f0800e4 + public const int browseLayout = 2131230948; // aapt resource value: 0x7f08008b public const int browseList = 2131230859; @@ -2688,8 +2691,8 @@ namespace MusicApp // aapt resource value: 0x7f0800cd public const int downFAB = 2131230925; - // aapt resource value: 0x7f0800e4 - public const int downloadLayout = 2131230948; + // aapt resource value: 0x7f0800e5 + public const int downloadLayout = 2131230949; // aapt resource value: 0x7f08007d public const int edit_query = 2131230845; @@ -2841,8 +2844,8 @@ namespace MusicApp // aapt resource value: 0x7f0800ba public const int line1 = 2131230906; - // aapt resource value: 0x7f0800df - public const int line2 = 2131230943; + // aapt resource value: 0x7f0800e0 + public const int line2 = 2131230944; // aapt resource value: 0x7f0800bc public const int line3 = 2131230908; @@ -2856,8 +2859,8 @@ namespace MusicApp // aapt resource value: 0x7f08005f public const int list_item = 2131230815; - // aapt resource value: 0x7f0800e1 - public const int masked = 2131230945; + // aapt resource value: 0x7f0800e2 + public const int masked = 2131230946; // aapt resource value: 0x7f0800ae public const int media_actions = 2131230894; @@ -2868,11 +2871,14 @@ namespace MusicApp // aapt resource value: 0x7f08004f public const int mini = 2131230799; + // aapt resource value: 0x7f0800df + public const int moreButton = 2131230943; + // aapt resource value: 0x7f08002a public const int multiply = 2131230762; - // aapt resource value: 0x7f0800e2 - public const int musicLayout = 2131230946; + // aapt resource value: 0x7f0800e3 + public const int musicLayout = 2131230947; // aapt resource value: 0x7f080095 public const int navigation_header_container = 2131230869; @@ -2946,8 +2952,8 @@ namespace MusicApp // aapt resource value: 0x7f0800c6 public const int playerTitle = 2131230918; - // aapt resource value: 0x7f0800e5 - public const int playlistLayout = 2131230949; + // aapt resource value: 0x7f0800e6 + public const int playlistLayout = 2131230950; // aapt resource value: 0x7f08008c public const int playlistName = 2131230860; @@ -3030,8 +3036,8 @@ namespace MusicApp // aapt resource value: 0x7f080089 public const int select_dialog_listview = 2131230857; - // aapt resource value: 0x7f0800e6 - public const int settings = 2131230950; + // aapt resource value: 0x7f0800e7 + public const int settings = 2131230951; // aapt resource value: 0x7f080073 public const int shortcut = 2131230835; @@ -3195,8 +3201,8 @@ namespace MusicApp // aapt resource value: 0x7f08000e public const int view_offset_helper = 2131230734; - // aapt resource value: 0x7f0800e0 - public const int visible = 2131230944; + // aapt resource value: 0x7f0800e1 + public const int visible = 2131230945; // aapt resource value: 0x7f08008a public const int webview = 2131230858; diff --git a/MusicApp/Resources/drawable/ic_more_vert_black_24dp.png b/MusicApp/Resources/drawable/ic_more_vert_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..22acc550088d98f9d98ced517de75b5e8ead3c7c GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B5}8r;B4q1>@UGdwClSM3^70uIQ21 z47_&cJkx~*+Z%R2IKOxGVZM^fH+7^Mmwc{S?NKJ@tD@b{HffqWt7pJW9xm}`3bIR@ eOD6DrGLJi>8B(9~m^Tk-EQ6=3pUXO@geCy;;w$k0 literal 0 HcmV?d00001 diff --git a/MusicApp/Resources/layout/Main.axml b/MusicApp/Resources/layout/Main.axml index f4b0200..6a14954 100644 --- a/MusicApp/Resources/layout/Main.axml +++ b/MusicApp/Resources/layout/Main.axml @@ -1,74 +1,75 @@ - + + + + + + + + - + + - - - - - - - + android:layout_width="match_parent" /> + - - - - - - - + android:layout_height="56dp" + app:menu="@menu/bottom_items" /> + + + + \ No newline at end of file diff --git a/MusicApp/Resources/layout/SongList.xml b/MusicApp/Resources/layout/SongList.xml index a66dc85..c7d0229 100644 --- a/MusicApp/Resources/layout/SongList.xml +++ b/MusicApp/Resources/layout/SongList.xml @@ -1,32 +1,43 @@  - - - - - - + + + + + + + \ No newline at end of file diff --git a/MusicApp/Resources/values/Holder.cs b/MusicApp/Resources/values/Holder.cs index 4ab0f23..5e10367 100644 --- a/MusicApp/Resources/values/Holder.cs +++ b/MusicApp/Resources/values/Holder.cs @@ -9,12 +9,14 @@ namespace MusicApp.Resources.values public TextView Title; public TextView Artist; public ImageView AlbumArt; + public ImageView more; public Holder(View v) { Title = v.FindViewById(Resource.Id.title); Artist = v.FindViewById(Resource.Id.artist); AlbumArt = v.FindViewById(Resource.Id.albumArt); + more = v.FindViewById(Resource.Id.moreButton); } } } \ No newline at end of file