diff options
author | Winson Chung <winsonc@google.com> | 2013-12-02 14:43:44 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:20 -0700 |
commit | dd0f6a8089d9dd126c3844a1d3bc192aee40d279 (patch) | |
tree | 850c0c63b305b9e471c89290640c69d39dee5fc4 /src/com/android/launcher3 | |
parent | 5f5c4b784eacc28ce86c2183c7be00fabbc18df4 (diff) | |
download | android_packages_apps_Trebuchet-dd0f6a8089d9dd126c3844a1d3bc192aee40d279.tar.gz android_packages_apps_Trebuchet-dd0f6a8089d9dd126c3844a1d3bc192aee40d279.tar.bz2 android_packages_apps_Trebuchet-dd0f6a8089d9dd126c3844a1d3bc192aee40d279.zip |
Modifying Workspace padding to account for Search Bar offsets. (Bug 11968598)
Change-Id: I26b8488afd6d75777e1d881f1105b5c1a89021d7
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index d6acd1ca0..5c6d77f4a 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -318,9 +318,9 @@ public class DeviceProfile { // Search Bar searchBarSpaceWidthPx = Math.min(searchBarSpaceMaxWidthPx, widthPx); - searchBarSpaceHeightPx = searchBarHeightPx + (searchBarVisible ? 2 * edgeMarginPx : 0); searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width); searchBarHeightPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height); + searchBarSpaceHeightPx = searchBarHeightPx + getSearchBarTopOffset(); // Calculate the actual text height Paint textPaint = new Paint(); @@ -436,6 +436,15 @@ public class DeviceProfile { return sum; } + /** Returns the search bar top offset */ + int getSearchBarTopOffset() { + if (isTablet() && !isVerticalBarLayout()) { + return searchBarVisible ? 4 * edgeMarginPx : 0; + } else { + return searchBarVisible ? 2 * edgeMarginPx : 0; + } + } + /** Returns the search bar bounds in the current orientation */ Rect getSearchBarBounds() { return getSearchBarBounds(isLandscape ? CellLayout.LANDSCAPE : CellLayout.PORTRAIT); @@ -583,7 +592,7 @@ public class DeviceProfile { View searchBar = launcher.getSearchBar(); lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams(); if (hasVerticalBarLayout) { - // Vertical search bar + // Vertical search bar space lp.gravity = Gravity.TOP | Gravity.LEFT; lp.width = searchBarSpaceHeightPx; lp.height = LayoutParams.MATCH_PARENT; @@ -591,13 +600,13 @@ public class DeviceProfile { 0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx); } else { - // Horizontal search bar + // Horizontal search bar space lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; lp.width = searchBarSpaceWidthPx; lp.height = searchBarSpaceHeightPx; searchBar.setPadding( 2 * edgeMarginPx, - 2 * edgeMarginPx, + getSearchBarTopOffset(), 2 * edgeMarginPx, 0); } searchBar.setLayoutParams(lp); |