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


Java DateUtils.WEEK_IN_MILLIS属性代码示例

本文整理汇总了Java中android.text.format.DateUtils.WEEK_IN_MILLIS属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.WEEK_IN_MILLIS属性的具体用法?Java DateUtils.WEEK_IN_MILLIS怎么用?Java DateUtils.WEEK_IN_MILLIS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.text.format.DateUtils的用法示例。


在下文中一共展示了DateUtils.WEEK_IN_MILLIS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFolderStatus

private String buildFolderStatus(FolderInfoHolder folder) {
    String folderStatus;
    if (folder.loading) {
        folderStatus = getString(R.string.status_loading);
    } else if (folder.status != null) {
        folderStatus = folder.status;
    } else if (folder.lastChecked != 0) {
        long now = System.currentTimeMillis();
        int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR;
        CharSequence formattedDate;

        if (Math.abs(now - folder.lastChecked) > DateUtils.WEEK_IN_MILLIS) {
            formattedDate = getString(R.string.preposition_for_date,
                    DateUtils.formatDateTime(context, folder.lastChecked, flags));
        } else {
            formattedDate = DateUtils.getRelativeTimeSpanString(folder.lastChecked,
                    now, DateUtils.MINUTE_IN_MILLIS, flags);
        }

        folderStatus = getString(folder.pushActive
                        ? R.string.last_refresh_time_format_with_push
                        : R.string.last_refresh_time_format,
                formattedDate);
    } else {
        folderStatus = null;
    }
    return folderStatus;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:28,代码来源:FolderList.java

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


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