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


Java FileTimeDisplay类代码示例

本文整理汇总了Java中group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay的典型用法代码示例。如果您正苦于以下问题:Java FileTimeDisplay类的具体用法?Java FileTimeDisplay怎么用?Java FileTimeDisplay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileTimeDisplay类属于group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs包,在下文中一共展示了FileTimeDisplay类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseFileAdapter

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
public BaseFileAdapter(Context context, int filterMode,
        boolean multiSelection) {
    super(context, R.layout.afc_file_item, null, 0);
    mFilterMode = filterMode;
    mMultiSelection = multiSelection;

    switch (mFilterMode) {
    case BaseFile.FILTER_FILES_AND_DIRECTORIES:
        mAdvancedSelectionOptions = new Integer[] {
                R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none,
                R.string.afc_cmd_advanced_selection_invert,
                R.string.afc_cmd_select_all_files,
                R.string.afc_cmd_select_all_folders };
        break;// FILTER_FILES_AND_DIRECTORIES
    default:
        mAdvancedSelectionOptions = new Integer[] {
                R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none,
                R.string.afc_cmd_advanced_selection_invert };
        break;// FILTER_DIRECTORIES_ONLY and FILTER_FILES_ONLY
    }

    mFileTimeDisplay = new FileTimeDisplay(
            DisplayPrefs.isShowTimeForOldDaysThisYear(context),
            DisplayPrefs.isShowTimeForOldDays(context));
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:28,代码来源:BaseFileAdapter.java

示例2: IFileAdapter

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
/**
 * Creates new {@link IFileAdapter}
 * 
 * @param context
 *            {@link Context}
 * @param objects
 *            the data
 * @param filterMode
 *            see {@link IFileProvider.FilterMode}
 * @param multiSelection
 *            see {@link FileChooserActivity#_MultiSelection}
 */
public IFileAdapter(Context context, List<IFileDataModel> objects, IFileProvider.FilterMode filterMode,
        boolean multiSelection) {
    // DO NOT use getApplicationContext(), due to this bug:
    // http://stackoverflow.com/questions/2634991/android-1-6-android-view-windowmanagerbadtokenexception-unable-to-add-window
    // http://code.google.com/p/android/issues/detail?id=11199
    mContext = context;
    mData = objects;
    mInflater = LayoutInflater.from(mContext);
    mFilterMode = filterMode;
    mMultiSelection = multiSelection;

    switch (mFilterMode) {
    case DirectoriesOnly:
    case FilesOnly:
        mAdvancedSelectionOptions = new Integer[] { R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none, R.string.afc_cmd_advanced_selection_invert };
        break;// DirectoriesOnly and FilesOnly
    default:
        mAdvancedSelectionOptions = new Integer[] { R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none, R.string.afc_cmd_advanced_selection_invert,
                R.string.afc_cmd_select_all_files, R.string.afc_cmd_select_all_folders };
        break;// FilesAndDirectories
    }

    mFileTimeDisplay = new FileTimeDisplay(DisplayPrefs.isShowTimeForOldDaysThisYear(mContext),
            DisplayPrefs.isShowTimeForOldDays(mContext));
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:40,代码来源:IFileAdapter.java

示例3: formatDate

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
/**
 * Formats date.
 * 
 * @param context
 *            {@link Context}.
 * @param date
 *            {@link Calendar}.
 * @param fileTimeDisplay
 *            {@link FileTimeDisplay}.
 * @return the formatted string, for local human reading.
 */
public static String formatDate(Context context, Calendar date, FileTimeDisplay fileTimeDisplay) {
    final Calendar _yesterday = Calendar.getInstance();
    _yesterday.add(Calendar.DAY_OF_YEAR, -1);

    String res;

    if (android.text.format.DateUtils.isToday(date.getTimeInMillis())) {
        res = android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatShortTime);
    }// today
    else if (date.get(Calendar.YEAR) == _yesterday.get(Calendar.YEAR)
            && date.get(Calendar.DAY_OF_YEAR) == _yesterday.get(Calendar.DAY_OF_YEAR)) {
        res = String.format("%s, %s", context.getString(R.string.afc_yesterday),
                android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatShortTime));
    }// yesterday
    else if (date.get(Calendar.YEAR) == _yesterday.get(Calendar.YEAR)) {
        if (fileTimeDisplay.isShowTimeForOldDaysThisYear())
            res = android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatShortTime
                    | _FormatMonthAndDay);
        else
            res = android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatMonthAndDay);
    }// this year
    else {
        if (fileTimeDisplay.isShowTimeForOldDays())
            res = android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatShortTime
                    | _FormatMonthAndDay | _FormatYear);
        else
            res = android.text.format.DateUtils.formatDateTime(context, date.getTimeInMillis(), _FormatMonthAndDay
                    | _FormatYear);
    }// other years (maybe older or newer than this year)

    return res;
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:44,代码来源:DateUtils.java

