protected override void OnCreate(Bundle bundle)
        {
            InitActivityTransitions();
            base.OnCreate(bundle);
            SetContentView(LayoutResource);
            Toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            if (Toolbar != null)
            {
                SetSupportActionBar(Toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }

            accelerometerManager = new AccelerometerManager(this, this);
            accelerometerManager.Configure(40, 350);
        }
Пример #2
0
        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 = LastNonConfigurationInstance as PuppyKittyState;

            if (state != null)
            {
                if (state.CurrentTask == null || state.CurrentTask.IsCompleted)
                {
                    await SetImage();
                }
            }
            else
            {
                state            = new PuppyKittyState();
                state.SetDefault = true;
            }
        }
 private void Start()
 {
     instance = this;
 }