private void InitializeViews() { Contract.Requires(() => _viewModel != null); Log.Info("InitializeViews"); SetContentView(Resource.Layout.activity_main); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); _toolbar.Title = _viewModel.Title; SetSupportActionBar(_toolbar); _loader = FindViewById <ProgressBar>(Resource.Id.progress_loading); _errorViewSwitcher = new ErrorViewSwitcher( this, FindViewById <LinearLayout>(Resource.Id.view_error)); _adapter = new SillyRecyclerAdapter(this); _recyclerView = FindViewById <RecyclerView>(Resource.Id.list_silly); _recyclerView.SetItemAnimator(new ScaleInAnimator()); _recyclerView.SetAdapter(_adapter); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _refreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.refresh_container); _refreshLayout.SetColorSchemeResources(Resource.Color.accent, Resource.Color.primary); }
private void InitializeViews() { Log.Info("InitializeViews"); SetContentView(Resource.Layout.activity_silly_details); _sillyDudeImage = FindViewById <ImageView>(Resource.Id.image_silly_dude); string imageUrl = Intent.GetStringExtra(TRANSITION_NAME); SupportPostponeEnterTransition(); _sillyDudeImage.ViewTreeObserver.AddOnPreDrawListener(new PreDrawListener(_sillyDudeImage, SupportStartPostponedEnterTransition)); var glideRequest = Glide.With(this); if (imageUrl.StartsWith("file")) { glideRequest.Load(Android.Net.Uri.Parse(imageUrl)).Into(_sillyDudeImage); } else { glideRequest.Load(imageUrl).Into(_sillyDudeImage); } var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); var loader = FindViewById <ProgressBar>(Resource.Id.progress_loading); _errorViewSwitcher = new ErrorViewSwitcher( this, FindViewById <LinearLayout>(Resource.Id.view_error)); var detailsLayout = FindViewById <LinearLayout>(Resource.Id.layout_details); _viewModelStateProcessor = new ViewModelStateProcessor(loader, _errorViewSwitcher, detailsLayout, UpdateDetails); _roleTextView = detailsLayout.FindViewById <TextView>(Resource.Id.text_role); _descriptionTextView = detailsLayout.FindViewById <TextView>(Resource.Id.text_description); }