@Override
 public void onSaveInstanceState(@NonNull Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(KEY_SELECTED_YEAR, mCalendar.get(Calendar.YEAR));
   outState.putInt(KEY_SELECTED_MONTH, mCalendar.get(Calendar.MONTH));
   outState.putInt(KEY_SELECTED_DAY, mCalendar.get(Calendar.DAY_OF_MONTH));
   outState.putInt(KEY_WEEK_START, mWeekStart);
   outState.putInt(KEY_YEAR_START, mMinYear);
   outState.putInt(KEY_YEAR_END, mMaxYear);
   outState.putInt(KEY_CURRENT_VIEW, mCurrentView);
   int listPosition = -1;
   if (mCurrentView == MONTH_AND_DAY_VIEW) {
     listPosition = mDayPickerView.getMostVisiblePosition();
   } else if (mCurrentView == YEAR_VIEW) {
     listPosition = mYearPickerView.getFirstVisiblePosition();
     outState.putInt(KEY_LIST_POSITION_OFFSET, mYearPickerView.getFirstPositionOffset());
   }
   outState.putInt(KEY_LIST_POSITION, listPosition);
   outState.putSerializable(KEY_MIN_DATE, mMinDate);
   outState.putSerializable(KEY_MAX_DATE, mMaxDate);
   outState.putSerializable(KEY_HIGHLIGHTED_DAYS, highlightedDays);
   outState.putSerializable(KEY_SELECTABLE_DAYS, selectableDays);
   outState.putBoolean(KEY_THEME_DARK, mThemeDark);
   outState.putBoolean(KEY_VIBRATE, mVibrate);
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(KEY_SELECTED_YEAR, mCalendar.get(Calendar.YEAR));
   outState.putInt(KEY_SELECTED_MONTH, mCalendar.get(Calendar.MONTH));
   outState.putInt(KEY_SELECTED_DAY, mCalendar.get(Calendar.DAY_OF_MONTH));
   outState.putInt(KEY_WEEK_START, mWeekStart);
   outState.putInt(KEY_YEAR_START, mMinYear);
   outState.putInt(KEY_YEAR_END, mMaxYear);
   outState.putInt(KEY_CURRENT_VIEW, mCurrentView);
   int listPosition = -1;
   if (mCurrentView == MONTH_AND_DAY_VIEW) {
     listPosition = mDayPickerView.getMostVisiblePosition();
   } else if (mCurrentView == YEAR_VIEW) {
     listPosition = mYearPickerView.getFirstVisiblePosition();
     outState.putInt(KEY_LIST_POSITION_OFFSET, mYearPickerView.getFirstPositionOffset());
   }
   outState.putInt(KEY_LIST_POSITION, listPosition);
 }