diff options
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android/FormsApplicationActivity.cs')
-rw-r--r-- | Xamarin.Forms.ControlGallery.Android/FormsApplicationActivity.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/FormsApplicationActivity.cs b/Xamarin.Forms.ControlGallery.Android/FormsApplicationActivity.cs new file mode 100644 index 00000000..7c999ce8 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/FormsApplicationActivity.cs @@ -0,0 +1,50 @@ +#if FORMS_APPLICATION_ACTIVITY + +using System.Diagnostics; +using Android.App; +using Android.Content.PM; +using Android.OS; +using Xamarin.Forms.Controls; +using Xamarin.Forms.Platform.Android; + +namespace Xamarin.Forms.ControlGallery.Android +{ + // This is the Pre-AppCompat version of Activity1 + +[Activity(Label = "Control Gallery", Icon = "@drawable/icon", MainLauncher = true, + HardwareAccelerated = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + public partial class Activity1 : FormsApplicationActivity + { + protected override void OnCreate(Bundle bundle) + { + base.OnCreate(bundle); + + if (!Debugger.IsAttached) + Insights.Initialize(App.InsightsApiKey, ApplicationContext); + + Forms.Init(this, bundle); + FormsMaps.Init(this, bundle); + Forms.ViewInitialized += (sender, e) => { + if (!string.IsNullOrWhiteSpace(e.View.StyleId)) + { + e.NativeView.ContentDescription = e.View.StyleId; + } + }; + + // uncomment to verify turning off title bar works. This is not intended to be dynamic really. + //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); + + var app = _app = new App(); + + // When the native control gallery loads up, it'll let us know so we can add the nested native controls + MessagingCenter.Subscribe<NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); + + // When the native binding gallery loads up, it'll let us know so we can set up the native bindings + MessagingCenter.Subscribe<NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); + + LoadApplication(app); + } + } +} + +#endif
\ No newline at end of file |