X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FNewTransactionActivity.java;h=ca2407db85fc5e2967031a7581e0e3d3ddf8fd0b;hb=3d7346ab18d1050328ec030d9e1aef41a2a73d79;hp=5ab1af08b2b5a913eaec9db095add5f84e550570;hpb=7ec1c4772ff88e23ed826cc19c5a9a32e35ddf7e;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java index 5ab1af08..ca2407db 100644 --- a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java @@ -64,6 +64,13 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal setSupportActionBar(toolbar); text_date = findViewById(R.id.new_transaction_date); + text_date.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public + void onFocusChange(View v, boolean hasFocus) { + if (hasFocus) pickTransactionDate(v); + } + }); text_descr = findViewById(R.id.new_transaction_description); hook_autocompletion_adapter(text_descr, MobileLedgerDB.DESCRIPTION_HISTORY_TABLE, "description"); @@ -71,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 @@ -234,6 +234,8 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal mSave = menu.findItem(R.id.action_submit_transaction); if (mSave == null) throw new AssertionError(); + check_transaction_submittable(); + return true; }