private void updateViews() {

    switch (mCurrentValues.type) {
      case DayValues.TYPE_ONE_SHOT:
        Calendar calendar = ((OneShotValues) mCurrentValues).date;
        mDatePicker.init(
            calendar.get(Calendar.YEAR),
            calendar.get(Calendar.MONTH),
            calendar.get(Calendar.DAY_OF_MONTH),
            this);
        break;

      case DayValues.TYPE_REPEAT:
        List<Integer> days = ((RepeatValues) mCurrentValues).days;
        mRepeatPicker.setSelectedDays(days);
        break;

      case DayValues.TYPE_EVERY:
        IntervalValues values = (IntervalValues) mCurrentValues;
        mIntervalPicker.setUnit(values.unit);
        mIntervalPicker.setNumberValue(values.number);
        break;
    }

    mBtnOneShot.setEnabled(mCurrentValues.type != DayValues.TYPE_ONE_SHOT);
    mBtnRepeat.setEnabled(mCurrentValues.type != DayValues.TYPE_REPEAT);
    mBtnEvery.setEnabled(mCurrentValues.type != DayValues.TYPE_EVERY);

    mViewSwitcher.setDisplayedChild(mCurrentValues.type);
    mListener.onCurrentValuesTypeChanged(mCurrentValues.type);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {

    View root = getView();

    mContainer = root.findViewById(R.id.scheduler_container);

    mViewSwitcher = (ViewAnimator) root.findViewById(R.id.scheduler_switcher);

    mBtnOneShot = (Button) root.findViewById(R.id.btn_one_shot);
    mBtnOneShot.setOnClickListener(mBtnClickListener);
    mBtnRepeat = (Button) root.findViewById(R.id.btn_repeat);
    mBtnRepeat.setOnClickListener(mBtnClickListener);
    mBtnEvery = (Button) root.findViewById(R.id.btn_every);
    mBtnEvery.setOnClickListener(mBtnClickListener);

    mDatePicker = (ScrollDatePicker) root.findViewById(R.id.scheduler_date_picker);
    Calendar calendar = Calendar.getInstance();
    mDatePicker.init(
        calendar.get(Calendar.YEAR),
        calendar.get(Calendar.MONTH),
        calendar.get(Calendar.DAY_OF_MONTH),
        this);

    mRepeatPicker = (RepeatPicker) root.findViewById(R.id.scheduler_repeat_picker);
    mRepeatPicker.setListener(this);

    mIntervalPicker = (IntervalPicker) root.findViewById(R.id.scheduler_every_picker);
    mIntervalPicker.setOnChangeListener(this);

    mOverlayView = root.findViewById(R.id.scheduler_overlay);
    mOverlayView.setOnClickListener(mOverlayClickListener);

    if (savedInstanceState != null) {
      mCurrentValues = savedInstanceState.getParcelable(STATE_CURRENT_VALUES);
    } else {
      mContainer.setAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_bottom));
      mOverlayView.animate().alpha(1.0f);

      mCurrentValues = getArguments().getParcelable(STATE_CURRENT_VALUES);
    }

    if (mCurrentValues == null) {
      mCurrentValues = new OneShotValues(Calendar.getInstance());
    }

    // save();     this overwrites the loaded schedule ;(

    updateViews();

    super.onActivityCreated(savedInstanceState);
  }