@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    View view = inflater.inflate(R.layout.mdtp_date_picker_dialog, null);

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearView.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
      mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
      mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
      mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
      currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
      listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
      listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
      mMinDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE);
      mMaxDate = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE);
      highlightedDays = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS);
      selectableDays = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS);
      mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
      mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
    }

    final Activity activity = getActivity();
    mDayPickerView = new SimpleDayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.mdtp_day_picker_description);
    mSelectDay = res.getString(R.string.mdtp_select_day);
    mYearPickerDescription = res.getString(R.string.mdtp_year_picker_description);
    mSelectYear = res.getString(R.string.mdtp_select_year);

    int bgColorResource =
        mThemeDark
            ? R.color.mdtp_date_picker_view_animator_dark_theme
            : R.color.mdtp_date_picker_view_animator;
    view.setBackgroundColor(activity.getResources().getColor(bgColorResource));

    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    Button okButton = (Button) view.findViewById(R.id.ok);
    okButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
              mCallBack.onDateSet(
                  DatePickerDialog.this,
                  mCalendar.get(Calendar.YEAR),
                  mCalendar.get(Calendar.MONTH),
                  mCalendar.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
          }
        });
    okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));

    Button cancelButton = (Button) view.findViewById(R.id.cancel);
    cancelButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            tryVibrate();
            getDialog().cancel();
          }
        });
    cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));
    cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
      if (currentView == MONTH_AND_DAY_VIEW) {
        mDayPickerView.postSetSelection(listPosition);
      } else if (currentView == YEAR_VIEW) {
        mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
      }
    }

    mHapticFeedbackController = new HapticFeedbackController(activity);
    return view;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    View view = inflater.inflate(R.layout.calendar_date_picker_dialog, null);

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearView.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
      mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
      mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
      mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
      currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
      listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
      listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
    }

    final Activity activity = getActivity();
    mDayPickerView = new DayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.day_picker_description);
    mSelectDay = res.getString(R.string.select_day);
    mYearPickerDescription = res.getString(R.string.year_picker_description);
    mSelectYear = res.getString(R.string.select_year);

    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    mDoneButton = (Button) view.findViewById(R.id.done);
    mDoneButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
              mCallBack.onDateSet(
                  CalendarDatePickerDialog.this,
                  mCalendar.get(Calendar.YEAR),
                  mCalendar.get(Calendar.MONTH),
                  mCalendar.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
          }
        });

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
      if (currentView == MONTH_AND_DAY_VIEW) {
        mDayPickerView.postSetSelection(listPosition);
      } else if (currentView == YEAR_VIEW) {
        mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
      }
    }
    return view;
  }