Skip to content

Commit a94227a

Browse files
committed
initial template project
0 parents  commit a94227a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+956
-0
lines changed

.gitignore

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
##
4+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5+
6+
# User-specific files
7+
*.suo
8+
*.user
9+
*.userosscache
10+
*.sln.docstates
11+
*.local_secrets.*
12+
13+
# User-specific files (MonoDevelop/Xamarin Studio)
14+
*.userprefs
15+
*.DS_Store
16+
17+
# Build results
18+
[Dd]ebug/
19+
[Dd]ebugPublic/
20+
[Rr]elease/
21+
[Rr]eleases/
22+
x64/
23+
x86/
24+
bld/
25+
[Bb]in/
26+
[Oo]bj/
27+
[Ll]og/
28+
29+
# Visual Studio 2015/2017 cache/options directory
30+
.vs/
31+
# Uncomment if you have tasks that create the project's static files in wwwroot
32+
#wwwroot/
33+
34+
# Visual Studio 2017 auto generated files
35+
Generated\ Files/
36+
37+
# MSTest test Results
38+
[Tt]est[Rr]esult*/
39+
[Bb]uild[Ll]og.*
40+
41+
# NUNIT
42+
*.VisualState.xml
43+
TestResult.xml
44+
45+
# .NET Core
46+
project.lock.json
47+
project.fragment.lock.json
48+
artifacts/
49+
**/Properties/launchSettings.json
50+
51+
# Files built by Visual Studio
52+
*_i.c
53+
*_p.c
54+
*_i.h
55+
*.ilk
56+
*.meta
57+
*.obj
58+
*.iobj
59+
*.pch
60+
*.pdb
61+
*.ipdb
62+
*.pgc
63+
*.pgd
64+
*.rsp
65+
*.sbr
66+
*.tlb
67+
*.tli
68+
*.tlh
69+
*.tmp
70+
*.tmp_proj
71+
*.log
72+
*.vspscc
73+
*.vssscc
74+
.builds
75+
*.pidb
76+
*.svclog
77+
*.scc
78+
79+
# Visual Studio cache files
80+
# files ending in .cache can be ignored
81+
*.[Cc]ache
82+
# but keep track of directories ending in .cache
83+
!*.[Cc]ache/
84+
85+
# MFractors (Xamarin productivity tool) working folder
86+
.mfractor/
87+
88+
# Xcode
89+
**.xcuserstate
90+
devsettings\.plist
91+
contents\.xcworkspacedata
92+
UserInterfaceState\.xcuserstate
93+
94+
# Android autogenerated file with resources identifiers
95+
**/Resources/Resource.designer.cs
96+
97+
# FAKE - F# Make
98+
.fake/
99+
100+
# JetBrains Rider
101+
.idea/
102+
*.sln.iml
103+
104+
# don't commit constants file
105+
# path to constants file

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# XamCast
+19
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 your 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");

