diff options
author | Andy Huang <ath@google.com> | 2014-02-26 11:55:03 -0800 |
---|---|---|
committer | Andy Huang <ath@google.com> | 2014-02-26 11:56:27 -0800 |
commit | e764cfd130c4f92ae823fd1f361ab70439e8ec95 (patch) | |
tree | bcebc3a50f8af347bf44a467b167d1d85de6a805 | |
parent | 874b2354e7662f43609a51d47f7ac02fd61a8bcc (diff) | |
download | android_packages_apps_UnifiedEmail-e764cfd130c4f92ae823fd1f361ab70439e8ec95.tar.gz android_packages_apps_UnifiedEmail-e764cfd130c4f92ae823fd1f361ab70439e8ec95.tar.bz2 android_packages_apps_UnifiedEmail-e764cfd130c4f92ae823fd1f361ab70439e8ec95.zip |
small refactor
wet -> dry
Change-Id: Iccb44b3156d5a38d6f3d0ddfee5b8d21f00c98cd
-rw-r--r-- | src/com/android/mail/ui/AbstractActivityController.java | 6 | ||||
-rw-r--r-- | src/com/android/mail/ui/OnePaneController.java | 3 | ||||
-rw-r--r-- | src/com/android/mail/ui/TwoPaneController.java | 6 | ||||
-rw-r--r-- | src/com/android/mail/ui/ViewMode.java | 4 |
4 files changed, 9 insertions, 10 deletions
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java index 031b00dc6..67cff54dc 100644 --- a/src/com/android/mail/ui/AbstractActivityController.java +++ b/src/com/android/mail/ui/AbstractActivityController.java @@ -660,8 +660,7 @@ public abstract class AbstractActivityController implements ActivityController, @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 @@ public abstract class AbstractActivityController implements ActivityController, 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 5d3759143..cd7fe3158 100644 --- a/src/com/android/mail/ui/OnePaneController.java +++ b/src/com/android/mail/ui/OnePaneController.java @@ -340,8 +340,7 @@ public final class OnePaneController extends AbstractActivityController { @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 134cd1c83..3bdf25a0d 100644 --- a/src/com/android/mail/ui/TwoPaneController.java +++ b/src/com/android/mail/ui/TwoPaneController.java @@ -162,8 +162,7 @@ public final class TwoPaneController extends AbstractActivityController { @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 @@ public final class TwoPaneController extends AbstractActivityController { @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 b5ba3b525..12346174c 100644 --- a/src/com/android/mail/ui/ViewMode.java +++ b/src/com/android/mail/ui/ViewMode.java @@ -202,6 +202,10 @@ public class ViewMode { 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; } |