├── .gitignore
├── Droid
├── Assets
│ └── AboutAssets.txt
├── CheckableFab.cs
├── MainActivity.cs
├── NativeTest.Droid.csproj
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Resources
│ ├── AboutResources.txt
│ ├── Resource.designer.cs
│ ├── anim
│ │ ├── buzzer_button_compress.xml
│ │ ├── buzzer_fade_out.xml
│ │ ├── buzzer_finger_move.xml
│ │ ├── door_knob_fade_in.xml
│ │ ├── door_knob_move.xml
│ │ ├── door_shadow_appear.xml
│ │ ├── door_shadow_grow.xml
│ │ └── door_trace_path.xml
│ ├── drawable-hdpi
│ │ └── icon.png
│ ├── drawable-xhdpi
│ │ └── icon.png
│ ├── drawable-xxhdpi
│ │ └── icon.png
│ ├── drawable
│ │ ├── anim_vector_finger_to_door.xml
│ │ ├── buzzer_animation_base_vector.xml
│ │ ├── ic_door.xml
│ │ ├── ic_fancy_fab_icon.xml
│ │ ├── ic_finger_buzzer.xml
│ │ └── icon.png
│ ├── layout
│ │ ├── Tabbar.axml
│ │ └── Toolbar.axml
│ └── values
│ │ └── styles.xml
└── packages.config
├── LICENSE.md
├── NativeTest.sln
├── NativeTest
├── NativeTest.cs
├── NativeTest.projitems
└── NativeTest.shproj
├── README.md
└── iOS
├── AppDelegate.cs
├── Assets.xcassets
├── AppIcons.appiconset
│ └── Contents.json
└── Contents.json
├── Entitlements.plist
├── Info.plist
├── LaunchScreen.storyboard
├── Main.cs
├── NativeTest2.iOS.csproj
└── packages.config
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 | *.userprefs
9 |
10 | # Xamarin Components
11 | Components/
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | x64/
18 | build/
19 | bld/
20 | [Bb]in/
21 | [Oo]bj/
22 | [Pp]ackages/
23 | [Cc]omponents/
24 | data/
25 | .nuget/
26 | .vs/
27 | *.csproj.bak
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | #NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | *_i.c
43 | *_p.c
44 | *_i.h
45 | *.ilk
46 | *.meta
47 | *.obj
48 | *.pch
49 | *.pdb
50 | *.pgc
51 | *.pgd
52 | *.rsp
53 | *.sbr
54 | *.tlb
55 | *.tli
56 | *.tlh
57 | *.tmp
58 | *.tmp_proj
59 | *.log
60 | *.vspscc
61 | *.vssscc
62 | .builds
63 | *.pidb
64 | *.svclog
65 | *.scc
66 |
67 | # Chutzpah Test files
68 | _Chutzpah*
69 |
70 | # Visual C++ cache files
71 | ipch/
72 | *.aps
73 | *.ncb
74 | *.opensdf
75 | *.sdf
76 | *.cachefile
77 |
78 | # Visual Studio profiler
79 | *.psess
80 | *.vsp
81 | *.vspx
82 |
83 | # TFS 2012 Local Workspace
84 | $tf/
85 |
86 | # Guidance Automation Toolkit
87 | *.gpState
88 |
89 | # ReSharper is a .NET coding add-in
90 | _ReSharper*/
91 | *.[Rr]e[Ss]harper
92 | *.DotSettings.user
93 |
94 | # JustCode is a .NET coding addin-in
95 | .JustCode
96 |
97 | # TeamCity is a build add-in
98 | _TeamCity*
99 |
100 | # DotCover is a Code Coverage Tool
101 | *.dotCover
102 |
103 | # NCrunch
104 | *.ncrunch*
105 | _NCrunch_*
106 | .*crunch*.local.xml
107 |
108 | # MightyMoose
109 | *.mm.*
110 | AutoTest.Net/
111 |
112 | # Web workbench (sass)
113 | .sass-cache/
114 |
115 | # Installshield output folder
116 | [Ee]xpress/
117 |
118 | # DocProject is a documentation generator add-in
119 | DocProject/buildhelp/
120 | DocProject/Help/*.HxT
121 | DocProject/Help/*.HxC
122 | DocProject/Help/*.hhc
123 | DocProject/Help/*.hhk
124 | DocProject/Help/*.hhp
125 | DocProject/Help/Html2
126 | DocProject/Help/html
127 |
128 | # Click-Once directory
129 | publish/
130 |
131 | # Publish Web Output
132 | *.[Pp]ublish.xml
133 | *.azurePubxml
134 |
135 | # Windows Azure Build Output
136 | csx/
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.dbproj.schemaview
151 | *.pfx
152 | *.publishsettings
153 | node_modules/
154 | .DS_Store
155 |
156 | # RIA/Silverlight projects
157 | Generated_Code/
158 |
159 | # Backup & report files from converting an old project file to a newer
160 | # Visual Studio version. Backup files are not needed, because we have git ;-)
161 | _UpgradeReport_Files/
162 | Backup*/
163 | UpgradeLog*.XML
164 | UpgradeLog*.htm
165 |
166 | # SQL Server files
167 | *.mdf
168 | *.ldf
169 |
170 | # Business Intelligence projects
171 | *.rdl.data
172 | *.bim.layout
173 | *.bim_*.settings
174 |
175 | # Microsoft Fakes
176 | FakesAssemblies/
177 |
--------------------------------------------------------------------------------
/Droid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
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");
20 |
--------------------------------------------------------------------------------
/Droid/CheckableFab.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | using Android.App;
7 | using Android.Content;
8 | using Android.OS;
9 | using Android.Runtime;
10 | using Android.Util;
11 | using Android.Views;
12 | using Android.Widget;
13 | using Android.Support.Design.Widget;
14 | using Android.Graphics.Drawables;
15 | using Android.Content.Res;
16 | using Android.Animation;
17 | using Android.Views.Animations;
18 | using DrawableCompat = Android.Support.V4.Graphics.Drawable.DrawableCompat;
19 |
20 | namespace NativeTest.Droid
21 | {
22 | public class CheckableFab : FloatingActionButton, ICheckable
23 | {
24 | static readonly int[] CheckedStateSet = {
25 | Android.Resource.Attribute.StateChecked
26 | };
27 | bool chked;
28 | Drawable.ConstantState imgState;
29 |
30 | public CheckableFab(Context context) :
31 | base(context)
32 | {
33 | Initialize(context, null);
34 |
35 | }
36 |
37 | public CheckableFab(Context context, IAttributeSet attrs) :
38 | base(context, attrs)
39 | {
40 | Initialize(context, attrs);
41 | }
42 |
43 | public CheckableFab(Context context, IAttributeSet attrs, int defStyle) :
44 | base(context, attrs, defStyle)
45 | {
46 | Initialize(context, attrs);
47 | }
48 |
49 | public CheckableFab(IntPtr handle, JniHandleOwnership own)
50 | : base(handle, own)
51 | {
52 | }
53 |
54 | void Initialize(Context context, IAttributeSet attrs)
55 | {
56 | //imgState = Drawable.GetConstantState();
57 | }
58 |
59 | public override void SetImageResource(int resId)
60 | {
61 | base.SetImageResource(resId);
62 | imgState = Drawable.GetConstantState();
63 | }
64 |
65 | public override bool PerformClick()
66 | {
67 | Toggle();
68 | return base.PerformClick();
69 | }
70 |
71 | public void Toggle()
72 | {
73 | JumpDrawablesToCurrentState();
74 | /* AnimatedVectorDrawable unfortunately keep its VectorDrawable child in
75 | * the same state everytime it re-runs animations instead of reset-ing.
76 | * This means the animation is screwed up, so we simply reset the drawable
77 | * everytime with a new copy
78 | */
79 | SetImageDrawable(imgState.NewDrawable(Resources));
80 | Checked = !Checked;
81 | }
82 |
83 | public bool Checked
84 | {
85 | get {
86 | return chked;
87 | }
88 | set {
89 | if (chked == value)
90 | return;
91 | chked = value;
92 | RefreshDrawableState();
93 | }
94 | }
95 |
96 | public override int[] OnCreateDrawableState(int extraSpace)
97 | {
98 | var space = extraSpace + (Checked ? CheckedStateSet.Length : 0);
99 | var drawableState = base.OnCreateDrawableState(space);
100 | if (Checked)
101 | MergeDrawableStates(drawableState, CheckedStateSet);
102 | return drawableState;
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/Droid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content;
5 | using Android.Content.PM;
6 | using Android.Runtime;
7 | using Android.Views;
8 | using Android.Widget;
9 | using Android.OS;
10 |
11 | namespace NativeTest.Droid
12 | {
13 | [Activity(Label = "NativeTest.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
15 | {
16 | protected override void OnCreate(Bundle bundle)
17 | {
18 | TabLayoutResource = Resource.Layout.Tabbar;
19 | ToolbarResource = Resource.Layout.Toolbar;
20 |
21 | base.OnCreate(bundle);
22 |
23 | global::Xamarin.Forms.Forms.Init(this, bundle);
24 |
25 | LoadApplication(new App());
26 | }
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/Droid/NativeTest.Droid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}
7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | Library
9 | NativeTest.Droid
10 | NativeTest.Droid
11 | v6.0
12 | True
13 | Resources\Resource.designer.cs
14 | Resource
15 | Properties\AndroidManifest.xml
16 | Resources
17 | Assets
18 | true
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug
25 | DEBUG;
26 | prompt
27 | 4
28 | false
29 | None
30 |
31 |
32 | true
33 | bin\Release
34 | prompt
35 | 4
36 | false
37 | false
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | ..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll
46 |
47 |
48 | ..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll
49 |
50 |
51 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll
52 |
53 |
54 | ..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll
55 |
56 |
57 | ..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll
58 |
59 |
60 | ..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll
61 |
62 |
63 | ..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll
64 |
65 |
66 | ..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll
67 |
68 |
69 | ..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
70 |
71 |
72 | ..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\FormsViewGroup.dll
73 |
74 |
75 | ..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Core.dll
76 |
77 |
78 | ..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
79 |
80 |
81 | ..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/Droid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Droid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using Android.App;
4 |
5 | // Information about this assembly is defined by the following attributes.
6 | // Change them to the values specific to your project.
7 |
8 | [assembly: AssemblyTitle("NativeTest.Droid")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("")]
13 | [assembly: AssemblyCopyright("jamesmontemagno")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
20 |
21 | [assembly: AssemblyVersion("1.0.0")]
22 |
23 | // The following attributes are used to specify the signing key for the assembly,
24 | // if desired. See the Mono documentation for more information about signing.
25 |
26 | //[assembly: AssemblyDelaySign(false)]
27 | //[assembly: AssemblyKeyFile("")]
28 |
29 |
--------------------------------------------------------------------------------
/Droid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
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.
45 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/buzzer_button_compress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/buzzer_fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/buzzer_finger_move.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/door_knob_fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/door_knob_move.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/door_shadow_appear.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/door_shadow_grow.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/Droid/Resources/anim/door_trace_path.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamesmontemagno/forms-native-embedding/58f9792d1a8e19a6c3fde87a728c6390eba005a8/Droid/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamesmontemagno/forms-native-embedding/58f9792d1a8e19a6c3fde87a728c6390eba005a8/Droid/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamesmontemagno/forms-native-embedding/58f9792d1a8e19a6c3fde87a728c6390eba005a8/Droid/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable/anim_vector_finger_to_door.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
10 |
13 |
16 |
19 |
22 |
25 |
28 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable/buzzer_animation_base_vector.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
31 |
32 |
37 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable/ic_door.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
17 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable/ic_fancy_fab_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable/ic_finger_buzzer.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
15 |
20 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamesmontemagno/forms-native-embedding/58f9792d1a8e19a6c3fde87a728c6390eba005a8/Droid/Resources/drawable/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Droid/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Droid/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/Droid/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 James Montemagno / Refractored LLC
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/NativeTest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NativeTest", "NativeTest\NativeTest.shproj", "{DB3B0CE8-5E42-46FA-BB07-6EB40D00FE2D}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeTest.Droid", "Droid\NativeTest.Droid.csproj", "{BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeTest2.iOS", "iOS\NativeTest2.iOS.csproj", "{F47FADBF-F098-4290-96D5-A748C2E036F9}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | Debug|iPhoneSimulator = Debug|iPhoneSimulator
15 | Release|iPhone = Release|iPhone
16 | Release|iPhoneSimulator = Release|iPhoneSimulator
17 | Debug|iPhone = Debug|iPhone
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
25 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
26 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|iPhone.ActiveCfg = Release|Any CPU
27 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|iPhone.Build.0 = Release|Any CPU
28 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
29 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
30 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
31 | {BAAD8E83-E481-4ACE-ABB3-2A635A4E8EBC}.Debug|iPhone.Build.0 = Debug|Any CPU
32 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
33 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
34 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|Any CPU.ActiveCfg = Release|iPhone
35 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|Any CPU.Build.0 = Release|iPhone
36 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
37 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
38 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|iPhone.ActiveCfg = Release|iPhone
39 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|iPhone.Build.0 = Release|iPhone
40 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
41 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
42 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|iPhone.ActiveCfg = Debug|iPhone
43 | {F47FADBF-F098-4290-96D5-A748C2E036F9}.Debug|iPhone.Build.0 = Debug|iPhone
44 | EndGlobalSection
45 | EndGlobal
46 |
--------------------------------------------------------------------------------
/NativeTest/NativeTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Xamarin.Forms;
4 | using System.Threading.Tasks;
5 | #if __ANDROID__
6 | using Xamarin.Forms.Platform.Android;
7 | using NativeTest.Droid;
8 | using Android.Views;
9 | #elif __IOS__
10 | using Xamarin.Forms.Platform.iOS;
11 | using UIKit;
12 | using CoreGraphics;
13 | #endif
14 |
15 | namespace NativeTest
16 | {
17 | public class App : Application
18 | {
19 | public App()
20 | {
21 | var list = new ListView();
22 | list.ItemsSource = new[] { "Hello", "World", "This", "Is", "Native", "Embedding" };
23 |
24 | // Main page layout
25 | var pageLayout = new StackLayout
26 | {
27 | Children =
28 | {
29 | list
30 | }
31 | };
32 |
33 | var absolute = new AbsoluteLayout()
34 | {
35 | VerticalOptions = LayoutOptions.FillAndExpand,
36 | HorizontalOptions = LayoutOptions.FillAndExpand
37 | };
38 |
39 | // Position the pageLayout to fill the entire screen.
40 | // Manage positioning of child elements on the page by editing the pageLayout.
41 | AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
42 | AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));
43 | absolute.Children.Add(pageLayout);
44 |
45 |
46 | var stack = new StackLayout
47 | {
48 | Padding = 8,
49 | HorizontalOptions = LayoutOptions.Center,
50 | };
51 |
52 | #if __ANDROID__
53 | var fab = new CheckableFab(Forms.Context);
54 |
55 | fab.SetImageResource(Droid.Resource.Drawable.ic_fancy_fab_icon);
56 | fab.Click += async (sender, e) =>
57 | {
58 | await Task.Delay(3000);
59 | await MainPage.DisplayAlert("Native FAB Clicked",
60 | "Whoa!!!!!!", "OK");
61 | };
62 |
63 |
64 | fab.UseCompatPadding = true;
65 | stack.Children.Add(fab);
66 | absolute.Children.Add(stack);
67 | // Overlay the FAB in the bottom-right corner
68 | AbsoluteLayout.SetLayoutFlags(stack, AbsoluteLayoutFlags.PositionProportional);
69 | AbsoluteLayout.SetLayoutBounds(stack, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
70 |
71 | #elif __IOS__
72 | var segmentControl = new UISegmentedControl();
73 | segmentControl.Frame = new CGRect(20, 20, 280, 40);
74 | segmentControl.InsertSegment("One", 0, false);
75 | segmentControl.InsertSegment("Two", 1, false);
76 | segmentControl.SelectedSegment = 1;
77 | segmentControl.ValueChanged += async (sender, e) =>
78 | {
79 | var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
80 | await MainPage.DisplayAlert($"Native Segmented Control Clicked {selectedSegmentId}",
81 | "Whoa!!!!!!", "OK");
82 | };
83 | stack.Children.Add(segmentControl);
84 | pageLayout.Children.Insert(0, stack);
85 | #endif
86 |
87 | // The root page of your application
88 | var content = new ContentPage
89 | {
90 | Title = "NativeTest",
91 | Content = absolute
92 | };
93 | MainPage = new NavigationPage(content);
94 | }
95 |
96 | protected override void OnStart()
97 | {
98 | // Handle when your app starts
99 | }
100 |
101 | protected override void OnSleep()
102 | {
103 | // Handle when your app sleeps
104 | }
105 |
106 | protected override void OnResume()
107 | {
108 | // Handle when your app resumes
109 | }
110 | }
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/NativeTest/NativeTest.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | {DB3B0CE8-5E42-46FA-BB07-6EB40D00FE2D}
7 |
8 |
9 | NativeTest
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/NativeTest/NativeTest.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {DB3B0CE8-5E42-46FA-BB07-6EB40D00FE2D}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Xamarin.Forms Native Embedding
2 |
3 | ## What is this?
4 | Example of showing native embedding for floating action buttons and segmented controls in Xamarin.Forms
5 |
6 | #### License
7 | Under MIT (See LICENSE.md)
8 |
--------------------------------------------------------------------------------
/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace NativeTest.iOS
9 | {
10 | [Register("AppDelegate")]
11 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
12 | {
13 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
14 | {
15 | global::Xamarin.Forms.Forms.Init();
16 |
17 | LoadApplication(new App());
18 |
19 | return base.FinishedLaunching(app, options);
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/AppIcons.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "iphone",
5 | "size": "29x29",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "iphone",
10 | "size": "29x29",
11 | "scale": "2x"
12 | },
13 | {
14 | "idiom": "iphone",
15 | "size": "29x29",
16 | "scale": "3x"
17 | },
18 | {
19 | "idiom": "iphone",
20 | "size": "40x40",
21 | "scale": "2x"
22 | },
23 | {
24 | "idiom": "iphone",
25 | "size": "40x40",
26 | "scale": "3x"
27 | },
28 | {
29 | "idiom": "iphone",
30 | "size": "57x57",
31 | "scale": "1x"
32 | },
33 | {
34 | "idiom": "iphone",
35 | "size": "57x57",
36 | "scale": "2x"
37 | },
38 | {
39 | "idiom": "iphone",
40 | "size": "60x60",
41 | "scale": "2x"
42 | },
43 | {
44 | "idiom": "iphone",
45 | "size": "60x60",
46 | "scale": "3x"
47 | },
48 | {
49 | "idiom": "ipad",
50 | "size": "29x29",
51 | "scale": "1x"
52 | },
53 | {
54 | "idiom": "ipad",
55 | "size": "29x29",
56 | "scale": "2x"
57 | },
58 | {
59 | "idiom": "ipad",
60 | "size": "40x40",
61 | "scale": "1x"
62 | },
63 | {
64 | "idiom": "ipad",
65 | "size": "40x40",
66 | "scale": "2x"
67 | },
68 | {
69 | "idiom": "ipad",
70 | "size": "50x50",
71 | "scale": "1x"
72 | },
73 | {
74 | "idiom": "ipad",
75 | "size": "50x50",
76 | "scale": "2x"
77 | },
78 | {
79 | "idiom": "ipad",
80 | "size": "72x72",
81 | "scale": "1x"
82 | },
83 | {
84 | "idiom": "ipad",
85 | "size": "72x72",
86 | "scale": "2x"
87 | },
88 | {
89 | "idiom": "ipad",
90 | "size": "76x76",
91 | "scale": "1x"
92 | },
93 | {
94 | "idiom": "ipad",
95 | "size": "76x76",
96 | "scale": "2x"
97 | },
98 | {
99 | "size": "24x24",
100 | "idiom": "watch",
101 | "scale": "2x",
102 | "role": "notificationCenter",
103 | "subtype": "38mm"
104 | },
105 | {
106 | "size": "27.5x27.5",
107 | "idiom": "watch",
108 | "scale": "2x",
109 | "role": "notificationCenter",
110 | "subtype": "42mm"
111 | },
112 | {
113 | "size": "29x29",
114 | "idiom": "watch",
115 | "role": "companionSettings",
116 | "scale": "2x"
117 | },
118 | {
119 | "size": "29x29",
120 | "idiom": "watch",
121 | "role": "companionSettings",
122 | "scale": "3x"
123 | },
124 | {
125 | "size": "40x40",
126 | "idiom": "watch",
127 | "scale": "2x",
128 | "role": "appLauncher",
129 | "subtype": "38mm"
130 | },
131 | {
132 | "size": "44x44",
133 | "idiom": "watch",
134 | "scale": "2x",
135 | "role": "longLook",
136 | "subtype": "42mm"
137 | },
138 | {
139 | "size": "86x86",
140 | "idiom": "watch",
141 | "scale": "2x",
142 | "role": "quickLook",
143 | "subtype": "38mm"
144 | },
145 | {
146 | "size": "98x98",
147 | "idiom": "watch",
148 | "scale": "2x",
149 | "role": "quickLook",
150 | "subtype": "42mm"
151 | }
152 | ],
153 | "info": {
154 | "version": 1,
155 | "author": "xcode"
156 | }
157 | }
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 | NativeTest2
7 | CFBundleName
8 | NativeTest2
9 | CFBundleIdentifier
10 | com.xamarin.nativetest2
11 | CFBundleShortVersionString
12 | 1.0
13 | CFBundleVersion
14 | 1.0
15 | LSRequiresIPhoneOS
16 |
17 | MinimumOSVersion
18 | 8.0
19 | UIDeviceFamily
20 |
21 | 1
22 | 2
23 |
24 | UILaunchStoryboardName
25 | LaunchScreen
26 | UIRequiredDeviceCapabilities
27 |
28 | armv7
29 |
30 | UISupportedInterfaceOrientations
31 |
32 | UIInterfaceOrientationPortrait
33 | UIInterfaceOrientationLandscapeLeft
34 | UIInterfaceOrientationLandscapeRight
35 |
36 | UISupportedInterfaceOrientations~ipad
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationPortraitUpsideDown
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 | XSAppIconAssets
44 | Assets.xcassets/AppIcons.appiconset
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace NativeTest2.iOS
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main(string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main(args, null, "AppDelegate");
18 | }
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/iOS/NativeTest2.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | {F47FADBF-F098-4290-96D5-A748C2E036F9}
7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | Exe
9 | NativeTest2.iOS
10 | NativeTest2.iOS
11 | Resources
12 |
13 |
14 | true
15 | full
16 | false
17 | bin\iPhoneSimulator\Debug
18 | DEBUG;ENABLE_TEST_CLOUD;
19 | prompt
20 | 4
21 | false
22 | iPhone Developer
23 | true
24 | true
25 | true
26 | true
27 | true
28 | None
29 | i386
30 | false
31 |
32 |
33 | true
34 | bin\iPhone\Release
35 |
36 | prompt
37 | 4
38 | false
39 | iPhone Developer
40 | true
41 | true
42 | true
43 | Entitlements.plist
44 | ARMv7, ARM64
45 |
46 |
47 | true
48 | bin\iPhoneSimulator\Release
49 |
50 | prompt
51 | 4
52 | false
53 | iPhone Developer
54 | true
55 | true
56 | None
57 | i386
58 |
59 |
60 | true
61 | full
62 | false
63 | bin\iPhone\Debug
64 | DEBUG;ENABLE_TEST_CLOUD;
65 | prompt
66 | 4
67 | false
68 | iPhone Developer
69 | true
70 | true
71 | true
72 | true
73 | true
74 | true
75 | true
76 | Entitlements.plist
77 | ARMv7, ARM64
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | ..\packages\Xamarin.Forms.2.2.0.31\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll
86 |
87 |
88 | ..\packages\Xamarin.Forms.2.2.0.31\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll
89 |
90 |
91 | ..\packages\Xamarin.Forms.2.2.0.31\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll
92 |
93 |
94 | ..\packages\Xamarin.Forms.2.2.0.31\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------