protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Insights.Initialize("6a6eb93e563f008f1e2e8d05de4b8d4c182f2321", this); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar); //Toolbar will now take on default actionbar characteristics SetSupportActionBar (toolbar); accelerometerManager = new AccelerometerManager(this, this); buttonRandom = FindViewById<Button>(Resource.Id.button_random); buttonRandom.Click += async (sender, args) => { state.CurrentTask = LoadImage(OverflowHelper.Animal.Random); await state.CurrentTask; }; buttonPuppy = FindViewById<Button>(Resource.Id.button_puppy); buttonPuppy.Click += async (sender, args) => { state.CurrentTask = LoadImage(OverflowHelper.Animal.Dog); await state.CurrentTask; }; buttonKitty = FindViewById<Button>(Resource.Id.button_kitty); buttonKitty.Click += async (sender, args) => await LoadImage(OverflowHelper.Animal.Cat); progressBar = FindViewById<ProgressBar>(Resource.Id.progressbar); imageView = FindViewById<ImageView>(Resource.Id.imageview_animal); imageViewAnimated = FindViewById<GifImageView>(Resource.Id.imageview_animal_animated); progressBar.Visibility = ViewStates.Invisible; imageView.Visibility = ViewStates.Gone; imageViewAnimated.Visibility = ViewStates.Gone; if (state != null) { if (state.CurrentTask == null || state.CurrentTask.IsCompleted) await SetImage(); } else { state = new PuppyKittyState(); state.SetDefault = true; } }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); accelerometerManager = new AccelerometerManager(this, this); buttonPuppy = FindViewById<Button>(Resource.Id.button_puppy); buttonPuppy.Click += async (sender, args) => { state.CurrentTask = LoadImage(OverflowHelper.Animal.Dog); await state.CurrentTask; }; buttonKitty = FindViewById<Button>(Resource.Id.button_kitty); buttonKitty.Click += async (sender, args) => await LoadImage(OverflowHelper.Animal.Cat); progressBar = FindViewById<ProgressBar>(Resource.Id.progressbar); imageView = FindViewById<ImageView>(Resource.Id.imageview_animal); imageViewAnimated = FindViewById<Helpers.AnimatedImageView>(Resource.Id.imageview_animal_animated); progressBar.Visibility = ViewStates.Invisible; imageView.Visibility = ViewStates.Gone; imageViewAnimated.Visibility = ViewStates.Gone; state = LastCustomNonConfigurationInstance as PuppyKittyState; if (state != null) { if (state.CurrentTask == null || state.CurrentTask.IsCompleted) await SetImage(); } else { state = new PuppyKittyState(); state.SetDefault = true; } }