diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml index 2bbd76d52e..e6f98a49ae 100644 --- a/res/layout-land/launcher.xml +++ b/res/layout-land/launcher.xml @@ -63,8 +63,8 @@ + android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 0db0e615fd..1d36f75cb0 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -26,7 +26,7 @@ 120dp - 24dp + 24dp 5dp diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 980b714830..21abd3c936 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -17,7 +17,7 @@ 16dp - 32dp + 32dp 1dp 50dp 8dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index eef651044b..7520be2f6e 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -80,7 +80,7 @@ public class DeviceProfile { public final int workspaceSpringLoadedBottomSpace; // Page indicator - private final int pageIndicatorSizePx; + private int pageIndicatorSizePx; private final int pageIndicatorLandGutterPx; private final int pageIndicatorLandWorkspaceOffsetPx; @@ -172,7 +172,8 @@ public class DeviceProfile { defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null); edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); desiredWorkspaceLeftRightMarginPx = edgeMarginPx; - pageIndicatorSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_size); + pageIndicatorSizePx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_min_page_indicator_size); pageIndicatorLandGutterPx = res.getDimensionPixelSize( R.dimen.dynamic_grid_page_indicator_gutter_width); pageIndicatorLandWorkspaceOffsetPx = @@ -228,8 +229,23 @@ public class DeviceProfile { availableHeightPx = maxSize.y; } - // Calculate the remaining vars + // Calculate all of the remaining variables. updateAvailableDimensions(dm, res); + + // Now that we have all of the variables calculated, we can tune certain sizes. + if (!isVerticalBarLayout()) { + // 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); + } + } + computeAllAppsButtonSize(context); // This is done last, after iconSizePx is calculated above. @@ -484,8 +500,8 @@ public class DeviceProfile { return new Rect(mInsets.left, mInsets.top + dropTargetBarSizePx + edgeMarginPx, mInsets.left + availableWidthPx, - mInsets.top + availableHeightPx - hotseatBarHeightPx - pageIndicatorSizePx - - edgeMarginPx); + mInsets.top + availableHeightPx - hotseatBarHeightPx + - pageIndicatorSizePx - edgeMarginPx); } }