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 ec6e47f49..78ebb7f39 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -294,8 +294,7 @@ public class DeviceProfile {
updateAvailableDimensions(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);
}
@@ -705,8 +704,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();
@@ -884,4 +882,24 @@ public class DeviceProfile {
// overviewMode.setLayoutParams(lp);
// }
}
+
+ 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;
+ }
+ }
}