From 42fcb92013bb28047b0fb2a81f86eea90416cb09 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 3 May 2020 15:56:38 +0300 Subject: [PATCH] =?utf8?q?Toast=20=E2=86=92=20Snackbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/ktnx/mobileledger/ui/activity/MainActivity.java | 6 +++--- .../ui/transaction_list/TransactionListFragment.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 21ed5588..bc481a6d 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -36,7 +36,6 @@ import android.view.animation.AnimationUtils; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; -import android.widget.Toast; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.widget.Toolbar; @@ -50,6 +49,7 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.snackbar.Snackbar; import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.async.DbOpQueue; @@ -597,8 +597,8 @@ public class MainActivity extends ProfileThemedActivity { TransactionListViewModel.scheduleTransactionListReload(); } else - Toast.makeText(this, error, Toast.LENGTH_LONG) - .show(); + Snackbar.make(mViewPager, error, Snackbar.LENGTH_LONG) + .show(); } public void onRetrieveStart() { ProgressBar progressBar = findViewById(R.id.transaction_list_progress_bar); diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java index 6477fe84..edd37825 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java @@ -28,13 +28,14 @@ import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.AutoCompleteTextView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.snackbar.Snackbar; + import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.ui.MobileLedgerListFragment; @@ -138,8 +139,8 @@ public class TransactionListFragment extends MobileLedgerListFragment { if (err == null) return; - Toast.makeText(mActivity, err, Toast.LENGTH_SHORT) - .show(); + Snackbar.make(this.root, err, Snackbar.LENGTH_LONG) + .show(); TransactionListViewModel.updateError.set(null); }); Data.transactions.addObserver( -- 2.39.5