Merge "Add selectors for drawer item state change" into jb-ub-mail-ur9
diff --git a/res/layout/folder_item.xml b/res/layout/folder_item.xml
index 3a82e64..ae4890a 100644
--- a/res/layout/folder_item.xml
+++ b/res/layout/folder_item.xml
@@ -44,7 +44,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/folder_list_item_left_margin"
- android:layout_marginRight="4dp"
android:visibility="gone" />
<LinearLayout
diff --git a/res/layout/one_pane_activity.xml b/res/layout/one_pane_activity.xml
index 901f6e4..b236819 100644
--- a/res/layout/one_pane_activity.xml
+++ b/res/layout/one_pane_activity.xml
@@ -20,17 +20,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <FrameLayout
- android:id="@+id/content_pane"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <include layout="@layout/conversation_pager" />
-
+ <!-- DrawerLayout current only supports one content view (b/8752191) -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <FrameLayout
+ android:id="@+id/content_pane"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <include layout="@layout/conversation_pager" />
+
<com.android.mail.ui.ActionableToastBar
android:id="@+id/toast_bar"
style="@style/ToastBarStyle" />
diff --git a/res/layout/widget.xml b/res/layout/widget.xml
index 91e325e..128f45a 100644
--- a/res/layout/widget.xml
+++ b/res/layout/widget.xml
@@ -67,7 +67,8 @@
android:id="@+id/widget_unread_count"
style="@style/UnreadCount"
android:layout_marginRight="12dip"
- android:textColor="#777777" />
+ android:textColor="#777777"
+ android:visibility="gone" />
<ImageButton
android:id="@+id/widget_compose"
android:layout_width="wrap_content"
diff --git a/res/menu-sw600dp-port/conversation_list_search_results_actions.xml b/res/menu-sw600dp-port/conversation_list_search_results_actions.xml
deleted file mode 100644
index ba722e6..0000000
--- a/res/menu-sw600dp-port/conversation_list_search_results_actions.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2012 Google Inc.
- Licensed to The Android Open Source Project.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:id="@+id/compose"
- android:title="@string/menu_compose"
- android:showAsAction="always"
- android:icon="@drawable/ic_menu_compose_normal_holo_light"
- android:alphabeticShortcut="@string/trigger_compose_char" />
-
- <item android:id="@+id/search"
- android:title="@string/menu_search"
- android:showAsAction="always|collapseActionView"
- android:icon="@drawable/ic_menu_search_holo_light"
- android:actionLayout="@layout/mail_actionbar_searchview" />
-
- <item android:id="@+id/refresh"
- android:title="@string/refresh"
- android:showAsAction="never"
- android:icon="@drawable/ic_menu_refresh_holo_light"
- android:alphabeticShortcut="@string/trigger_refresh_char" />
-
- <item android:id="@+id/settings"
- android:title="@string/menu_settings"
- android:showAsAction="never" />
-
- <item
- android:id="@+id/feedback_menu_item"
- android:icon="@android:drawable/ic_menu_send"
- android:showAsAction="never"
- android:title="@string/feedback" />
-
- <item
- android:id="@+id/help_info_menu_item"
- android:icon="@android:drawable/ic_menu_help"
- android:showAsAction="never"
- android:title="@string/help_and_info" />
-
-</menu>
diff --git a/res/menu/conversation_list_menu.xml b/res/menu/conversation_list_menu.xml
index e2483b5..99b9db2 100644
--- a/res/menu/conversation_list_menu.xml
+++ b/res/menu/conversation_list_menu.xml
@@ -20,16 +20,16 @@
<!-- Always available -->
<item android:id="@+id/compose"
android:title="@string/menu_compose"
- android:showAsAction="always"
+ android:showAsAction="ifRoom"
android:icon="@drawable/ic_menu_compose_normal_holo_light"
android:alphabeticShortcut="@string/trigger_compose_char" />
<!-- Available only for accounts with SERVER_SEARCH and in a folder
that supports FOLDER_SERVER_SEARCH -->
<item android:id="@+id/search" android:title="@string/menu_search"
- android:showAsAction="always|collapseActionView"
- android:icon="@drawable/ic_menu_search_holo_light"
- android:actionLayout="@layout/mail_actionbar_searchview" />
+ android:showAsAction="always|collapseActionView"
+ android:icon="@drawable/ic_menu_search_holo_light"
+ android:actionLayout="@layout/mail_actionbar_searchview" />
<!-- Available only in the trash folder, when the account supports emptying it -->
<item android:id="@+id/empty_trash"
diff --git a/res/menu/conversation_list_search_results_actions.xml b/res/menu/conversation_list_search_results_actions.xml
index ab699d3..15769c9 100644
--- a/res/menu/conversation_list_search_results_actions.xml
+++ b/res/menu/conversation_list_search_results_actions.xml
@@ -20,19 +20,19 @@
<item android:id="@+id/compose"
android:title="@string/menu_compose"
- android:showAsAction="always"
+ android:showAsAction="ifRoom"
android:icon="@drawable/ic_menu_compose_normal_holo_light"
android:alphabeticShortcut="@string/trigger_compose_char" />
<item android:id="@+id/search"
android:title="@string/menu_search"
- android:showAsAction="always|collapseActionView"
+ android:showAsAction="ifRoom|collapseActionView"
android:icon="@drawable/ic_menu_search_holo_light"
android:actionLayout="@layout/mail_actionbar_searchview" />
<item android:id="@+id/refresh"
android:title="@string/refresh"
- android:showAsAction="ifRoom"
+ android:showAsAction="never"
android:icon="@drawable/ic_menu_refresh_holo_light"
android:alphabeticShortcut="@string/trigger_refresh_char" />
diff --git a/res/menu/conversation_list_selection_actions_menu.xml b/res/menu/conversation_list_selection_actions_menu.xml
index d162706..c8823ae 100644
--- a/res/menu/conversation_list_selection_actions_menu.xml
+++ b/res/menu/conversation_list_selection_actions_menu.xml
@@ -69,7 +69,7 @@
<item
android:id="@+id/move_to"
android:title="@string/menu_move_to"
- android:showAsAction="always"
+ android:showAsAction="ifRoom"
android:icon="@drawable/ic_menu_move_to_holo_light" />
<item
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index ff0f47d..289212c 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -63,14 +63,14 @@
<dimen name="spinner_frame_width">196dip</dimen>
<dimen name="folder_list_heading_padding_side">16dp</dimen>
<dimen name="folder_list_heading_padding_bottom">3dp</dimen>
- <dimen name="folder_list_item_left_margin">16dp</dimen>
+ <dimen name="folder_list_item_left_margin">7dp</dimen>
<dimen name="folder_list_item_right_margin">8dp</dimen>
<!-- Let's try to keep this consistent with color_block_height above, unless there's a good reason not to. -->
<dimen name="folder_swatch_height">6dip</dimen>
<dimen name="folder_list_popup_width">200dip</dimen>
<dimen name="folder_list_folder_color_width">36dip</dimen>
<dimen name="folder_list_item_minimum_height">48dip</dimen>
- <dimen name="account_item_left_margin">16dp</dimen>
+ <dimen name="account_item_left_margin">14dp</dimen>
<dimen name="account_item_right_margin">8dp</dimen>
<dimen name="account_item_minimum_height">48dip</dimen>
<dimen name="account_item_swatch_height">8dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1d574e4..0759db9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -846,8 +846,24 @@
<!-- Settings screen, preference name for archive vs. delete [CHAR LIMIT=50] -->
<string name="preference_archive_vs_delete_title">Remove action</string>
- <!-- Settings screen, preference description for archive vs. delete [CHAR LIMIT=200] -->
- <string name="preference_archive_vs_delete_text">Delete rather than archive conversations</string>
+ <!-- Options to select from for whether to have archive or delete as the remove action [CHAR LIMIT=50] -->
+ <string-array name="prefEntries_archive_vs_delete">
+ <item>Archive conversations</item>
+ <item>Delete conversations</item>
+ </string-array>
+ <!-- Description of currently selected option of whether to use archive or delete as remove action [CHAR LIMIT=200] -->
+ <string-array name="prefSummaries_archive_vs_delete_summary">
+ <item>Archive rather than delete conversations</item>
+ <item>Delete rather than archive conversations</item>
+ </string-array>
+ <string-array translatable="false" name="prefValues_archive_vs_delete">
+ <item>archive</item>
+ <item>delete</item>
+ </string-array>
+ <!-- Dialog title for the choosing whether to use archive or delete as remove action [CHAR LIMIT=150] -->
+ <string name="prefDialogTitle_archive_vs_delete">Remove action</string>
+ <!-- The default value -->
+ <string translatable="false" name="prefDefault_archive_vs_delete">archive</string>
<!-- Settings screen, Reply to all default setting title [CHAR LIMIT=30] -->
<string name="preferences_default_reply_all_title">Reply all</string>
diff --git a/src/com/android/mail/MailIntentService.java b/src/com/android/mail/MailIntentService.java
index 503f385..7f04392 100644
--- a/src/com/android/mail/MailIntentService.java
+++ b/src/com/android/mail/MailIntentService.java
@@ -62,7 +62,7 @@
final String action = intent.getAction();
if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
- handleLocaleChanged();
+ NotificationUtils.cancelAndResendNotifications(this);
} else if (ACTION_CLEAR_NEW_MAIL_NOTIFICATIONS.equals(action)) {
final Account account = intent.getParcelableExtra(Utils.EXTRA_ACCOUNT);
final Folder folder = intent.getParcelableExtra(Utils.EXTRA_FOLDER);
@@ -91,9 +91,4 @@
final Intent intent = new Intent(ACTION_BACKUP_DATA_CHANGED);
context.startService(intent);
}
-
- private void handleLocaleChanged() {
- // Cancel all notifications. The correct ones will be recreated when the app starts back up
- NotificationUtils.cancelAndResendNotifications(this);
- }
}
diff --git a/src/com/android/mail/adapter/DrawerItem.java b/src/com/android/mail/adapter/DrawerItem.java
index 44c03b0..a372fdc 100644
--- a/src/com/android/mail/adapter/DrawerItem.java
+++ b/src/com/android/mail/adapter/DrawerItem.java
@@ -264,8 +264,8 @@
// Folders are always enabled.
return true;
case VIEW_ACCOUNT:
- // Accounts are only enabled if they are not the current account.
- return !mIsSelected;
+ // Accounts are always enabled.
+ return true;
case VIEW_WAITING_FOR_SYNC:
// Waiting for sync cannot be tapped, so never enabled.
return false;
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 4910fa7..49d6a5d 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -109,6 +109,9 @@
private static final String CONV_ITEM_VIEW_CATEGORY = "ConversationItemView";
private static final String CONTACT_PHOTO_ACTION = "ContactPhoto";
private static final String NUM_PHOTOS_LABEL = "num_photos";
+ private static final String CUSTOM_DIMEN_ACCOUNT_TYPE_GOOGLE_COM = "account_type_google_com";
+ private static final String CUSTOM_DIMEN_ACCOUNT_TYPE_NON_GOOGLE_COM
+ = "account_type_non_google_com";
private static final boolean REPORT_ANALYTICS = true;
@@ -451,15 +454,27 @@
numPhotos++;
}
}
+
// Number of subtiles
sConversationItemViewTracker.setCustomMetric(1, (long)numTiles);
// Number of resolved photos
sConversationItemViewTracker.setCustomMetric(2, (long)numPhotos);
// Number of letter subtiles
sConversationItemViewTracker.setCustomMetric(3, (long)(numTiles - numPhotos));
+ final String accountTypeCustomDimen = mAccount.endsWith("google.com") ?
+ CUSTOM_DIMEN_ACCOUNT_TYPE_GOOGLE_COM :
+ CUSTOM_DIMEN_ACCOUNT_TYPE_NON_GOOGLE_COM;
+ sConversationItemViewTracker.setCustomDimension(3, accountTypeCustomDimen);
+ // This is a hack. Ideally this would check the folder object to determine if it
+ // is the primary section
+ final String isPrimarySection =
+ TextUtils.equals(mDisplayedFolder.persistentId, "^sq_ig_i_personal") ?
+ "primary" : "not_primary";
+ sConversationItemViewTracker.setCustomDimension(4, isPrimarySection);
sConversationItemViewTracker.sendEvent(CONV_ITEM_VIEW_CATEGORY,
CONTACT_PHOTO_ACTION, NUM_PHOTOS_LABEL, (long)numTiles);
+
mReportedStats = true;
}
}
diff --git a/src/com/android/mail/providers/Settings.java b/src/com/android/mail/providers/Settings.java
index ef8674d..9a8fddd 100644
--- a/src/com/android/mail/providers/Settings.java
+++ b/src/com/android/mail/providers/Settings.java
@@ -22,7 +22,7 @@
import android.os.Parcelable;
import android.text.TextUtils;
-import com.android.mail.providers.UIProvider.AccountColumns;
+import com.android.mail.providers.UIProvider.AccountColumns.SettingsColumns;
import com.android.mail.providers.UIProvider.AutoAdvance;
import com.android.mail.providers.UIProvider.ConversationListIcon;
import com.android.mail.providers.UIProvider.DefaultReplyBehavior;
@@ -138,81 +138,58 @@
}
public Settings(Cursor cursor) {
- signature = cursor.getString(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.SIGNATURE));
- mAutoAdvance = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.AUTO_ADVANCE));
- messageTextSize = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE));
- snapHeaders = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.SNAP_HEADERS));
- replyBehavior = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.REPLY_BEHAVIOR));
- convListIcon = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.CONV_LIST_ICON));
- confirmDelete = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE)) != 0;
- confirmArchive = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.CONFIRM_ARCHIVE)) != 0;
- confirmSend = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.CONFIRM_SEND)) != 0;
- defaultInbox = Utils.getValidUri(cursor.getString(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX)));
- defaultInboxName = cursor.getString(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME));
- forceReplyFromDefault = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT)) != 0;
- maxAttachmentSize = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE));
- swipe = cursor.getInt(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.SWIPE));
- priorityArrowsEnabled = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED)) != 0;
- setupIntentUri = Utils.getValidUri(cursor.getString(
- cursor.getColumnIndex(UIProvider.AccountColumns.SettingsColumns.SETUP_INTENT_URI)));
- conversationViewMode = cursor.getInt(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE));
- veiledAddressPattern = cursor.getString(cursor.getColumnIndex(
- UIProvider.AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN));
+ signature = cursor.getString(cursor.getColumnIndex(SettingsColumns.SIGNATURE));
+ mAutoAdvance = cursor.getInt(cursor.getColumnIndex(SettingsColumns.AUTO_ADVANCE));
+ messageTextSize = cursor.getInt(cursor.getColumnIndex(SettingsColumns.MESSAGE_TEXT_SIZE));
+ snapHeaders = cursor.getInt(cursor.getColumnIndex(SettingsColumns.SNAP_HEADERS));
+ replyBehavior = cursor.getInt(cursor.getColumnIndex(SettingsColumns.REPLY_BEHAVIOR));
+ convListIcon = cursor.getInt(cursor.getColumnIndex(SettingsColumns.CONV_LIST_ICON));
+ confirmDelete = cursor.getInt(cursor.getColumnIndex(SettingsColumns.CONFIRM_DELETE)) != 0;
+ confirmArchive = cursor.getInt(cursor.getColumnIndex(SettingsColumns.CONFIRM_ARCHIVE)) != 0;
+ confirmSend = cursor.getInt(cursor.getColumnIndex(SettingsColumns.CONFIRM_SEND)) != 0;
+ defaultInbox = Utils.getValidUri(
+ cursor.getString(cursor.getColumnIndex(SettingsColumns.DEFAULT_INBOX)));
+ defaultInboxName =
+ cursor.getString(cursor.getColumnIndex(SettingsColumns.DEFAULT_INBOX_NAME));
+ forceReplyFromDefault = cursor.getInt(
+ cursor.getColumnIndex(SettingsColumns.FORCE_REPLY_FROM_DEFAULT)) != 0;
+ maxAttachmentSize =
+ cursor.getInt(cursor.getColumnIndex(SettingsColumns.MAX_ATTACHMENT_SIZE));
+ swipe = cursor.getInt(cursor.getColumnIndex(SettingsColumns.SWIPE));
+ priorityArrowsEnabled = cursor.getInt(
+ cursor.getColumnIndex(SettingsColumns.PRIORITY_ARROWS_ENABLED)) != 0;
+ setupIntentUri = Utils.getValidUri(
+ cursor.getString(cursor.getColumnIndex(SettingsColumns.SETUP_INTENT_URI)));
+ conversationViewMode =
+ cursor.getInt(cursor.getColumnIndex(SettingsColumns.CONVERSATION_VIEW_MODE));
+ veiledAddressPattern =
+ cursor.getString(cursor.getColumnIndex(SettingsColumns.VEILED_ADDRESS_PATTERN));
}
private Settings(JSONObject json) {
- signature = json.optString(AccountColumns.SettingsColumns.SIGNATURE, sDefault.signature);
- mAutoAdvance = json.optInt(AccountColumns.SettingsColumns.AUTO_ADVANCE,
- sDefault.getAutoAdvanceSetting());
- messageTextSize = json.optInt(AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE,
- sDefault.messageTextSize);
- snapHeaders = json.optInt(AccountColumns.SettingsColumns.SNAP_HEADERS,
- sDefault.snapHeaders);
- replyBehavior = json.optInt(AccountColumns.SettingsColumns.REPLY_BEHAVIOR,
- sDefault.replyBehavior);
- convListIcon = json.optInt(AccountColumns.SettingsColumns.CONV_LIST_ICON,
- sDefault.convListIcon);
- confirmDelete = json.optBoolean(AccountColumns.SettingsColumns.CONFIRM_DELETE,
- sDefault.confirmDelete);
- confirmArchive = json.optBoolean(AccountColumns.SettingsColumns.CONFIRM_ARCHIVE,
- sDefault.confirmArchive);
- confirmSend = json.optBoolean(AccountColumns.SettingsColumns.CONFIRM_SEND,
- sDefault.confirmSend);
- defaultInbox = Utils.getValidUri(
- json.optString(AccountColumns.SettingsColumns.DEFAULT_INBOX));
- defaultInboxName = json.optString(AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME,
+ signature = json.optString(SettingsColumns.SIGNATURE, sDefault.signature);
+ mAutoAdvance = json.optInt(SettingsColumns.AUTO_ADVANCE, sDefault.getAutoAdvanceSetting());
+ messageTextSize = json.optInt(SettingsColumns.MESSAGE_TEXT_SIZE, sDefault.messageTextSize);
+ snapHeaders = json.optInt(SettingsColumns.SNAP_HEADERS, sDefault.snapHeaders);
+ replyBehavior = json.optInt(SettingsColumns.REPLY_BEHAVIOR, sDefault.replyBehavior);
+ convListIcon = json.optInt(SettingsColumns.CONV_LIST_ICON, sDefault.convListIcon);
+ confirmDelete = json.optBoolean(SettingsColumns.CONFIRM_DELETE, sDefault.confirmDelete);
+ confirmArchive = json.optBoolean(SettingsColumns.CONFIRM_ARCHIVE, sDefault.confirmArchive);
+ confirmSend = json.optBoolean(SettingsColumns.CONFIRM_SEND, sDefault.confirmSend);
+ defaultInbox = Utils.getValidUri( json.optString(SettingsColumns.DEFAULT_INBOX));
+ defaultInboxName = json.optString(SettingsColumns.DEFAULT_INBOX_NAME,
sDefault.defaultInboxName);
- forceReplyFromDefault =
- json.optBoolean(AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT,
- sDefault.forceReplyFromDefault);
- maxAttachmentSize = json.optInt(AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE,
- sDefault.maxAttachmentSize);
- swipe = json.optInt(AccountColumns.SettingsColumns.SWIPE, sDefault.swipe);
- priorityArrowsEnabled =
- json.optBoolean(AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED,
- sDefault.priorityArrowsEnabled);
- setupIntentUri = Utils.getValidUri(
- json.optString(AccountColumns.SettingsColumns.SETUP_INTENT_URI));
- conversationViewMode = json.optInt(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE,
+ forceReplyFromDefault = json.optBoolean(SettingsColumns.FORCE_REPLY_FROM_DEFAULT,
+ sDefault.forceReplyFromDefault);
+ maxAttachmentSize =
+ json.optInt(SettingsColumns.MAX_ATTACHMENT_SIZE, sDefault.maxAttachmentSize);
+ swipe = json.optInt(SettingsColumns.SWIPE, sDefault.swipe);
+ priorityArrowsEnabled = json.optBoolean(SettingsColumns.PRIORITY_ARROWS_ENABLED,
+ sDefault.priorityArrowsEnabled);
+ setupIntentUri = Utils.getValidUri(json.optString(SettingsColumns.SETUP_INTENT_URI));
+ conversationViewMode = json.optInt(SettingsColumns.CONVERSATION_VIEW_MODE,
UIProvider.ConversationViewMode.UNDEFINED);
- veiledAddressPattern =
- json.optString(AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, null);
+ veiledAddressPattern = json.optString(SettingsColumns.VEILED_ADDRESS_PATTERN, null);
}
/**
@@ -235,29 +212,26 @@
public synchronized JSONObject toJSON() {
final JSONObject json = new JSONObject();
try {
- json.put(AccountColumns.SettingsColumns.SIGNATURE,
- getNonNull(signature, sDefault.signature));
- json.put(AccountColumns.SettingsColumns.AUTO_ADVANCE, getAutoAdvanceSetting());
- json.put(AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE, messageTextSize);
- json.put(AccountColumns.SettingsColumns.SNAP_HEADERS, snapHeaders);
- json.put(AccountColumns.SettingsColumns.REPLY_BEHAVIOR, replyBehavior);
- json.put(AccountColumns.SettingsColumns.CONV_LIST_ICON, convListIcon);
- json.put(AccountColumns.SettingsColumns.CONFIRM_DELETE, confirmDelete);
- json.put(AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, confirmArchive);
- json.put(AccountColumns.SettingsColumns.CONFIRM_SEND, confirmSend);
- json.put(AccountColumns.SettingsColumns.DEFAULT_INBOX,
+ json.put(SettingsColumns.SIGNATURE, getNonNull(signature, sDefault.signature));
+ json.put(SettingsColumns.AUTO_ADVANCE, getAutoAdvanceSetting());
+ json.put(SettingsColumns.MESSAGE_TEXT_SIZE, messageTextSize);
+ json.put(SettingsColumns.SNAP_HEADERS, snapHeaders);
+ json.put(SettingsColumns.REPLY_BEHAVIOR, replyBehavior);
+ json.put(SettingsColumns.CONV_LIST_ICON, convListIcon);
+ json.put(SettingsColumns.CONFIRM_DELETE, confirmDelete);
+ json.put(SettingsColumns.CONFIRM_ARCHIVE, confirmArchive);
+ json.put(SettingsColumns.CONFIRM_SEND, confirmSend);
+ json.put(SettingsColumns.DEFAULT_INBOX,
getNonNull(defaultInbox, sDefault.defaultInbox));
- json.put(AccountColumns.SettingsColumns.DEFAULT_INBOX_NAME,
+ json.put(SettingsColumns.DEFAULT_INBOX_NAME,
getNonNull(defaultInboxName, sDefault.defaultInboxName));
- json.put(AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT,
- forceReplyFromDefault);
- json.put(AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE,
- maxAttachmentSize);
- json.put(AccountColumns.SettingsColumns.SWIPE, swipe);
- json.put(AccountColumns.SettingsColumns.PRIORITY_ARROWS_ENABLED, priorityArrowsEnabled);
- json.put(AccountColumns.SettingsColumns.SETUP_INTENT_URI, setupIntentUri);
- json.put(AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, conversationViewMode);
- json.put(AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, veiledAddressPattern);
+ json.put(SettingsColumns.FORCE_REPLY_FROM_DEFAULT, forceReplyFromDefault);
+ json.put(SettingsColumns.MAX_ATTACHMENT_SIZE, maxAttachmentSize);
+ json.put(SettingsColumns.SWIPE, swipe);
+ json.put(SettingsColumns.PRIORITY_ARROWS_ENABLED, priorityArrowsEnabled);
+ json.put(SettingsColumns.SETUP_INTENT_URI, setupIntentUri);
+ json.put(SettingsColumns.CONVERSATION_VIEW_MODE, conversationViewMode);
+ json.put(SettingsColumns.VEILED_ADDRESS_PATTERN, veiledAddressPattern);
} catch (JSONException e) {
LogUtils.wtf(LOG_TAG, e, "Could not serialize settings");
}
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index f0c74f3..878bfd4 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -375,7 +375,7 @@
* TODO: When we want to support a heterogeneous set of account types, this value may need
* to be moved to a global content provider.
*/
- public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
+ public static final String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
/**
* Uri for VIEW intent that will cause the help screens for this account type to be
@@ -383,7 +383,7 @@
* TODO: When we want to support a heterogeneous set of account types, this value may need
* to be moved to a global content provider.
*/
- public static String HELP_INTENT_URI = "helpIntentUri";
+ public static final String HELP_INTENT_URI = "helpIntentUri";
/**
* Uri for VIEW intent that will cause the send feedback for this account type to be
@@ -391,7 +391,7 @@
* TODO: When we want to support a heterogeneous set of account types, this value may need
* to be moved to a global content provider.
*/
- public static String SEND_FEEDBACK_INTENT_URI = "sendFeedbackIntentUri";
+ public static final String SEND_FEEDBACK_INTENT_URI = "sendFeedbackIntentUri";
/**
* Uri for VIEW intent that will cause the user to be prompted for authentication for
@@ -399,7 +399,7 @@
* handle this intent are expected to return {@link android.app.Activity#RESULT_OK} if the
* user successfully authenticated.
*/
- public static String REAUTHENTICATION_INTENT_URI = "reauthenticationUri";
+ public static final String REAUTHENTICATION_INTENT_URI = "reauthenticationUri";
/**
* This int column contains the current sync status of the account (the logical AND of the
@@ -770,16 +770,16 @@
* This int column represents the capabilities of the folder specified by
* FolderCapabilities flags.
*/
- public static String CAPABILITIES = "capabilities";
+ public static final String CAPABILITIES = "capabilities";
/**
* This int column represents whether or not this folder has any
* child folders.
*/
- public static String HAS_CHILDREN = "hasChildren";
+ public static final String HAS_CHILDREN = "hasChildren";
/**
* This int column represents how large the sync window is.
*/
- public static String SYNC_WINDOW = "syncWindow";
+ public static final String SYNC_WINDOW = "syncWindow";
/**
* This string column contains the content provider uri to return the
* list of conversations for this folder.
@@ -1001,41 +1001,41 @@
* This int column contains the number of messages in this conversation.
* For unthreaded, this will always be 1.
*/
- public static String NUM_MESSAGES = "numMessages";
+ public static final String NUM_MESSAGES = "numMessages";
/**
* This int column contains the number of drafts associated with this
* conversation.
*/
- public static String NUM_DRAFTS = "numDrafts";
+ public static final String NUM_DRAFTS = "numDrafts";
/**
* This int column contains the state of drafts and replies associated
* with this conversation. Use ConversationSendingState to interpret
* this field.
*/
- public static String SENDING_STATE = "sendingState";
+ public static final String SENDING_STATE = "sendingState";
/**
* This int column contains the priority of this conversation. Use
* ConversationPriority to interpret this field.
*/
- public static String PRIORITY = "priority";
+ public static final String PRIORITY = "priority";
/**
* This int column indicates whether the conversation has been read
*/
- public static String READ = "read";
+ public static final String READ = "read";
/**
* This int column indicates whether the conversation has been seen
*/
- public static String SEEN = "seen";
+ public static final String SEEN = "seen";
/**
* This int column indicates whether the conversation has been starred
*/
- public static String STARRED = "starred";
+ public static final String STARRED = "starred";
/**
* This blob column contains the marshalled form of a Parceled
@@ -1532,17 +1532,17 @@
/**
* This boolean column indicates whether the message has been read
*/
- public static String READ = "read";
+ public static final String READ = "read";
/**
* This boolean column indicates whether the message has been seen
*/
- public static String SEEN = "seen";
+ public static final String SEEN = "seen";
/**
* This boolean column indicates whether the message has been starred
*/
- public static String STARRED = "starred";
+ public static final String STARRED = "starred";
/**
* This integer column represents the offset in the message of quoted
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 523024c..ea2e82e 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -626,7 +626,7 @@
* is no drawer.
*/
@Override
- public void closeDrawerForNewList() {
+ public void closeDrawer(final boolean hasNewFolderOrAccount) {
mDrawerObservers.notifyChanged();
}
diff --git a/src/com/android/mail/ui/AccountController.java b/src/com/android/mail/ui/AccountController.java
index 951a9bc..32465c8 100644
--- a/src/com/android/mail/ui/AccountController.java
+++ b/src/com/android/mail/ui/AccountController.java
@@ -92,6 +92,8 @@
/**
* When the {@link FolderListFragment} has a new account ready for changing to,
* close the drawer and then wait for {@link DataSetObservable#notifyChanged()}.
+ * @param hasNewFolderOrAccount true if we need to load conversations for a different folder
+ * or account, false otherwise.
*/
- void closeDrawerForNewList();
+ void closeDrawer(boolean hasNewFolderOrAccount);
}
diff --git a/src/com/android/mail/ui/FolderListFragment.java b/src/com/android/mail/ui/FolderListFragment.java
index 623bf00..c93ffab 100644
--- a/src/com/android/mail/ui/FolderListFragment.java
+++ b/src/com/android/mail/ui/FolderListFragment.java
@@ -372,10 +372,6 @@
mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mListView.setEmptyView(null);
mListView.setDivider(null);
- // If we're not using tablet UI, set the background correctly
- if (!Utils.useTabletUI(getResources())) {
- mListView.setBackgroundResource(R.color.list_background_color);
- }
if (savedState != null && savedState.containsKey(BUNDLE_LIST_STATE)) {
mListView.onRestoreInstanceState(savedState.getParcelable(BUNDLE_LIST_STATE));
}
@@ -466,16 +462,18 @@
final Account account = drawerItem.mAccount;
if (account != null && account.settings.defaultInbox.equals(mSelectedFolderUri)) {
- // We're already in the default inbox for the same account, just re-check item.
+ // We're already in the default inbox for account, just re-check item ...
final int defaultInboxPosition = position + 1;
if (mListView.getChildAt(defaultInboxPosition) != null) {
mListView.setItemChecked(defaultInboxPosition, true);
}
+ // ... and close the drawer (no new target folders/accounts)
+ mAccountChanger.closeDrawer(false /* hasNewFolderOrAccount */);
} else {
// Switching accounts takes you to the inbox, which is always a system folder.
mSelectedFolderType = DrawerItem.FOLDER_SYSTEM;
mNextAccount = account;
- mAccountChanger.closeDrawerForNewList();
+ mAccountChanger.closeDrawer(true /* hasNewFolderOrAccount */);
}
} else if (itemType == DrawerItem.VIEW_FOLDER) {
// Folder type, so change folders only.
@@ -507,7 +505,10 @@
// Go to the conversation list for this folder.
if (!folder.uri.equals(mSelectedFolderUri)) {
mNextFolder = folder;
- mAccountChanger.closeDrawerForNewList();
+ mAccountChanger.closeDrawer(true /* hasNewFolderOrAccount */);
+ } else {
+ // Clicked on same folder, just close drawer
+ mAccountChanger.closeDrawer(false /* hasNewFolderOrAccount */);
}
}
}
@@ -1076,6 +1077,10 @@
manager.destroyLoader(FOLDER_LOADER_ID);
manager.restartLoader(FOLDER_LOADER_ID, Bundle.EMPTY, this);
// An updated cursor causes the entire list to refresh. No need to refresh the list.
+ // But we do need to blank out the current folder, since the account might not be
+ // synced.
+ mSelectedFolderUri = null;
+ mCurrentFolderForUnreadCheck = null;
} else if (account == null) {
// This should never happen currently, but is a safeguard against a very incorrect
// non-null account -> null account transition.
diff --git a/src/com/android/mail/ui/FolderSelectionActivity.java b/src/com/android/mail/ui/FolderSelectionActivity.java
index 4b66e09..71a7e40 100644
--- a/src/com/android/mail/ui/FolderSelectionActivity.java
+++ b/src/com/android/mail/ui/FolderSelectionActivity.java
@@ -133,7 +133,7 @@
* Since there is no drawer to wait for, notifyChanged to the observers.
*/
@Override
- public void closeDrawerForNewList() {
+ public void closeDrawer(final boolean hasNewFolderOrAccount) {
mDrawerObservers.notifyChanged();
}
};
diff --git a/src/com/android/mail/ui/OnePaneController.java b/src/com/android/mail/ui/OnePaneController.java
index 92b45d9..804317b 100644
--- a/src/com/android/mail/ui/OnePaneController.java
+++ b/src/com/android/mail/ui/OnePaneController.java
@@ -225,7 +225,7 @@
mDrawerPullout = (ViewGroup) mDrawerContainer.findViewById(R.id.drawer_pullout);
mDrawerContainer.setDrawerShadow(
mContext.getResources().getDrawable(R.drawable.drawer_shadow), Gravity.LEFT);
-
+ mDrawerPullout.setBackgroundResource(R.color.list_background_color);
mDrawerToggle = new ActionBarDrawerToggle((Activity)mActivity, mDrawerContainer,
R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
@@ -804,10 +804,10 @@
/**
* The default behavior calls mDrawerObserver's notifyChanged(). So, to notify the consumer of
* the observer that the drawer is closed, we simply make a call to
- * {@link AbstractActivityController#closeDrawerForNewList()}.
+ * {@link AbstractActivityController#closeDrawer(boolean)}.
*/
public void notifyDrawerClosed() {
- super.closeDrawerForNewList();
+ super.closeDrawer(true);
}
/**
@@ -816,7 +816,13 @@
* or put in an idle state.
*/
@Override
- public void closeDrawerForNewList() {
+ public void closeDrawer(final boolean hasNewFolderOrAccount) {
+ // If there are no new folders or accounts to switch to, just close the drawer
+ if (!hasNewFolderOrAccount) {
+ mDrawerContainer.closeDrawers();
+ return;
+ }
+
final ConversationListFragment conversationList = getConversationListFragment();
if (conversationList != null) {
mListViewForAnimating = conversationList.getListView();
diff --git a/src/com/android/mail/utils/NotificationUtils.java b/src/com/android/mail/utils/NotificationUtils.java
index 60eb343..06697dc 100644
--- a/src/com/android/mail/utils/NotificationUtils.java
+++ b/src/com/android/mail/utils/NotificationUtils.java
@@ -312,8 +312,8 @@
// Only resend notifications if the notifications are from the same folder
// and same account as the undo notification that was previously displayed.
- if (!Objects.equal(accountUri, notification.account.uri) &&
- !Objects.equal(folderUri, folder.uri)) {
+ if (accountUri != null && !Objects.equal(accountUri, notification.account.uri) &&
+ folderUri != null && !Objects.equal(folderUri, folder.uri)) {
continue;
}
diff --git a/src/com/android/mail/widget/WidgetService.java b/src/com/android/mail/widget/WidgetService.java
index c8ece7c..d2b9770 100644
--- a/src/com/android/mail/widget/WidgetService.java
+++ b/src/com/android/mail/widget/WidgetService.java
@@ -100,7 +100,7 @@
if (!TextUtils.isEmpty(account.name)) {
remoteViews.setTextViewText(R.id.widget_account, account.name);
}
- remoteViews.setViewVisibility(R.id.widget_unread_count, View.VISIBLE);
+ remoteViews.setViewVisibility(R.id.widget_unread_count, View.GONE);
remoteViews.setViewVisibility(R.id.widget_compose, View.VISIBLE);
remoteViews.setViewVisibility(R.id.conversation_list, View.VISIBLE);
remoteViews.setViewVisibility(R.id.empty_conversation_list, View.VISIBLE);
@@ -548,9 +548,17 @@
if (!TextUtils.isEmpty(mAccount.name)) {
remoteViews.setTextViewText(R.id.widget_account, mAccount.name);
}
- remoteViews.setViewVisibility(R.id.widget_unread_count, View.VISIBLE);
- remoteViews.setTextViewText(R.id.widget_unread_count,
- Utils.getUnreadCountString(mContext, unreadCount));
+
+ final String unreadCountString = Utils.getUnreadCountString(mContext, unreadCount);
+
+ // If there are 0 unread messages, hide the unread count text view.
+ // Otherwise, show the unread count.
+ if ("".equals(unreadCountString)) {
+ remoteViews.setViewVisibility(R.id.widget_unread_count, View.GONE);
+ } else {
+ remoteViews.setViewVisibility(R.id.widget_unread_count, View.VISIBLE);
+ remoteViews.setTextViewText(R.id.widget_unread_count, unreadCountString);
+ }
appWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews);
} else if (loader == mConversationCursorLoader) {