Merge "Add support for caching the account list"
diff --git a/res/values-sw600dp-port/constants.xml b/res/values-sw600dp-port/constants.xml
new file mode 100644
index 0000000..90883a3
--- /dev/null
+++ b/res/values-sw600dp-port/constants.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2011 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.
+-->
+<resources>
+ <!-- Boolean value indicating whether the table UI should be used. -->
+ <integer name="use_tablet_ui">1</integer>
+ <!-- Boolean value indicating whether conversation can be collapsed. -->
+ <integer name="conversation_list_collapsible">1</integer>
+ <integer name="conversation_header_mode">1</integer>
+ <integer name="folder_list_weight">1</integer>
+ <integer name="conversation_list_weight">2</integer>
+ <integer name="conversation_view_weight">1</integer>
+</resources>
\ No newline at end of file
diff --git a/res/values-sw600dp/constants.xml b/res/values-sw600dp/constants.xml
index d9523c3..266ca5b 100644
--- a/res/values-sw600dp/constants.xml
+++ b/res/values-sw600dp/constants.xml
@@ -19,4 +19,7 @@
<!-- Boolean value indicating whether the table UI should be used. -->
<integer name="use_tablet_ui">1</integer>
<integer name="conversation_header_mode">1</integer>
+ <integer name="folder_list_weight">1</integer>
+ <integer name="conversation_list_weight">3</integer>
+ <integer name="conversation_view_weight">3</integer>
</resources>
diff --git a/res/values-sw720dp-land/constants.xml b/res/values-sw720dp-land/constants.xml
new file mode 100644
index 0000000..8eea1b1
--- /dev/null
+++ b/res/values-sw720dp-land/constants.xml
@@ -0,0 +1,27 @@
+<!--
+ Copyright (C) 2011 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.
+-->
+<resources>
+ <!-- Boolean value indicating whether conversation can be collapsed. -->
+ <integer name="conversation_list_collapsible">0</integer>
+ <integer name="conversation_list_header_mode">0</integer>
+ <!-- Boolean value indicating whether, from within the conversation view, the mark unread
+ action can be shown with the archive action. -->
+ <integer name="can_show_conversation_mark_unread_with_archive_action">0</integer>
+ <integer name="folder_list_weight">1</integer>
+ <integer name="conversation_list_weight">3</integer>
+ <integer name="conversation_view_weight">6</integer>
+</resources>
\ No newline at end of file
diff --git a/res/values-sw720dp/constants.xml b/res/values-sw720dp/constants.xml
new file mode 100644
index 0000000..f82bc72
--- /dev/null
+++ b/res/values-sw720dp/constants.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright (C) 2011 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.
+-->
+<resources>
+ <integer name="folder_list_weight">1</integer>
+ <integer name="conversation_list_weight">3</integer>
+ <integer name="conversation_view_weight">3</integer>
+</resources>
\ No newline at end of file
diff --git a/src/com/android/mail/ui/TwoPaneLayout.java b/src/com/android/mail/ui/TwoPaneLayout.java
index a94f058..f192909 100644
--- a/src/com/android/mail/ui/TwoPaneLayout.java
+++ b/src/com/android/mail/ui/TwoPaneLayout.java
@@ -575,7 +575,7 @@
// size changes for any reason (e.g. orientation change).
mConversationListContainer.getLayoutParams().width =
ViewGroup.LayoutParams.MATCH_PARENT;
-
+ requestLayout();
dispatchConversationListVisibilityChange();
dispatchConversationVisibilityChanged(false);
}
diff --git a/src/com/android/mail/utils/AccountUtils.java b/src/com/android/mail/utils/AccountUtils.java
index 26d927a..b745291 100644
--- a/src/com/android/mail/utils/AccountUtils.java
+++ b/src/com/android/mail/utils/AccountUtils.java
@@ -74,14 +74,21 @@
public static Account[] getSyncingAccounts(Context context,
AccountManagerCallback<Account[]> callback, String type, String[] features) {
ContentResolver resolver = context.getContentResolver();
- Cursor accountsCursor = resolver.query(AccountCacheProvider.getAccountsUri(),
- UIProvider.ACCOUNTS_PROJECTION, null, null, null);
+ Cursor accountsCursor = null;
ArrayList<Account> accounts = new ArrayList<Account>();
Account account;
- if (accountsCursor != null) {
- while (accountsCursor.moveToNext()) {
- account = new Account(accountsCursor);
- accounts.add(account);
+ try {
+ accountsCursor = resolver.query(AccountCacheProvider.getAccountsUri(),
+ UIProvider.ACCOUNTS_PROJECTION, null, null, null);
+ if (accountsCursor != null) {
+ while (accountsCursor.moveToNext()) {
+ account = new Account(accountsCursor);
+ accounts.add(account);
+ }
+ }
+ } finally {
+ if (accountsCursor != null) {
+ accountsCursor.close();
}
}
return accounts.toArray(new Account[accounts.size()]);