Пример #1
0
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.datetime_picker_submit:
       saveSelectedDateTime();
       sendRoutesRequest(mBegDateTime.toString(), mEndDateTime.toString());
     case R.id.datetime_picker_cancel:
     case R.id.datetime_picker_close:
       hidePickerDialog();
       break;
     case R.id.path_endtime:
     case R.id.path_begtime:
       mCurrButton = (Button) v;
       showPickerDialog(mCurrButton.getHint().toString(), mCurrButton.getText().toString());
       break;
   }
 }
Пример #2
0
  private void saveSelectedDateTime() {

    // save beg date
    mBegDateTime.setYear(datetime_picker_date.getYear());
    mBegDateTime.setMonth(datetime_picker_date.getMonth());
    mBegDateTime.setDay(datetime_picker_date.getDayOfMonth());

    // save end date
    mEndDateTime.setYear(datetime_picker_date.getYear());
    mEndDateTime.setMonth(datetime_picker_date.getMonth());
    mEndDateTime.setDay(datetime_picker_date.getDayOfMonth());

    switch (mCurrButton.getId()) {
      case R.id.path_begtime:
        // // date
        // mBegDateTime.setYear(datetime_picker_date.getYear());
        // mBegDateTime.setMonth(datetime_picker_date.getMonth());
        // mBegDateTime.setDay(datetime_picker_date.getDayOfMonth());
        // time
        mBegDateTime.setHours(datetime_picker_time.getCurrentHour());
        mBegDateTime.setMinutes(datetime_picker_time.getCurrentMinute());
        // // set
        // mCurrButton.setText(mBegDateTime.toString(mDateTimeFormat));
        break;
      case R.id.path_endtime:
        // // date
        // mEndDateTime.setYear(datetime_picker_date.getYear());
        // mEndDateTime.setMonth(datetime_picker_date.getMonth());
        // mEndDateTime.setDay(datetime_picker_date.getDayOfMonth());
        // time
        mEndDateTime.setHours(datetime_picker_time.getCurrentHour());
        mEndDateTime.setMinutes(datetime_picker_time.getCurrentMinute());
        // // set
        // mCurrButton.setText(mEndDateTime.toString(mDateTimeFormat));
        break;
    }

    // set
    mBtnBegTime.setText(mBegDateTime.toString(mDateTimeFormat));

    // set
    mBtnEndTime.setText(mEndDateTime.toString(mDateTimeFormat));
  }
Пример #3
0
  private void checkInitRoutes() {
    Bundle bundle = getIntent().getExtras();
    if (bundle == null) {
      toPointCenter();
      ToastShow.show(this, "参数错误,没有轨迹的起始和结束时间!");
      return;
    }
    try {
      String topName = bundle.getString(PathActivity.ARGS_TOP_NAME);
      String begTime = bundle.getString(PathActivity.ARGS_BEG_DATE);
      String endTime = bundle.getString(PathActivity.ARGS_END_DATE);

      mActionBar.setTitle(topName);
      if (begTime != null && endTime != null) {
        mBegDateTime = DateTime.from(begTime);
        mBtnBegTime.setText(mBegDateTime.toString(mDateTimeFormat));
        mEndDateTime = DateTime.from(endTime);
        mBtnEndTime.setText(mEndDateTime.toString(mDateTimeFormat));
        sendRoutesRequest(begTime, endTime);
      } else {
        {
          mEndDateTime = DateTime.now();
          mBegDateTime = DateTime.from(mEndDateTime);
          // 默认当天6点开始
          mBegDateTime.setHours(6);
          mBegDateTime.setMinutes(0);
          // mEndDateTime.addDay(-3);// 默认查最近三天的记录
        }
        mBtnBegTime.setText(mBegDateTime.toString(mDateTimeFormat));
        mBtnEndTime.setText(mEndDateTime.toString(mDateTimeFormat));

        toCaricoCenter();
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      // ToastShow.show(this, "Intent参数不正确!");
    }
  }