summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-12-02 14:43:44 -0800
committerWinson Chung <winsonc@google.com>2013-12-02 14:43:44 -0800
commit69e04ea5ab08ae923d5c8de079c7a36998e5e46a (patch)
treecc107d7f173deb2fd82252fd06fae43722d84eef /src
parenta50d34306c5fe6748392b493b5fbd4c54bf5f39f (diff)
downloadandroid_packages_apps_Trebuchet-69e04ea5ab08ae923d5c8de079c7a36998e5e46a.tar.gz
android_packages_apps_Trebuchet-69e04ea5ab08ae923d5c8de079c7a36998e5e46a.tar.bz2
android_packages_apps_Trebuchet-69e04ea5ab08ae923d5c8de079c7a36998e5e46a.zip
Modifying Workspace padding to account for Search Bar offsets. (Bug 11968598)
Change-Id: I26b8488afd6d75777e1d881f1105b5c1a89021d7
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 626ec42cb..930188587 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -310,7 +310,7 @@ public class DeviceProfile {
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 @@ public class DeviceProfile {
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 @@ 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;
@@ -569,13 +578,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);