From 4d049f831057ca9776b1724853633b48ddc6c21e Mon Sep 17 00:00:00 2001 From: Me on Windows Date: Fri, 4 Jun 2021 02:33:50 +0000 Subject: [PATCH 01/45] This is basic, but at least can launch on Android 4.4. --- ArchitectureOverview.xopp | Bin 0 -> 4121 bytes NuGet.Config | 7 + QuickPlay.sln | 28 + QuickPlay/Configuration.cs | 27 +- QuickPlay/Interfaces.cs | 2 +- QuickPlay/MainActivity.cs | 76 +- QuickPlay/MpdMonitorService.cs | 34 + QuickPlay/Properties/AndroidManifest.xml | 2 +- QuickPlay/QuickPlay.csproj | 23 +- QuickPlay/Resources/Resource.designer.cs | 10541 ++++++----------- QuickPlay/Resources/layout/activity_main.xml | 75 +- QuickPlay/Resources/layout/content_main.xml | 2 +- QuickPlay/Resources/values/strings.xml | 1 + QuickPlay/Resources/values/styles.xml | 6 +- 14 files changed, 3602 insertions(+), 7222 deletions(-) create mode 100644 ArchitectureOverview.xopp create mode 100644 NuGet.Config create mode 100644 QuickPlay/MpdMonitorService.cs diff --git a/ArchitectureOverview.xopp b/ArchitectureOverview.xopp new file mode 100644 index 0000000000000000000000000000000000000000..67e418ab50f82621c160b4c6027c1fc132370161 GIT binary patch literal 4121 zcmV+!5a#b6iwFP!000003cXrakK0O13O_w#8$DZbG6|=Xbrkxap2O(* zpU+Pp&(UEYPS%#U_a{lT|MWb18%U)rm|_!{HCwFxZ|ksUn3OD%wg371o72cUZ2T~> zK3K8uTk|B@#{cU$!6KO-T-%E_&X;Yr+wb2#I&aH7ecbN-m9EK_Ry)%^a%+AiMyEj~>E`EAt((erht2F#rdx3_#V6AU^*YgH5m)m`Im|@) z>m*3$3!UwbEPR@uQnl)haQDnM6~sH2(t0?MqeRU{_%f4P&N{SEk6+p+7AJ*Zdrr5# znyq*ws9p61|-3$fKY4RZvpt zAueW?xgz!2y81HTleB+L*Qjd5+2f$G%JsT&JIxPif3{uc#^YMSZ=iFOaSroZm62Yl zAT(KTmWRx;=x&;uPEyM|UU#C>OPbZ#iR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5b@0WS77X-W9+nq3L3c@8JV{(qt13U`c{aaQ1>;!0*ux0?jz2_G>%4$qy*8L~C$5M?VO@*WTMyyPt8>Gw;-e+=hfS zf#&xv;Ra+{!%^k|J{;TFzzT|#i3ecJM1bBGvKw6eIrCxAC=~#NYyC!i08A3fvu5&V zJ>Uo4lO&5Uh@U$CCQAJHsbzjKh!a2b{3qMC|D4?Xy4@Id3%&)OVVWOQM-1^+#)X7` zJ9GhGH*tcDkOqjvpa&YhG{C?H41j!zA78@;Kc5i{V-1Riedmxkj2lBO2XyGp1{GvX3)Q@!rT z39u$j(8K$tt4U$bd-vnO$AJ*SVUXRA1F?ec2IYV}jx#{EqU?wF!C8iV-&br6G!;rZ zR048W;x%9vS|NrL|NXdW?yl&d{yW=+ie;EIELjdE9DT&~mdyA95&PdMkS zZ}D@B+xzib+v0u2%?zi}SA+qIZ(pn>WZ#II=>WfE@Xi + + + + + + \ No newline at end of file diff --git a/QuickPlay.sln b/QuickPlay.sln index 54c5126..64c209c 100644 --- a/QuickPlay.sln +++ b/QuickPlay.sln @@ -5,10 +5,17 @@ VisualStudioVersion = 16.0.31112.23 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickPlay", "QuickPlay\QuickPlay.csproj", "{FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MpcNET", "..\..\Third-party\MpcNET\Source\MpcNET\MpcNET.csproj", "{9477D75F-2F50-41A8-A082-B43873FFE0B4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MpcCore", "..\..\Third-party\mpcCore\src\MpcCore\MpcCore.csproj", "{D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPDConsoleTests", "..\MPDConsoleTests\MPDConsoleTests.csproj", "{8A1047BF-5D07-4242-9DB8-1D419B953E34}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Release-Stable|Any CPU = Release-Stable|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -17,6 +24,27 @@ Global {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release|Any CPU.ActiveCfg = Release|Any CPU {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release|Any CPU.Build.0 = Release|Any CPU {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release|Any CPU.Deploy.0 = Release|Any CPU + {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU + {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release-Stable|Any CPU.Build.0 = Release|Any CPU + {FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release-Stable|Any CPU.Deploy.0 = Release|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Release|Any CPU.Build.0 = Release|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU + {9477D75F-2F50-41A8-A082-B43873FFE0B4}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Release|Any CPU.Build.0 = Release|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU + {D0A5AD05-B98C-45E6-B61D-4700F7AA72CF}.Release-Stable|Any CPU.Build.0 = Release|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Release|Any CPU.Build.0 = Release|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU + {8A1047BF-5D07-4242-9DB8-1D419B953E34}.Release-Stable|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/QuickPlay/Configuration.cs b/QuickPlay/Configuration.cs index 723e4b4..16771e0 100644 --- a/QuickPlay/Configuration.cs +++ b/QuickPlay/Configuration.cs @@ -1,14 +1,30 @@ using System; using System.IO; -namespace QuickPlayer +namespace QuickPlay { /// /// Application (global) configuration data class /// - class AppConfiguration + [Serializable] + sealed class AppConfiguration { + public readonly string playerConfigUrl; + public static AppConfiguration loadSavedConfiguration() + { + throw new NotImplementedException(); + } + + public void saveConfiguration() + { + + + + // Make sure that the configuration is same + var newConfig = AppConfiguration.loadSavedConfiguration(); + if (this != newConfig) throw new InvalidDataException("Saved configuration is different from the supplied one."); + } } /// @@ -31,12 +47,15 @@ namespace QuickPlayer sealed class NetworkConfigurationProvider : IPlayerConfigurationProvider { - + PlayerConfiguration IPlayerConfigurationProvider.GetConfiguration() + { + throw new NotImplementedException(); + } } sealed class FileConfigurationProvider : IPlayerConfigurationProvider { - public readonly StreamReader reader; + StreamReader reader; public FileConfigurationProvider(StreamReader reader) { this.reader = reader; diff --git a/QuickPlay/Interfaces.cs b/QuickPlay/Interfaces.cs index dd4c473..0f3e44d 100644 --- a/QuickPlay/Interfaces.cs +++ b/QuickPlay/Interfaces.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; // MPD client abstractions and simplifications -namespace QuickPlayer +namespace QuickPlay { /// /// Simplified abstraction of possible players. Only methods needed are included. diff --git a/QuickPlay/MainActivity.cs b/QuickPlay/MainActivity.cs index 531edb4..f61e704 100644 --- a/QuickPlay/MainActivity.cs +++ b/QuickPlay/MainActivity.cs @@ -1,60 +1,58 @@ using System; using Android.App; using Android.OS; -using Android.Runtime; -using Android.Views; -using AndroidX.AppCompat.Widget; -using AndroidX.AppCompat.App; -using Google.Android.Material.FloatingActionButton; -using Google.Android.Material.Snackbar; +//using Android.Runtime; +//using Android.Views; +//using AndroidX.AppCompat.Widget; +//using AndroidX.AppCompat.App; +//using Google.Android.Material.FloatingActionButton; +//using Google.Android.Material.Snackbar; +using Android.Support.V7.App; +using Toolbar = Android.Support.V7.Widget.Toolbar; + +using System.Net; +//using MpcNET; +//using MpcNET.Commands.Playback; +//using MpcCore; +//using MpcCore.Commands.Player; +//using MpcCore.Response; +using System.Collections.Generic; namespace QuickPlay { - [Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true)] + [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] public class MainActivity : AppCompatActivity { + private AppConfiguration appConfig; + private List playerConfigs; + protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); - Xamarin.Essentials.Platform.Init(this, savedInstanceState); - SetContentView(Resource.Layout.activity_main); - - Toolbar toolbar = FindViewById(Resource.Id.toolbar); - SetSupportActionBar(toolbar); - FloatingActionButton fab = FindViewById(Resource.Id.fab); - fab.Click += FabOnClick; - } - - public override bool OnCreateOptionsMenu(IMenu menu) - { - MenuInflater.Inflate(Resource.Menu.menu_main, menu); - return true; - } - public override bool OnOptionsItemSelected(IMenuItem item) - { - int id = item.ItemId; - if (id == Resource.Id.action_settings) - { - return true; - } + // App initialization + //appConfig = AppConfiguration.loadSavedConfiguration(); + //playerConfigs = acquirePlayerConfigs(); - return base.OnOptionsItemSelected(item); - } + // UI initialization + SetContentView(Resource.Layout.activity_main); - private void FabOnClick(object sender, EventArgs eventArgs) - { - View view = (View) sender; - Snackbar.Make(view, "Replace with your own action", Snackbar.LengthLong) - .SetAction("Action", (View.IOnClickListener)null).Show(); + // UI Toolbar initialization + // var toolbar = FindViewById(Resource.Id.toolbar); + // SetSupportActionBar(toolbar); + // ActionBar.Title = "My Toolbar"; } - public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) + List acquirePlayerConfigs() { - Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); + // FIXME: Bad! We have IPlayerConfigurationProviders + ///var url = appConfig.playerConfigUrl; + // TODO: Learn cURL and get configs :-) - base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + return null; + throw new NotImplementedException(); } - } + + } } diff --git a/QuickPlay/MpdMonitorService.cs b/QuickPlay/MpdMonitorService.cs new file mode 100644 index 0000000..bef31d7 --- /dev/null +++ b/QuickPlay/MpdMonitorService.cs @@ -0,0 +1,34 @@ +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace QuickPlay +{ + [Service(Exported = true, Name = "cz.ledoian.quickplay.mpdmonior")] + class MpdMonitorService : Service + { + public override void OnCreate() + { + base.OnCreate(); + } + public override IBinder OnBind(Intent intent) + { + throw new NotImplementedException(); + } + public override bool OnUnbind(Intent intent) + { + return base.OnUnbind(intent); + } + public override void OnDestroy() + { + base.OnDestroy(); + } + } +} \ No newline at end of file diff --git a/QuickPlay/Properties/AndroidManifest.xml b/QuickPlay/Properties/AndroidManifest.xml index 889595d..a10ecfd 100644 --- a/QuickPlay/Properties/AndroidManifest.xml +++ b/QuickPlay/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/QuickPlay/QuickPlay.csproj b/QuickPlay/QuickPlay.csproj index 0e5a4c9..3db59f7 100644 --- a/QuickPlay/QuickPlay.csproj +++ b/QuickPlay/QuickPlay.csproj @@ -36,11 +36,13 @@ 4 True None - true + false false false false false + false + false True @@ -64,6 +66,9 @@ + + + @@ -108,12 +113,18 @@ - - - 2.1.0.8 + + 28.0.0.3 - - + + 28.0.0.3 + + + + + {d0a5ad05-b98c-45e6-b61d-4700f7aa72cf} + MpcCore + + + + + - - - - + + + diff --git a/QuickPlay/Resources/layout/content_main.xml b/QuickPlay/Resources/layout/content_main.xml index 5662d6d..050b6e9 100644 --- a/QuickPlay/Resources/layout/content_main.xml +++ b/QuickPlay/Resources/layout/content_main.xml @@ -1,10 +1,10 @@ + QuickPlay Settings + Not Connected! diff --git a/QuickPlay/Resources/values/styles.xml b/QuickPlay/Resources/values/styles.xml index fef37f9..545b9c6 100644 --- a/QuickPlay/Resources/values/styles.xml +++ b/QuickPlay/Resources/values/styles.xml @@ -1,7 +1,7 @@ - -