• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Monetary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bitcoinj.core.Monetary的典型用法代码示例。如果您正苦于以下问题:Java Monetary类的具体用法?Java Monetary怎么用?Java Monetary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: isValidAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
private boolean isValidAmount(final boolean zeroIsValid) {
    final String str = textView.getText().toString().trim();

    try {
        if (!str.isEmpty()) {
            final Monetary amount;
            if (localCurrencyCode == null) {
                amount = inputFormat.parse(str);
                if (((Coin) amount).isGreaterThan(Constants.NETWORK_PARAMETERS.getMaxMoney()))
                    return false;
            } else {
                amount = inputFormat.parseFiat(localCurrencyCode, str);
            }

            // exactly zero
            return zeroIsValid || amount.signum() > 0;
        }
    } catch (final Exception x) {
    }

    return false;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:23,代码来源:CurrencyAmountView.java


示例2: isValidAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
private boolean isValidAmount(final boolean zeroIsValid)
{
    final String str = textView.getText().toString().trim();

    try
    {
        if (!str.isEmpty())
        {
            final Monetary amount;
            if (localCurrencyCode == null)
                amount = inputFormat.parse(str);
            else
                amount = inputFormat.parseFiat(localCurrencyCode, str);

            // exactly zero
            return zeroIsValid || amount.signum() > 0;
        }
    }
    catch (final Exception x)
    {
    }

    return false;
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:25,代码来源:CurrencyAmountView.java


示例3: getAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Nullable
public Monetary getAmount() {
    if (!isValidAmount(false))
        return null;

    final String amountStr = textView.getText().toString().trim();
    if (localCurrencyCode == null)
        return inputFormat.parse(amountStr);
    else
        return inputFormat.parseFiat(localCurrencyCode, amountStr);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:12,代码来源:CurrencyAmountView.java


示例4: setAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public void setAmount(@Nullable final Monetary amount, final boolean fireListener) {
    if (!fireListener)
        textViewListener.setFire(false);

    if (amount != null)
        textView.setText(new MonetarySpannable(inputFormat, amountSigned, amount));
    else
        textView.setText(null);

    if (!fireListener)
        textViewListener.setFire(true);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:13,代码来源:CurrencyAmountView.java


示例5: onRestoreInstanceState

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Override
protected void onRestoreInstanceState(final Parcelable state) {
    if (state instanceof Bundle) {
        final Bundle bundle = (Bundle) state;
        super.onRestoreInstanceState(bundle.getParcelable("super_state"));
        textView.onRestoreInstanceState(bundle.getParcelable("child_textview"));
        setAmount((Monetary) bundle.getSerializable("amount"), false);
    } else {
        super.onRestoreInstanceState(state);
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:12,代码来源:CurrencyAmountView.java


示例6: onFocusChange

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Override
public void onFocusChange(final View v, final boolean hasFocus) {
    if (!hasFocus) {
        final Monetary amount = getAmount();
        if (amount != null)
            setAmount(amount, false);
    }

    if (listener != null && fire)
        listener.focusChanged(hasFocus);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:12,代码来源:CurrencyAmountView.java


示例7: getAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Nullable
public Monetary getAmount()
{
    if (!isValidAmount(false))
        return null;

    final String amountStr = textView.getText().toString().trim();
    if (localCurrencyCode == null)
        return inputFormat.parse(amountStr);
    else
        return inputFormat.parseFiat(localCurrencyCode, amountStr);
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:13,代码来源:CurrencyAmountView.java


示例8: setAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public void setAmount(@Nullable final Monetary amount, final boolean fireListener)
{
    if (!fireListener)
        textViewListener.setFire(false);

    if (amount != null)
        textView.setText(new MonetarySpannable(inputFormat, amountSigned, amount));
    else
        textView.setText(null);

    if (!fireListener)
        textViewListener.setFire(true);
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:14,代码来源:CurrencyAmountView.java


示例9: onRestoreInstanceState

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Override
protected void onRestoreInstanceState(final Parcelable state)
{
    if (state instanceof Bundle)
    {
        final Bundle bundle = (Bundle) state;
        super.onRestoreInstanceState(bundle.getParcelable("super_state"));
        textView.onRestoreInstanceState(bundle.getParcelable("child_textview"));
        setAmount((Monetary) bundle.getSerializable("amount"), false);
    }
    else
    {
        super.onRestoreInstanceState(state);
    }
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:16,代码来源:CurrencyAmountView.java


示例10: onFocusChange

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Override
public void onFocusChange(final View v, final boolean hasFocus)
{
    if (!hasFocus)
    {
        final Monetary amount = getAmount();
        if (amount != null)
            setAmount(amount, false);
    }

    if (listener != null && fire)
        listener.focusChanged(hasFocus);
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:14,代码来源:CurrencyAmountView.java


示例11: equals

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
@Override
public boolean equals(final Object o) {
    if (o == this)
        return true;
    if (o == null || o.getClass() != getClass())
        return false;
    final Monetary otherMonetary = ((MonetaryWrapper) o).getMonetary();
    return monetary.getValue() == otherMonetary.getValue();
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:10,代码来源:MonetaryWrapper.java


示例12: getAmountByVolume

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public Coin getAmountByVolume(Volume volume) {
    Monetary monetary = volume.getMonetary();
    if (monetary instanceof Fiat && this.monetary instanceof Fiat)
        return new ExchangeRate((Fiat) this.monetary).fiatToCoin((Fiat) monetary);
    else if (monetary instanceof Altcoin && this.monetary instanceof Altcoin)
        return new AltcoinExchangeRate((Altcoin) this.monetary).altcoinToCoin((Altcoin) monetary);
    else
        return Coin.ZERO;
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:10,代码来源:Price.java


示例13: formatVolume

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public String formatVolume(Volume volume, MonetaryFormat fiatVolumeFormat, boolean appendCurrencyCode) {
    if (volume != null) {
        Monetary monetary = volume.getMonetary();
        if (monetary instanceof Fiat)
            return formatFiat((Fiat) monetary, fiatVolumeFormat, appendCurrencyCode);
        else
            return formatAltcoinVolume((Altcoin) monetary, appendCurrencyCode);
    } else {
        return "";
    }
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:12,代码来源:BSFormatter.java


示例14: formatPrice

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public String formatPrice(Price price, MonetaryFormat fiatPriceFormat, boolean appendCurrencyCode) {
    if (price != null) {
        Monetary monetary = price.getMonetary();
        if (monetary instanceof Fiat)
            return formatFiat((Fiat) monetary, fiatPriceFormat, appendCurrencyCode);
        else
            return formatAltcoin((Altcoin) monetary, appendCurrencyCode);
    } else {
        return Res.get("shared.na");
    }
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:12,代码来源:BSFormatter.java


示例15: formatPriceWithCode

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public String formatPriceWithCode(Price price) {
    Monetary monetary = price.getMonetary();
    if (monetary instanceof Fiat)
        return formatFiat((Fiat) monetary, fiatPriceFormat, true);
    else {
        return formatAltcoinWithCode((Altcoin) monetary);
    }
    //return formatPrice(fiat) + " " + getCurrencyPair(fiat.getCurrencyCode());
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:10,代码来源:BSFormatter.java


示例16: setAmount

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public void setAmount(final Monetary amount) {
    this.amount = amount;
    updateView();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:5,代码来源:CurrencyTextView.java


示例17: setHint

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public void setHint(@Nullable final Monetary hint) {
    this.hint = hint;
    updateAppearance();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:5,代码来源:CurrencyAmountView.java


示例18: MonetarySpannable

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public MonetarySpannable(final MonetaryFormat format, final boolean signed, @Nullable final Monetary monetary) {
    super(format(format, signed, monetary));
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:4,代码来源:MonetarySpannable.java


示例19: MonetarySpannable

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
public MonetarySpannable(final MonetaryFormat format, final boolean signed, @Nullable final Monetary value) {
    super(format(format, signed, value));
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:4,代码来源:MonetarySpannable.java


示例20: format

import org.bitcoinj.core.Monetary; //导入依赖的package包/类
/**
 * Format the given monetary value to a human readable form.
 */
public CharSequence format(Monetary monetary) {
    return format(monetary, monetary.smallestUnitExponent());
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:7,代码来源:MonetaryFormat.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OriginalType类代码示例发布时间:2022-05-22
下一篇:
Java HttpMethodConstraintElement类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap