protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.animation_demo); _shake = AnimationUtils.LoadAnimation(this, Resource.Animation.shake); _fadeOut = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out); _fadeIn = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_in); _scale = AnimationUtils.LoadAnimation(this, Resource.Animation.scale); _text = FindViewById<TextView>(Resource.Id.text); FindViewById<Button>(Resource.Id.shake_button).Click += (e, args) => _text.StartAnimation(_shake); FindViewById<Button>(Resource.Id.fadeout_button).Click += (e, args) => { _text.StartAnimation(_fadeOut); _text.Visibility = Android.Views.ViewStates.Invisible; }; FindViewById<Button>(Resource.Id.fadein_button).Click += (e, args) => { _text.Visibility = Android.Views.ViewStates.Visible; _text.StartAnimation(_fadeIn); }; FindViewById<Button>(Resource.Id.scale_button).Click += (e, args) => _text.StartAnimation(_scale); }
protected override void OnCreate(Bundle bundle) { Console.WriteLine("AboutActivity - OnCreate"); base.OnCreate(bundle); _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>(); SetContentView(Resource.Layout.About); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetHomeButtonEnabled(true); _progressBar = FindViewById<ProgressBar>(Resource.Id.about_progressBar); _lblLoading = FindViewById<TextView>(Resource.Id.about_lblLoading); _webView = FindViewById<WebView>(Resource.Id.about_webView); _webViewClient = new MyWebViewClient(); _webViewClient.PageFinished += (sender, args) => { Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out); anim.AnimationEnd += (animSender, animArgs) => { _lblLoading.Visibility = ViewStates.Gone; }; _lblLoading.StartAnimation(anim); Animation anim2 = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out); anim2.AnimationEnd += (animSender, animArgs) => { _progressBar.Visibility = ViewStates.Gone; }; _progressBar.StartAnimation(anim2); }; _webView.SetWebViewClient(_webViewClient); // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready //((AndroidNavigationManager)_navigationManager).SetAboutActivityInstance(this); _navigationManager.BindAboutView(this); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Favorites); // toolbar setup var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); favoritesListView = FindViewById<RecyclerView>(Resource.Id.FavoritesList); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView favoritesListView.HasFixedSize = true; // use a linear layout manager var layoutManager = new LinearLayoutManager(this); layoutManager.Orientation = (int)Orientation.Vertical; favoritesListView.SetLayoutManager(layoutManager); _favoritesService = SimpleIoc.Default.GetInstance<IFavoritesService>(); _favorites = await _favoritesService.GetFavoritesAsync(); // specify an adapter (see also next example) mAdapter = new FavoriteListAdapter(this, _favorites, this); favoritesListView.SetAdapter(mAdapter); favoritesListView.ChildViewRemoved += FavoritesListView_ChildViewRemoved; var callback = new SimpleItemTouchHelperCallback((IItemTouchHelperAdapter)mAdapter); _itemTouchHelper = new ItemTouchHelper(callback); _itemTouchHelper.AttachToRecyclerView(favoritesListView); _placeHolder = FindViewById<TextView>(Resource.Id.placeHolder); _placeHolderAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.placeholder); if (_favorites.Count == 0) { await Task.Delay(200); _placeHolder.StartAnimation(_placeHolderAnimation); _placeHolder.Visibility = ViewStates.Visible; } }