本文整理汇总了Java中android.text.format.DateFormat.getTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:Java DateFormat.getTimeFormat方法的具体用法?Java DateFormat.getTimeFormat怎么用?Java DateFormat.getTimeFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.format.DateFormat
的用法示例。
在下文中一共展示了DateFormat.getTimeFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupScheduleSettings
import android.text.format.DateFormat; //导入方法依赖的package包/类
private void setupScheduleSettings() {
if (mAllDaySchedule) {
mStartTimeButton.setEnabled(false);
mStartTimeButton.setBackgroundColor(0x649e9e9e);
mStartTimeButton.setText(R.string.schedule_disabled);
mStopTimeButton.setEnabled(false);
mStopTimeButton.setBackgroundColor(0x649e9e9e);
mStopTimeButton.setText(R.string.schedule_disabled);
mNextDay.setVisibility(View.INVISIBLE);
} else {
mStartTimeButton.setEnabled(true);
mStopTimeButton.setEnabled(true);
mStartTimeButton.setBackgroundColor(0xffff4081);
mStopTimeButton.setBackgroundColor(0xffff4081);
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(this);
mStartTimeButton.setText(timeFormat.format(
Func.convertHourMinute2Date(mStartTimeHour, mStartTimeMinute)));
mStopTimeButton.setText(timeFormat.format(
Func.convertHourMinute2Date(mStopTimeHour, mStopTimeMinute)));
int startTime = mStartTimeHour * 60 + mStartTimeMinute;
int stopTime = mStopTimeHour * 60 + mStopTimeMinute;
if (startTime > stopTime) {
mNextDay.setVisibility(View.VISIBLE);
} else {
mNextDay.setVisibility(View.INVISIBLE);
}
}
}
示例2: onActivityResult2
import android.text.format.DateFormat; //导入方法依赖的package包/类
@Override
public void onActivityResult2(int requestCode, Intent data) {
int hour = data.getIntExtra(TimePickerFragment.EXTRA_HOUR, 0);
int minute = data.getIntExtra(TimePickerFragment.EXTRA_MINUTE, 0);
java.text.DateFormat timeFormat = DateFormat.getTimeFormat(this);
String formattedTime = timeFormat.format(Func.convertHourMinute2Date(hour, minute));
int time = hour * 60 + minute;
if (requestCode == START_TIME_REQUEST) {
mStartTimeHour = hour;
mStartTimeMinute = minute;
mStartTimeButton.setText(formattedTime);
int stopTime = mStopTimeHour * 60 + mStopTimeMinute;
if (time > stopTime) {
mNextDay.setVisibility(View.VISIBLE);
} else {
mNextDay.setVisibility(View.INVISIBLE);
}
} else if (requestCode == STOP_TIME_REQUEST) {
mStopTimeHour = hour;
mStopTimeMinute = minute;
mStopTimeButton.setText(formattedTime);
int startTime = mStartTimeHour * 60 + mStartTimeMinute;
if (time < startTime) {
mNextDay.setVisibility(View.VISIBLE);
} else {
mNextDay.setVisibility(View.INVISIBLE);
}
}
}
示例3: AdapterBaseImpl
import android.text.format.DateFormat; //导入方法依赖的package包/类
protected AdapterBaseImpl(Context ctx_, int mode_)
{
ctx = ctx_;
mode = mode_;
mInflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
localeDateFormat = DateFormat.getDateFormat(ctx);
localeTimeFormat = DateFormat.getTimeFormat(ctx);
density = ctx.getResources().getDisplayMetrics().density;
}
示例4: TimeSetToastController
import android.text.format.DateFormat; //导入方法依赖的package包/类
private TimeSetToastController(Context appContext) {
this.appContext = appContext;
timeFormatter = DateFormat.getTimeFormat(appContext);
}