Java Code Examples for android.text.format.DateUtils#FORMAT_12HOUR
The following examples show how to use
android.text.format.DateUtils#FORMAT_12HOUR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimePickerClockDelegate.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24Hour) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getHour()); mTempCalendar.set(Calendar.MINUTE, getMinute()); final String selectedTime = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); final String selectionMode = mRadialTimePickerView.getCurrentItemShowing() == HOUR_INDEX ? mSelectHours : mSelectMinutes; event.getText().add(selectedTime + " " + selectionMode); }
Example 2
Source File: TimePickerClockDelegate.java From DateTimePicker with Apache License 2.0 | 6 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24Hour) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getHour()); mTempCalendar.set(Calendar.MINUTE, getMinute()); final String selectedTime = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); final String selectionMode = mRadialTimePickerView.getCurrentItemShowing() == HOUR_INDEX ? mSelectHours : mSelectMinutes; event.getText().add(selectedTime + " " + selectionMode); }
Example 3
Source File: TimePicker.java From NewXmPluginSDK with Apache License 2.0 | 6 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24HourView) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour()); mTempCalendar.set(Calendar.MINUTE, getCurrentMinute()); String selectedDateUtterance = DateUtils.formatDateTime(getContext(), mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDateUtterance); }
Example 4
Source File: SublimeTimePicker.java From SublimePicker with Apache License 2.0 | 6 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); int flags = DateUtils.FORMAT_SHOW_TIME; // The deprecation status does not show up in the documentation and // source code does not outline the alternative. // Leaving this as is for now. if (mIs24HourView) { //noinspection deprecation flags |= DateUtils.FORMAT_24HOUR; } else { //noinspection deprecation flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour()); mTempCalendar.set(Calendar.MINUTE, getCurrentMinute()); String selectedDate = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDate); }
Example 5
Source File: TimePickerSpinnerDelegate.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24HourView) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getHour()); mTempCalendar.set(Calendar.MINUTE, getMinute()); String selectedDateUtterance = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDateUtterance); }
Example 6
Source File: TimePickerSpinnerDelegate.java From DateTimePicker with Apache License 2.0 | 5 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24HourView) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getHour()); mTempCalendar.set(Calendar.MINUTE, getMinute()); String selectedDateUtterance = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDateUtterance); }
Example 7
Source File: TimePickerSpinnerDelegate.java From ticdesign with Apache License 2.0 | 5 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24HourView) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour()); mTempCalendar.set(Calendar.MINUTE, getCurrentMinute()); String selectedDateUtterance = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDateUtterance); }
Example 8
Source File: AppCompatTimePickerDelegate.java From AppCompat-Extension-Library with Apache License 2.0 | 5 votes |
@Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { int flags = DateUtils.FORMAT_SHOW_TIME; if (mIs24HourView) { flags |= DateUtils.FORMAT_24HOUR; } else { flags |= DateUtils.FORMAT_12HOUR; } mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour()); mTempCalendar.set(Calendar.MINUTE, getCurrentMinute()); String selectedDate = DateUtils.formatDateTime(mContext, mTempCalendar.getTimeInMillis(), flags); event.getText().add(selectedDate); }