summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-01-13 14:40:54 -0800
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:14:44 -0700
commitfead876334da6f5d8c67d2a0a6788896d524a87b (patch)
tree59f54b9ec005726d115fd925cfca270102f6400c
parent6987542672e89726d512dee5186e60354f29d932 (diff)
downloadandroid_packages_apps_Trebuchet-fead876334da6f5d8c67d2a0a6788896d524a87b.zip
android_packages_apps_Trebuchet-fead876334da6f5d8c67d2a0a6788896d524a87b.tar.gz
android_packages_apps_Trebuchet-fead876334da6f5d8c67d2a0a6788896d524a87b.tar.bz2
Trebuchet: Remove app search controller if turned off
Issue-id: CYNGNOS-1590 Change-Id: I0e5e8eacfc696380947f1667fd5ebd927252e125
-rw-r--r--src/com/android/launcher3/Launcher.java23
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java4
2 files changed, 20 insertions, 7 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 5dc7f93..901a9b2 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -365,6 +365,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.
@@ -5154,18 +5156,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 5434e72..18030b4 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");
}