Merge "Implement "auto-advance" on two-pane"
This commit is contained in:
commit
07fc10ae22
@ -18,12 +18,12 @@ package com.android.email.activity;
|
||||
|
||||
import com.android.email.Clock;
|
||||
import com.android.email.Email;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
import com.android.email.RefreshManager;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.activity.setup.AccountSecurity;
|
||||
import com.android.email.activity.setup.AccountSettingsXL;
|
||||
import com.android.email.activity.setup.AccountSetupBasics;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
import com.android.email.provider.EmailContent.Mailbox;
|
||||
import com.android.email.service.MailService;
|
||||
@ -298,16 +298,32 @@ public class MessageListXL extends Activity implements View.OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the "delete" button on message view is pressed.
|
||||
*/
|
||||
private void onDeleteMessage() {
|
||||
// the delete triggers mCursorObserver in MessageOrderManager.
|
||||
// first move to older/newer before the actual delete
|
||||
long messageIdToDelete = mFragmentManager.getMessageId();
|
||||
|
||||
if (!moveToOlder()) moveToNewer(); // TODO use "auto-advance" preference
|
||||
onCurrentMessageGone();
|
||||
|
||||
ActivityHelper.deleteMessage(this, messageIdToDelete);
|
||||
// If this was the last message, moveToOlder/Newer didn't move the current position.
|
||||
// MessageOrderManager detects the current message is gone, and we go back to the message
|
||||
// list in onMessageNotFound().
|
||||
}
|
||||
|
||||
private void onCurrentMessageGone() {
|
||||
switch (Preferences.getPreferences(this).getAutoAdvanceDirection()) {
|
||||
case Preferences.AUTO_ADVANCE_NEWER:
|
||||
if (moveToNewer()) return;
|
||||
if (moveToOlder()) return;
|
||||
break;
|
||||
case Preferences.AUTO_ADVANCE_OLDER:
|
||||
if (moveToOlder()) return;
|
||||
if (moveToNewer()) return;
|
||||
break;
|
||||
}
|
||||
// Last message in the box or AUTO_ADVANCE_MESSAGE_LIST. Go back to message list.
|
||||
mFragmentManager.goBackToMailbox();
|
||||
}
|
||||
|
||||
private void onSetMessageUnread() {
|
||||
@ -483,10 +499,7 @@ public class MessageListXL extends Activity implements View.OnClickListener,
|
||||
|
||||
@Override
|
||||
public void onRespondedToInvite(int response) {
|
||||
if (!moveToOlder()) {
|
||||
// if this is the last message, move up to message-list.
|
||||
mFragmentManager.goBackToMailbox();
|
||||
}
|
||||
onCurrentMessageGone();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -634,11 +647,6 @@ public class MessageListXL extends Activity implements View.OnClickListener,
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onAddNewAccount() {
|
||||
AccountSetupBasics.actionNewAccount(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onRefresh() {
|
||||
// Cancel previously running instance if any.
|
||||
Utility.cancelTaskInterrupt(mRefreshTask);
|
||||
|
@ -330,6 +330,7 @@ public class MessageView extends MessageViewBase implements View.OnClickListener
|
||||
|
||||
@Override
|
||||
public void onRespondedToInvite(int response) {
|
||||
// TODO use "auto-advance" preference
|
||||
if (!moveToOlder()) {
|
||||
finish(); // if this is the last message, move up to message-list.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user