/** * 时间获取 * * @param mGITime 控件 * @param context 承接上下文 */ public void endTime(GeneralInput mGITime, Context context) { TimePickerDialog tp = new TimePickerDialog(context, (view12, hourOfDay, minute) -> { StringBuilder sb = new StringBuilder(); if (hourOfDay < DATA_RANGE) { sb.append(BEFORE_TIME).append(hourOfDay).append(TIME_SYMBOL); } else { sb.append(hourOfDay).append(TIME_SYMBOL); } if (minute < DATA_RANGE) { sb.append(BEFORE_TIME).append(minute); } else { sb.append(minute); } mGITime.setText(sb.toString()); }, mCalendar.get(Calendar.HOUR_OF_DAY), mCalendar.get(Calendar.MINUTE), true); InputMethodUtil.closeIfNeeded((Activity) context); tp.show(); }