]> git.ktnx.net Git - mobile-ledger.git/commitdiff
template details: ensure single empty account when account data is changed
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 8 Feb 2021 06:07:24 +0000 (06:07 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Feb 2021 07:37:28 +0000 (07:37 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsAdapter.java

index 4ec4a39b23312ad7fe2fe9ac25dd3f4eb604e836..fbaed1ceaafa876b7d227e46bea5d372e6d82590 100644 (file)
@@ -622,6 +622,8 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter<TemplateDetailsAdapter
                     Logger.debug(D_TEMPLATE_UI,
                             "Storing changed account name " + s + "; accRow=" + accRow);
                     accRow.setAccountName(String.valueOf(s));
+
+                    mModel.applyList(null);
                 }
             };
             b.templateDetailsAccountName.addTextChangedListener(accountNameWatcher);
@@ -644,6 +646,8 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter<TemplateDetailsAdapter
                     Logger.debug(D_TEMPLATE_UI,
                             "Storing changed account comment " + s + "; accRow=" + accRow);
                     accRow.setAccountComment(String.valueOf(s));
+
+                    mModel.applyList(null);
                 }
             };
             b.templateDetailsAccountComment.addTextChangedListener(accountCommentWatcher);
@@ -651,11 +655,9 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter<TemplateDetailsAdapter
             b.templateDetailsAccountAmount.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) {
@@ -682,6 +684,8 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter<TemplateDetailsAdapter
                             b.templateDetailsAccountAmountLayout.setError("!");
                         }
                     }
+
+                    mModel.applyList(null);
                 }
             });
             b.templateDetailsAccountAmount.setOnFocusChangeListener((v, hasFocus) -> {