當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。