Skip to content

Commit f2c774c

Browse files
author
theweavrs
committed
add breadplayer android project
1 parent 409307e commit f2c774c

File tree

18 files changed

+369
-29
lines changed

18 files changed

+369
-29
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with you package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{1241A6F7-0E20-4F20-A50F-E701C6089D6B}</ProjectGuid>
9+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<OutputType>Library</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<RootNamespace>BreadPlayer.Views.Android</RootNamespace>
13+
<AssemblyName>BreadPlayer.Views.Android</AssemblyName>
14+
<FileAlignment>512</FileAlignment>
15+
<AndroidApplication>True</AndroidApplication>
16+
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
17+
<AndroidResgenClass>Resource</AndroidResgenClass>
18+
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
19+
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
20+
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
21+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
22+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
23+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
26+
<DebugSymbols>True</DebugSymbols>
27+
<DebugType>Full</DebugType>
28+
<Optimize>False</Optimize>
29+
<OutputPath>bin\Debug\</OutputPath>
30+
<DefineConstants>DEBUG;TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
34+
<AndroidLinkMode>None</AndroidLinkMode>
35+
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<DebugSymbols>True</DebugSymbols>
39+
<DebugType>PdbOnly</DebugType>
40+
<Optimize>True</Optimize>
41+
<OutputPath>bin\Release\</OutputPath>
42+
<DefineConstants>TRACE</DefineConstants>
43+
<ErrorReport>prompt</ErrorReport>
44+
<WarningLevel>4</WarningLevel>
45+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
46+
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
47+
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
48+
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
49+
</PropertyGroup>
50+
<ItemGroup>
51+
<Reference Include="System" />
52+
<Reference Include="System.Xml" />
53+
<Reference Include="System.Core" />
54+
<Reference Include="Mono.Android" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<Compile Include="MainActivity.cs" />
58+
<Compile Include="Resources\Resource.Designer.cs" />
59+
<Compile Include="Properties\AssemblyInfo.cs" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="GettingStarted.Xamarin" />
63+
<None Include="Resources\AboutResources.txt" />
64+
<None Include="Properties\AndroidManifest.xml" />
65+
<None Include="Assets\AboutAssets.txt" />
66+
</ItemGroup>
67+
<ItemGroup>
68+
<AndroidResource Include="Resources\layout\Main.axml">
69+
<SubType>Designer</SubType>
70+
</AndroidResource>
71+
<AndroidResource Include="Resources\values\Strings.xml" />
72+
</ItemGroup>
73+
<ItemGroup>
74+
<Folder Include="Resources\drawable\" />
75+
<Folder Include="Resources\mipmap-hdpi\" />
76+
<Folder Include="Resources\mipmap-mdpi\" />
77+
<Folder Include="Resources\mipmap-xhdpi\" />
78+
<Folder Include="Resources\mipmap-xxhdpi\" />
79+
<Folder Include="Resources\mipmap-xxxhdpi\" />
80+
</ItemGroup>
81+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
82+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
83+
Other similar extension points exist, see Microsoft.Common.targets.
84+
<Target Name="BeforeBuild">
85+
</Target>
86+
<Target Name="AfterBuild">
87+
</Target>
88+
-->
89+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<GettingStarted>
2+
<LocalContent>GS\Android\CS\AndroidApp\GettingStarted.html</LocalContent>
3+
<EmbeddedNavigation>false</EmbeddedNavigation>
4+
</GettingStarted>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Android.App;
2+
using Android.Widget;
3+
using Android.OS;
4+
5+
namespace BreadPlayer.Views.Android
6+
{
7+
[Activity(Label = "BreadPlayer.Views.Android", MainLauncher = true)]
8+
public class MainActivity : Activity
9+
{
10+
protected override void OnCreate(Bundle savedInstanceState)
11+
{
12+
base.OnCreate(savedInstanceState);
13+
14+
// Set our view from the "main" layout resource
15+
SetContentView(Resource.Layout.Main);
16+
}
17+
}
18+
}
19+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="BreadPlayer.Views.Android.BreadPlayer.Views.Android"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<uses-sdk android:minSdkVersion="21" />
7+
<application android:allowBackup="true" android:label="@string/app_name">
8+
</application>
9+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("BreadPlayer.Views.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("BreadPlayer.Views.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2017")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.axml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable/
12+
icon.png
13+
14+
layout/
15+
main.axml
16+
17+
values/
18+
strings.xml
19+
20+
In order to get the build system to recognize Android resources, set the build action to
21+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
22+
instead operate on resource IDs. When you compile an Android application that uses resources,
23+
the build system will package the resources for distribution and generate a class called "R"
24+
(this is an Android convention) that contains the tokens for each one of the resources
25+
included. For example, for the above Resources layout, this is what the R class would expose:
26+
27+
public class R {
28+
public class drawable {
29+
public const int icon = 0x123;
30+
}
31+
32+
public class layout {
33+
public const int main = 0x456;
34+
}
35+
36+
public class strings {
37+
public const int first_string = 0xabc;
38+
public const int second_string = 0xbcd;
39+
}
40+
}
41+
42+
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43+
to reference the layout/main.axml file, or R.strings.first_string to reference the first
44+
string in the dictionary file values/strings.xml.

BreadPlayer.Views.Android/Resources/Resource.Designer.cs

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
>
7+
</LinearLayout>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">BreadPlayer.Views.Android</string>
4+
</resources>

0 commit comments

Comments
 (0)