Ejemplo n.º 1
0
 private void fillMonthDate() {
   int monthDay = JGDateUtil.getCurrentMonthDay();
   int lastMonthDays = JGDateUtil.getMonthDays(mShowDate.year, mShowDate.month - 1);
   int currentMonthDays = JGDateUtil.getMonthDays(mShowDate.year, mShowDate.month);
   int firstDayWeek = JGDateUtil.getWeekDayFromDate(mShowDate.year, mShowDate.month);
   boolean isCurrentMonth = false;
   if (JGDateUtil.isCurrentMonth(mShowDate)) {
     isCurrentMonth = true;
   }
   int day = 0;
   for (int j = 0; j < TOTAL_ROW; j++) {
     rows[j] = new Row(j);
     for (int i = 0; i < TOTAL_COL; i++) {
       int postion = i + j * TOTAL_COL;
       if (postion >= firstDayWeek && postion < firstDayWeek + currentMonthDays) {
         day++;
         if (isCurrentMonth && day == monthDay) {
           JGCustomDate date = JGCustomDate.modifiDayForObject(mShowDate, day);
           // mClickCell = new Cell(date,State.TODAY, i,j);
           date.week = i;
           // mCallBack.clickDate(date);
           // rows[j].cells[i] = new Cell(date,State.CLICK_DAY, i,j);
           rows[j].cells[i] = new Cell(date, State.CURRENT_MONTH_DAY, i, j);
           continue;
         }
         rows[j].cells[i] =
             new Cell(
                 JGCustomDate.modifiDayForObject(mShowDate, day), State.CURRENT_MONTH_DAY, i, j);
       } else if (postion < firstDayWeek) {
         rows[j].cells[i] =
             new Cell(
                 new JGCustomDate(
                     mShowDate.year,
                     mShowDate.month - 1,
                     lastMonthDays - (firstDayWeek - postion - 1)),
                 State.PAST_MONTH_DAY,
                 i,
                 j);
       } else if (postion >= firstDayWeek + currentMonthDays) {
         rows[j].cells[i] =
             new Cell(
                 (new JGCustomDate(
                     mShowDate.year,
                     mShowDate.month + 1,
                     postion - firstDayWeek - currentMonthDays + 1)),
                 State.NEXT_MONTH_DAY,
                 i,
                 j);
       }
     }
   }
 }
Ejemplo n.º 2
0
 private void measureClickCell(int col, int row) {
   if (col >= TOTAL_COL || row >= TOTAL_ROW) return;
   if (mClickCell != null) {
     rows[mClickCell.j].cells[mClickCell.i] = mClickCell;
   }
   if (rows[row] != null) {
     mClickCell =
         new Cell(
             rows[row].cells[col].date,
             rows[row].cells[col].state,
             rows[row].cells[col].i,
             rows[row].cells[col].j);
     rows[row].cells[col].state = State.CLICK_DAY;
     JGCustomDate date = rows[row].cells[col].date;
     date.week = col;
     mCallBack.clickDate(date);
     invalidate();
   }
 }
Ejemplo n.º 3
0
 private void fillWeekDate() {
   int lastMonthDays = JGDateUtil.getMonthDays(mShowDate.year, mShowDate.month - 1);
   rows[0] = new Row(0);
   int day = mShowDate.day;
   for (int i = TOTAL_COL - 1; i >= 0; i--) {
     day -= 1;
     if (day < 1) {
       day = lastMonthDays;
     }
     JGCustomDate date = JGCustomDate.modifiDayForObject(mShowDate, day);
     if (JGDateUtil.isToday(date)) {
       mClickCell = new Cell(date, State.TODAY, i, 0);
       date.week = i;
       mCallBack.clickDate(date);
       rows[0].cells[i] = new Cell(date, State.CLICK_DAY, i, 0);
       continue;
     }
     rows[0].cells[i] = new Cell(date, State.CURRENT_MONTH_DAY, i, 0);
   }
 }