本文整理汇总了Java中android.text.format.DateUtils.MINUTE_IN_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.MINUTE_IN_MILLIS属性的具体用法?Java DateUtils.MINUTE_IN_MILLIS怎么用?Java DateUtils.MINUTE_IN_MILLIS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.format.DateUtils
的用法示例。
在下文中一共展示了DateUtils.MINUTE_IN_MILLIS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePing
private void updatePing(ThingsMessage message) {
int ping = (int) (System.currentTimeMillis() - message.getCreationTime());
if (ping > DateUtils.MINUTE_IN_MILLIS) { // if bigger probably the clock of Things and Mobile are not in sync
ping = 0;
}
mOledDisplayController.setPing(ping);
}
示例2: formatTime
public static String formatTime(String pattern, long milli) {
int m = (int) (milli / DateUtils.MINUTE_IN_MILLIS);
int s = (int) ((milli / DateUtils.SECOND_IN_MILLIS) % 60);
String mm = String.format(Locale.getDefault(), "%02d", m);
String ss = String.format(Locale.getDefault(), "%02d", s);
return pattern.replace("mm", mm).replace("ss", ss);
}
示例3: formatDuring
/**
* 将给定的毫秒数转换为可读字符串
*
* @param milliseconds 待转换的毫秒数
* @return 该毫秒数转换为 * days * hours * minutes * seconds 后的格式
*/
public static String formatDuring(long milliseconds) {
long days = milliseconds / DateUtils.DAY_IN_MILLIS;
long hours = (milliseconds % DateUtils.DAY_IN_MILLIS) / DateUtils.HOUR_IN_MILLIS;
long minutes = (milliseconds % DateUtils.HOUR_IN_MILLIS) / DateUtils.MINUTE_IN_MILLIS;
long seconds = (milliseconds % DateUtils.MINUTE_IN_MILLIS) / DateUtils.SECOND_IN_MILLIS;
return days + " days " + hours + " hours " + minutes + " minutes "
+ seconds + " seconds ";
}
示例4: onBindViewHolder
@Override
public void onBindViewHolder(final BlockViewHolder holder, final int position) {
final StoredBlock storedBlock = getItem(position);
final Block header = storedBlock.getHeader();
holder.miningRewardAdjustmentView
.setVisibility(isMiningRewardHalvingPoint(storedBlock) ? View.VISIBLE : View.GONE);
holder.miningDifficultyAdjustmentView
.setVisibility(isDifficultyTransitionPoint(storedBlock) ? View.VISIBLE : View.GONE);
final int height = storedBlock.getHeight();
holder.heightView.setText(Integer.toString(height));
final long timeMs = header.getTimeSeconds() * DateUtils.SECOND_IN_MILLIS;
if (timeMs < System.currentTimeMillis() - DateUtils.MINUTE_IN_MILLIS)
holder.timeView.setText(DateUtils.getRelativeDateTimeString(context, timeMs, DateUtils.MINUTE_IN_MILLIS,
DateUtils.WEEK_IN_MILLIS, 0));
else
holder.timeView.setText(R.string.block_row_now);
holder.hashView.setText(WalletUtils.formatHash(null, header.getHashAsString(), 8, 0, ' '));
final int transactionChildCount = holder.transactionsViewGroup.getChildCount() - ROW_BASE_CHILD_COUNT;
int iTransactionView = 0;
if (transactions != null) {
for (final Transaction tx : transactions) {
if (tx.getAppearsInHashes().containsKey(header.getHash())) {
final View view;
if (iTransactionView < transactionChildCount) {
view = holder.transactionsViewGroup.getChildAt(ROW_INSERT_INDEX + iTransactionView);
} else {
view = inflater.inflate(R.layout.block_row_transaction, null);
holder.transactionsViewGroup.addView(view, ROW_INSERT_INDEX + iTransactionView);
}
bindView(view, tx);
iTransactionView++;
}
}
}
final int leftoverTransactionViews = transactionChildCount - iTransactionView;
if (leftoverTransactionViews > 0)
holder.transactionsViewGroup.removeViews(ROW_INSERT_INDEX + iTransactionView, leftoverTransactionViews);
if (onClickListener != null) {
holder.menuView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
onClickListener.onBlockMenuClick(v, storedBlock);
}
});
}
}