Search in sources :

Example 91 with NumberFormat

use of java.text.NumberFormat in project AdMoney by ErnestoGonAr.

the class CustomAdapter_Prestamos method onBindViewHolder.

// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
    Double monto = Double.parseDouble(mDataSet[position][0]);
    NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.getDefault());
    viewHolder.cantidad.setText(nf.format(monto));
    viewHolder.nombre.setText(mDataSet[position][1]);
    viewHolder.fecha.setText(mDataSet[position][2]);
}
Also used : NumberFormat(java.text.NumberFormat)

Example 92 with NumberFormat

use of java.text.NumberFormat in project pcgen by PCGen.

the class Movement method toString.

/**
	 * Provides a String representation of this Movement object, suitable for
	 * display to a user.
	 * @return String
	 */
@Override
public String toString() {
    final StringBuilder movelabel = new StringBuilder();
    if (movementTypes.length > 0) {
        movelabel.append(movementTypes[0]);
        NumberFormat numFmt = NumberFormat.getNumberInstance();
        movelabel.append(' ').append(numFmt.format(Globals.getGameModeUnitSet().convertDistanceToUnitSet(movements[0])));
        movelabel.append(Globals.getGameModeUnitSet().getDistanceUnit());
        if (movementMult[0] != 0) {
            movelabel.append('(').append(movementMultOp[0]).append(numFmt.format(movementMult[0])).append(')');
        }
        for (int i = 1; i < movementTypes.length; ++i) {
            movelabel.append(", ");
            movelabel.append(movementTypes[i]);
            movelabel.append(' ').append(numFmt.format(Globals.getGameModeUnitSet().convertDistanceToUnitSet(movements[i])));
            movelabel.append(Globals.getGameModeUnitSet().getDistanceUnit());
            if (movementMult[i] != 0) {
                movelabel.append('(').append(movementMultOp[i]).append(numFmt.format(movementMult[i])).append(')');
            }
        }
    }
    return movelabel.toString();
}
Also used : NumberFormat(java.text.NumberFormat)

Example 93 with NumberFormat

use of java.text.NumberFormat in project pcgen by PCGen.

the class EquipSetMigration method renumberChildren.

/**
	 * Renumber the equipment sets in order with a potential new parent path 
	 * also. This is a recursive function.
	 * 
	 * @param targets The ordered list of equipment sets to be renumbered.
	 * @param allEquipSets The collection of all of the character's equipment sets.
	 * @param newParentPath The new path of the parent.
	 */
private static void renumberChildren(List<EquipSet> targets, Collection<EquipSet> allEquipSets, String newParentPath) {
    if (targets.isEmpty()) {
        return;
    }
    int index = 1;
    NumberFormat format = new DecimalFormat("00");
    for (EquipSet equipSet : targets) {
        String oldIdPath = equipSet.getIdPath();
        equipSet.setIdPath(newParentPath + "." + format.format(index++));
        List<EquipSet> children = getSortedChildren(allEquipSets, oldIdPath);
        renumberChildren(children, allEquipSets, equipSet.getIdPath());
    }
}
Also used : EquipSet(pcgen.core.character.EquipSet) DecimalFormat(java.text.DecimalFormat) NumberFormat(java.text.NumberFormat)

Example 94 with NumberFormat

use of java.text.NumberFormat in project android_frameworks_base by ResurrectionRemix.

the class StatusBarIconView method placeNumber.

void placeNumber() {
    final String str;
    final int tooBig = getContext().getResources().getInteger(android.R.integer.status_bar_notification_info_maxnum);
    if (mIcon.number > tooBig) {
        str = getContext().getResources().getString(R.string.status_bar_notification_info_overflow);
    } else {
        NumberFormat f = NumberFormat.getIntegerInstance();
        str = f.format(mIcon.number);
    }
    mNumberText = str;
    final int w = getWidth();
    final int h = getHeight();
    final Rect r = new Rect();
    mNumberPaint.getTextBounds(str, 0, str.length(), r);
    final int tw = r.right - r.left;
    final int th = r.bottom - r.top;
    mNumberBackground.getPadding(r);
    int dw = r.left + tw + r.right;
    if (dw < mNumberBackground.getMinimumWidth()) {
        dw = mNumberBackground.getMinimumWidth();
    }
    mNumberX = w - r.right - ((dw - r.right - r.left) / 2);
    int dh = r.top + th + r.bottom;
    if (dh < mNumberBackground.getMinimumWidth()) {
        dh = mNumberBackground.getMinimumWidth();
    }
    mNumberY = h - r.bottom - ((dh - r.top - th - r.bottom) / 2);
    mNumberBackground.setBounds(w - dw, h - dh, w, h);
}
Also used : Rect(android.graphics.Rect) Paint(android.graphics.Paint) NumberFormat(java.text.NumberFormat)

Example 95 with NumberFormat

use of java.text.NumberFormat in project android_frameworks_base by ResurrectionRemix.

the class BugreportReceiverTest method testProgress_cancel.

public void testProgress_cancel() throws Exception {
    resetProperties();
    sendBugreportStarted(1000);
    waitForScreenshotButtonEnabled(true);
    final NumberFormat nf = NumberFormat.getPercentInstance();
    nf.setMinimumFractionDigits(2);
    nf.setMaximumFractionDigits(2);
    assertProgressNotification(NAME, 00.00f);
    openProgressNotification(ID);
    UiObject cancelButton = mUiBot.getVisibleObject(mContext.getString(com.android.internal.R.string.cancel).toUpperCase());
    mUiBot.click(cancelButton, "cancel_button");
    waitForService(false);
}
Also used : UiObject(android.support.test.uiautomator.UiObject) NumberFormat(java.text.NumberFormat)

Aggregations

NumberFormat (java.text.NumberFormat)471 DecimalFormat (java.text.DecimalFormat)92 ArrayList (java.util.ArrayList)24 HashMap (java.util.HashMap)24 BigDecimal (java.math.BigDecimal)23 Locale (java.util.Locale)22 Map (java.util.Map)18 Test (org.junit.Test)17 ParseException (java.text.ParseException)16 DecimalFormatSymbols (java.text.DecimalFormatSymbols)14 JFreeChart (org.jfree.chart.JFreeChart)13 IOException (java.io.IOException)12 ParsePosition (java.text.ParsePosition)12 XYSeries (org.jfree.data.xy.XYSeries)11 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)11 Intent (android.content.Intent)10 PrintWriter (java.io.PrintWriter)9 View (android.view.View)8 TextView (android.widget.TextView)8 Currency (java.util.Currency)8