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

Commit 18751b64 authored by Jon Miranda's avatar Jon Miranda
Browse files

Landscape launcher grid/all apps to spec.

* Moves FastScroller to the right.

Bug: 64160529
Change-Id: Ie0dfc0a2f0f2d6f6366e4f299769148d76017782
parent ec99420f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@
        style="@style/FastScrollerPopup"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_marginEnd="-5dp" />
        android:layout_marginTop="-5dp"
        android:layout_marginEnd="-45dp" />

    <com.android.launcher3.allapps.LandscapeFastScroller
        android:id="@+id/fast_scroller"
@@ -30,9 +31,9 @@
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/apps_list_view"
        android:layout_marginEnd="-48dp"
        android:layout_marginTop="-8dp"
        android:layout_alignParentTop="@+id/apps_list_view"
        android:layout_marginEnd="-88dp"
        android:layout_marginTop="14dp"
        launcher:canThumbDetach="true" />

</merge>
 No newline at end of file
+14 −2
Original line number Diff line number Diff line
@@ -30,12 +30,24 @@
    <dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>

    <dimen name="dynamic_grid_cell_layout_padding">0dp</dimen>
    <dimen name="dynamic_grid_cell_layout_bottom_padding">5.5dp</dimen>

    <!-- Folders -->
    <dimen name="folder_preview_padding">2dp</dimen>

    <!-- Page indicator -->
    <dimen name="dynamic_grid_page_indicator_land_left_nav_bar_gutter_width">50dp</dimen>
    <dimen name="dynamic_grid_page_indicator_land_right_nav_bar_gutter_width">74dp</dimen>

    <!-- Hotseat -->
    <!-- Will be set to equal the hotseat icon size. -->
    <dimen name="dynamic_grid_hotseat_size">0dp</dimen>

    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_gutter_width">50dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_left_padding">44dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_right_padding">18dp</dimen>

    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_gutter_width">56dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_left_padding">32dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_right_padding">6dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_gutter_width">24dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_gutter_width">32dp</dimen>
</resources>
+8 −2
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@
    <dimen name="dynamic_grid_edge_margin">8dp</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_page_indicator_land_left_nav_bar_gutter_width">0dp</dimen>
    <dimen name="dynamic_grid_page_indicator_land_right_nav_bar_gutter_width">0dp</dimen>
    <dimen name="dynamic_grid_icon_drawable_padding">8dp</dimen>
    <dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen>
    <dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
@@ -31,16 +32,21 @@
    <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_layout_bottom_padding">0dp</dimen>
    <dimen name="dynamic_grid_cell_padding_x">8dp</dimen>

    <!-- Hotseat -->
    <dimen name="dynamic_grid_hotseat_top_padding">8dp</dimen>
    <dimen name="dynamic_grid_hotseat_bottom_padding">2dp</dimen>
    <dimen name="dynamic_grid_hotseat_height">80dp</dimen>
    <dimen name="dynamic_grid_hotseat_size">80dp</dimen>

    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_right_padding">0dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_right_padding">0dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_gutter_width">0dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_gutter_width">0dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_left_nav_bar_left_padding">0dp</dimen>
    <dimen name="dynamic_grid_hotseat_land_right_nav_bar_left_padding">0dp</dimen>


<!-- Drop target bar -->
    <dimen name="dynamic_grid_drop_target_size">48dp</dimen>
+65 −45
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class DeviceProfile {
    // Workspace
    private final int desiredWorkspaceLeftRightMarginPx;
    public final int cellLayoutPaddingLeftRightPx;
    public final int cellLayoutBottomPaddingPx;
    public final int edgeMarginPx;
    public final Rect defaultWidgetPadding;
    private final int defaultPageSpacingPx;
@@ -84,7 +85,8 @@ public class DeviceProfile {

    // Page indicator
    private int pageIndicatorSizePx;
    private final int pageIndicatorLandGutterPx;
    private final int pageIndicatorLandLeftNavBarGutterPx;
    private final int pageIndicatorLandRightNavBarGutterPx;
    private final int pageIndicatorLandWorkspaceOffsetPx;

    // Workspace icons
@@ -113,13 +115,16 @@ public class DeviceProfile {

    // Hotseat
    public int hotseatCellHeightPx;
    public int hotseatBarHeightPx;
    // In portrait: size = height, in landscape: size = width
    public int hotseatBarSizePx;
    public int hotseatBarTopPaddingPx;
    public int hotseatBarBottomPaddingPx;

    public int hotseatBarLeftNavBarLeftPaddingPx;
    public int hotseatBarLeftNavBarRightPaddingPx;

    public int hotseatBarRightNavBarLeftPaddingPx;
    public int hotseatBarRightNavBarRightPaddingPx;
    public int hotseatBarBottomPaddingPx;
    public int hotseatLandLeftNavBarGutterPx;
    public int hotseatLandRightNavBarGutterPx;

    // All apps
    public int allAppsCellHeightPx;
@@ -177,10 +182,14 @@ public class DeviceProfile {
        desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
        cellLayoutPaddingLeftRightPx =
                res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
        cellLayoutBottomPaddingPx =
                res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_bottom_padding);
        pageIndicatorSizePx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_min_page_indicator_size);
        pageIndicatorLandGutterPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_page_indicator_gutter_width);
        pageIndicatorLandLeftNavBarGutterPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_page_indicator_land_left_nav_bar_gutter_width);
        pageIndicatorLandRightNavBarGutterPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_page_indicator_land_right_nav_bar_gutter_width);
        pageIndicatorLandWorkspaceOffsetPx =
                res.getDimensionPixelSize(R.dimen.all_apps_caret_workspace_offset);
        defaultPageSpacingPx =
