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
This commit is contained in:
parent
dbd2aeda76
commit
d9cdd88702
@ -165,7 +165,7 @@ public class MessageListFragment extends ListFragment
|
||||
/**
|
||||
* 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 class MessageListFragment extends ListFragment
|
||||
public static final Callback INSTANCE = new EmptyCallback();
|
||||
|
||||
@Override
|
||||
public void onMailboxNotFound() {
|
||||
public void onMailboxNotFound(boolean isFirstLoad) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1301,7 +1301,7 @@ public class MessageListFragment extends ListFragment
|
||||
mListAdapter.swapCursor(cursor);
|
||||
|
||||
if (!cursor.mIsFound) {
|
||||
mCallback.onMailboxNotFound();
|
||||
mCallback.onMailboxNotFound(mIsFirstLoad);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -902,10 +902,14 @@ abstract class UIControllerBase implements MailboxListFragment.Callback,
|
||||
|
||||
// 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));
|
||||
|
Loading…
Reference in New Issue
Block a user