This is basic, but at least can launch on Android 4.4.

develop
LEdoian 4 years ago
parent 5b73f1750f
commit 4d049f8310

Binary file not shown.

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Local (Sundew)" value="C:\Users\Me\AppData\Local\Sundew.Packaging.Publish.m\packages" />
</packageSources>
</configuration>

@ -5,10 +5,17 @@ VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickPlay", "QuickPlay\QuickPlay.csproj", "{FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickPlay", "QuickPlay\QuickPlay.csproj", "{FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release-Stable|Any CPU = Release-Stable|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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.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.Build.0 = Release|Any CPU
{FDBCCBF8-7CA5-4719-8CBB-8E33C464B27C}.Release|Any CPU.Deploy.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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -1,14 +1,30 @@
using System; using System;
using System.IO; using System.IO;
namespace QuickPlayer namespace QuickPlay
{ {
/// <summary> /// <summary>
/// Application (global) configuration data class /// Application (global) configuration data class
/// </summary> /// </summary>
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.");
}
} }
/// <summary> /// <summary>
@ -31,12 +47,15 @@ namespace QuickPlayer
sealed class NetworkConfigurationProvider : IPlayerConfigurationProvider sealed class NetworkConfigurationProvider : IPlayerConfigurationProvider
{ {
PlayerConfiguration IPlayerConfigurationProvider.GetConfiguration()
{
throw new NotImplementedException();
}
} }
sealed class FileConfigurationProvider : IPlayerConfigurationProvider sealed class FileConfigurationProvider : IPlayerConfigurationProvider
{ {
public readonly StreamReader reader; StreamReader reader;
public FileConfigurationProvider(StreamReader reader) public FileConfigurationProvider(StreamReader reader)
{ {
this.reader = reader; this.reader = reader;

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
// MPD client abstractions and simplifications // MPD client abstractions and simplifications
namespace QuickPlayer namespace QuickPlay
{ {
/// <summary> /// <summary>
/// Simplified abstraction of possible players. Only methods needed are included. /// Simplified abstraction of possible players. Only methods needed are included.

@ -1,60 +1,58 @@
using System; using System;
using Android.App; using Android.App;
using Android.OS; using Android.OS;
using Android.Runtime; //using Android.Runtime;
using Android.Views; //using Android.Views;
using AndroidX.AppCompat.Widget; //using AndroidX.AppCompat.Widget;
using AndroidX.AppCompat.App; //using AndroidX.AppCompat.App;
using Google.Android.Material.FloatingActionButton; //using Google.Android.Material.FloatingActionButton;
using Google.Android.Material.Snackbar; //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 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 public class MainActivity : AppCompatActivity
{ {
private AppConfiguration appConfig;
private List<PlayerConfiguration> playerConfigs;
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
SetContentView(Resource.Layout.activity_main);
Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(toolbar);
FloatingActionButton fab = FindViewById<FloatingActionButton>(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) // App initialization
{ //appConfig = AppConfiguration.loadSavedConfiguration();
int id = item.ItemId; //playerConfigs = acquirePlayerConfigs();
if (id == Resource.Id.action_settings)
{
return true;
}
return base.OnOptionsItemSelected(item); // UI initialization
} SetContentView(Resource.Layout.activity_main);
private void FabOnClick(object sender, EventArgs eventArgs) // UI Toolbar initialization
{ // var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
View view = (View) sender; // SetSupportActionBar(toolbar);
Snackbar.Make(view, "Replace with your own action", Snackbar.LengthLong) // ActionBar.Title = "My Toolbar";
.SetAction("Action", (View.IOnClickListener)null).Show();
} }
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) List<PlayerConfiguration> 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();
} }
} }
} }

@ -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();
}
}
}

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.quickplay" android:installLocation="auto"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="cz.ledoian.android.quickplay" android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" /> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"></application> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

@ -36,11 +36,13 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode> <AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk> <EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<AotAssemblies>false</AotAssemblies> <AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM> <EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies> <BundleAssemblies>false</BundleAssemblies>
<AndroidKeyStore>false</AndroidKeyStore>
<AndroidUseAapt2>false</AndroidUseAapt2>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
@ -64,6 +66,9 @@
<Reference Include="System.Numerics.Vectors" /> <Reference Include="System.Numerics.Vectors" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Configuration.cs" />
<Compile Include="Interfaces.cs" />
<Compile Include="MpdMonitorService.cs" />
<Compile Include="MainActivity.cs" /> <Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" /> <Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@ -108,12 +113,18 @@
<Folder Include="Resources\drawable\" /> <Folder Include="Resources\drawable\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.2.0.5" /> <PackageReference Include="Xamarin.Android.Support.v7.AppCompat">
<PackageReference Include="Xamarin.AndroidX.Arch.Core.Runtime"> <Version>28.0.0.3</Version>
<Version>2.1.0.8</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0.1" /> <PackageReference Include="Xamarin.Android.Support.Vector.Drawable">
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" /> <Version>28.0.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Third-party\mpcCore\src\MpcCore\MpcCore.csproj">
<Project>{d0a5ad05-b98c-45e6-b61d-4700f7aa72cf}</Project>
<Name>MpcCore</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

File diff suppressed because it is too large Load Diff

@ -1,32 +1,63 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <!--
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar <android.support.v7.wid.
android:layout_width="match_parent"
android:layout_height="@dimen/abc_action_bar_content_inset_with_nav">
-->
<!-- TODO: Use Coordinator layout -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<!-- <android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="match_parent"
android:background="?attr/colorPrimary" android:gravity="center_vertical"
app:popupTheme="@style/AppTheme.PopupOverlay" /> android:id="@+id/titleText">
<TextView
</com.google.android.material.appbar.AppBarLayout> android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
<include layout="@layout/content_main" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
<com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/appTitleText" />
android:id="@+id/fab" <TextView
android:text="@string/player_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:id="@+id/playerNameText" />
android:layout_margin="@dimen/fab_margin" </LinearLayout>
app:srcCompat="@android:drawable/ic_dialog_email" /> </android.support.v7.widget.Toolbar>
-->
<!-- </android.support.design.widget.AppBarLayout>
-->
</androidx.coordinatorlayout.widget.CoordinatorLayout> <include layout="@layout/content_main" />
<!--<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayout1" />
-->
</RelativeLayout>
<!--
</android.support.design.widget.CoordinatorLayout>
-->

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- LinearLayout? -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"> tools:showIn="@layout/activity_main">
<TextView <TextView

@ -1,4 +1,5 @@
<resources> <resources>
<string name="app_name">QuickPlay</string> <string name="app_name">QuickPlay</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="player_name">Not Connected!</string>
</resources> </resources>

@ -1,7 +1,7 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@ -13,8 +13,8 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources> </resources>

Loading…
Cancel
Save