summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-07-26 23:59:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-07-26 23:59:59 +0000
commitb35bb6021c0a2a4f43c8edc78448e23ee8969fc8 (patch)
treebe328fe0493b6cd320cfd63cf29b300e4f49e150 /src
parent254bd42729e404d13a779b73b2f5dd67fa21e7da (diff)
parent30d0aa2605a9f47e0e1f3d7ae04859f51ce7cf10 (diff)
downloadandroid_packages_apps_Trebuchet-b35bb6021c0a2a4f43c8edc78448e23ee8969fc8.tar.gz
android_packages_apps_Trebuchet-b35bb6021c0a2a4f43c8edc78448e23ee8969fc8.tar.bz2
android_packages_apps_Trebuchet-b35bb6021c0a2a4f43c8edc78448e23ee8969fc8.zip
Merge "Launcher grid changes." into ub-launcher3-dorval-polish
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index bd239690f..031bfe115 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -63,6 +63,8 @@ public class DeviceProfile {
*/
private static final float MAX_HORIZONTAL_PADDING_PERCENT = 0.14f;
+ private static final float TALL_DEVICE_ASPECT_RATIO_THRESHOLD = 1.82f;
+
// Overview mode
private final int overviewModeMinIconZoneHeightPx;
private final int overviewModeMaxIconZoneHeightPx;
@@ -173,7 +175,8 @@ public class DeviceProfile {
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
- cellLayoutPaddingLeftRightPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
+ cellLayoutPaddingLeftRightPx =
+ res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
pageIndicatorSizePx = res.getDimensionPixelSize(
R.dimen.dynamic_grid_min_page_indicator_size);
pageIndicatorLandGutterPx = res.getDimensionPixelSize(
@@ -235,17 +238,18 @@ public class DeviceProfile {
updateAvailableDimensions(dm, res);
// Now that we have all of the variables calculated, we can tune certain sizes.
- if (!isVerticalBarLayout()) {
+ float aspectRatio = ((float) Math.max(availableWidthPx, availableHeightPx))
+ / Math.min(availableWidthPx, availableHeightPx);
+ boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0;
+ if (!isVerticalBarLayout() && isPhone && isTallDevice) {
// We increase the page indicator size when there is extra space.
// ie. For a display with a large aspect ratio, we can keep the icons on the workspace
// in portrait mode closer together by increasing the page indicator size.
- int newPageIndicatorSizePx = getCellSize().y - iconSizePx - iconTextSizePx
- - iconDrawablePaddingOriginalPx;
- if (newPageIndicatorSizePx > pageIndicatorSizePx) {
- pageIndicatorSizePx = newPageIndicatorSizePx;
- // Recalculate the available dimensions using the new page indicator size.
- updateAvailableDimensions(dm, res);
- }
+ // Note: This calculation was created after noticing a pattern in the design spec.
+ pageIndicatorSizePx = getCellSize().y - iconSizePx - iconDrawablePaddingPx;
+
+ // Recalculate the available dimensions using the new page indicator size.
+ updateAvailableDimensions(dm, res);
}
computeAllAppsButtonSize(context);