本文整理汇总了Java中android.text.format.DateUtils.HOUR_IN_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.HOUR_IN_MILLIS属性的具体用法?Java DateUtils.HOUR_IN_MILLIS怎么用?Java DateUtils.HOUR_IN_MILLIS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.format.DateUtils
的用法示例。
在下文中一共展示了DateUtils.HOUR_IN_MILLIS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dump
@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
Log.d("dump", "Downloads updated in last hour:");
final SQLiteDatabase db = mOpenHelper.getReadableDatabase();
final long modifiedAfter = System.currentTimeMillis() - DateUtils.HOUR_IN_MILLIS;
final Cursor cursor = db.query(DB_TABLE, null,
Downloads.Impl.COLUMN_LAST_MODIFICATION + ">" + modifiedAfter, null, null, null,
Downloads.Impl._ID + " ASC");
try {
final String[] cols = cursor.getColumnNames();
final int idCol = cursor.getColumnIndex(BaseColumns._ID);
while (cursor.moveToNext()) {
Log.d("dump", "Download #" + cursor.getInt(idCol) + ":");
for (int i = 0; i < cols.length; i++) {
// Omit sensitive data when dumping
if (Downloads.Impl.COLUMN_COOKIE_DATA.equals(cols[i])) {
continue;
}
Log.d("dump", cols[i] + ", " + cursor.getString(i));
}
}
} finally {
cursor.close();
}
}
示例2: setReductionStats
/**
* Sets the current statistics for viewing. These include the original total daily size of
* received resources before compression, and the actual total daily size of received
* resources after compression. The last update time is specified in milliseconds since the
* epoch.
* @param lastUpdateTimeMillis The last time the statistics were updated.
* @param networkStatsHistoryOriginal The history of original content lengths.
* @param networkStatsHistoryReceived The history of received content lengths.
*/
public void setReductionStats(
long lastUpdateTimeMillis,
NetworkStatsHistory networkStatsHistoryOriginal,
NetworkStatsHistory networkStatsHistoryReceived) {
mCurrentTime = lastUpdateTimeMillis;
mRightPosition = mCurrentTime + DateUtils.HOUR_IN_MILLIS
- TimeZone.getDefault().getOffset(mCurrentTime);
mLeftPosition = lastUpdateTimeMillis - DateUtils.DAY_IN_MILLIS * DAYS_IN_CHART;
mOriginalNetworkStatsHistory = networkStatsHistoryOriginal;
mReceivedNetworkStatsHistory = networkStatsHistoryReceived;
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:DataReductionStatsPreference.java
示例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: getOftenLoggerResetMillisecond
public long getOftenLoggerResetMillisecond() {
return getOftenLoggerReset() * DateUtils.HOUR_IN_MILLIS;
}
示例5: getTotalBoardHoursRunning
public double getTotalBoardHoursRunning(){
if ( this.durationBoardRunning > 0){
return (double)durationBoardRunning / (double) DateUtils.HOUR_IN_MILLIS;
}
return 0.00;
}
示例6: convertSecondsToHours
/**
* Converter segundos em horas
*/
public static double convertSecondsToHours(double seconds) {
return seconds > 0.00 ? (seconds * 1000.00) / DateUtils.HOUR_IN_MILLIS : 0.00;
}
示例7: updateView
private void updateView() {
if (!isAdded())
return;
final boolean showProgress;
if (blockchainState != null && blockchainState.bestChainDate != null) {
final long blockchainLag = System.currentTimeMillis() - blockchainState.bestChainDate.getTime();
final boolean blockchainUptodate = blockchainLag < BLOCKCHAIN_UPTODATE_THRESHOLD_MS;
final boolean noImpediments = blockchainState.impediments.isEmpty();
showProgress = !(blockchainUptodate || !blockchainState.replaying);
final String downloading = getString(noImpediments ? R.string.blockchain_state_progress_downloading
: R.string.blockchain_state_progress_stalled);
if (blockchainLag < 2 * DateUtils.DAY_IN_MILLIS) {
final long hours = blockchainLag / DateUtils.HOUR_IN_MILLIS;
viewProgress.setText(getString(R.string.blockchain_state_progress_hours, downloading, hours));
} else if (blockchainLag < 2 * DateUtils.WEEK_IN_MILLIS) {
final long days = blockchainLag / DateUtils.DAY_IN_MILLIS;
viewProgress.setText(getString(R.string.blockchain_state_progress_days, downloading, days));
} else if (blockchainLag < 90 * DateUtils.DAY_IN_MILLIS) {
final long weeks = blockchainLag / DateUtils.WEEK_IN_MILLIS;
viewProgress.setText(getString(R.string.blockchain_state_progress_weeks, downloading, weeks));
} else {
final long months = blockchainLag / (30 * DateUtils.DAY_IN_MILLIS);
viewProgress.setText(getString(R.string.blockchain_state_progress_months, downloading, months));
}
} else {
showProgress = false;
}
if (!showProgress) {
viewBalance.setVisibility(View.VISIBLE);
if (!showLocalBalance)
viewBalanceLocal.setVisibility(View.GONE);
if (balance != null) {
viewBalanceBtc.setVisibility(View.VISIBLE);
viewBalanceBtc.setFormat(config.getFormat());
viewBalanceBtc.setAmount(balance);
if (showLocalBalance) {
if (exchangeRate != null) {
final Fiat localValue = exchangeRate.rate.coinToFiat(balance);
viewBalanceLocal.setVisibility(View.VISIBLE);
viewBalanceLocal.setFormat(Constants.LOCAL_FORMAT.code(0,
Constants.PREFIX_ALMOST_EQUAL_TO + exchangeRate.getCurrencyCode()));
viewBalanceLocal.setAmount(localValue);
viewBalanceLocal.setTextColor(getResources().getColor(R.color.fg_less_significant));
} else {
viewBalanceLocal.setVisibility(View.INVISIBLE);
}
}
} else {
viewBalanceBtc.setVisibility(View.INVISIBLE);
}
if (balance != null && balance.isGreaterThan(TOO_MUCH_BALANCE_THRESHOLD)) {
viewBalanceWarning.setVisibility(View.VISIBLE);
viewBalanceWarning.setText(R.string.wallet_balance_fragment_too_much);
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
viewBalanceWarning.setVisibility(View.VISIBLE);
viewBalanceWarning.setText(R.string.wallet_balance_fragment_insecure_device);
} else {
viewBalanceWarning.setVisibility(View.GONE);
}
viewProgress.setVisibility(View.GONE);
} else {
viewProgress.setVisibility(View.VISIBLE);
viewBalance.setVisibility(View.INVISIBLE);
}
}
示例8: convertMillisToHours
/**
* Converter milisegundos em horas.
*
* @param millis informar os milisegundos.
* @return total em horas.
*/
public static double convertMillisToHours(double millis) {
return millis > 0.00 ? millis / DateUtils.HOUR_IN_MILLIS : 0.00;
}