本文整理汇总了Java中group.pals.android.lib.ui.filechooser.utils.DateUtils类的典型用法代码示例。如果您正苦于以下问题:Java DateUtils类的具体用法?Java DateUtils怎么用?Java DateUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateUtils类属于group.pals.android.lib.ui.filechooser.utils包,在下文中一共展示了DateUtils类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: formatDate
import group.pals.android.lib.ui.filechooser.utils.DateUtils; //导入依赖的package包/类
/**
* Formats {@code millis} to time.
*
* @param c
* {@link Context}.
* @param millis
* the time in milliseconds.
* @return the formatted time.
*/
private static String formatDate(Context c, long millis) {
if (android.text.format.DateUtils.isToday(millis))
return c.getString(R.string.afc_today);
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(millis);
final Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_YEAR, -1);
if (cal.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
if (cal.get(Calendar.DAY_OF_YEAR) == yesterday
.get(Calendar.DAY_OF_YEAR))
return c.getString(R.string.afc_yesterday);
else
return android.text.format.DateUtils.formatDateTime(c, millis,
DateUtils._FormatMonthAndDay);
}
return android.text.format.DateUtils.formatDateTime(c, millis,
DateUtils._FormatMonthAndDay | DateUtils._FormatYear);
}
开发者ID:wcmatthysen,项目名称:android-filechooser,代码行数:32,代码来源:HistoryCursorAdapter.java
示例2: updateView
import group.pals.android.lib.ui.filechooser.utils.DateUtils; //导入依赖的package包/类
/**
* Updates the view.
*
* @param parent
* the parent view
* @param childView
* the child view.
* @param bag
* the "view holder", see {@link Bag}
* @param data
* {@link IFileDataModel}
* @param file
* {@link IFile}
* @since v2.0 alpha
*/
private void updateView(ViewGroup parent, View childView, Bag bag, final IFileDataModel data, IFile file) {
/*
* Use single line for grid view, multiline for list view
*/
bag.mTxtFileName.setSingleLine(parent instanceof GridView);
// file icon
bag.mImageIcon.setImageResource(FileUtils.getResIcon(file));
// filename
bag.mTxtFileName.setText(file.getName());
// check if this file has been marked as to be deleted or not
if (data.isTobeDeleted())
bag.mTxtFileName.setPaintFlags(bag.mTxtFileName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
else
bag.mTxtFileName.setPaintFlags(bag.mTxtFileName.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
// file info
String time = DateUtils.formatDate(mContext, file.lastModified(), mFileTimeDisplay);
if (file.isDirectory())
bag.mTxtFileInfo.setText(time);
else
bag.mTxtFileInfo.setText(String.format("%s, %s", Converter.sizeToStr(file.length()), time));
// checkbox
if (mMultiSelection) {
if (FilterMode.FilesOnly.equals(mFilterMode) && file.isDirectory()) {
bag.mCheckboxSelection.setVisibility(View.GONE);
} else {
bag.mCheckboxSelection.setVisibility(View.VISIBLE);
bag.mCheckboxSelection.setFocusable(false);
bag.mCheckboxSelection.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
data.setSelected(isChecked);
}
});
bag.mCheckboxSelection.setOnLongClickListener(mCheckboxSelectionOnLongClickListener);
bag.mCheckboxSelection.setChecked(data.isSelected());
}
} else
bag.mCheckboxSelection.setVisibility(View.GONE);
}
开发者ID:FAIMS,项目名称:faims-android,代码行数:62,代码来源:IFileAdapter.java
示例3: formatTime
import group.pals.android.lib.ui.filechooser.utils.DateUtils; //导入依赖的package包/类
/**
* Formats {@code millis} to short time. E.g: "10:01am".
*
* @param c
* {@link Context}.
* @param millis
* time in milliseconds.
* @return the formatted time.
*/
private static String formatTime(Context c, long millis) {
return android.text.format.DateUtils.formatDateTime(c, millis,
DateUtils._FormatShortTime);
}
开发者ID:wcmatthysen,项目名称:android-filechooser,代码行数:14,代码来源:HistoryCursorAdapter.java
注:本文中的group.pals.android.lib.ui.filechooser.utils.DateUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论