本文整理汇总了Java中com.sleepbot.datetimepicker.time.TimePickerDialog类的典型用法代码示例。如果您正苦于以下问题:Java TimePickerDialog类的具体用法?Java TimePickerDialog怎么用?Java TimePickerDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimePickerDialog类属于com.sleepbot.datetimepicker.time包,在下文中一共展示了TimePickerDialog类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sensorstartonClick
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
public void sensorstartonClick() {
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance((DatePickerDialog.OnDateSetListener) this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance((TimePickerDialog.OnTimeSetListener) this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false, false);
timePickerDialog.show(getSupportFragmentManager(), "timepicker");
datePickerDialog.setYearRange(2016, 2028);
datePickerDialog.show(getSupportFragmentManager(), "datepicker");
/*
Notification notification = new NotificationCompat.Builder(getApplication())
.setSmallIcon(R.drawable.common_google_signin_btn_icon_dark)
.setContentTitle("Hello World")
.setContentText("My first Android Wear notification")
.extend(
new NotificationCompat.WearableExtender().setHintShowBackgroundOnly(false))
.build();
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplication());
int notificationId = 1;
notificationManager.notify(notificationId, notification);
*/
}
示例2: onDateSet
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
@Override
public void onDateSet(DatePickerDialog datePickerDialog, int year,
int month, int day) {
isRemind = false;
// a bug in the datetimepicker-library
// which will cause the month is month - 1
month++;
remindTimeString = String.valueOf(year) + "-";
remindTimeString += (month < 10 ? "0" + String.valueOf(month) : String.valueOf(month)) + "-";
remindTimeString += (day < 10 ? "0" + String.valueOf(day) : String.valueOf(day)) + "-";
final Calendar calendar = Calendar.getInstance();
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
timePickerDialog.setVibrate(false);
timePickerDialog.setCloseOnSingleTapMinute(false);
timePickerDialog.setCancelable(false);
timePickerDialog.show(getSupportFragmentManager(), GlobalSettings.TIMEPICKER_TAG);
}
示例3: onDateSet
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
@Override
public void onDateSet(DatePickerDialog datePickerDialog, int year,
int month, int day) {
// TODO Auto-generated method stub
// a bug in the datetimepicker-library
// which will cause the month is month - 1
month++;
newRemindTimeString = String.valueOf(year) + "-";
newRemindTimeString += (month < 10 ? "0" + String.valueOf(month) : String.valueOf(month)) + "-";
newRemindTimeString += (day < 10 ? "0" + String.valueOf(day) : String.valueOf(day)) + "-";
final Calendar calendar = Calendar.getInstance();
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
timePickerDialog.setVibrate(false);
timePickerDialog.setCloseOnSingleTapMinute(false);
timePickerDialog.setCancelable(false);
timePickerDialog.show(mActivity.getSupportFragmentManager(), GlobalSettings.TIMEPICKER_TAG);
}
示例4: showTimePicker
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
private void showTimePicker(final int position, final AlarmCardRecyclerAdapter.AlarmCardViewHolder viewHolder)
{
String[] time = StringUtil.getTimeFormattedSystem(mContext, 13, 0).split(" ");
boolean is24h = time.length < 2;
AlarmPref alarmPref = mAlarmPrefs.get(position);
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener()
{
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, int h, int m)
{
setAlarmTime(position, h, m);
setAlarmTimeView(viewHolder.alarmTime, viewHolder.am_pm, h,
m);
activateAlarm(viewHolder, position);
}
},
alarmPref.getHour(),
alarmPref.getMinute(),
is24h,
false);
timePickerDialog.show(getActivity().getSupportFragmentManager(), null);
}
示例5: setRemindTime
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
private void setRemindTime() {
final Calendar calendar = Calendar.getInstance();
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
timePickerDialog.setVibrate(false);
timePickerDialog.setCloseOnSingleTapMinute(false);
timePickerDialog.setCancelable(true);
timePickerDialog.show(getSupportFragmentManager(), GlobalSettings.TIMEPICKER_TAG);
}
示例6: showDateTimeSelectors
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
/**
* Show date and time pickers
*/
protected void showDateTimeSelectors(long reminder) {
// Sets actual time or previously saved in note
final Calendar now = DateHelper.getCalendar(reminder);
DatePickerDialog mCalendarDatePickerDialog = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth) {
reminderYear = year;
reminderMonth = monthOfYear;
reminderDay = dayOfMonth;
TimePickerDialog mRadialTimePickerDialog = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, int hour, int minute) {
hourOfDay = hour;
minutes = minute;
showRecurrencePickerDialog(recurrenceRule);
}
}, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
DateHelper.is24HourMode(mActivity));
mRadialTimePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}
}, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
mCalendarDatePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}
示例7: initDateTimePicker
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
/**
* 初始化日期时间选择器
*/
private void initDateTimePicker(Bundle savedInstanceState){
final Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
true);
timePickerDialog = TimePickerDialog.newInstance(this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
true,
true);
if (savedInstanceState != null) {
DatePickerDialog dpd = (DatePickerDialog) getSupportFragmentManager().findFragmentByTag(DATEPICKER_TAG);
if (dpd != null) {
dpd.setOnDateSetListener(this);
}
TimePickerDialog tpd = (TimePickerDialog) getSupportFragmentManager().findFragmentByTag(TIMEPICKER_TAG);
if (tpd != null) {
tpd.setOnTimeSetListener(this);
}
}
}
示例8: onClick
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_enable:
config.setWidgetCountdownEnable(true);
getActivity().finish();
break;
case R.id.tv_disable:
config.setWidgetCountdownEnable(false);
getActivity().finish();
break;
case R.id.tv_countdown_content:
Intent intent = new Intent(getActivity(), CommentActivity.class);
intent.putExtra(Constants.StringConstant.PARAMS_DATA, config.getCountdownContent());
intent.putExtra(Constants.StringConstant.PARAMS_DATA1, config.getWidgetCountdownColor());
startActivityForResult(intent, Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE);
break;
case R.id.tv_countdown_time:
calendar.setTimeInMillis(config.getCountdownTimestamp());
dpd = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
tpd = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
dpd.setYearRange(Constants.CommonValue.FIRST_YEAR, Constants.CommonValue.LAST_YEAR);
dpd.setCloseOnSingleTapDay(false);
dpd.show(getFragmentManager(), TAG);
break;
default:
break;
}
}
示例9: onClick
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_enable:
config.setWidgetTimingEnable(true);
getActivity().finish();
break;
case R.id.tv_disable:
config.setWidgetTimingEnable(false);
getActivity().finish();
break;
case R.id.tv_timing_content:
Intent intent = new Intent(getActivity(), CommentActivity.class);
intent.putExtra(Constants.StringConstant.PARAMS_DATA, config.getTimingContent());
intent.putExtra(Constants.StringConstant.PARAMS_DATA1, config.getWidgetTimingColor());
startActivityForResult(intent, Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE);
break;
case R.id.tv_timing_time:
calendar.setTimeInMillis(config.getTimingTimestamp());
dpd = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
tpd = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
dpd.setYearRange(Constants.CommonValue.FIRST_YEAR, Constants.CommonValue.LAST_YEAR);
dpd.setCloseOnSingleTapDay(false);
dpd.show(getFragmentManager(), TAG);
break;
default:
break;
}
}
示例10: initTimePickerDialog
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
private void initTimePickerDialog(Context context) {
final Calendar calendar = Calendar.getInstance();
// create the dialog to show later:
timePickerDialog = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, int hour, int minute) {
setSelectedTime(hour, minute);
}
},
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE),
is24HourFormat(getTimeFormat()), hasVibratePermission(context));
}
示例11: getTimePickerDialog
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
/**
* Gets the default {@link TimePickerDialog} that is shown when the footer is clicked.
* @return The dialog, or null if a custom time picker has been set and the default one is thus unused.
*/
public @Nullable TimePickerDialog getTimePickerDialog() {
if(customTimePicker != null)
return null;
return timePickerDialog;
}
示例12: getTimePickerDialog
import com.sleepbot.datetimepicker.time.TimePickerDialog; //导入依赖的package包/类
/**
* Gets the default {@link TimePickerDialog} that is shown when the footer in the TimeSpinner is clicked.
* @return The dialog, or null if a custom time picker has been set and the default one is thus unused.
*/
public @Nullable TimePickerDialog getTimePickerDialog() {
return timeSpinner.getTimePickerDialog();
}