示例4: BaseFileAdapter

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
public BaseFileAdapter(Context context, int filterMode,
        boolean multiSelection) {
    super(context, R.layout.afc_file_item, null, 0);
    mFilterMode = filterMode;
    mMultiSelection = multiSelection;

    switch (mFilterMode) {
    case BaseFile._FilterFilesAndDirectories:
        mAdvancedSelectionOptions = new Integer[] {
                R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none,
                R.string.afc_cmd_advanced_selection_invert,
                R.string.afc_cmd_select_all_files,
                R.string.afc_cmd_select_all_folders };
        break;// _FilterFilesAndDirectories
    default:
        mAdvancedSelectionOptions = new Integer[] {
                R.string.afc_cmd_advanced_selection_all,
                R.string.afc_cmd_advanced_selection_none,
                R.string.afc_cmd_advanced_selection_invert };
        break;// _FilterDirectoriesOnly and _FilterFilesOnly
    }

    mFileTimeDisplay = new FileTimeDisplay(
            DisplayPrefs.isShowTimeForOldDaysThisYear(context),
            DisplayPrefs.isShowTimeForOldDays(context));
}
 
开发者ID:wcmatthysen,项目名称:android-filechooser,代码行数:28,代码来源:BaseFileAdapter.java

示例5: formatDate

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
/**
 * Formats date.
 * 
 * @param context
 *            {@link Context}.
 * @param date
 *            {@link Calendar}.
 * @param fileTimeDisplay
 *            {@link FileTimeDisplay}.
 * @return the formatted string, for local human reading.
 */
public static String formatDate(Context context, Calendar date,
        FileTimeDisplay fileTimeDisplay) {
    final Calendar yesterday = Calendar.getInstance();
    yesterday.add(Calendar.DAY_OF_YEAR, -1);

    String res;

    if (android.text.format.DateUtils.isToday(date.getTimeInMillis())) {
        res = android.text.format.DateUtils.formatDateTime(context,
                date.getTimeInMillis(), FORMAT_SHORT_TIME);
    }// today
    else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)
            && date.get(Calendar.DAY_OF_YEAR) == yesterday
                    .get(Calendar.DAY_OF_YEAR)) {
        res = String.format(
                "%s, %s",
                context.getString(R.string.afc_yesterday),
                android.text.format.DateUtils.formatDateTime(context,
                        date.getTimeInMillis(), FORMAT_SHORT_TIME));
    }// yesterday
    else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
        if (fileTimeDisplay.showTimeForOldDaysThisYear)
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), FORMAT_SHORT_TIME
                            | FORMAT_MONTH_AND_DAY);
        else
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), FORMAT_MONTH_AND_DAY);
    }// this year
    else {
        if (fileTimeDisplay.showTimeForOldDays)
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), FORMAT_SHORT_TIME
                            | FORMAT_MONTH_AND_DAY | FORMAT_YEAR);
        else
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), FORMAT_MONTH_AND_DAY
                            | FORMAT_YEAR);
    }// other years (maybe older or newer than this year)

    return res;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:54,代码来源:DateUtils.java

示例6: formatDate

import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay; //导入依赖的package包/类
/**
 * Formats date.
 * 
 * @param context
 *            {@link Context}.
 * @param date
 *            {@link Calendar}.
 * @param fileTimeDisplay
 *            {@link FileTimeDisplay}.
 * @return the formatted string, for local human reading.
 */
public static String formatDate(Context context, Calendar date,
        FileTimeDisplay fileTimeDisplay) {
    final Calendar yesterday = Calendar.getInstance();
    yesterday.add(Calendar.DAY_OF_YEAR, -1);

    String res;

    if (android.text.format.DateUtils.isToday(date.getTimeInMillis())) {
        res = android.text.format.DateUtils.formatDateTime(context,
                date.getTimeInMillis(), _FormatShortTime);
    }// today
    else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)
            && date.get(Calendar.DAY_OF_YEAR) == yesterday
                    .get(Calendar.DAY_OF_YEAR)) {
        res = String.format(
                "%s, %s",
                context.getString(R.string.afc_yesterday),
                android.text.format.DateUtils.formatDateTime(context,
                        date.getTimeInMillis(), _FormatShortTime));
    }// yesterday
    else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
        if (fileTimeDisplay.isShowTimeForOldDaysThisYear())
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), _FormatShortTime
                            | _FormatMonthAndDay);
        else
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), _FormatMonthAndDay);
    }// this year
    else {
        if (fileTimeDisplay.isShowTimeForOldDays())
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), _FormatShortTime
                            | _FormatMonthAndDay | _FormatYear);
        else
            res = android.text.format.DateUtils.formatDateTime(context,
                    date.getTimeInMillis(), _FormatMonthAndDay
                            | _FormatYear);
    }// other years (maybe older or newer than this year)

    return res;
}
 
开发者ID:wcmatthysen,项目名称:android-filechooser,代码行数:54,代码来源:DateUtils.java


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