From 132e5d323968313494ca3052d60fd0a08757248e Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 5 Dec 2018 20:39:22 +0000 Subject: [PATCH] progress bar around the save transaction floating action button --- .../mobileledger/NewTransactionActivity.java | 6 +++ .../res/layout/activity_new_transaction.xml | 40 ++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java index 7fc8bcc8..7648a65f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java @@ -23,6 +23,7 @@ import android.view.View; import android.widget.AutoCompleteTextView; import android.widget.EditText; import android.widget.FilterQueryProvider; +import android.widget.ProgressBar; import android.widget.SimpleCursorAdapter; import android.widget.TableLayout; import android.widget.TableRow; @@ -50,6 +51,7 @@ import java.util.Objects; public class NewTransactionActivity extends AppCompatActivity implements TaskCallback { private TableLayout table; private FloatingActionButton fab; + private ProgressBar progress; private TextView text_date; private TextView text_descr; private static SaveTransactionTask saver; @@ -75,6 +77,8 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal new_transaction_save_clicked(view); } }); + progress = findViewById(R.id.save_transaction_progress); + Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); table = findViewById(R.id.new_transaction_accounts_table); for (int i = 0; i < table.getChildCount(); i++) { @@ -86,6 +90,7 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal public void new_transaction_save_clicked(View view) { fab.setEnabled(false); + progress.setVisibility(View.VISIBLE); saver = new SaveTransactionTask(this); @@ -218,6 +223,7 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal @Override public void done() { fab.setEnabled(true); + progress.setVisibility(View.INVISIBLE); reset_form(); } diff --git a/app/src/main/res/layout/activity_new_transaction.xml b/app/src/main/res/layout/activity_new_transaction.xml index 4b166867..75876a43 100644 --- a/app/src/main/res/layout/activity_new_transaction.xml +++ b/app/src/main/res/layout/activity_new_transaction.xml @@ -22,15 +22,35 @@ - + + + + + + + \ No newline at end of file -- 2.39.5