本文整理匯總了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);
}