当前位置: 首页>>代码示例>>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;未经允许,请勿转载。