當前位置: 首頁>>代碼示例>>Java>>正文


Java DateFormat.getTimeFormat方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:35,代碼來源:AppSettingsActivity.java

示例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);
        }
    }
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:33,代碼來源:AppSettingsActivity.java

示例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;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:10,代碼來源:AdapterBaseImpl.java

示例4: TimeSetToastController

import android.text.format.DateFormat; //導入方法依賴的package包/類
private TimeSetToastController(Context appContext) {
    this.appContext = appContext;
    timeFormatter = DateFormat.getTimeFormat(appContext);
}
 
開發者ID:philliphsu,項目名稱:NumberPadTimePicker,代碼行數:5,代碼來源:TimeSetToastController.java


注:本文中的android.text.format.DateFormat.getTimeFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。