Don't pass ACCOUNT_ID_COMBINED_VIEW to message compose.
If you do so, MessageCompose won't be able to restore an account, so it'll use null account... Bug 3324472 Change-Id: Ic0e615b31e21246e41f6f2c709a8422bef230040
This commit is contained in:
parent
1dde2253cb
commit
f29ce4d37b
|
@ -268,13 +268,14 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||
}
|
||||
|
||||
private void setAccount(Account account) {
|
||||
mAccount = account;
|
||||
if (account != null) {
|
||||
mFromView.setText(account.mEmailAddress);
|
||||
mAddressAdapterTo.setAccount(account);
|
||||
mAddressAdapterCc.setAccount(account);
|
||||
mAddressAdapterBcc.setAccount(account);
|
||||
if (account == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mAccount = account;
|
||||
mFromView.setText(account.mEmailAddress);
|
||||
mAddressAdapterTo.setAccount(account);
|
||||
mAddressAdapterCc.setAccount(account);
|
||||
mAddressAdapterBcc.setAccount(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -467,7 +467,7 @@ public class MessageListXL extends Activity implements
|
|||
@Override
|
||||
public boolean onUrlInMessageClicked(String url) {
|
||||
return ActivityHelper.openUrlInMessage(MessageListXL.this, url,
|
||||
mFragmentManager.getAccountId());
|
||||
mFragmentManager.getActualAccountId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -632,7 +632,7 @@ public class MessageListXL extends Activity implements
|
|||
int i = 0;
|
||||
while (accountsCursor.moveToNext()) {
|
||||
final long accountId = AccountSelectorAdapter.getAccountId(accountsCursor);
|
||||
if (accountId == mFragmentManager.getAccountId()) {
|
||||
if (accountId == mFragmentManager.getUIAccountId()) {
|
||||
defaultSelection = i;
|
||||
break;
|
||||
}
|
||||
|
@ -703,8 +703,7 @@ public class MessageListXL extends Activity implements
|
|||
}
|
||||
|
||||
private boolean shouldShowRefreshButton() {
|
||||
final long accountId = mFragmentManager.getAccountId();
|
||||
return (accountId != -1) && (accountId != Account.ACCOUNT_ID_COMBINED_VIEW);
|
||||
return -1 != mFragmentManager.getActualAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -729,19 +728,19 @@ public class MessageListXL extends Activity implements
|
|||
if (!mFragmentManager.isAccountSelected()) {
|
||||
return false; // this shouldn't really happen
|
||||
}
|
||||
MessageCompose.actionCompose(this, mFragmentManager.getAccountId());
|
||||
MessageCompose.actionCompose(this, mFragmentManager.getActualAccountId());
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onAccountSettings() {
|
||||
AccountSettingsXL.actionSettings(this, mFragmentManager.getAccountId());
|
||||
AccountSettingsXL.actionSettings(this, mFragmentManager.getActualAccountId());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onRefresh() {
|
||||
// Cancel previously running instance if any.
|
||||
Utility.cancelTaskInterrupt(mRefreshTask);
|
||||
mRefreshTask = new RefreshTask(this, mFragmentManager.getAccountId(),
|
||||
mRefreshTask = new RefreshTask(this, mFragmentManager.getActualAccountId(),
|
||||
mFragmentManager.getMailboxId());
|
||||
mRefreshTask.execute();
|
||||
}
|
||||
|
|
|
@ -167,10 +167,25 @@ class MessageListXLFragmentManager {
|
|||
mMessageViewFragment.setCallback(messageViewFragmentCallback);
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
/**
|
||||
* @return the currently selected account ID, *or* {@link Account#ACCOUNT_ID_COMBINED_VIEW}.
|
||||
*
|
||||
* @see #getActualAccountId()
|
||||
*/
|
||||
public long getUIAccountId() {
|
||||
return mAccountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currently selected account ID. If the current view is the combined view,
|
||||
* it'll return -1.
|
||||
*
|
||||
* @see #getUIAccountId()
|
||||
*/
|
||||
public long getActualAccountId() {
|
||||
return mAccountId == Account.ACCOUNT_ID_COMBINED_VIEW ? -1 : mAccountId;
|
||||
}
|
||||
|
||||
public long getMailboxId() {
|
||||
return mMailboxId;
|
||||
}
|
||||
|
@ -179,8 +194,11 @@ class MessageListXLFragmentManager {
|
|||
return mMessageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if an account is selected, or the current view is the combined view.
|
||||
*/
|
||||
public boolean isAccountSelected() {
|
||||
return getAccountId() != -1;
|
||||
return getUIAccountId() != -1;
|
||||
}
|
||||
|
||||
public boolean isMailboxSelected() {
|
||||
|
|
Loading…
Reference in New Issue