summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeviceProfile.java
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-03-17 15:59:06 -0700
committerRajesh Yengisetty <rajesh@cyngn.com>2015-03-17 23:01:20 +0000
commit5482c2f488e7ce312a85e7440b72865d1f2cf598 (patch)
treee833b7bf5af7febbf8ab45d8118c6f86b5500e0e /src/com/android/launcher3/DeviceProfile.java
parentb4b01cdc995309f0b850c5de928d147b83e97fbd (diff)
downloadpackages_apps_Trebuchet-5482c2f488e7ce312a85e7440b72865d1f2cf598.tar.gz
packages_apps_Trebuchet-5482c2f488e7ce312a85e7440b72865d1f2cf598.tar.bz2
packages_apps_Trebuchet-5482c2f488e7ce312a85e7440b72865d1f2cf598.zip
Trebuchet: disable search bar when there are no search activities
- On non-GMS devices, there are no Search apps which can support the search bar implementation. - Disable the search bar entirely if there is no search activity - Add a new utility method in SettingsProvider Change-Id: I3bcbceae4ceab308e4d797dad107e0a2ab72d673
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;
+ }
+ }
}