private void initView() {
    ((TextView) findViewById(R.id.title))
        .setText(getResources().getString(R.string.putao_calendar_title));

    findViewById(R.id.back_layout).setOnClickListener(this);

    mDateTView = (TextView) findViewById(R.id.calendar_date);
    mLeftImgView = (ImageView) findViewById(R.id.calendar_left);
    mRightImgView = (ImageView) findViewById(R.id.calendar_right);
    mLeftImgView.setOnClickListener(this);
    mRightImgView.setOnClickListener(this);

    mWeekTagGridView = (MyGridView) findViewById(R.id.gridView_week);
    mWeekTagGridView.setAdapter(new CalendarAdapter(this, false));

    mCalendarGridView = (MyGridView) findViewById(R.id.gridView_calendar);
    mCalendarGridView.setOnItemClickListener(this);
    mCalendarAdapter = new CalendarAdapter(this, true);
    mCalendarAdapter.setInAndOutDate(mLastInCalendarModel, mLastOutCalendarModel);

    if (mDateType == CalendarBean.MODEL_TRAIN_START) {
      mCalendarAdapter.setTrainStartDate(
          mLastTrainCalendarModel, today, tomorrow, afterTomorrow); // modify by lisheng 2014-12-15
    }

    mCalendarGridView.setAdapter(mCalendarAdapter);
    mCalendarAdapter.showDate(this);
  }
 @Override
 public void onClick(View view) {
   int id = view.getId();
   if (id == R.id.back_layout) {
     finish();
   } else if (id == R.id.calendar_left) {
     mCalendarAdapter.showPreviousMonth(this);
   } else if (id == R.id.calendar_right) {
     mCalendarAdapter.showNextMonth(this);
   } else {
   }
 }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long arg3) {
   CalendarBean selectCalendarModel = (CalendarBean) view.getTag();
   if (selectCalendarModel == null) {
     return;
   }
   int type = selectCalendarModel.getType();
   if (type == CalendarBean.MODEL_TAG_THIS) {
     if (mDateType == CalendarBean.MODEL_SELECT_IN) {
       if (mLastOutCalendarModel != null
           && selectCalendarModel.compareTo(mLastOutCalendarModel) >= 0) {
         // 选择的入住日期 如果大于 离店日期,则清除离店日期
         mLastOutCalendarModel = null;
         mCalendarAdapter.clearOutCalendarInfo();
         mNeedClearOutCalendarInfo = true;
       }
       mLastInCalendarModel = selectCalendarModel;
     } else if (mDateType == CalendarBean.MODEL_SELECT_OUT) {
       if (mLastInCalendarModel != null
           && selectCalendarModel.compareTo(mLastInCalendarModel) <= 0) {
         // 离店日期 必须大于 入住日期
         mHandler.sendEmptyMessageDelayed(MSG_SHOW_SELECTDATE_HINT_ACTION, 300);
         return;
       }
       mLastOutCalendarModel = selectCalendarModel;
     }
     mCalendarAdapter.setCalendarInfo(position, mDateType);
     Intent intent = new Intent();
     if (mNeedClearOutCalendarInfo) {
       // 返回到订机票页面时清除离店日期
       intent.putExtra("NeedClearOutCalendar", true);
     }
     intent.putExtra("SelectCalendar", selectCalendarModel);
     setResult(RESULT_OK, intent);
     mHandler.sendEmptyMessageDelayed(MSG_RETURN_ACTION, 300);
   } else if (type == CalendarBean.MODEL_TAG_NEXT) {
     mCalendarAdapter.showNextMonth(this);
   }
 }