diff options
author | cretin45 <cretin45@gmail.com> | 2016-01-13 14:40:54 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-01-13 14:41:41 -0800 |
commit | fb312defb7f570d2e3a6ed2357735759c647cb8b (patch) | |
tree | 9500a52a726a7091ac57ce5c695d22f2afe5cc3e | |
parent | 5b044565f7e509069b5bdff4e71fd11281dc171f (diff) | |
download | android_packages_apps_Trebuchet-fb312defb7f570d2e3a6ed2357735759c647cb8b.tar.gz android_packages_apps_Trebuchet-fb312defb7f570d2e3a6ed2357735759c647cb8b.tar.bz2 android_packages_apps_Trebuchet-fb312defb7f570d2e3a6ed2357735759c647cb8b.zip |
Trebuchet: Remove app search controller if turned off
Issue-id: CYNGNOS-1590
Change-Id: I0e5e8eacfc696380947f1667fd5ebd927252e125
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 23 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 4 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b9acd5a96..5e55f5f12 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -371,6 +371,8 @@ public class Launcher extends Activity private boolean mUseScrubber = true; + private boolean mIsDrawerSearchBarEnabled; + // This is set to the view that launched the activity that navigated the user away from // launcher. Since there is no callback for when the activity has finished launching, enable // the press state and keep this reference to reset the press state when we return to launcher. @@ -5187,18 +5189,25 @@ public class Launcher extends Activity } private void setupSearchBar(Context context) { - boolean isDrawerSearchBarEnabled = SettingsProvider.getBoolean(context, + mIsDrawerSearchBarEnabled = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_DRAWER_SEARCH, R.bool.preferences_interface_homescreen_search_default); - if (mLauncherCallbacks != null && mLauncherCallbacks.getAllAppsSearchBarController() != null) { - mAppsView.setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController()); + if (mIsDrawerSearchBarEnabled) { + if (mLauncherCallbacks != null + && mLauncherCallbacks.getAllAppsSearchBarController() != null) { + mAppsView + .setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController()); + } else { + mAppsView.setSearchBarController(mAppsView.newDefaultAppSearchController()); + } } else { - mAppsView.setSearchBarController(mAppsView.newDefaultAppSearchController()); + mAppsView.setSearchBarController(null); + mAppsView.setHasSearchBar(mIsDrawerSearchBarEnabled); + mAppsView.setSearchBarContainerViewVisibility( + mIsDrawerSearchBarEnabled ? View.VISIBLE : View.GONE); + mAppsView.updateBackgroundAndPaddings(); } - mAppsView.setHasSearchBar(isDrawerSearchBarEnabled); - mAppsView.setSearchBarContainerViewVisibility( - isDrawerSearchBarEnabled ? View.VISIBLE : View.GONE); } class SettingsPanelSlideListener extends VerticalSlidingPanel.SimplePanelSlideListener { diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 5434e720f..18030b451 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -290,6 +290,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc * Sets the search bar that shows above the a-z list. */ public void setSearchBarController(AllAppsSearchBarController searchController) { + if (searchController == null) { + mSearchBarController = null; + return; + } if (mSearchBarController != null) { throw new RuntimeException("Expected search bar controller to only be set once"); } |