Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fbb0ccc authored by Shamali P's avatar Shamali P
Browse files

Use derived padding instead of static 300dp for large portrait displays

In tablet, portrait mode, a padding of 300dp was applied to make it
less elongated, but that doesn't scale well across different devices.

So, we use 1/6th of height as the additional padding. This fixes the
existing logic.

Bug: 318410881
Bug: 315055849
Flag: N/A
Test: Screenshot update in cl chain.
Change-Id: Ia9cfe481131f086b66f625069cbf9a7c0343c2c9
parent 933a05a2
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -32,7 +32,4 @@
<!-- Widget picker-->
    <dimen name="widget_list_horizontal_margin">49dp</dimen>
    <dimen name="widget_list_horizontal_margin_two_pane">24dp</dimen>

<!-- Bottom sheet-->
    <dimen name="bottom_sheet_extra_top_padding">0dp</dimen>
</resources>
+0 −3
Original line number Diff line number Diff line
@@ -38,9 +38,6 @@
<!-- Widget picker-->
    <dimen name="widget_list_horizontal_margin">30dp</dimen>

<!-- Bottom sheet-->
    <dimen name="bottom_sheet_extra_top_padding">300dp</dimen>

    <!--  Folder spaces  -->
    <dimen name="folder_footer_horiz_padding">24dp</dimen>
</resources>
+0 −1
Original line number Diff line number Diff line
@@ -454,7 +454,6 @@
    <dimen name="padded_rounded_button_padding">8dp</dimen>

    <!-- Bottom sheet related parameters -->
    <dimen name="bottom_sheet_extra_top_padding">0dp</dimen>
    <dimen name="bottom_sheet_handle_area_height">36dp</dimen>
    <dimen name="bottom_sheet_handle_width">32dp</dimen>
    <dimen name="bottom_sheet_handle_height">4dp</dimen>
+12 −9
Original line number Diff line number Diff line
@@ -416,15 +416,18 @@ public class DeviceProfile {
        gridVisualizationPaddingY = res.getDimensionPixelSize(
                R.dimen.grid_visualization_vertical_cell_spacing);

        // Tablet portrait mode uses a single pane widget picker and extra padding may be applied on
        // top to avoid making it look too elongated.
        {
            // In large screens, in portrait mode, a bottom sheet can appear too elongated, so, we
            // apply additional padding.
            final boolean applyExtraTopPadding = isTablet
                    && !isLandscape
                    && (aspectRatio > MIN_ASPECT_RATIO_FOR_EXTRA_TOP_PADDING);
            final int derivedTopPadding = heightPx / 6;
            bottomSheetTopPadding = mInsets.top // statusbar height
                + (applyExtraTopPadding ? res.getDimensionPixelSize(
                R.dimen.bottom_sheet_extra_top_padding) : 0)
                    + (applyExtraTopPadding ? derivedTopPadding : 0)
                    + (isTablet ? 0 : edgeMarginPx); // phones need edgeMarginPx additional padding
        }

        bottomSheetOpenDuration = res.getInteger(R.integer.config_bottomSheetOpenDuration);
        bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration);
        if (isTablet) {