From ee6bd2dc22849c31c06d5afcb2bce15e13031766 Mon Sep 17 00:00:00 2001 From: Sander Bogaert Date: Tue, 17 Jul 2012 10:59:55 -0400 Subject: [PATCH] Pressing the actionbar icon will take you back to the accountsscreen. --- src/com/fsck/k9/activity/Accounts.java | 7 +++++++ src/com/fsck/k9/activity/FolderList.java | 6 ++++++ src/com/fsck/k9/activity/MessageList.java | 6 ++++++ src/com/fsck/k9/activity/MessageView.java | 4 ++++ 4 files changed, 23 insertions(+) diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index 0026d9128..678694714 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -309,6 +309,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC context.startActivity(intent); } + public static void listAccountsClearTop(Context context) { + Intent intent = new Intent(context, Accounts.class); + intent.putExtra(EXTRA_STARTUP, false); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + context.startActivity(intent); + } + @Override public void onNewIntent(Intent intent) { Uri uri = intent.getData(); diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java index 4565d6cdb..34ae4b1e7 100644 --- a/src/com/fsck/k9/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -556,6 +556,12 @@ public class FolderList extends K9ListActivity implements OnNavigationListener { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case android.R.id.home: + Accounts.listAccountsClearTop(this); + finish(); + + return true; + case R.id.compose: MessageCompose.actionCompose(this, mAccount); diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 8cf8fbdd0..87c2bcc88 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -1500,6 +1500,12 @@ public class MessageList final List selection = getSelectionFromCheckboxes(); int itemId = item.getItemId(); switch (itemId) { + case android.R.id.home: { + // app icon in action bar clicked; go home + Accounts.listAccountsClearTop(this); + finish(); + return true; + } case R.id.compose: { onCompose(); return true; diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index dba252334..171369560 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -852,6 +852,10 @@ public class MessageView extends K9Activity implements OnClickListener { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case android.R.id.home: + Accounts.listAccountsClearTop(this); + finish(); + break; case R.id.delete: onDelete(); break;