Changes for NO_XXX

- Added Message.NO_MESSAGE
- Renamed PSEUDO_ACCOUNT_ID_NONE to NO_ACCOUNT
- Removed PARENT_KEY_NONE and use NO_MAILBOX instead
- For starters, cleaned up the UI controllers to use them.

Change-Id: I6cfd87ece2fced8e9f7c76d034c4d1dbf9e4db10
This commit is contained in:
Makoto Onuki 2011-05-17 10:50:30 -07:00
parent e211b1a32a
commit b36ac01792
11 changed files with 80 additions and 76 deletions

View File

@ -724,6 +724,9 @@ public abstract class EmailContent {
public static final int FLAG_REPLIED_TO = 1 << 18;
public static final int FLAG_FORWARDED = 1 << 19;
/** a pseudo ID for "no message". */
public static final long NO_MESSAGE = -1L;
public Message() {
mBaseUri = CONTENT_URI;
}
@ -1035,7 +1038,7 @@ public abstract class EmailContent {
*
* <em>IMPORTANT</em>: This must never be stored to the database.
*/
public static final long PSEUDO_ACCOUNT_ID_NONE = -1L;
public static final long NO_ACCOUNT = -1L;
// Whether or not the user has asked for notifications of new mail in this account
public final static int FLAGS_NOTIFY_NEW_MAIL = 1<<0;

View File

@ -126,8 +126,7 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns
// Push-Hold indicates an EAS push or ping Mailbox shouldn't sync just yet
public static final int CHECK_INTERVAL_PUSH_HOLD = -4;
// Sentinels for PARENT_KEY
public static final long PARENT_KEY_NONE = -1L;
// Sentinel for PARENT_KEY. Use NO_MAILBOX for toplevel mailboxes (i.e. no parents).
public static final long PARENT_KEY_UNINITIALIZED = 0L;
private static final String WHERE_TYPE_AND_ACCOUNT_KEY =

View File

@ -91,11 +91,11 @@ public class NotificationController {
private final HashMap<Long, MessageData> mNotificationMap;
private ContentObserver mAccountObserver;
/**
* Suspend notifications for this account. If {@link Account#PSEUDO_ACCOUNT_ID_NONE}, no
* Suspend notifications for this account. If {@link Account#NO_ACCOUNT}, no
* account notifications are suspended. If {@link Account#ACCOUNT_ID_COMBINED_VIEW},
* notifications for all accounts are suspended.
*/
private long mSuspendAccountId = Account.PSEUDO_ACCOUNT_ID_NONE;
private long mSuspendAccountId = Account.NO_ACCOUNT;
/** Constructor */
@VisibleForTesting
@ -244,11 +244,11 @@ public class NotificationController {
* suspended. If {@code suspend} is {@code false}, the account ID is ignored.
*/
public void suspendMessageNotification(boolean suspend, long accountId) {
if (mSuspendAccountId != Account.PSEUDO_ACCOUNT_ID_NONE) {
if (mSuspendAccountId != Account.NO_ACCOUNT) {
// we're already suspending an account; un-suspend it
mSuspendAccountId = Account.PSEUDO_ACCOUNT_ID_NONE;
mSuspendAccountId = Account.NO_ACCOUNT;
}
if (suspend && accountId != Account.PSEUDO_ACCOUNT_ID_NONE && accountId > 0L) {
if (suspend && accountId != Account.NO_ACCOUNT && accountId > 0L) {
mSuspendAccountId = accountId;
if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) {
// Only go onto the notification handler if we really, absolutely need to

View File

@ -55,7 +55,7 @@ public final class ActivityHelper {
* @param url URL to open
* @param senderAccountId if the URL is mailto:, we use this account as the sender.
* TODO When MessageCompose implements the account selector, this won't be necessary.
* Pass {@link Account#PSEUDO_ACCOUNT_ID_NONE} to use the default account.
* Pass {@link Account#NO_ACCOUNT} to use the default account.
* @return true if the URI has successfully been opened.
*/
public static boolean openUrlInMessage(Activity activity, String url, long senderAccountId) {

View File

@ -221,7 +221,7 @@ import android.widget.TextView;
MailboxFragmentLoader(Context context, long accountId, long parentKey) {
super(context, Mailbox.CONTENT_URI,
(parentKey != Mailbox.PARENT_KEY_NONE)
(parentKey != Mailbox.NO_MAILBOX)
? MailboxesAdapter.SUBMAILBOX_PROJECTION
: MailboxesAdapter.PROJECTION,
MAILBOX_SELECTION_WITH_PARENT,
@ -244,7 +244,7 @@ import android.widget.TextView;
final Cursor childMailboxCursor = super.loadInBackground();
// If we're not showing the top level mailboxes, add the "parent" mailbox.
if (mParentKey != Mailbox.PARENT_KEY_NONE) {
if (mParentKey != Mailbox.NO_MAILBOX) {
final Cursor parentCursor = getContext().getContentResolver().query(
Mailbox.CONTENT_URI, CURMAILBOX_PROJECTION, MAILBOX_SELECTION,
new String[] { Long.toString(mAccountId), Long.toString(mParentKey) },

View File

@ -216,7 +216,7 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList
* to open the root.
*/
public static MailboxListFragment newInstance(long accountId, long parentMailboxId) {
if (accountId == Account.PSEUDO_ACCOUNT_ID_NONE) {
if (accountId == Account.NO_ACCOUNT) {
throw new IllegalArgumentException();
}
final MailboxListFragment instance = new MailboxListFragment();

View File

@ -124,7 +124,7 @@ public class MessageFileView extends Activity implements MessageViewFragmentBase
@Override
public boolean onUrlInMessageClicked(String url) {
// EML files don't have the "owner" account, so use the default account as the sender.
return ActivityHelper.openUrlInMessage(this, url, Account.PSEUDO_ACCOUNT_ID_NONE);
return ActivityHelper.openUrlInMessage(this, url, Account.NO_ACCOUNT);
}
@Override

View File

@ -247,7 +247,7 @@ public class MessageListFragment extends ListFragment
*/
public static MessageListFragment newInstance(long accountId, long mailboxId) {
// sanity check
if ((accountId == Account.PSEUDO_ACCOUNT_ID_NONE) || (mailboxId == Mailbox.NO_MAILBOX)) {
if ((accountId == Account.NO_ACCOUNT) || (mailboxId == Mailbox.NO_MAILBOX)) {
throw new IllegalArgumentException();
}
if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) {

View File

@ -22,6 +22,8 @@ import com.android.email.RefreshManager;
import com.android.email.activity.setup.AccountSettings;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.EmailContent.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.EmailAsyncTask;
import android.app.Fragment;
@ -48,13 +50,6 @@ abstract class UIControllerBase {
protected static final String BUNDLE_KEY_MAILBOX_ID = "UIController.state.mailbox_id";
protected static final String BUNDLE_KEY_MESSAGE_ID = "UIController.state.message_id";
/** No account selected */
static final long NO_ACCOUNT = Account.PSEUDO_ACCOUNT_ID_NONE;
/** No mailbox selected */
static final long NO_MAILBOX = -1;
/** No message selected */
static final long NO_MESSAGE = -1;
/** The owner activity */
final EmailActivity mActivity;
@ -268,7 +263,7 @@ abstract class UIControllerBase {
* @return true if an account is selected, or the current view is the combined view.
*/
public final boolean isAccountSelected() {
return getUIAccountId() != NO_ACCOUNT;
return getUIAccountId() != Account.NO_ACCOUNT;
}
/**
@ -281,19 +276,19 @@ abstract class UIControllerBase {
/**
* @return the currently selected account ID. If the current view is the combined view,
* it'll return {@link #NO_ACCOUNT}.
* it'll return {@link Account#NO_ACCOUNT}.
*
* @see #getUIAccountId()
*/
public final long getActualAccountId() {
return isActualAccountSelected() ? getUIAccountId() : NO_ACCOUNT;
return isActualAccountSelected() ? getUIAccountId() : Account.NO_ACCOUNT;
}
/**
* Show the default view for the given account.
*
* @param accountId ID of the account to load. Can be {@link Account#ACCOUNT_ID_COMBINED_VIEW}.
* Must never be {@link #NO_ACCOUNT}.
* Must never be {@link Account#NO_ACCOUNT}.
*/
public abstract void openAccount(long accountId);
@ -302,9 +297,11 @@ abstract class UIControllerBase {
* a particular view at a request from outside of the activity, such as the widget.
*
* @param accountId ID of the account to load. Can be {@link Account#ACCOUNT_ID_COMBINED_VIEW}.
* Must never be {@link #NO_ACCOUNT}.
* @param mailboxId ID of the mailbox to load. If {@link #NO_MAILBOX}, load the account's inbox.
* @param messageId ID of the message to load. If {@link #NO_MESSAGE}, do not open a message.
* Must never be {@link Account#NO_ACCOUNT}.
* @param mailboxId ID of the mailbox to load. If {@link Mailbox#NO_MAILBOX},
* load the account's inbox.
* @param messageId ID of the message to load. If {@link Message#NO_MESSAGE},
* do not open a message.
*/
public abstract void open(long accountId, long mailboxId, long messageId);

View File

@ -19,6 +19,8 @@ package com.android.email.activity;
import com.android.email.Email;
import com.android.email.R;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.EmailContent.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.Utility;
@ -54,9 +56,9 @@ class UIControllerOnePane extends UIControllerBase {
* Don't use them directly; use the accessors instead, as we might want to get them from the
* topmost fragment in the future.
*/
private long mCurrentAccountId = NO_ACCOUNT;
private long mCurrentMailboxId = NO_MAILBOX;
private long mCurrentMessageId = NO_MESSAGE;
private long mCurrentAccountId = Account.NO_ACCOUNT;
private long mCurrentMailboxId = Mailbox.NO_MAILBOX;
private long mCurrentMessageId = Message.NO_MESSAGE;
private MessageCommandButtonView mMessageCommandButtons;
@ -74,7 +76,7 @@ class UIControllerOnePane extends UIControllerBase {
@Override
public void onMailboxSelected(
long accountId, long mailboxId, boolean navigate, boolean dragDrop) {
open(accountId, mailboxId, NO_MESSAGE);
open(accountId, mailboxId, Message.NO_MESSAGE);
}
};
@ -99,7 +101,7 @@ class UIControllerOnePane extends UIControllerBase {
@Override
public void onMailboxNotFound() {
open(getUIAccountId(), NO_MAILBOX, NO_MESSAGE);
open(getUIAccountId(), Mailbox.NO_MAILBOX, Message.NO_MESSAGE);
}
@Override
@ -257,9 +259,9 @@ class UIControllerOnePane extends UIControllerBase {
@Override
public void restoreInstanceState(Bundle savedInstanceState) {
super.restoreInstanceState(savedInstanceState);
mCurrentAccountId = savedInstanceState.getLong(BUNDLE_KEY_ACCOUNT_ID, NO_ACCOUNT);
mCurrentMailboxId = savedInstanceState.getLong(BUNDLE_KEY_MAILBOX_ID, NO_MAILBOX);
mCurrentMessageId = savedInstanceState.getLong(BUNDLE_KEY_MESSAGE_ID, NO_MESSAGE);
mCurrentAccountId = savedInstanceState.getLong(BUNDLE_KEY_ACCOUNT_ID, Account.NO_ACCOUNT);
mCurrentMailboxId = savedInstanceState.getLong(BUNDLE_KEY_MAILBOX_ID, Mailbox.NO_MAILBOX);
mCurrentMessageId = savedInstanceState.getLong(BUNDLE_KEY_MESSAGE_ID, Message.NO_MESSAGE);
}
@Override
@ -310,24 +312,24 @@ class UIControllerOnePane extends UIControllerBase {
}
private boolean isMailboxListVisible() {
return (getMailboxId() == NO_MAILBOX);
return (getMailboxId() == Mailbox.NO_MAILBOX);
}
private boolean isMessageListVisible() {
return (getMailboxId() != NO_MAILBOX) && (getMessageId() == NO_MESSAGE);
return (getMailboxId() != Mailbox.NO_MAILBOX) && (getMessageId() == Message.NO_MESSAGE);
}
private boolean isMessageViewVisible() {
return (getMailboxId() != NO_MAILBOX) && (getMessageId() != NO_MESSAGE);
return (getMailboxId() != Mailbox.NO_MAILBOX) && (getMessageId() != Message.NO_MESSAGE);
}
@Override
public boolean onBackPressed(boolean isSystemBackKey) {
if (isMessageViewVisible()) {
open(getUIAccountId(), getMailboxId(), NO_MESSAGE);
open(getUIAccountId(), getMailboxId(), Message.NO_MESSAGE);
return true;
} else if (isMessageListVisible()) {
open(getUIAccountId(), NO_MAILBOX, NO_MESSAGE);
open(getUIAccountId(), Mailbox.NO_MAILBOX, Message.NO_MESSAGE);
return true;
} else {
// STOPSHIP Remove this and return false. This is so that the app can be closed
@ -355,7 +357,7 @@ class UIControllerOnePane extends UIControllerBase {
@Override
public void openAccount(long accountId) {
open(accountId, NO_MAILBOX, NO_MESSAGE);
open(accountId, Mailbox.NO_MAILBOX, Message.NO_MESSAGE);
}
@Override
@ -364,7 +366,7 @@ class UIControllerOnePane extends UIControllerBase {
Log.d(Logging.LOG_TAG, this + " open accountId=" + accountId
+ " mailboxId=" + mailboxId + " messageId=" + messageId);
}
if (accountId == NO_ACCOUNT) {
if (accountId == Account.NO_ACCOUNT) {
throw new IllegalArgumentException();
}
@ -383,16 +385,16 @@ class UIControllerOnePane extends UIControllerBase {
final FragmentManager fm = mActivity.getFragmentManager();
final FragmentTransaction ft = fm.beginTransaction();
if (messageId != NO_MESSAGE) {
if (messageId != Message.NO_MESSAGE) {
ft.replace(R.id.fragment_placeholder, MessageViewFragment.newInstance(messageId));
} else if (mailboxId != NO_MAILBOX) {
} else if (mailboxId != Mailbox.NO_MAILBOX) {
ft.replace(R.id.fragment_placeholder, MessageListFragment.newInstance(
accountId, mailboxId));
} else {
ft.replace(R.id.fragment_placeholder,
MailboxListFragment.newInstance(accountId, Mailbox.PARENT_KEY_NONE));
MailboxListFragment.newInstance(accountId, Mailbox.NO_MAILBOX));
}
mCurrentAccountId = accountId;
@ -411,7 +413,7 @@ class UIControllerOnePane extends UIControllerBase {
public long getMailboxSettingsMailboxId() {
// Mailbox settings is still experimental, and doesn't have to work on the phone.
Utility.showToast(mActivity, "STOPSHIP: Mailbox settings not supported on 1 pane");
return -1;
return Mailbox.NO_MAILBOX;
}
/*
@ -421,7 +423,7 @@ class UIControllerOnePane extends UIControllerBase {
public long getSearchMailboxId() {
// Search is still experimental, and doesn't have to work on the phone.
Utility.showToast(mActivity, "STOPSHIP: Search not supported on 1 pane");
return -1;
return Mailbox.NO_MAILBOX;
}
private class CommandButtonCallback implements MessageCommandButtonView.Callback {

View File

@ -24,6 +24,7 @@ import com.android.email.RefreshManager;
import com.android.email.activity.setup.AccountSecurity;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.EmailContent.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.emailcommon.utility.Utility;
@ -54,7 +55,7 @@ class UIControllerTwoPane extends UIControllerBase implements
/* package */ static final int INBOX_AUTO_REFRESH_MIN_INTERVAL = 10 * 1000; // in milliseconds
/** Current account id */
private long mAccountId = NO_ACCOUNT;
private long mAccountId = Account.NO_ACCOUNT;
// TODO Remove this instance variable and replace it with a call to mMessageListFragment to
// retrieve it's mailbox ID. There's no reason we should be duplicating data
@ -63,10 +64,10 @@ class UIControllerTwoPane extends UIControllerBase implements
* IMPORTANT: Do not confuse this with the value returned by {@link #getMessageListMailboxId()}
* which is the mailbox id associated with the message list fragment. The two may be different.
*/
private long mMailboxListMailboxId = NO_MAILBOX;
private long mMailboxListMailboxId = Mailbox.NO_MAILBOX;
/** Current message id */
private long mMessageId = NO_MESSAGE;
private long mMessageId = Message.NO_MESSAGE;
private ActionBarController mActionBarController;
private final ActionBarControllerCallback mActionBarControllerCallback =
@ -173,9 +174,9 @@ class UIControllerTwoPane extends UIControllerBase implements
if (((visiblePanes & ThreePaneLayout.PANE_RIGHT) == 0) &&
((previousVisiblePanes & ThreePaneLayout.PANE_RIGHT) != 0)) {
// Message view just got hidden
mMessageId = NO_MESSAGE;
mMessageId = Message.NO_MESSAGE;
if (mMessageListFragment != null) {
mMessageListFragment.setSelectedMessage(NO_MESSAGE);
mMessageListFragment.setSelectedMessage(Message.NO_MESSAGE);
}
uninstallMessageViewFragment(mActivity.getFragmentManager().beginTransaction())
.commit();
@ -203,7 +204,7 @@ class UIControllerTwoPane extends UIControllerBase implements
updateMailboxList(accountId, mailboxId, true,
false /* don't clear message list and message view */);
} else if (mailboxId == NO_MAILBOX) {
} else if (mailboxId == Mailbox.NO_MAILBOX) {
// reload the top-level message list. Always implies navigate.
openAccount(accountId);
} else if (navigate) {
@ -426,11 +427,11 @@ class UIControllerTwoPane extends UIControllerBase implements
}
private boolean isMailboxSelected() {
return getMessageListMailboxId() != NO_MAILBOX;
return getMessageListMailboxId() != Mailbox.NO_MAILBOX;
}
private boolean isMessageSelected() {
return getMessageId() != NO_MESSAGE;
return getMessageId() != Message.NO_MESSAGE;
}
/**
@ -450,7 +451,7 @@ class UIControllerTwoPane extends UIControllerBase implements
protected boolean isRefreshEnabled() {
// - Don't show for combined inboxes, but
// - Show even for non-refreshable mailboxes, in which case we refresh the mailbox list
return -1 != getActualAccountId();
return getActualAccountId() != Account.NO_ACCOUNT;
}
/**
@ -516,9 +517,10 @@ class UIControllerTwoPane extends UIControllerBase implements
@Override
public void restoreInstanceState(Bundle savedInstanceState) {
super.restoreInstanceState(savedInstanceState);
mAccountId = savedInstanceState.getLong(BUNDLE_KEY_ACCOUNT_ID, NO_ACCOUNT);
mMailboxListMailboxId = savedInstanceState.getLong(BUNDLE_KEY_MAILBOX_ID, NO_MAILBOX);
mMessageId = savedInstanceState.getLong(BUNDLE_KEY_MESSAGE_ID, NO_MESSAGE);
mAccountId = savedInstanceState.getLong(BUNDLE_KEY_ACCOUNT_ID, Account.NO_ACCOUNT);
mMailboxListMailboxId = savedInstanceState.getLong(BUNDLE_KEY_MAILBOX_ID,
Mailbox.NO_MAILBOX);
mMessageId = savedInstanceState.getLong(BUNDLE_KEY_MESSAGE_ID, Message.NO_MESSAGE);
long[] mailboxIds = savedInstanceState.getLongArray(BUNDLE_KEY_MAILBOX_STACK);
if (mailboxIds != null) {
// Restore the mailbox stack; ugly hack to get around 'Long' versus 'long'
@ -585,7 +587,7 @@ class UIControllerTwoPane extends UIControllerBase implements
@Override
public void openAccount(long accountId) {
mMailboxStack.clear();
open(accountId, NO_MAILBOX, NO_MESSAGE);
open(accountId, Mailbox.NO_MAILBOX, Message.NO_MESSAGE);
refreshActionBar();
}
@ -611,10 +613,10 @@ class UIControllerTwoPane extends UIControllerBase implements
Log.d(Logging.LOG_TAG, this + " open accountId=" + accountId
+ " mailboxId=" + mailboxId + " messageId=" + messageId);
}
if (accountId == NO_ACCOUNT) {
if (accountId == Account.NO_ACCOUNT) {
throw new IllegalArgumentException();
} else if (mailboxId == NO_MAILBOX) {
updateMailboxList(accountId, NO_MAILBOX, true, true);
} else if (mailboxId == Mailbox.NO_MAILBOX) {
updateMailboxList(accountId, Mailbox.NO_MAILBOX, true, true);
// Show the appropriate message list
if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) {
@ -626,7 +628,7 @@ class UIControllerTwoPane extends UIControllerBase implements
mMailboxFinder = new MailboxFinder(mActivity, mAccountId, Mailbox.TYPE_INBOX, this);
mMailboxFinder.startLookup();
}
} else if (messageId == NO_MESSAGE) {
} else if (messageId == Message.NO_MESSAGE) {
// STOPSHIP Use the appropriate parent mailbox ID
updateMailboxList(accountId, mailboxId, true, true);
updateMessageList(mailboxId, true, true);
@ -657,9 +659,9 @@ class UIControllerTwoPane extends UIControllerBase implements
* specified account is already selected, no actions will be performed unless
* <code>forceReload</code> is <code>true</code>.
*
* @param accountId ID of the account to load. Must never be {@link #NO_ACCOUNT}.
* @param accountId ID of the account to load. Must never be {@link Account#NO_ACCOUNT}.
* @param parentMailboxId ID of the mailbox to use as the parent mailbox. Pass
* {@link #NO_MAILBOX} to show the root mailboxes.
* {@link Mailbox#NO_MAILBOX} to show the root mailboxes.
* @param changeVisiblePane if true, the message view will be hidden.
* @param clearDependentPane if true, the message list and the message view will be cleared
*/
@ -676,7 +678,7 @@ class UIControllerTwoPane extends UIControllerBase implements
+ " parentMailboxId=" + parentMailboxId);
}
preFragmentTransactionCheck();
if (accountId == NO_ACCOUNT) {
if (accountId == Account.NO_ACCOUNT) {
throw new IllegalArgumentException();
}
@ -691,7 +693,7 @@ class UIControllerTwoPane extends UIControllerBase implements
final FragmentTransaction ft = fm.beginTransaction();
uninstallMailboxListFragment(ft);
if (clearDependentPane) {
mMessageId = NO_MESSAGE;
mMessageId = Message.NO_MESSAGE;
uninstallMessageListFragment(ft);
uninstallMessageViewFragment(ft);
}
@ -721,7 +723,8 @@ class UIControllerTwoPane extends UIControllerBase implements
* given message is shown. If <code>navigateToMailbox<code> is <code>true</code>, the
* mailbox is navigated to and any contained mailboxes are shown.
*
* @param mailboxId ID of the mailbox to load. Must never be <code>0</code> or <code>-1</code>.
* @param mailboxId ID of the mailbox to load. Must never be <code>0</code> or
* {@link Mailbox#NO_MAILBOX}.
* @param changeVisiblePane if true, the message view will be hidden.
* @param clearDependentPane if true, the message view will be cleared
*/
@ -731,7 +734,7 @@ class UIControllerTwoPane extends UIControllerBase implements
Log.d(Logging.LOG_TAG, this + " updateMessageList mMailboxId=" + mailboxId);
}
preFragmentTransactionCheck();
if (mailboxId == 0 || mailboxId == -1) {
if (mailboxId == 0 || mailboxId == Mailbox.NO_MAILBOX) {
throw new IllegalArgumentException();
}
@ -743,7 +746,7 @@ class UIControllerTwoPane extends UIControllerBase implements
uninstallMessageListFragment(ft);
if (clearDependentPane) {
uninstallMessageViewFragment(ft);
mMessageId = NO_MESSAGE;
mMessageId = Message.NO_MESSAGE;
}
ft.add(mThreePane.getMiddlePaneId(), MessageListFragment.newInstance(
mAccountId, mailboxId));
@ -762,14 +765,14 @@ class UIControllerTwoPane extends UIControllerBase implements
/**
* Show a message on the message view.
*
* @param messageId ID of the mailbox to load. Must never be {@link #NO_MESSAGE}.
* @param messageId ID of the mailbox to load. Must never be {@link Message#NO_MESSAGE}.
*/
private void updateMessageView(long messageId) {
if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {
Log.d(Logging.LOG_TAG, this + " updateMessageView messageId=" + messageId);
}
preFragmentTransactionCheck();
if (messageId == NO_MESSAGE) {
if (messageId == Message.NO_MESSAGE) {
throw new IllegalArgumentException();
}
@ -902,7 +905,7 @@ class UIControllerTwoPane extends UIControllerBase implements
return true;
} else if (!mMailboxStack.isEmpty()) {
long mailboxId = mMailboxStack.pop();
if (mailboxId == NO_MAILBOX) {
if (mailboxId == Mailbox.NO_MAILBOX) {
// No mailbox; reload the top-level message list
openAccount(mAccountId);
} else {
@ -982,7 +985,7 @@ class UIControllerTwoPane extends UIControllerBase implements
mRefreshManager.refreshMessageList(mAccountId, mMailboxId, false);
}
// Refresh mailbox list
if (mAccountId != -1) {
if (mAccountId != Account.NO_ACCOUNT) {
if (shouldRefreshMailboxList()) {
mRefreshManager.refreshMailboxList(mAccountId);
}