summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeviceProfile.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/DeviceProfile.java')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9bdfcf41b..d6c401d4f 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -315,8 +315,7 @@ public class DeviceProfile {
updateAvailableDimensions(context);
computeAllAppsButtonSize(context);
// Search Bar
- searchBarVisible = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
- R.bool.preferences_interface_homescreen_search_default);
+ searchBarVisible = isSearchBarEnabled(context);
searchBarSpaceWidthPx = Math.min(searchBarSpaceMaxWidthPx, widthPx);
searchBarSpaceHeightPx = 2 * edgeMarginPx + (searchBarVisible ? searchBarHeightPx : 3 * edgeMarginPx);
}
@@ -780,8 +779,7 @@ public class DeviceProfile {
public void layout(Launcher launcher) {
// Update search bar for live settings
- searchBarVisible = SettingsProvider.getBoolean(launcher, SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
- R.bool.preferences_interface_homescreen_search_default);
+ searchBarVisible = isSearchBarEnabled(launcher);
searchBarSpaceHeightPx = 2 * edgeMarginPx + (searchBarVisible ? searchBarHeightPx : 3 * edgeMarginPx);
FrameLayout.LayoutParams lp;
Resources res = launcher.getResources();
@@ -960,4 +958,24 @@ public class DeviceProfile {
}
}
}
+
+ private boolean isSearchBarEnabled(Context context) {
+ boolean searchActivityExists = Utilities.searchActivityExists(context);
+
+ boolean isSearchEnabled = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
+ R.bool.preferences_interface_homescreen_search_default);
+
+ if (searchActivityExists) {
+ return isSearchEnabled;
+ } else {
+ if (isSearchEnabled) {
+ // Disable search bar
+ SettingsProvider.putBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH, false);
+ }
+
+ return false;
+ }
+ }
}