當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。