]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
hide all of the "Last update" text when there was never a successful update
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index a9db652ed0e0a0f0c8932ce81a9710c9f944da76..86463aac20c22bc34d7f50ec4cec5fc00ee74541 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();
@@ -297,15 +298,17 @@ public class MainActivity extends ProfileThemedActivity {
         });
     }
     private void updateLastUpdateDisplay() {
+        LinearLayout l = findViewById(R.id.transactions_last_update_layout);
         TextView v = findViewById(R.id.transactions_last_update);
         Date date = Data.lastUpdateDate.get();
         if (date == null) {
-            v.setText(R.string.transaction_last_update_never);
+            l.setVisibility(View.INVISIBLE);
             Log.d("main", "no last update date :(");
         }
         else {
             final String text = DateFormat.getDateTimeInstance().format(date);
             v.setText(text);
+            l.setVisibility(View.VISIBLE);
             Log.d("main", String.format("Date formatted: %s", text));
         }
     }
@@ -421,6 +424,7 @@ public class MainActivity extends ProfileThemedActivity {
 //        currentFragment = transactionListFragment;
     }
     public void showAccountTransactions(LedgerAccount account) {
+        mBackMeansToAccountList = true;
         showTransactionsFragment(account);
     }
     @Override
@@ -430,10 +434,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() {