XamCast.Android/MainActivity.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.OS;
7+
8+
namespace XamCast.Droid
9+
{
10+
[Activity(Label = "XamCast", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
11+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
12+
{
13+
protected override void OnCreate(Bundle savedInstanceState)
14+
{
15+
base.OnCreate(savedInstanceState);
16+
17+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
18+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
19+
LoadApplication(new App());
20+
}
21+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
22+
{
23+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
24+
25+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xamcat.xamcast">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
4+
<application android:label="XamCast.Android" android:theme="@style/MainTheme"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
+30
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("XamCast.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("XamCast.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
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+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
27+
28+
// Add some common permissions, these can be removed if not needed
29+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.xml),
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-hdpi/
12+
icon.png
13+
14+
drawable-ldpi/
15+
icon.png
16+
17+
drawable-mdpi/
18+
icon.png
19+
20+
layout/
21+
main.xml
22+
23+
values/
24+
strings.xml
25+
26+
In order to get the build system to recognize Android resources, set the build action to
27+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
28+
instead operate on resource IDs. When you compile an Android application that uses resources,
29+
the build system will package the resources for distribution and generate a class called
30+
"Resource" that contains the tokens for each one of the resources included. For example,
31+
for the above Resources layout, this is what the Resource class would expose:
32+
33+
public class Resource {
34+
public class drawable {
35+
public const int icon = 0x123;
36+
}
37+
38+
public class layout {
39+
public const int main = 0x456;
40+
}
41+
42+
public class strings {
43+
public const int first_string = 0xabc;
44+
public const int second_string = 0xbcd;
45+
}
46+
}
47+
48+
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49+
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50+
string in the dictionary file values/strings.xml.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/launcher_background" />
4+
<foreground android:drawable="@mipmap/launcher_foreground" />
5+
</adaptive-icon>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/launcher_background" />
4+
<foreground android:drawable="@mipmap/launcher_foreground" />
5+
</adaptive-icon>
4.64 KB
Loading
Loading
2.74 KB
Loading
Loading
6.86 KB
Loading
Loading
12.5 KB
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="launcher_background">#FFFFFF</color>
4+
<color name="colorPrimary">#3F51B5</color>
5+
<color name="colorPrimaryDark">#303F9F</color>
6+
<color name="colorAccent">#FF4081</color>
7+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<resources>
3+
4+
<style name="MainTheme" parent="MainTheme.Base">
5+
<!-- As of Xamarin.Forms 4.6 the theme has moved into the Forms binary -->
6+
<!-- If you want to override anything you can do that here. -->
7+
<!-- Underneath are a couple of entries to get you started. -->
8+
9+
<!-- Set theme colors from https://aka.ms/material-colors -->
10+
<!-- colorPrimary is used for the default action bar background -->
11+
<!--<item name="colorPrimary">#2196F3</item>-->
12+
<!-- colorPrimaryDark is used for the status bar -->
13+
<!--<item name="colorPrimaryDark">#1976D2</item>-->
14+
<!-- colorAccent is used as the default value for colorControlActivated
15+
which is used to tint widgets -->
16+
<!--<item name="colorAccent">#FF4081</item>-->
17+
</style>
18+
</resources>
+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{8DFB603B-104E-46EA-ABBE-78B4022BC077}</ProjectGuid>
7+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>XamCast.Droid</RootNamespace>
11+
<AssemblyName>XamCast.Android</AssemblyName>
12+
<Deterministic>True</Deterministic>
13+
<AndroidApplication>True</AndroidApplication>
14+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
15+
<AndroidResgenClass>Resource</AndroidResgenClass>
16+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
17+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
18+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
19+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
20+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
21+
<AndroidUseAapt2>true</AndroidUseAapt2>
22+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
23+
<NuGetPackageImportStamp>
24+
</NuGetPackageImportStamp>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
<DebugType>portable</DebugType>
29+
<Optimize>false</Optimize>
30+
<OutputPath>bin\Debug</OutputPath>
31+
<DefineConstants>DEBUG;</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<AndroidLinkMode>None</AndroidLinkMode>
35+
</PropertyGroup>
36+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
37+
<DebugSymbols>true</DebugSymbols>
38+
<DebugType>portable</DebugType>
39+
<Optimize>true</Optimize>
40+
<OutputPath>bin\Release</OutputPath>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
44+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
45+
</PropertyGroup>
46+
<ItemGroup>
47+
<Reference Include="Mono.Android" />
48+
<Reference Include="System" />
49+
<Reference Include="System.Core" />
50+
<Reference Include="System.Xml.Linq" />
51+
<Reference Include="System.Xml" />
52+
<Reference Include="System.Numerics" />
53+
<Reference Include="System.Numerics.Vectors" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
57+
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Include="MainActivity.cs" />
61+
<Compile Include="Resources\Resource.designer.cs" />
62+
<Compile Include="Properties\AssemblyInfo.cs" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<None Include="Resources\AboutResources.txt" />
66+
<None Include="Assets\AboutAssets.txt" />
67+
<None Include="Properties\AndroidManifest.xml" />
68+
</ItemGroup>
69+
<ItemGroup>
70+
<AndroidResource Include="Resources\values\styles.xml" />
71+
<AndroidResource Include="Resources\values\colors.xml" />
72+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
73+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
74+
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
75+
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
76+
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
77+
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
78+
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
79+
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
80+
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
81+
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
82+
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
83+
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
84+
</ItemGroup>
85+
<ItemGroup>
86+
<Folder Include="Resources\drawable\" />
87+
</ItemGroup>
88+
<ItemGroup>
89+
<ProjectReference Include="..\XamCast\XamCast.csproj">
90+
<Project>{89B08093-7915-43BF-A036-9DA088B18DC9}</Project>
91+
<Name>XamCast</Name>
92+
</ProjectReference>
93+
</ItemGroup>
94+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
95+
</Project>

0 commit comments

Comments
 (0)