]> git.ktnx.net Git - mobile-ledger.git/commitdiff
new transaction: remove the xml-driven rows and populate by hand
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 12:52:32 +0000 (12:52 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 12:52:32 +0000 (12:52 +0000)
the by-hand method is used on demand anyway and should work and set all
the propertied of the rows/fields

the xml-driven stuff is still useful during development for figuring out
what is the purpose of each property

app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java

index 70b5632136f7cfbaa9939cea81b5e66f6925f791..ca2407db85fc5e2967031a7581e0e3d3ddf8fd0b 100644 (file)
@@ -78,16 +78,9 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal
 
         Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
         table = findViewById(R.id.new_transaction_accounts_table);
-        for (int i = 0; i < table.getChildCount(); i++) {
-            TableRow row = (TableRow) table.getChildAt(i);
-            AutoCompleteTextView acc_name_view = (AutoCompleteTextView) row.getChildAt(0);
-            TextView amount_view = (TextView) row.getChildAt(1);
-            hook_swipe_listener(row);
-            hook_autocompletion_adapter(acc_name_view, MobileLedgerDB.ACCOUNTS_TABLE, "name");
-            hook_text_change_listener(acc_name_view);
-            hook_text_change_listener(amount_view);
-//            Log.d("swipe", "hooked to row "+i);
-        }
+        table.removeAllViews();
+        do_add_account_row(false);
+        do_add_account_row(false);
     }
 
     @Override