X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FNewTransactionActivity.java;h=1f259fba008d217d8a80c1f852952fad25903130;hb=ffd3fc6e70872c8fcbf41a39ba6641bfbc45a37e;hp=8ec820241caf42657295e189a385651f73a2ba77;hpb=0272b2095a6c19cd4ff779b63751c05c98459423;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 8ec82024..1f259fba 100644 --- a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java @@ -33,6 +33,7 @@ import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; +import java.util.Date; import java.util.Objects; /* @@ -74,6 +75,7 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal }); text_descr = findViewById(R.id.new_transaction_description); hook_autocompletion_adapter(text_descr, MobileLedgerDB.DESCRIPTION_HISTORY_TABLE, "description"); + hook_text_change_listener(text_descr); progress = findViewById(R.id.save_transaction_progress); @@ -108,7 +110,9 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal saver = new SaveTransactionTask(this); saver.setPref(PreferenceManager.getDefaultSharedPreferences(this)); - LedgerTransaction tr = new LedgerTransaction(text_date.getText().toString(), text_descr.getText().toString()); + String date = text_date.getText().toString(); + if (date.isEmpty()) date = String.valueOf(new Date().getDate()); + LedgerTransaction tr = new LedgerTransaction(date, text_descr.getText().toString()); TableLayout table = findViewById(R.id.new_transaction_accounts_table); for ( int i = 0; i < table.getChildCount(); i++ ) { @@ -283,6 +287,11 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal do_add_account_row(true); } + public + void resetTransactionFromMenu(MenuItem item) { + reset_form(); + } + public void saveTransactionFromMenu(MenuItem item) { save_transaction(); }