Update some dimens for portrait edit state

Fix: 324133830
Flag: NONE
Test: HomeScreenEditImageTest
Change-Id: I7f42664b63e6981bcef5db2e76129bd3fe567102
This commit is contained in:
fbaron
2024-02-23 10:54:13 -08:00
committed by Federico Baron
parent cb5d2ab72f
commit 3bb6d4bd81
4 changed files with 29 additions and 16 deletions
+15 -4
View File
@@ -83,6 +83,7 @@ public class DeviceProfile {
// Minimum aspect ratio beyond which an extra top padding may be applied to a bottom sheet.
private static final float MIN_ASPECT_RATIO_FOR_EXTRA_TOP_PADDING = 1.5f;
private static final float MAX_ASPECT_RATIO_FOR_ALTERNATE_EDIT_STATE = 1.5f;
public static final PointF DEFAULT_SCALE = new PointF(1.0f, 1.0f);
public static final ViewScaleProvider DEFAULT_PROVIDER = itemInfo -> DEFAULT_SCALE;
@@ -500,8 +501,17 @@ public class DeviceProfile {
}
dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
dropTargetBarTopMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_top_margin);
dropTargetBarBottomMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin);
// Some foldable portrait modes are too wide in terms of aspect ratio so we need to tweak
// the dimensions for edit state.
final boolean shouldApplyWidePortraitDimens = isTablet
&& !isLandscape
&& aspectRatio < MAX_ASPECT_RATIO_FOR_ALTERNATE_EDIT_STATE;
dropTargetBarTopMarginPx = shouldApplyWidePortraitDimens
? 0
: res.getDimensionPixelSize(R.dimen.drop_target_top_margin);
dropTargetBarBottomMarginPx = shouldApplyWidePortraitDimens
? res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin_wide_portrait)
: res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin);
dropTargetDragPaddingPx = res.getDimensionPixelSize(R.dimen.drop_target_drag_padding);
dropTargetTextSizePx = res.getDimensionPixelSize(R.dimen.drop_target_text_size);
dropTargetHorizontalPaddingPx = res.getDimensionPixelSize(
@@ -592,8 +602,9 @@ public class DeviceProfile {
}
}
springLoadedHotseatBarTopMarginPx = res.getDimensionPixelSize(
R.dimen.spring_loaded_hotseat_top_margin);
springLoadedHotseatBarTopMarginPx = shouldApplyWidePortraitDimens
? res.getDimensionPixelSize(R.dimen.spring_loaded_hotseat_top_margin_wide_portrait)
: res.getDimensionPixelSize(R.dimen.spring_loaded_hotseat_top_margin);
if (mIsResponsiveGrid) {
updateHotseatSizes(mResponsiveWorkspaceCellSpec.getIconSize());