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]);
}
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();
}
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());
}
}
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);
}
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);
}
Aggregations