summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorMartin Herndl <martin.herndl@gmail.com>2015-12-16 15:37:11 +0100
committerTom Powell <zifnab@zifnab06.net>2017-03-26 15:52:43 -0700
commit68313b2f89ac59a9c56858b739f93db2e19cc427 (patch)
treed3aa6a83a5b742a1d92d5fc84792613db24da53f /src/com/android/launcher3/Launcher.java
parentc9cbd24d946e2d7a964348e0af7e4012c5aa94b1 (diff)
downloadandroid_packages_apps_Trebuchet-68313b2f89ac59a9c56858b739f93db2e19cc427.tar.gz
android_packages_apps_Trebuchet-68313b2f89ac59a9c56858b739f93db2e19cc427.tar.bz2
android_packages_apps_Trebuchet-68313b2f89ac59a9c56858b739f93db2e19cc427.zip
Add app drawer search bar toggle to settings
This adds the possibility to enable or disable the search bar on top of the app drawer. In the Launcher class it will be created with the View.GONE visibility to avoid taking up space if disabled. Per default it behaves like before and is enabled. PS3: Make sure the hasSearchBar boolean is set. Change-Id: I48711aea2b15bf535815d0e453ac33079af26eca
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 228be03b7..f8044aa5b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1581,11 +1581,7 @@ public class Launcher extends Activity
// Setup Apps and Widgets
mAppsView = (AllAppsContainerView) findViewById(R.id.apps_view);
mWidgetsView = (WidgetsContainerView) findViewById(R.id.widgets_view);
- if (mLauncherCallbacks != null && mLauncherCallbacks.getAllAppsSearchBarController() != null) {
- mAppsView.setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController());
- } else {
- mAppsView.setSearchBarController(mAppsView.newDefaultAppSearchController());
- }
+ setupSearchBar(this);
// Setup the drag controller (drop targets have to be added in reverse order in priority)
dragController.setDragScoller(mWorkspace);
@@ -1863,11 +1859,7 @@ public class Launcher extends Activity
.from(this).inflate(R.layout.all_apps, mDragLayer, false);
mDragLayer.addView(mAppsView, mDragLayer.getChildCount() - 1);
mAppsView.setVisibility(View.INVISIBLE);
- if (mLauncherCallbacks != null && mLauncherCallbacks.getAllAppsSearchBarController() != null) {
- mAppsView.setSearchBarController(mLauncherCallbacks.getAllAppsSearchBarController());
- } else {
- mAppsView.setSearchBarController(mAppsView.newDefaultAppSearchController());
- }
+ setupSearchBar(this);
mAppsView.addApps(addedApps);
tryAndUpdatePredictedApps();
mAppsView.reset();
@@ -5144,6 +5136,21 @@ public class Launcher extends Activity
}
}
+ private void setupSearchBar(Context context) {
+ boolean isDrawerSearchBarEnabled = 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());
+ } else {
+ mAppsView.setSearchBarController(mAppsView.newDefaultAppSearchController());
+ }
+ mAppsView.setHasSearchBar(isDrawerSearchBarEnabled);
+ mAppsView.setSearchBarContainerViewVisibility(
+ isDrawerSearchBarEnabled ? View.VISIBLE : View.GONE);
+ }
+
class SettingsPanelSlideListener extends VerticalSlidingPanel.SimplePanelSlideListener {
ImageView mAnimatedArrow;