本文整理匯總了Java中android.app.TimePickerDialog.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java TimePickerDialog.setTitle方法的具體用法?Java TimePickerDialog.setTitle怎麽用?Java TimePickerDialog.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.app.TimePickerDialog
的用法示例。
在下文中一共展示了TimePickerDialog.setTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setAlarm
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Subscribe
public void setAlarm(OnAlarmClickEvent event) {
arrivalTime = event.arrivalTime;
alarmTime = event.arrivalTime;
int reminder = Integer.parseInt(sharedPreferences.getString(getString(R.string.pref_key_alarm_reminder), "5"));
alarmTime = alarmTime.minusMinutes(reminder);
TimePickerDialog timePickerDialog = new TimePickerDialog(
this,
this,
alarmTime.getHourOfDay(),
alarmTime.getMinuteOfHour(),
DateFormat.is24HourFormat(this)
);
timePickerDialog.setTitle(R.string.alarm_dialog_title);
timePickerDialog.setMessage(getString(R.string.alarm_dialog_message_fmt, DateUtils.formatTime(arrivalTime)));
timePickerDialog.show();
}
示例2: setCountDownTime
import android.app.TimePickerDialog; //導入方法依賴的package包/類
private void setCountDownTime(final CountDownTimerView countDownTimerView)
{
TimePickerDialog timePickerDialog = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener()
{
//hours are taken as minutes and minutes as seconds
@Override
public void onTimeSet(TimePicker view, int minute, int second)
{
long countDownMillis = (minute * 60 + second) * 1000;
countDownTimerView.setCountDownTime(countDownMillis);
}
}, 0, 0, true);
timePickerDialog.setTitle(getString(R.string.minutes_and_seconds));
timePickerDialog.show();
}
示例3: onDialogClosed
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Override
protected void onDialogClosed(final boolean positiveResult) {
if (positiveResult) {
v.set(dp.getYear(), dp.getMonth(), dp.getDayOfMonth());
cv.put(getKey(), v.getTimeInMillis());
if (ul != null) {
ul.onUpdateValue(this);
}
if (dt) {
TimePickerDialog tpd = new TimePickerDialog(getContext(), this,
v.get(Calendar.HOUR_OF_DAY), v.get(Calendar.MINUTE), true);
tpd.setTitle(getTitle());
tpd.setCancelable(true);
tpd.show();
}
}
}
示例4: pickNightTime
import android.app.TimePickerDialog; //導入方法依賴的package包/類
private void pickNightTime() {
TimePickerDialog.OnTimeSetListener startTimeListener = (view, startHourOfDay, startMinuteOfDay) -> {
TimePickerDialog timePickerDialogEnd = new TimePickerDialog(getActivity(), (view1, endHourOfDay, endMinuteOfDay) -> storeNightModeInterval(startHourOfDay * 60 + startMinuteOfDay, endHourOfDay * 60 + endMinuteOfDay), Settings.get().ui().getNightEndTime() / 60, Settings.get().ui().getNightEndTime() % 60, true);
timePickerDialogEnd.setTitle(R.string.title_end_time);
timePickerDialogEnd.show();
};
TimePickerDialog timePickerDialogStart = new TimePickerDialog(getActivity(), startTimeListener,
Settings.get().ui().getNightStartTime() / 60, Settings.get().ui().getNightStartTime() % 60, true);
timePickerDialogStart.setTitle(R.string.title_start_time);
timePickerDialogStart.show();
}
示例5: openTimePickerDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
private void openTimePickerDialog(boolean is24r) {
Calendar calendar = Calendar.getInstance();
timePickerDialog = new TimePickerDialog(BluetoothActivity.this,
onTimeSetListener, calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE), is24r);
timePickerDialog.setTitle("Set Alarm Time");
timePickerDialog.show();
}
示例6: onCreateDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
TimePickerDialog tp = new TimePickerDialog(getActivity(), this, this.hour, this.minute,
DateFormat.is24HourFormat(getActivity()));
if (title != null) tp.setTitle(title);
return tp;
}
示例7: onCreateDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar cal = DateHelper.getCalendar(defaultTime);
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
boolean is24HourMode = DateHelper.is24HourMode(mActivity);
TimePickerDialog tpd = new TimePickerDialog(mActivity, R.style.Theme_AppCompat_Dialog_NoBackgroundOrDim, mListener, hour, minute, is24HourMode);
tpd.setTitle("");
return tpd;
}
示例8: openTimePickerDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
private void openTimePickerDialog(boolean is24r){
Calendar calendar = Calendar.getInstance();
timePickerDialog = new TimePickerDialog(getActivity(),onTimeSetListener,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
is24r);
timePickerDialog.setTitle("Set Alarm Time");
timePickerDialog.show();
}
示例9: onSetTime
import android.app.TimePickerDialog; //導入方法依賴的package包/類
public void onSetTime(View v) {
TimePickerDialog picker = new TimePickerDialog(v.getContext(),
TimePickerDialog.THEME_DEVICE_DEFAULT_LIGHT, (p, hour, minute) -> {
App.dispatch(new CountdoneAction(CountdoneAction.Type.SET_DURATION, (hour * 60 + minute ) * 60 * 1000L));
}, (int) App.state().currentTask().remainder()/60/60/1000,
(int) (App.state().currentTask().remainder()/60/1000)%60, true);
picker.setTitle(R.string.set_time_title);
picker.show();
}
示例10: onCreateDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
int hour = 0;
int minute = 0;
TimePickerDialog tpd = new TimePickerDialog(getActivity(), this, hour, minute, true);
tpd.setTitle(R.string.timer_title);
tpd.setMessage(getString(R.string.set_time_from_now));
return tpd;
}
示例11: onCreateDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar cal = DateHelper.getCalendar(defaultTime);
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
boolean is24HourMode = DateHelper.is24HourMode(mActivity);
TimePickerDialog tpd = new TimePickerDialog(mActivity, R.style.Theme_AppCompat_Dialog_NoBackgroundOrDim, mListener, hour, minute, is24HourMode);
tpd.setTitle("");
return tpd;
}
示例12: showTimeDialog
import android.app.TimePickerDialog; //導入方法依賴的package包/類
public void showTimeDialog(View v)
{
//Calculates what page and position we are at
holder = projectListView.getPositionForView(v);
//Calculate what hour and minute that we are at when we click
try
{
hourmin = user.getProjects().get(holder).getTimeByDate(homeFragmentCalendar).getTimeAsArray();
newHour = hourmin[0];
newMin = hourmin[1];
}
catch (Exception name)
{
Log.d("ERROR", name + "");
}
/**
* Show the TimePickerDialog
*/
TimePickerDialog picker = new TimePickerDialog(getActivity(), timeSetListener, newHour, newMin, true);
picker.setTitle("Enter hours and minutes spent on this project:");
picker.setButton(TimePickerDialog.BUTTON_POSITIVE, "Set", picker);
picker.setButton(TimePickerDialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int id)
{
//dialog.dismiss();
mIgnoreTimeSet = true;
Log.d("Picker", "Cancelled!");
}
});
picker.show();
}
示例13: setCurrentTimeOnView
import android.app.TimePickerDialog; //導入方法依賴的package包/類
public void setCurrentTimeOnView() {
timeTextView = (TextView) this.findViewById(R.id.notification_time_set);
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
picker = new TimePickerDialog(this, timePickerListener, hour, minute, true);
picker.setTitle("Set time of notification (hh:mm)");
// set current time into textview
timeTextView.setText(hour+ ":" +minute);
thisNotification.setNotificationHour(hour);
thisNotification.setNotificationMinute(minute);
}
示例14: setOldTimeOnView
import android.app.TimePickerDialog; //導入方法依賴的package包/類
public void setOldTimeOnView()
{
timeTextView = (TextView) this.findViewById(R.id.notification_time_set);
picker = new TimePickerDialog(this, timePickerListener, hour, minute, true);
picker.setTitle("Set time of notification (hh:mm)");
timeTextView.setText(hour+ ":" +minute);
}
示例15: showTimePicker
import android.app.TimePickerDialog; //導入方法依賴的package包/類
private void showTimePicker() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
TimePickerDialog timeDialog = new TimePickerDialog(getActivity(),
(timePicker, hour, minute) -> {
taskCalender.set(Calendar.HOUR_OF_DAY, hour);
taskCalender.set(Calendar.MINUTE, minute);
task.setTaskDate(taskCalender);
presenter.addTask(task, false);
updateAfterAdding(task);
if (task.getRepeatCategory() != 0){
new RepeatOp().execute(task);
}
},
todayCalender.get(Calendar.HOUR_OF_DAY),
todayCalender.get(Calendar.MINUTE), false);
timeDialog.setTitle("Select Task Time");
timeDialog.show();
}else {
TimePicker picker = new TimePicker(getActivity());
picker.setOnTimeChangedListener((timePicker, hour, minute) -> {
taskCalender.set(Calendar.HOUR_OF_DAY, hour);
taskCalender.set(Calendar.MINUTE, minute);
});
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setTitle("Select Task Time")
.setView(picker)
.setPositiveButton("Submit", (dialogInterface, i) -> {
dialogInterface.dismiss();
task.setTaskDate(taskCalender);
presenter.addTask(task, false);
updateAfterAdding(task);
if (task.getRepeatCategory() != 0){
new RepeatOp().execute(task);
}
})
.create();
dialog.show();
}
}