Merge "Fix folder NPE in DrawerItem" into jb-ub-mail-ur9
diff --git a/src/com/android/mail/ui/OnePaneController.java b/src/com/android/mail/ui/OnePaneController.java
index fc33b8d..4496489 100644
--- a/src/com/android/mail/ui/OnePaneController.java
+++ b/src/com/android/mail/ui/OnePaneController.java
@@ -191,8 +191,14 @@
public void onViewModeChanged(int newMode) {
super.onViewModeChanged(newMode);
- // When view mode changes, we should wait for drawer to close and
- // repopulate folders.
+ // When view mode changes, lock drawer if viewing search results or
+ // waiting for sync. Afterward, reset drawer state and load the folder
+ // fragment into the drawer pullout.
+ if (ViewMode.isSearchMode(newMode)) {
+ mDrawerContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+ } else {
+ mDrawerContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
+ }
resetAndLoadDrawer();
// When entering conversation list mode, hide and clean up any currently visible
diff --git a/src/com/android/mail/ui/ViewMode.java b/src/com/android/mail/ui/ViewMode.java
index 9644fdc..62dfa59 100644
--- a/src/com/android/mail/ui/ViewMode.java
+++ b/src/com/android/mail/ui/ViewMode.java
@@ -170,7 +170,7 @@
return isListMode(mMode);
}
- public static final boolean isListMode(int mode) {
+ public static boolean isListMode(final int mode) {
return mode == CONVERSATION_LIST || mode == SEARCH_RESULTS_LIST;
}
@@ -178,12 +178,20 @@
return isConversationMode(mMode);
}
- public static final boolean isConversationMode(int mode) {
+ public static boolean isConversationMode(final int mode) {
return mode == CONVERSATION || mode == SEARCH_RESULTS_CONVERSATION;
}
+ public static boolean isSearchMode(final int mode) {
+ return mode == SEARCH_RESULTS_LIST || mode == SEARCH_RESULTS_CONVERSATION;
+ }
+
public boolean isWaitingForSync() {
- return mMode == WAITING_FOR_ACCOUNT_INITIALIZATION;
+ return isWaitingForSync(mMode);
+ }
+
+ public static boolean isWaitingForSync(final int mode) {
+ return mode == WAITING_FOR_ACCOUNT_INITIALIZATION;
}
/**