summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Miranda <jonmiranda@google.com>2017-07-25 22:54:53 +0000
committerJonathan Miranda <jonmiranda@google.com>2017-07-25 22:54:53 +0000
commit3aa645b7e6154f326ba4aa825f0a9f5b92d5bd37 (patch)
tree3ed3ebf5bef6316643f7ab8a7a95c81703f084d4
parentcab2e0e8a1ac529227a4b89646e44ba197087de2 (diff)
parent30d0aa2605a9f47e0e1f3d7ae04859f51ce7cf10 (diff)
downloadandroid_packages_apps_Trebuchet-3aa645b7e6154f326ba4aa825f0a9f5b92d5bd37.tar.gz
android_packages_apps_Trebuchet-3aa645b7e6154f326ba4aa825f0a9f5b92d5bd37.tar.bz2
android_packages_apps_Trebuchet-3aa645b7e6154f326ba4aa825f0a9f5b92d5bd37.zip
[automerger] Launcher grid changes. am: 30d0aa2605
Change-Id: I2acf9e9086534266b97846fbf3d9ea4181839f6f
-rw-r--r--res/values-land/dimens.xml2
-rw-r--r--res/values/dimens.xml1
-rw-r--r--src/com/android/launcher3/DeviceProfile.java22
3 files changed, 16 insertions, 9 deletions
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 3ecdf59dc..1b58e1775 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -29,6 +29,8 @@
<dimen name="dynamic_grid_min_page_indicator_size">48dp</dimen>
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
+ <dimen name="dynamic_grid_cell_layout_padding">0dp</dimen>
+
<dimen name="folder_preview_padding">2dp</dimen>
<!-- Hotseat -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0eb3982ca..1d93b2ae4 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -30,6 +30,7 @@
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
+ <dimen name="dynamic_grid_cell_layout_padding">5.5dp</dimen>
<dimen name="dynamic_grid_cell_padding_x">8dp</dimen>
<!-- Hotseat -->
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index cb4ad55c7..153131b0b 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;
@@ -174,7 +176,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(
@@ -239,17 +242,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);