public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
            {
                // if the presenter is null, we are probably trying to recreate the fragment after it has been removed from memory.
                // don't allow that to happen
                if (_presenter == null)
                {
                    DismissAllowingStateLoss();
                    return(null);
                }

                var view = Activity.LayoutInflater.Inflate(Resource.Layout.Fragment_EditMediaListItem, container,
                                                           false);

                _coordLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.EditMediaListItem_CoordLayout);

                SetupToolbar(view.FindViewById <Toolbar>(Resource.Id.EditMediaListItem_Toolbar));
                SetupScore(_scorePicker       = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ScorePicker), view.FindViewById <Button>(Resource.Id.EditMediaListItem_CustomScoringButton));
                SetupStatus(_statusSpinner    = view.FindViewById <AppCompatSpinner>(Resource.Id.EditMediaListItem_StatusSpinner));
                SetupProgress(_progressPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ProgressPicker),
                              view.FindViewById <TextView>(Resource.Id.EditMediaListItem_ProgressLabel));
                SetupVolumeProgress(view.FindViewById(Resource.Id.EditMediaListItem_VolumeProgressContainer),
                                    _progressVolumesPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_VolumeProgressPicker));
                SetupRepeat(_repeatPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_RewatchedPicker),
                            view.FindViewById <TextView>(Resource.Id.EditMediaListItem_RewatchedLabel));
                SetupNotes(_notesView = view.FindViewById <EditText>(Resource.Id.EditMediaListItem_Notes));
                SetupCustomLists(view.FindViewById(Resource.Id.EditMediaListItem_CustomListsContainer),
                                 view.FindViewById <LinearLayout>(Resource.Id.EditMediaListItem_CustomLists));
                SetupStartDate(_startDateView   = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_StartDate));
                SetupFinishDate(_finishDateView = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_FinishDate));
                SetupDeleteButton(view.FindViewById(Resource.Id.EditMediaListItem_DeleteButton));

                return(view);
            }
 private void SetupFinishDate(DatePickerTextView finishDateView)
 {
     finishDateView.SelectedDate = _completeMedia ? DateTime.Now : _mediaList?.CompletedAt?.GetDate();
     finishDateView.DateChanged += (sender, args) => {
         if (_startDateView.SelectedDate > args.Date)
         {
             Snackbar.Make(_coordLayout, "Finish date must be on or after Start date!", Snackbar.LengthShort)
             .Show();
             _finishDateView.SelectedDate = null;
         }
     };
 }
 private void SetupStartDate(DatePickerTextView startDateView)
 {
     startDateView.SelectedDate = _mediaList?.StartedAt?.GetDate();
     startDateView.DateChanged += (sender, args) => {
         if (_finishDateView.SelectedDate < args.Date)
         {
             Snackbar.Make(_coordLayout, "Start date must be on or before Finish date!", Snackbar.LengthShort)
             .Show();
             _startDateView.SelectedDate = null;
         }
     };
 }