From: Damyan Ivanov Date: Thu, 28 Mar 2019 18:18:23 +0000 (+0200) Subject: after showing account's transactions, make Back return to the account list X-Git-Tag: v0.9~54 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=20aa0282e0bee8ba789de85bfe7a2184c3342e79;p=mobile-ledger.git after showing account's transactions, make Back return to the account list --- 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() {