+ public void new_transaction_save_clicked(View view) {
+ fab.setEnabled(false);
+
+ saver = new SaveTransactionTask(this);
+
+ saver.setPref(PreferenceManager.getDefaultSharedPreferences(this));
+ LedgerTransaction tr = new LedgerTransaction(text_date.getText().toString(), text_descr.getText().toString());
+
+ TableLayout table = findViewById(R.id.new_transaction_accounts_table);
+ for ( int i = 0; i < table.getChildCount(); i++ ) {
+ TableRow row = (TableRow) table.getChildAt(i);
+ String acc = ((TextView) row.getChildAt(0)).getText().toString();
+ String amt = ((TextView) row.getChildAt(1)).getText().toString();
+ LedgerTransactionItem item =
+ amt.length() > 0
+ ? new LedgerTransactionItem( acc, Float.parseFloat(amt))
+ : new LedgerTransactionItem( acc );
+
+ tr.add_item(item);
+ }
+ saver.execute(tr);
+ }