New calculation for page indicator size on tall devices.

am: 2ed276eb13

Change-Id: Ie3fdf1e1f646d4b4ecab5e9ecb542253bb85ca1b
This commit is contained in:
Jon Miranda 2017-07-06 15:20:03 +00:00 committed by android-build-merger
commit 050406fcd9
5 changed files with 27 additions and 11 deletions

View File

@ -63,8 +63,8 @@
<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
android:id="@+id/page_indicator"
android:theme="@style/HomeScreenElementTheme"
android:layout_width="@dimen/dynamic_grid_page_indicator_size"
android:layout_height="@dimen/dynamic_grid_page_indicator_size"
android:layout_width="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_gravity="bottom|left"/>
<include layout="@layout/widgets_view"

View File

@ -18,11 +18,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/HomeScreenElementTheme"
android:layout_width="match_parent"
android:layout_height="@dimen/dynamic_grid_page_indicator_size">
android:layout_height="@dimen/dynamic_grid_min_page_indicator_size">
<ImageView
android:id="@+id/all_apps_handle"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_gravity="top|center"
android:scaleType="centerInside"/>
</com.android.launcher3.pageindicators.PageIndicatorLineCaret>

View File

@ -26,7 +26,7 @@
<!-- Dynamic grid -->
<dimen name="dynamic_grid_overview_bar_item_width">120dp</dimen>
<dimen name="dynamic_grid_page_indicator_size">24dp</dimen>
<dimen name="dynamic_grid_min_page_indicator_size">24dp</dimen>
<dimen name="folder_preview_padding">5dp</dimen>
<!-- Hotseat -->

View File

@ -17,7 +17,7 @@
<resources>
<!-- Dynamic Grid -->
<dimen name="dynamic_grid_edge_margin">16dp</dimen>
<dimen name="dynamic_grid_page_indicator_size">32dp</dimen>
<dimen name="dynamic_grid_min_page_indicator_size">32dp</dimen>
<dimen name="dynamic_grid_page_indicator_line_height">1dp</dimen>
<dimen name="dynamic_grid_page_indicator_gutter_width">50dp</dimen>
<dimen name="dynamic_grid_icon_drawable_padding">8dp</dimen>

View File

@ -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);
}
}