Don't show "mailbox not found" toast on "back"

* We'll only show this on a first load of the
  MessageListFragment

Bug: 5396997
Change-Id: I9a93bfd6e2c31d1ed8f75f1ec486da060712dffd
diff --git a/src/com/android/email/activity/MessageListFragment.java b/src/com/android/email/activity/MessageListFragment.java
index 1bf32ea..bffa8bb 100644
--- a/src/com/android/email/activity/MessageListFragment.java
+++ b/src/com/android/email/activity/MessageListFragment.java
@@ -165,7 +165,7 @@
         /**
          * Called when the specified mailbox does not exist.
          */
-        public void onMailboxNotFound();
+        public void onMailboxNotFound(boolean firstLoad);
 
         /**
          * Called when the user wants to open a message.
@@ -206,7 +206,7 @@
         public static final Callback INSTANCE = new EmptyCallback();
 
         @Override
-        public void onMailboxNotFound() {
+        public void onMailboxNotFound(boolean isFirstLoad) {
         }
 
         @Override
@@ -1301,7 +1301,7 @@
             mListAdapter.swapCursor(cursor);
 
             if (!cursor.mIsFound) {
-                mCallback.onMailboxNotFound();
+                mCallback.onMailboxNotFound(mIsFirstLoad);
                 return;
             }
 
diff --git a/src/com/android/email/activity/UIControllerBase.java b/src/com/android/email/activity/UIControllerBase.java
index 8e4c3a5..6f9d7cc 100644
--- a/src/com/android/email/activity/UIControllerBase.java
+++ b/src/com/android/email/activity/UIControllerBase.java
@@ -902,10 +902,14 @@
 
     // MessageListFragment.Callback
     @Override
-    public void onMailboxNotFound() {
+    public void onMailboxNotFound(boolean isFirstLoad) {
         // Something bad happened - the account or mailbox we were looking for was deleted.
         // Just restart and let the entry flow find a good default view.
-        Utility.showToast(mActivity, R.string.toast_mailbox_not_found);
+        if (isFirstLoad) {
+            // Only show this if it's the first load (e.g. a shortcut) rather an a return to
+            // a mailbox (which might be in a just-deleted account)
+            Utility.showToast(mActivity, R.string.toast_mailbox_not_found);
+        }
         long accountId = getUIAccountId();
         if (accountId != Account.NO_ACCOUNT) {
             mActivity.startActivity(Welcome.createOpenAccountInboxIntent(mActivity, accountId));