+
+ b.patternDetailsAccountAmount.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+ }
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+ }
+ @Override
+ public void afterTextChanged(Editable s) {
+ PatternDetailsItem.AccountRow accRow = getItem();
+
+ String str = String.valueOf(s);
+ if (Misc.emptyIsNull(str) == null) {
+ accRow.setAmount(null);
+ }
+ else {
+ try {
+ final float amount = Data.parseNumber(str);
+ accRow.setAmount(amount);
+ b.patternDetailsAccountAmountLayout.setError(null);
+
+ Logger.debug(D_PATTERN_UI, String.format(Locale.US,
+ "Storing changed account amount %s [%4.2f]; accRow=%s", s,
+ amount, accRow));
+ }
+ catch (NumberFormatException | ParseException e) {
+ b.patternDetailsAccountAmountLayout.setError("!");
+ }
+ }
+ }
+ });
+ b.patternDetailsAccountAmount.setOnFocusChangeListener((v, hasFocus) -> {
+ if (hasFocus)
+ return;
+
+ PatternDetailsItem.AccountRow accRow = getItem();
+ if (!accRow.hasLiteralAmount())
+ return;
+ Float amt = accRow.getAmount();
+ if (amt == null)
+ return;
+
+ b.patternDetailsAccountAmount.setText(Data.formatNumber(amt));
+ });