当前位置: 首页>>代码示例>>Java>>正文


Java DateUtils.SECOND_IN_MILLIS属性代码示例

本文整理汇总了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;
}
 
开发者ID:zhou-you,项目名称:RxEasyHttp,代码行数:22,代码来源:DateTimeUtils.java

示例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);

}
 
开发者ID:socoolby,项目名称:CoolClock,代码行数:13,代码来源:DateModel.java

示例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);
}
 
开发者ID:lijunyandev,项目名称:MeetMusic,代码行数:7,代码来源:PlayActivity.java

示例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));
}
 
开发者ID:willowtreeapps,项目名称:elevator-room,代码行数:9,代码来源:LobbyViewModel.java

示例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));
}
 
开发者ID:willowtreeapps,项目名称:elevator-room,代码行数:8,代码来源:ElevatorViewModel.java

示例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);
                    }
                });
    }
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:14,代码来源:PhotoFragment.java

示例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();
        }
    }
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:29,代码来源:PhotoFragment.java

示例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 ";
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:14,代码来源:XulSystemUtil.java

示例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);
            }
        });
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:56,代码来源:BlockListAdapter.java

示例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);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:12,代码来源:ScheduleContract.java


注:本文中的android.text.format.DateUtils.SECOND_IN_MILLIS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。