]> git.ktnx.net Git - mobile-ledger.git/commitdiff
after showing account's transactions, make Back return to the account list
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 18:18:23 +0000 (20:18 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 18:28:55 +0000 (20:28 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index a9db652ed0e0a0f0c8932ce81a9710c9f944da76..dcf653fd4fc761ada654ba852181f5b9d8308d29 100644 (file)
@@ -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() {