From 20aa0282e0bee8ba789de85bfe7a2184c3342e79 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 28 Mar 2019 20:18:23 +0200 Subject: [PATCH] after showing account's transactions, make Back return to the account list --- .../mobileledger/ui/activity/MainActivity.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 a9db652e..dcf653fd 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 @@ -95,6 +95,7 @@ public class MainActivity extends ProfileThemedActivity { private ProfilesRecyclerViewAdapter mProfileListAdapter; private int mCurrentPage; private String mAccountFilter; + private boolean mBackMeansToAccountList = false; @Override protected void onStart() { super.onStart(); @@ -421,6 +422,7 @@ public class MainActivity extends ProfileThemedActivity { // currentFragment = transactionListFragment; } public void showAccountTransactions(LedgerAccount account) { + mBackMeansToAccountList = true; showTransactionsFragment(account); } @Override @@ -430,10 +432,16 @@ public class MainActivity extends ProfileThemedActivity { drawer.closeDrawer(GravityCompat.START); } else { - Log.d("fragments", - String.format("manager stack: %d", fragmentManager.getBackStackEntryCount())); + if (mBackMeansToAccountList && (mViewPager.getCurrentItem() == 1)) { + TransactionListFragment.accountFilter.set(null); + showAccountSummaryFragment(); + mBackMeansToAccountList = false; + } + else { + Log.d("fragments", String.format("manager stack: %d", fragmentManager.getBackStackEntryCount())); - super.onBackPressed(); + super.onBackPressed(); + } } } public void updateLastUpdateTextFromDB() { -- 2.39.5