Merge "Import translations. DO NOT MERGE" into jb-ub-mail-ur8
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/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index 2600c74..5427dea 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -480,6 +480,7 @@
private void finishSetup(int action, Intent intent, Bundle savedInstanceState,
boolean showQuotedText) {
+ setFocus(action);
if (action == COMPOSE) {
mQuotedTextView.setVisibility(View.GONE);
}
@@ -493,7 +494,6 @@
initFromSpinner(savedInstanceState != null ? savedInstanceState : intent.getExtras(),
action);
initChangeListeners();
- setFocus(action);
updateHideOrShowCcBcc();
updateHideOrShowQuotedText(showQuotedText);
}
@@ -1427,7 +1427,6 @@
// This is the email address of the current user, i.e. the one composing
// the reply.
final String accountEmail = Address.getEmailAddress(account).getAddress();
- String fromAddress = getAddress(refMessage.from);
String[] sentToAddresses = refMessage.getToAddresses();
String replytoAddress = refMessage.replyTo;
final Collection<String> toAddresses;
@@ -1437,12 +1436,12 @@
// message, excluding the current user's email address and any addresses
// already on the To list.
if (action == ComposeActivity.REPLY) {
- toAddresses = initToRecipients(account, accountEmail, fromAddress, replytoAddress,
+ toAddresses = initToRecipients(account, accountEmail, refMessage.from, replytoAddress,
sentToAddresses);
addToAddresses(toAddresses);
} else if (action == ComposeActivity.REPLY_ALL) {
final Set<String> ccAddresses = Sets.newHashSet();
- toAddresses = initToRecipients(account, accountEmail, fromAddress, replytoAddress,
+ toAddresses = initToRecipients(account, accountEmail, refMessage.from, replytoAddress,
sentToAddresses);
addToAddresses(toAddresses);
addRecipients(accountEmail, ccAddresses, sentToAddresses);
@@ -1541,7 +1540,8 @@
@VisibleForTesting
protected Collection<String> initToRecipients(String account, String accountEmail,
- String senderAddress, String replyToAddress, String[] inToAddresses) {
+ String fullSenderAddress, String replyToAddress,
+ String[] inToAddresses) {
// The To recipient is the reply-to address specified in the original
// message, unless it is:
// the current user OR a custom from of the current user, in which case
@@ -1552,8 +1552,8 @@
&& !recipientMatchesThisAccount(account, replyToAddress)) {
toAddresses.add(replyToAddress);
} else {
- if (!recipientMatchesThisAccount(account, senderAddress)) {
- toAddresses.add(senderAddress);
+ if (!recipientMatchesThisAccount(account, fullSenderAddress)) {
+ toAddresses.add(fullSenderAddress);
} else {
// This happens if the user replies to a message they originally
// wrote. In this case, "reply" really means "re-send," so we
diff --git a/src/com/android/mail/persistence/Persistence.java b/src/com/android/mail/persistence/Persistence.java
index 408a814..4b5319c 100644
--- a/src/com/android/mail/persistence/Persistence.java
+++ b/src/com/android/mail/persistence/Persistence.java
@@ -17,6 +17,7 @@
package com.android.mail.persistence;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Maps;
import android.content.Context;
import android.content.SharedPreferences;
@@ -24,6 +25,7 @@
import com.android.mail.utils.LogTag;
+import java.util.Map;
import java.util.Set;
/**
@@ -36,7 +38,7 @@
private static Persistence mInstance = null;
- private static SharedPreferences sSharedPrefs;
+ private static final Map<String, SharedPreferences> SHARED_PREFS_MAP = Maps.newHashMap();
protected Persistence() {
// Singleton only, use getInstance()
@@ -58,11 +60,15 @@
}
public SharedPreferences getPreferences(Context context) {
- if (sSharedPrefs == null) {
- sSharedPrefs = context.getSharedPreferences(
- getSharedPreferencesName(), Context.MODE_PRIVATE);
+ final String sharedPrefName = getSharedPreferencesName();
+ synchronized (SHARED_PREFS_MAP) {
+ SharedPreferences preferences = SHARED_PREFS_MAP.get(sharedPrefName);
+ if (preferences == null) {
+ preferences = context.getSharedPreferences(sharedPrefName, Context.MODE_PRIVATE);
+ SHARED_PREFS_MAP.put(sharedPrefName, preferences);
+ }
+ return preferences;
}
- return sSharedPrefs;
}
protected String makeKey(String account, String key) {
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);
+ }
}
}