class NewTransactionItemHolder extends RecyclerView.ViewHolder
implements DatePickerFragment.DatePickedListener, DescriptionSelectedCallback {
- private final String decimalDot;
+ private final String decimalDot = ".";
private final MobileLedgerProfile mProfile;
private final NewTransactionRowBinding b;
private final NewTransactionItemsAdapter mAdapter;
mProfile = Data.getProfile();
- View.OnFocusChangeListener focusMonitor = (v, hasFocus) -> {
+ @SuppressLint("DefaultLocale") View.OnFocusChangeListener focusMonitor = (v, hasFocus) -> {
final int id = v.getId();
if (hasFocus) {
boolean wasSyncing = syncingData;
syncingData = wasSyncing;
}
}
+ else { // lost focus
+ if (id == R.id.account_row_acc_amounts) {
+ try {
+ String input = String.valueOf(b.accountRowAccAmounts.getText());
+ input = input.replace(decimalSeparator, decimalDot);
+ b.accountRowAccAmounts.setText(
+ String.format("%4.2f", Float.parseFloat(input)));
+ }
+ catch (NumberFormatException ex) {
+ // ignored
+ }
+ }
+ }
if (id == R.id.comment) {
commentFocusChanged(b.comment, hasFocus);
DecimalFormatSymbols.getInstance(locale)
.getMonetaryDecimalSeparator()));
- decimalDot = ".";
-
final TextWatcher tw = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {