small refactor

wet -> dry

Change-Id: Iccb44b3156d5a38d6f3d0ddfee5b8d21f00c98cd
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 031b00d..67cff54 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -660,8 +660,7 @@
     @Override
     public void switchToDefaultInboxOrChangeAccount(Account account) {
         LogUtils.d(LOG_TAG, "AAC.switchToDefaultAccount(%s)", account);
-        if (mViewMode.getMode() == ViewMode.SEARCH_RESULTS_LIST ||
-                mViewMode.getMode() == ViewMode.SEARCH_RESULTS_CONVERSATION) {
+        if (mViewMode.isSearchMode()) {
             // We are in an activity on top of the main navigation activity.
             // We need to return to it with a result code that indicates it should navigate to
             // a different folder.
@@ -4232,8 +4231,7 @@
             LogUtils.d(LOG_TAG, "AAC onDrawerStateChanged %d", newState);
             mDrawerState = newState;
             mDrawerToggle.onDrawerStateChanged(mDrawerState);
-            if (mViewMode.getMode() == ViewMode.SEARCH_RESULTS_LIST ||
-                    mViewMode.getMode() == ViewMode.SEARCH_RESULTS_CONVERSATION) {
+            if (mViewMode.isSearchMode()) {
                 return;
             }
             if (mDrawerState == DrawerLayout.STATE_IDLE) {
diff --git a/src/com/android/mail/ui/OnePaneController.java b/src/com/android/mail/ui/OnePaneController.java
index 5d37591..cd7fe31 100644
--- a/src/com/android/mail/ui/OnePaneController.java
+++ b/src/com/android/mail/ui/OnePaneController.java
@@ -340,8 +340,7 @@
 
     @Override
     public void onFolderSelected(Folder folder) {
-        if (mViewMode.getMode() == ViewMode.SEARCH_RESULTS_LIST ||
-                mViewMode.getMode() == ViewMode.SEARCH_RESULTS_CONVERSATION) {
+        if (mViewMode.isSearchMode()) {
             // We are in an activity on top of the main navigation activity.
             // We need to return to it with a result code that indicates it should navigate to
             // a different folder.
diff --git a/src/com/android/mail/ui/TwoPaneController.java b/src/com/android/mail/ui/TwoPaneController.java
index 134cd1c..3bdf25a 100644
--- a/src/com/android/mail/ui/TwoPaneController.java
+++ b/src/com/android/mail/ui/TwoPaneController.java
@@ -162,8 +162,7 @@
 
     @Override
     public void switchToDefaultInboxOrChangeAccount(Account account) {
-        if (mViewMode.getMode() == ViewMode.SEARCH_RESULTS_LIST ||
-                mViewMode.getMode() == ViewMode.SEARCH_RESULTS_CONVERSATION) {
+        if (mViewMode.isSearchMode()) {
             // We are in an activity on top of the main navigation activity.
             // We need to return to it with a result code that indicates it should navigate to
             // a different folder.
@@ -182,8 +181,7 @@
     @Override
     public void onFolderSelected(Folder folder) {
         // It's possible that we are not in conversation list mode
-        if (mViewMode.getMode() == ViewMode.SEARCH_RESULTS_LIST ||
-                mViewMode.getMode() == ViewMode.SEARCH_RESULTS_CONVERSATION) {
+        if (mViewMode.isSearchMode()) {
             // We are in an activity on top of the main navigation activity.
             // We need to return to it with a result code that indicates it should navigate to
             // a different folder.
diff --git a/src/com/android/mail/ui/ViewMode.java b/src/com/android/mail/ui/ViewMode.java
index b5ba3b5..1234617 100644
--- a/src/com/android/mail/ui/ViewMode.java
+++ b/src/com/android/mail/ui/ViewMode.java
@@ -202,6 +202,10 @@
         return mode == CONVERSATION || mode == SEARCH_RESULTS_CONVERSATION;
     }
 
+    public boolean isSearchMode() {
+        return isSearchMode(mMode);
+    }
+
     public static boolean isSearchMode(final int mode) {
         return mode == SEARCH_RESULTS_LIST || mode == SEARCH_RESULTS_CONVERSATION;
     }