From 1f59271769e372c509d87e3a3adb47be196fb6f6 Mon Sep 17 00:00:00 2001 From: Jorge Lugo Date: Thu, 23 Jun 2011 19:01:21 -0700 Subject: [PATCH] Widget logo opens up mailbox Pressing the email widget's logo will open up the account's inbox. Also, composing a new email open the compose window for that account instead of an arbitrary account as before. Bug: 3366819 Change-Id: I03c0d6973f5428b2044e755f41fcc6f4da225afa --- src/com/android/email/widget/EmailWidget.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/widget/EmailWidget.java b/src/com/android/email/widget/EmailWidget.java index 44670be0c..4839017b5 100644 --- a/src/com/android/email/widget/EmailWidget.java +++ b/src/com/android/email/widget/EmailWidget.java @@ -196,8 +196,10 @@ public class EmailWidget implements RemoteViewsService.RemoteViewsFactory, * @param intent The intent to be used when launching the activity */ private void setActivityIntent(RemoteViews views, int buttonId, Intent intent) { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // just in case intent comes without it PendingIntent pendingIntent = - PendingIntent.getActivity(mContext, 0, intent, 0); + PendingIntent.getActivity(mContext, (int) mAccountId, intent, + PendingIntent.FLAG_UPDATE_CURRENT); views.setOnClickPendingIntent(buttonId, pendingIntent); } @@ -309,8 +311,11 @@ public class EmailWidget implements RemoteViewsService.RemoteViewsFactory, views.setViewVisibility(R.id.message_list, View.VISIBLE); views.setViewVisibility(R.id.tap_to_configure, View.GONE); // Create click intent for "compose email" target - intent = MessageCompose.getMessageComposeIntent(mContext, -1); + intent = MessageCompose.getMessageComposeIntent(mContext, mAccountId); setActivityIntent(views, R.id.widget_compose, intent); + // Create click intent for logo to open inbox + intent = Welcome.createOpenAccountInboxIntent(mContext, mAccountId); + setActivityIntent(views, R.id.widget_logo, intent); } else { // TODO This really should never happen ... probably can remove the else block // Hide compose icon & show "touch to configure" text