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


Java Monetary类代码示例

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


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


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