本文整理汇总了Java中com.wdullaer.materialdatetimepicker.time.TimePickerDialog.show方法的典型用法代码示例。如果您正苦于以下问题:Java TimePickerDialog.show方法的具体用法?Java TimePickerDialog.show怎么用?Java TimePickerDialog.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.wdullaer.materialdatetimepicker.time.TimePickerDialog
的用法示例。
在下文中一共展示了TimePickerDialog.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDateSet
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@Override
public void onDateSet(DatePickerDialog datePickerDialog, int year, int month, int day) {
mScheduledDate = Calendar.getInstance();
mScheduledDate.set(Calendar.YEAR, year);
mScheduledDate.set(Calendar.MONTH, month);
mScheduledDate.set(Calendar.DAY_OF_MONTH, day);
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
CreateActivity.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE) + 1,
false
);
tpd.show(getFragmentManager(), Consts.FRAGMENT_TAG_DATETIME_PICKER);
}
示例2: onTimeSet
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, int h, int min) {
if (nightTimeStart[0] >= 25) {
nightTimeStart = new int[]{h, min};
boolean twentyFourHourStyle = DateFormat.is24HourFormat(getActivity());
TimePickerDialog tpd = TimePickerDialog
.newInstance(this, 6, 0, twentyFourHourStyle);
tpd.setOnCancelListener(this);
tpd.setTitle(getActivity().getString(R.string.nighttime_end_dialog_title));
tpd.show(getFragmentManager(), NIGHT_END_TIME_DIALOG_TAG);
} else {
SharedPreferences current = getActivity().getSharedPreferences("night_time", Context.MODE_PRIVATE);
current.edit().putInt("startHour", nightTimeStart[0])
.putInt("startMinute", nightTimeStart[1])
.putInt("endHour", h)
.putInt("endMinute", min)
.apply();
nightTimeStart[0] = 42;
}
}
示例3: setTime
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
public void setTime(View v){
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
false
);
tpd.setThemeDark(false);
tpd.show(getFragmentManager(), "Timepickerdialog");
}
示例4: showTimeDelayDialog
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void showTimeDelayDialog() {
int totalSecs = preferences.getTimerDelay();
int hours = totalSecs / 3600;
int minutes = (totalSecs % 3600) / 60;
int seconds = totalSecs % 60;
TimePickerDialog mTimePickerDialog = TimePickerDialog.newInstance(this, hours, minutes, seconds, true);
mTimePickerDialog.enableSeconds(true);
mTimePickerDialog.show(mActivity.getFragmentManager(), "TimePickerDialog");
}
示例5: showTimeDelayDialog
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void showTimeDelayDialog() {
int totalSecs = preferences.getTimerDelay();
int hours = totalSecs / 3600;
int minutes = (totalSecs % 3600) / 60;
int seconds = totalSecs % 60;
TimePickerDialog mTimePickerDialog = TimePickerDialog.newInstance(this, hours, minutes, seconds, true);
mTimePickerDialog.enableSeconds(true);
mTimePickerDialog.show(getFragmentManager(), "TimePickerDialog");
}
示例6: showTimePickerDialog
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void showTimePickerDialog() {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(this.timeSetListener, now.get(11),
now.get(12), true);
tpd.vibrate(false);
tpd.setAccentColor(getResources().getColor(R.color.gn));
tpd.show(getFragmentManager(), "Timepickerdialog");
}
示例7: onDateSet
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
String date = " " + year + "年\n" + (++monthOfYear) + "月" + dayOfMonth+"日";
if (left) {
naiveDateLeft = new NaiveDate(year, monthOfYear, dayOfMonth);
leftDate = date;
} else {
naiveDateRight = new NaiveDate(year, monthOfYear, dayOfMonth);
rightDate = date;
}
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
PublishNeedsActivity.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
true
);
tpd.enableSeconds(false);
tpd.setThemeDark(false);
tpd.vibrate(true);
tpd.dismissOnPause(true);
tpd.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Log.d("TimePicker", "Dialog was cancelled");
}
});
tpd.show(getFragmentManager(), "Timepickerdialog");
}
示例8: updateCountdownTime
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@OnClick(R.id.countdown_time)
public void updateCountdownTime() {
Calendar cal = Calendar.getInstance();
cal.setTime(dateOption.getDate());
TimePickerDialog dpd = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
Calendar curDate = Calendar.getInstance();
curDate.setTime(dateOption.getDate());
curDate.set(curDate.get(Calendar.YEAR), curDate.get(Calendar.MONTH), curDate.get(Calendar.DAY_OF_MONTH), hourOfDay, minute, second);
dateOption.setValue(curDate.getTime());
dateOption.save();
updateWidgetProperty(COUNTDOWN_DATE, dateOption.value);
updateCountdownDateAndTimeText();
}
},
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
false
);
dpd.show(getActivity().getFragmentManager(), "timepickerdialog");
}
示例9: openTimePicker
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void openTimePicker() {
Calendar c = Calendar.getInstance();
long time = mRemindItem.getTime();
if (time > 0) {
c.setTimeInMillis(time);
}
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(mTimeSetListener, hour, minute, true);
// timePickerDialog.dismissOnPause(true);
timePickerDialog.vibrate(false);
timePickerDialog.show(getActivity().getFragmentManager(), TIME_PICKER_DIALOG_TAG);
}
示例10: sleeping
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
public void sleeping(){
if(IS_ALARM_CREATED){
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyAlertDialogStyle);
builder.setTitle(getResources().getString(R.string.autocomplete));
builder.setMessage(getResources().getString(R.string.mess_to_stop_alarm));
builder.setNegativeButton(getResources().getString(R.string.cancel),null);
builder.setPositiveButton(getResources().getString(R.string.close_alarm),new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
alarm.cancel(startAlarmPI);
IS_ALARM_CREATED=false;
createToast(getResources().getString(R.string.mess_alarm_closed));
}
});
builder.setCancelable(false);
builder.show();
}else {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(this, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), true);
if(settings.getInt(5)==1) {
tpd.setThemeDark(true);
}else{
tpd.setThemeDark(false);
}
tpd.setTitle(getResources().getString(R.string.autocomplete));
tpd.setCancelText(getResources().getString(R.string.cancel));
tpd.setOkText(getResources().getString(R.string.alarm_ok));
tpd.show(getFragmentManager(), "TimePicker");
Log.d("State", "MainActivity: sleeping()");
}
}
示例11: onClick
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(eventTime);
switch (view.getId()) {
case R.id.careportal_newnstreatment_eventdate:
DatePickerDialog dpd = DatePickerDialog.newInstance(
this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
dpd.show(context.getFragmentManager(), "Datepickerdialog");
break;
case R.id.careportal_newnstreatment_eventtime:
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(context)
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
tpd.show(context.getFragmentManager(), "Timepickerdialog");
break;
case R.id.ok:
createNSTreatment();
dismiss();
break;
case R.id.cancel:
dismiss();
break;
}
}
示例12: showTimeDialog
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
/**
* 时间选择
*/
private void showTimeDialog() {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
ActReleaseProductActivity.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
true
);
tpd.show(getFragmentManager(), "Timepickerdialog");
}
示例13: showTimeDialog
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void showTimeDialog() {
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
ActReleaseRoadshowActivity.this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
true
);
tpd.show(getFragmentManager(), "Timepickerdialog");
}
示例14: chooseTime
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
private void chooseTime(int button) {
if (date != null) {
Calendar now = Calendar.getInstance();
TimePickerDialog timePicker = TimePickerDialog.newInstance(
this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
true
);
if (button == 1) {
//custom Listener to avoid conflicts with second dialog
timePicker.setOnTimeSetListener(new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
Calendar start = Calendar.getInstance();
start.setTime(date);
start.add(Calendar.HOUR_OF_DAY, hourOfDay);
start.add(Calendar.MINUTE, minute);
startTime = start.getTime();
mButtonStart.setText(DateUtils.formatDate(startTime, "HH:mm"));
}
});
timePicker.show(getFragmentManager(), "TimePicker");
} else {
if (startTime != null) {
timePicker.setMinTime(startTime.getHours(), startTime.getMinutes() + 1, 0);
timePicker.show(getFragmentManager(), "TimePicker");
} else {
Toast.makeText(AddAppointmentActivity.this, R.string.err_set_start_first, Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(AddAppointmentActivity.this, R.string.err_set_date_first, Toast.LENGTH_SHORT).show();
}
}
示例15: onClick
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; //导入方法依赖的package包/类
@OnClick({R.id.edit_remind_date_box, R.id.edit_remind_time, R.id.ll_remind_fr,
R.id.tv_save, R.id.tv_cancel, R.id.tv_state})
public void onClick(View view) {
mVicInput.stopRecord();
switch (view.getId()) {
case R.id.edit_remind_date_box:
Date rDate = TimeUtils.parse(mEditRemindDate.getText().toString());
Calendar now = Calendar.getInstance();
now.setTime(rDate);
//将当前日期传入日期选择器,并显示
DatePickerDialog datePicker = DatePickerDialog.newInstance(
this,
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH)
);
datePicker.setAccentColor(getResources().getColor(R.color.base_blue));
datePicker.show(getFragmentManager(), "DatePicker");
break;
case R.id.edit_remind_time:
SimpleDate rTime = new SimpleDate(mEditRemindTime.getText().toString());
TimePickerDialog timePicker = TimePickerDialog.newInstance(
this,
rTime.getHour(),
rTime.getMinute(),
true);
timePicker.setAccentColor(getResources().getColor(R.color.base_blue));
timePicker.show(getFragmentManager(), "TimePicker");
break;
case R.id.ll_remind_fr:
final Remind rRemind = (Remind) ((TaskCard) mPresenter.getShowDatas().get(getAdapterPosition() - 1)).t;
Calendar cl = Calendar.getInstance();
if (rRemind.getRdate() != null)
cl.setTime(rRemind.getRdate());
RemindFrDialog frDialog = new RemindFrDialog(RemindActivity.this, rRemind.getFrequency(), cl, new RemindFrDialog.OnResultListener() {
@Override
public void onResult(int fr) {
remindFr = fr;
// rRemind.setFrequency(fr);
mEditRemindFr.setText(AssistUtils.translateRemindFrequency(fr));
}
});
frDialog.show();
break;
case R.id.tv_save:
saveHandle();
break;
case R.id.tv_cancel:
cancelHandle();
break;
case R.id.tv_state:
TaskCard<Remind> taskCard = mPresenter.getShowDatas().get(getAdapterPosition() - 1);
if (taskCard.taskState == TaskCard.TaskState.REVOCABLE) { //处于可撤销状态,点击撤销删除
if (taskCard.t.getRdate().compareTo(TimeUtils.getTodayDate()) != -1 && taskCard.t.getRdate().before(TimeUtils.getTomorrow())) {
mPresenter.setTodayCount(mPresenter.getTodayCount() + 1);
notifyItemChanged(0);
}
taskCard.taskState = TaskCard.TaskState.ACTIVE;
if (taskCard.t.getFrequency() == 0 && taskCard.t.getRdate().before(new Date())) {
taskCard.taskState = TaskCard.TaskState.INVALID;
}
taskCard.t.setSynced(false);
mPresenter.operateData(IRemind.INSERT_TYPE, taskCard.t);
mPresenter.switchRemind(taskCard.t, RemindService.ADD);
notifyItemChanged(getAdapterPosition());
//与服务器同步数据
AssistEntityDao.create().sync(mRemindEntityDao);
}
break;
}
}