当前位置: 首页>>代码示例>>Java>>正文


Java DateUtils.FORMAT_SHOW_TIME属性代码示例

本文整理汇总了Java中android.text.format.DateUtils.FORMAT_SHOW_TIME属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.FORMAT_SHOW_TIME属性的具体用法?Java DateUtils.FORMAT_SHOW_TIME怎么用?Java DateUtils.FORMAT_SHOW_TIME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.text.format.DateUtils的用法示例。


在下文中一共展示了DateUtils.FORMAT_SHOW_TIME属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFolderStatus

private String buildFolderStatus(FolderInfoHolder folder) {
    String folderStatus;
    if (folder.loading) {
        folderStatus = getString(R.string.status_loading);
    } else if (folder.status != null) {
        folderStatus = folder.status;
    } else if (folder.lastChecked != 0) {
        long now = System.currentTimeMillis();
        int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR;
        CharSequence formattedDate;

        if (Math.abs(now - folder.lastChecked) > DateUtils.WEEK_IN_MILLIS) {
            formattedDate = getString(R.string.preposition_for_date,
                    DateUtils.formatDateTime(context, folder.lastChecked, flags));
        } else {
            formattedDate = DateUtils.getRelativeTimeSpanString(folder.lastChecked,
                    now, DateUtils.MINUTE_IN_MILLIS, flags);
        }

        folderStatus = getString(folder.pushActive
                        ? R.string.last_refresh_time_format_with_push
                        : R.string.last_refresh_time_format,
                formattedDate);
    } else {
        folderStatus = null;
    }
    return folderStatus;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:28,代码来源:FolderList.java

示例2: dispatchPopulateAccessibilityEvent

/**
 * Announce the currently-selected time when launched.
 */
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        // Clear the event's current text so that only the current time will be spoken.
        event.getText().clear();
        Time time = new Time();
        time.hour = getHours();
        time.minute = getMinutes();
        long millis = time.normalize(true);
        int flags = DateUtils.FORMAT_SHOW_TIME;
        if (mIs24HourMode) {
            flags |= DateUtils.FORMAT_24HOUR;
        }
        String timeString = DateUtils.formatDateTime(getContext(), millis, flags);
        event.getText().add(timeString);
        return true;
    }
    return super.dispatchPopulateAccessibilityEvent(event);
}
 
开发者ID:ttpho,项目名称:TimePicker,代码行数:22,代码来源:RadialPickerLayout.java

示例3: dispatchPopulateAccessibilityEvent

/**
 * Announce the currently-selected time when launched.
 */
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        // Clear the event's current text so that only the current time will be spoken.
        event.getText().clear();
        Calendar time = Calendar.getInstance();
        time.set(Calendar.HOUR, getHours());
        time.set(Calendar.MINUTE, getMinutes());
        time.set(Calendar.SECOND, getSeconds());
        long millis = time.getTimeInMillis();
        int flags = DateUtils.FORMAT_SHOW_TIME;
        if (mIs24HourMode) {
            flags |= DateUtils.FORMAT_24HOUR;
        }
        String timeString = DateUtils.formatDateTime(getContext(), millis, flags);
        event.getText().add(timeString);
        return true;
    }
    return super.dispatchPopulateAccessibilityEvent(event);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:23,代码来源:RadialPickerLayout.java

示例4: formatTime

public static String formatTime(Context context, long when) {
	// TODO: DateUtils should make this easier
	Time then = new Time();
	then.set(when);
	Time now = new Time();
	now.setToNow();

	int flags = DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT | DateUtils.FORMAT_ABBREV_ALL;

	if (then.year != now.year) {
		flags |= DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_DATE;
	} else if (then.yearDay != now.yearDay) {
		flags |= DateUtils.FORMAT_SHOW_DATE;
	} else {
		flags |= DateUtils.FORMAT_SHOW_TIME;
	}

	return DateUtils.formatDateTime(context, when, flags);
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:Utils.java

示例5: onPopulateAccessibilityEvent

@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);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:18,代码来源:TimePickerClockDelegate.java

示例6: timeString

private String timeString(long ts) {
    int flags = DateUtils.FORMAT_SHOW_DATE |
            DateUtils.FORMAT_SHOW_TIME |
            DateUtils.FORMAT_ABBREV_MONTH |
            DateUtils.FORMAT_SHOW_WEEKDAY |
            DateUtils.FORMAT_ABBREV_WEEKDAY;

    return DateUtils.formatDateTime(getContext(), ts, flags);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:9,代码来源:BooksFragment.java

示例7: formatTimeAndEndTime

public String formatTimeAndEndTime(OrgDateTime time) {
    long t1 = time.getCalendar().getTimeInMillis();
    long t2 = time.getEndCalendar().getTimeInMillis();

    int flags = DateUtils.FORMAT_SHOW_TIME;

    return format(t1, t2, flags);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:8,代码来源:UserTimeFormatter.java

示例8: onPopulateAccessibilityEvent

@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);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:14,代码来源:TimePickerSpinnerDelegate.java

示例9: formatTime

public String formatTime(OrgDateTime time) {
    long timestamp = time.getCalendar().getTimeInMillis();

    int flags = DateUtils.FORMAT_SHOW_TIME;

    return format(timestamp, timestamp, flags);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:7,代码来源:UserTimeFormatter.java


注:本文中的android.text.format.DateUtils.FORMAT_SHOW_TIME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。