Merge "don't strip the sender name out of the sender address before adding the sender to recips." into jb-ub-mail
diff --git a/res/layout/widget.xml b/res/layout/widget.xml
index 98f579e..268ed34 100644
--- a/res/layout/widget.xml
+++ b/res/layout/widget.xml
@@ -82,7 +82,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:gravity="center"
-        android:text="@string/no_conversations"
+        android:text="@string/loading_conversations"
         android:textColor="@android:color/black"
         android:textSize="16sp"
         android:textStyle="bold"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 159acd3..e2bf243 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -359,9 +359,13 @@
     <!-- Dialog text: confirm discard -->
     <string name="confirm_discard_text">Discard this message?</string>
 
-    <!-- Undo bar strings -->
+    <!-- Conversation list shared between the Activity and Widget -->
+    <!-- Displayed in the middle of the screen when conversations are being loaded [CHAR LIMIT 100]-->
+    <string name="loading_conversations">Loading\u2026</string>
     <!-- Displayed in the middle of the screen when the inbox is empty [CHAR LIMIT 100]-->
     <string name="no_conversations">No conversations.</string>
+
+    <!-- Undo bar strings -->
     <!-- Menu item: undo latest action [CHAR LIMIT=12]-->
     <string name="undo">Undo</string>
 
@@ -769,6 +773,17 @@
     <!-- Dialog title when showing message header details in a popup window. [CHAR LIMIT=100]-->
     <string name="message_details_title">Message details</string>
 
+    <!-- General preference: Label of the setting for the direction to move to
+         when deleting the current message.
+         Options contain "newer message","older message", etc. [CHAR LIMIT=32] -->
+    <string name="auto_advance_label">Auto-advance</string>
+
+    <!-- General preference: Description of the setting for the direction to move to
+         when deleting the current message.
+         Options contain "newer message","older message", etc. [CHAR LIMIT=64] -->
+    <string name="auto_advance_summary">Choose which screen to show after you
+         delete a message</string>
+
     <!-- Title of the dialog that appears the first time they perform an action that would cause
          auto advance logic to fire [CHAR LIMIT=70] -->
     <string name="auto_advance_help_title">Set auto-advance preference\n(after you delete, etc.)</string>
diff --git a/src/com/android/mail/widget/BaseWidgetProvider.java b/src/com/android/mail/widget/BaseWidgetProvider.java
index 63bd122..e0dd5ac 100644
--- a/src/com/android/mail/widget/BaseWidgetProvider.java
+++ b/src/com/android/mail/widget/BaseWidgetProvider.java
@@ -288,6 +288,9 @@
             remoteViews.setViewVisibility(R.id.widget_folder_not_synced, View.GONE);
             remoteViews.setViewVisibility(R.id.widget_configuration, View.VISIBLE);
 
+            remoteViews.setTextViewText(R.id.empty_conversation_list,
+                    context.getString(R.string.loading_conversations));
+
             final Intent configureIntent = new Intent(context, MailboxSelectionActivity.class);
             configureIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
             configureIntent.setData(Uri.parse(configureIntent.toUri(Intent.URI_INTENT_SCHEME)));
diff --git a/src/com/android/mail/widget/WidgetService.java b/src/com/android/mail/widget/WidgetService.java
index f662a8f..4e8c555 100644
--- a/src/com/android/mail/widget/WidgetService.java
+++ b/src/com/android/mail/widget/WidgetService.java
@@ -488,6 +488,8 @@
         @Override
         public void onLoadComplete(Loader<Cursor> loader, Cursor data) {
             final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
+            final RemoteViews remoteViews =
+                    new RemoteViews(mContext.getPackageName(), R.layout.widget);
 
             if (loader == mFolderLoader) {
                 if (!isDataValid(data)) {
@@ -498,9 +500,6 @@
                 final String folderName = data.getString(UIProvider.FOLDER_NAME_COLUMN);
                 mFolderCount = data.getInt(UIProvider.FOLDER_TOTAL_COUNT_COLUMN);
 
-                final RemoteViews remoteViews =
-                        new RemoteViews(mContext.getPackageName(), R.layout.widget);
-
                 if (!mFolderInformationShown && !TextUtils.isEmpty(folderName) &&
                         !TextUtils.isEmpty(mAccount.name)) {
                     // We want to do a full update to the widget at least once, as the widget
@@ -529,7 +528,6 @@
 
                 appWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews);
             } else if (loader == mConversationCursorLoader) {
-
                 // We want to cache the new cursor
                 synchronized (sWidgetLock) {
                     if (!isDataValid(data)) {
@@ -538,8 +536,15 @@
                         mConversationCursor = data;
                     }
                 }
-                appWidgetManager.notifyAppWidgetViewDataChanged(
-                        mAppWidgetId, R.id.conversation_list);
+
+                appWidgetManager.notifyAppWidgetViewDataChanged(mAppWidgetId,
+                        R.id.conversation_list);
+
+                if (mConversationCursor == null || mConversationCursor.getCount() == 0) {
+                    remoteViews.setTextViewText(R.id.empty_conversation_list,
+                            mContext.getString(R.string.no_conversations));
+                    appWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews);
+                }
             }
         }