Пример #1
0
  private void showPickerDialog(String title, String strDatetime) {
    if (mDialog == null) {
      mDialog = new PopupWindowDialog(mPathActivity);
      mDialog.setContentView(R.layout.datetime_picker);
    }

    View view = mDialog.getContentView();
    {
      view.findViewById(R.id.datetime_picker_close).setOnClickListener(this);
      view.findViewById(R.id.datetime_picker_cancel).setOnClickListener(this);
      view.findViewById(R.id.datetime_picker_submit).setOnClickListener(this);
    }

    TextView lblTitle = (TextView) view.findViewById(R.id.datetime_picker_title);
    datetime_picker_date = (DatePicker) view.findViewById(R.id.datetime_picker_date);
    datetime_picker_time = (TimePicker) view.findViewById(R.id.datetime_picker_time);
    lblTitle.setText(title);

    DateTime datetime = DateTime.from(strDatetime, "yyyy-MM-dd HH:mm");

    datetime_picker_date.init(
        datetime.getYear(), datetime.getMonth(), datetime.getDay(), null); // date.getDay()

    // pkrTime.setIs24HourView(true);// 24小时制
    datetime_picker_time.setCurrentHour(datetime.getHours()); // 设置当前小时。
    datetime_picker_time.setCurrentMinute(datetime.getMinutes()); // 当前分钟
    // datetime_picker_time.setOnTimeChangedListener(null);
    mDialog.show();
  }
Пример #2
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参数不正确!");
    }
  }