Ejemplo n.º 1
0
 private void setCurrentView(int currentView, boolean forceRefresh) {
   long timeInMillis = this.mCalendar.getTimeInMillis();
   switch (currentView) {
     case VIEW_DATE_PICKER_MONTH_DAY:
       ObjectAnimator monthDayAnim = Utils.getPulseAnimator(this.mMonthAndDayView, 0.9F, 1.05F);
       if (this.mDelayAnimation) {
         monthDayAnim.setStartDelay(500L);
         this.mDelayAnimation = false;
       }
       this.mDayPickerView.onDateChanged();
       if (this.mCurrentView != currentView || forceRefresh) {
         this.mMonthAndDayView.setSelected(true);
         this.mYearView.setSelected(false);
         this.mAnimator.setDisplayedChild(VIEW_DATE_PICKER_MONTH_DAY);
         this.mCurrentView = currentView;
       }
       monthDayAnim.start();
       String monthDayDesc =
           DateUtils.formatDateTime(getActivity(), timeInMillis, DateUtils.FORMAT_SHOW_DATE);
       this.mAnimator.setContentDescription(this.mDayPickerDescription + ": " + monthDayDesc);
       return;
     case VIEW_DATE_PICKER_YEAR:
       ObjectAnimator yearAnim = Utils.getPulseAnimator(this.mYearView, 0.85F, 1.1F);
       if (this.mDelayAnimation) {
         yearAnim.setStartDelay(500L);
         this.mDelayAnimation = false;
       }
       this.mYearPickerView.onDateChanged();
       if (this.mCurrentView != currentView || forceRefresh) {
         this.mMonthAndDayView.setSelected(false);
         this.mYearView.setSelected(true);
         this.mAnimator.setDisplayedChild(VIEW_DATE_PICKER_YEAR);
         this.mCurrentView = currentView;
       }
       yearAnim.start();
       String dayDesc = YEAR_FORMAT.format(Long.valueOf(timeInMillis));
       this.mAnimator.setContentDescription(this.mYearPickerDescription + ": " + dayDesc);
   }
 }
Ejemplo n.º 2
0
 private void adjustDayInMonthIfNeeded(int month, int year) {
   int currentDay = this.mCalendar.get(Calendar.DAY_OF_MONTH);
   int day = Utils.getDaysInMonth(month, year);
   if (currentDay > day) this.mCalendar.set(Calendar.DAY_OF_MONTH, day);
 }