am 1a5adf4f: Merge "Modifying Workspace padding to account for Search Bar offsets. (Bug 11968598)" into jb-ub-now-jolly-elf
* commit '1a5adf4f4cb30114fc0e508651b2833dd15674d0':
Modifying Workspace padding to account for Search Bar offsets. (Bug 11968598)
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 626ec42..9301885 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -310,7 +310,7 @@
searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width);
searchBarHeightPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height);
searchBarSpaceWidthPx = Math.min(searchBarSpaceMaxWidthPx, widthPx);
- searchBarSpaceHeightPx = searchBarHeightPx + 2 * edgeMarginPx;
+ searchBarSpaceHeightPx = searchBarHeightPx + getSearchBarTopOffset();
// Calculate the actual text height
Paint textPaint = new Paint();
@@ -419,6 +419,15 @@
return sum;
}
+ /** Returns the search bar top offset */
+ int getSearchBarTopOffset() {
+ if (isTablet() && !isVerticalBarLayout()) {
+ return 4 * edgeMarginPx;
+ } else {
+ return 2 * edgeMarginPx;
+ }
+ }
+
/** Returns the search bar bounds in the current orientation */
Rect getSearchBarBounds() {
return getSearchBarBounds(isLandscape ? CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
@@ -561,7 +570,7 @@
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;
@@ -569,13 +578,13 @@
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);