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
committercretin45 <cretin45@gmail.com>2015-12-16 11:46:58 -0800
commite524508dc1808f07feca3e6aa290d80adee421e0 (patch)
treebbce44613eae8f2c9164a4a3ddd90d1e887b9061 /src/com/android/launcher3/Launcher.java
parent1b0f2b4127d1893c244896f5d94e1e0342ce601e (diff)
downloadandroid_packages_apps_Trebuchet-e524508dc1808f07feca3e6aa290d80adee421e0.tar.gz
android_packages_apps_Trebuchet-e524508dc1808f07feca3e6aa290d80adee421e0.tar.bz2
android_packages_apps_Trebuchet-e524508dc1808f07feca3e6aa290d80adee421e0.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;