本文整理汇总了Java中android.text.format.DateUtils.SECOND_IN_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.SECOND_IN_MILLIS属性的具体用法?Java DateUtils.SECOND_IN_MILLIS怎么用?Java DateUtils.SECOND_IN_MILLIS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.format.DateUtils
的用法示例。
在下文中一共展示了DateUtils.SECOND_IN_MILLIS属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserZoneMillis
/**
* 将UTC-0时区时间字符串转换成用户时区时间距离1970-01-01的毫秒数.
*
* @param strUtcTime UTC-0时区的时间字符串
* @param strInFmt 时间格式
* @return 用户时区时间距离1970-01-01的毫秒数.
* @throws ParseException 时间转换异常
*/
public static long getUserZoneMillis(final String strUtcTime,
final String strInFmt) throws ParseException {
if (StringUtils.isNull(strUtcTime)) {
throw new NullPointerException("参数strUtcTime不能为空");
} else if (StringUtils.isNull(strInFmt)) {
throw new NullPointerException("参数strInFmt不能为空");
}
long lUtcMillis = parseMillis(strUtcTime, strInFmt);
Time time = new Time();
time.setToNow();
long lOffset = time.gmtoff * DateUtils.SECOND_IN_MILLIS;
long lUserZoneMillis = lUtcMillis + lOffset;
return lUserZoneMillis;
}
示例2: minusTime
public int minusTime(DateModel strEnd) {
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Date d1 = null;
Date d2 = null;
try {
d1 = df.parse(strEnd.getShortTimeString());
d2 = df.parse(this.getShortTimeString());
} catch (Exception e) {
e.printStackTrace();
}
return (int) ((d2.getTime() - d1.getTime()) / DateUtils.SECOND_IN_MILLIS);
}
示例3: 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);
}
示例4: generateRandomPerson
public void generateRandomPerson() {
int goal = (int) (Math.random() * ElevatorViewModel.TOTAL_FLOORS);
int start = (int) (goal + Math.random() * (ElevatorViewModel.TOTAL_FLOORS - 1) + 1) % ElevatorViewModel.TOTAL_FLOORS;
final Person person = new Person(
System.currentTimeMillis() + DateUtils.SECOND_IN_MILLIS * 15,
goal, start
);
RxUtil.runInBg(() -> database.personDao().newPerson(person));
}
示例5: generateFirstPerson
public void generateFirstPerson() {
int goal = (int) (Math.random() * (ElevatorViewModel.TOTAL_FLOORS - 1)) + 1;
final Person person = new Person(
System.currentTimeMillis() + DateUtils.SECOND_IN_MILLIS * 15,
goal, 0
);
RxUtil.runInBg(() -> database.personDao().newPerson(person));
}
示例6: onStart
@Override
public void onStart() {
super.onStart();
ignoreTimeout = false;
final long delay = TIMEOUT * DateUtils.SECOND_IN_MILLIS - (System.currentTimeMillis() - Long.parseLong(preferences.getStartTime()));
Observable.timer(Math.max(delay, 0), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.compose(bindToLifecycle())
.subscribe(value -> {
if (listener != null && !ignoreTimeout) {
// listener.onTimeout(FaceNotFoundFragment.Reason.NOT_FOUND);
}
});
}
示例7: onBestShotReady
@Override
public void onBestShotReady() {
if (faceInGoodState && listener != null) {
ignoreTimeout = true;
// if liveness on, start checking it, else finish
if (preferences.getLivenessAuth()) {
Toast.makeText(getContext(), "Close the eyes please", Toast.LENGTH_SHORT).show();
photoProcessor.startCheckLiveness();
ignoreTimeoutLiveness = false;
final long delay = LIVENESS_TIMEOUT * DateUtils.SECOND_IN_MILLIS;
Observable.timer(Math.max(delay, 0), TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.compose(bindToLifecycle())
.subscribe(value -> {
if (listener != null && !ignoreTimeoutLiveness) {
// listener.onTimeout(FaceNotFoundFragment.Reason.LIVENESS);
}
});
} else {
submitBestShot();
}
} else {
photoProcessor.resumeSearch();
}
}
示例8: 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 ";
}
示例9: 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);
}
});
}
}
示例10: generateBlockId
/**
* Generate a {@link #BLOCK_ID} that will always match the requested
* {@link Blocks} details.
*
* @param startTime the block start time, in milliseconds since Epoch UTC
* @param endTime the block end time, in milliseconds since Epoch UTF
*/
public static String generateBlockId(long startTime, long endTime) {
startTime /= DateUtils.SECOND_IN_MILLIS;
endTime /= DateUtils.SECOND_IN_MILLIS;
return ParserUtils.sanitizeId(startTime + "-" + endTime);
}