本文整理匯總了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);
}
});
}
}