@@ -213,16 +222,15 @@ public class DeviceProfile {
                R.dimen.dynamic_grid_hotseat_land_left_nav_bar_right_padding);
        hotseatBarRightNavBarRightPaddingPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_hotseat_land_right_nav_bar_right_padding);
        hotseatBarHeightPx = isVerticalBarLayout()
                ? res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height)
                : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height)
        hotseatBarLeftNavBarLeftPaddingPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_hotseat_land_left_nav_bar_left_padding);
        hotseatBarRightNavBarLeftPaddingPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_hotseat_land_right_nav_bar_left_padding);
        hotseatBarSizePx = isVerticalBarLayout()
                ? Utilities.pxFromDp(inv.iconSize, dm)
                : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_size)
                        + hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx;

        hotseatLandLeftNavBarGutterPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_hotseat_land_left_nav_bar_gutter_width);
        hotseatLandRightNavBarGutterPx = res.getDimensionPixelSize(
                R.dimen.dynamic_grid_hotseat_land_right_nav_bar_gutter_width);

        // Determine sizes.
        widthPx = width;
        heightPx = height;
@@ -246,7 +254,7 @@ public class DeviceProfile {
            // in portrait mode closer together by adding more height to the hotseat.
            // Note: This calculation was created after noticing a pattern in the design spec.
            int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx;
            hotseatBarHeightPx += extraSpace - pageIndicatorSizePx;
            hotseatBarSizePx += extraSpace - pageIndicatorSizePx;

            // Recalculate the available dimensions using the new hotseat size.
            updateAvailableDimensions(dm, res);
@@ -332,11 +340,16 @@ public class DeviceProfile {
    }

    private void updateIconSize(float scale, Resources res, DisplayMetrics dm) {
        // Workspace
        float invIconSizePx = isVerticalBarLayout() ? inv.landscapeIconSize : inv.iconSize;
        iconSizePx = (int) (Utilities.pxFromDp(invIconSizePx, dm) * scale);
        iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
        iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);

        cellWidthPx = iconSizePx + iconDrawablePaddingPx;
        cellHeightPx = iconSizePx + iconDrawablePaddingPx
                + Utilities.calculateTextHeight(iconTextSizePx);

        // All apps
        allAppsIconTextSizePx = iconTextSizePx;
        allAppsIconSizePx = iconSizePx;
@@ -348,15 +361,14 @@ public class DeviceProfile {
            adjustToHideWorkspaceLabels();
        }

        cellWidthPx = iconSizePx + iconDrawablePaddingPx;
        cellHeightPx = iconSizePx + iconDrawablePaddingPx
                + Utilities.calculateTextHeight(iconTextSizePx);

        // Hotseat
        if (isVerticalBarLayout()) {
            hotseatBarSizePx = iconSizePx;
        }
        hotseatCellHeightPx = iconSizePx + iconDrawablePaddingPx;

        if (!isVerticalBarLayout()) {
            int expectedWorkspaceHeight = availableHeightPx - hotseatBarHeightPx
            int expectedWorkspaceHeight = availableHeightPx - hotseatBarSizePx
                    - pageIndicatorSizePx - topWorkspacePadding;
            float minRequiredHeight = dropTargetBarSizePx + workspaceSpringLoadedBottomSpace;
            workspaceSpringLoadShrinkFactor = Math.min(
@@ -449,9 +461,10 @@ public class DeviceProfile {
        // Since we are only concerned with the overall padding, layout direction does
        // not matter.
        Point padding = getTotalWorkspacePadding();
        int cellPadding = cellLayoutPaddingLeftRightPx * 2;
        result.x = calculateCellWidth(availableWidthPx - padding.x - cellPadding, inv.numColumns);
        result.y = calculateCellHeight(availableHeightPx - padding.y, inv.numRows);
        result.x = calculateCellWidth(availableWidthPx - padding.x
                - cellLayoutPaddingLeftRightPx * 2, inv.numColumns);
        result.y = calculateCellHeight(availableHeightPx - padding.y
                - cellLayoutBottomPaddingPx, inv.numRows);
        return result;
    }

@@ -467,20 +480,21 @@ public class DeviceProfile {
        Rect padding = recycle == null ? new Rect() : recycle;
        if (isVerticalBarLayout()) {
            if (mInsets.left > 0) {
                padding.set(mInsets.left + pageIndicatorLandGutterPx,
                padding.set(mInsets.left + pageIndicatorLandLeftNavBarGutterPx,
                        0,
                        hotseatBarHeightPx + hotseatLandLeftNavBarGutterPx
                                + hotseatBarLeftNavBarRightPaddingPx - mInsets.left,
                        hotseatBarSizePx + hotseatBarLeftNavBarRightPaddingPx
                                + hotseatBarLeftNavBarLeftPaddingPx
                                - mInsets.left,
                        edgeMarginPx);
            } else {
                padding.set(pageIndicatorLandGutterPx,
                padding.set(pageIndicatorLandRightNavBarGutterPx,
                        0,
                        hotseatBarHeightPx + hotseatLandRightNavBarGutterPx
                                + hotseatBarRightNavBarRightPaddingPx,
                        hotseatBarSizePx + hotseatBarRightNavBarRightPaddingPx
                                + hotseatBarRightNavBarLeftPaddingPx,
                        edgeMarginPx);
            }
        } else {
            int paddingBottom = hotseatBarHeightPx + pageIndicatorSizePx;
            int paddingBottom = hotseatBarSizePx + pageIndicatorSizePx;
            if (isTablet) {
                // Pad the left and right of the workspace to ensure consistent spacing
                // between all icons
@@ -515,14 +529,14 @@ public class DeviceProfile {
            // Folders should only appear right of the drop target bar and left of the hotseat
            return new Rect(mInsets.left + dropTargetBarSizePx + edgeMarginPx,
                    mInsets.top,
                    mInsets.left + availableWidthPx - hotseatBarHeightPx - edgeMarginPx,
                    mInsets.left + availableWidthPx - hotseatBarSizePx - edgeMarginPx,
                    mInsets.top + availableHeightPx);
        } else {
            // Folders should only appear below the drop target bar and above the hotseat
            return new Rect(mInsets.left,
                    mInsets.top + dropTargetBarSizePx + edgeMarginPx,
                    mInsets.left + availableWidthPx,
                    mInsets.top + availableHeightPx - hotseatBarHeightPx
                    mInsets.top + availableHeightPx - hotseatBarSizePx
                            - pageIndicatorSizePx - edgeMarginPx);
        }
    }
@@ -609,38 +623,44 @@ public class DeviceProfile {
        if (hasVerticalBarLayout) {
            // Vertical hotseat -- The hotseat is fixed in the layout to be on the right of the
            //                     screen regardless of RTL
            lp.gravity = Gravity.RIGHT;
            lp.width = hotseatBarHeightPx + mInsets.left + mInsets.right;
            lp.height = LayoutParams.MATCH_PARENT;

            int paddingRight = mInsets.left > 0
                    ? hotseatBarLeftNavBarRightPaddingPx
                    : hotseatBarRightNavBarRightPaddingPx;
            int paddingLeft = mInsets.left > 0
                    ? hotseatBarLeftNavBarLeftPaddingPx
                    : hotseatBarRightNavBarLeftPaddingPx;

            hotseat.getLayout().setPadding(mInsets.left + cellLayoutPaddingLeftRightPx,
                    mInsets.top, mInsets.right + paddingRight + cellLayoutPaddingLeftRightPx,
                    workspacePadding.bottom);
            lp.gravity = Gravity.RIGHT;
            lp.width = hotseatBarSizePx + mInsets.left + mInsets.right
                    + paddingLeft + paddingRight;
            lp.height = LayoutParams.MATCH_PARENT;

            hotseat.getLayout().setPadding(mInsets.left + cellLayoutPaddingLeftRightPx
                            + paddingLeft,
                    mInsets.top,
                    mInsets.right + cellLayoutPaddingLeftRightPx + paddingRight,
                    workspacePadding.bottom + cellLayoutBottomPaddingPx);
        } else if (isTablet) {
            // Pad the hotseat with the workspace padding calculated above
            lp.gravity = Gravity.BOTTOM;
            lp.width = LayoutParams.MATCH_PARENT;
            lp.height = hotseatBarHeightPx + mInsets.bottom;
            lp.height = hotseatBarSizePx + mInsets.bottom;
            hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left
                            + cellLayoutPaddingLeftRightPx,
                    hotseatBarTopPaddingPx,
                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx,
                    hotseatBarBottomPaddingPx + mInsets.bottom);
                    hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx);
        } else {
            // For phones, layout the hotseat without any bottom margin
            // to ensure that we have space for the folders
            lp.gravity = Gravity.BOTTOM;
            lp.width = LayoutParams.MATCH_PARENT;
            lp.height = hotseatBarHeightPx + mInsets.bottom;
            lp.height = hotseatBarSizePx + mInsets.bottom;
            hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left
                            + cellLayoutPaddingLeftRightPx,
                    hotseatBarTopPaddingPx,
                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx,
                    hotseatBarBottomPaddingPx + mInsets.bottom);
                    hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx);
        }
        hotseat.setLayoutParams(lp);

@@ -659,7 +679,7 @@ public class DeviceProfile {
                // Put the page indicators above the hotseat
                lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                lp.height = pageIndicatorSizePx;
                lp.bottomMargin = hotseatBarHeightPx + mInsets.bottom;
                lp.bottomMargin = hotseatBarSizePx + mInsets.bottom;
            }
            pageIndicator.setLayoutParams(lp);
        }