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

Commit 91b9de1f authored by Thales Lima's avatar Thales Lima Committed by Android (Google) Code Review
Browse files

Merge "Create attr for padding between icon and text in cells" into tm-qpr-dev

parents 90c29267 d852d656
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2023 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resources>
    <style name="CellStyleDefault">
        <item name="iconDrawablePadding">4dp</item>
    </style>
</resources>
 No newline at end of file
+9 −2
Original line number Diff line number Diff line
@@ -142,9 +142,13 @@
        <!--  numSearchContainerColumns defaults to numColumns, if not specified -->
        <attr name="numSearchContainerColumns" format="integer" />

        <!-- Support attributes in CellStyle. defaults to CellStyleDefault -->
        <attr name="cellStyle" format="reference" />

        <!-- numFolderRows & numFolderColumns defaults to numRows & numColumns, if not specified -->
        <attr name="numFolderRows" format="integer" />
        <attr name="numFolderColumns" format="integer" />
        <!-- Support attributes in FolderStyle -->
        <attr name="folderStyle" format="reference" />

        <!-- numAllAppsColumns defaults to numColumns, if not specified -->
@@ -387,7 +391,7 @@

    </declare-styleable>

    <declare-styleable name="FolderDisplayStyle">
    <declare-styleable name="FolderStyle">
        <!-- defaults to minCellHeight if not specified
        when GridDisplayOption#isScalable is true. -->
        <attr name="folderCellHeight" format="dimension" />
@@ -402,7 +406,6 @@
        <attr name="folderTopPadding" format="dimension" />
    </declare-styleable>


    <declare-styleable name="CellLayout">
        <attr name="containerType" format="integer">
            <enum name="workspace" value="0" />
@@ -411,6 +414,10 @@
        </attr>
    </declare-styleable>

    <declare-styleable name="CellStyle">
        <attr name="iconDrawablePadding" format="dimension" />
    </declare-styleable>

    <declare-styleable name="ShadowDrawable">
        <attr name="android:src" />
        <attr name="android:shadowColor" />
+5 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@
        <item name="android:windowTranslucentStatus">true</item>
    </style>

    <style name="FolderDefaultStyle">
    <style name="FolderStyleDefault">
        <item name="folderTopPadding">24dp</item>
        <item name="folderCellHeight">94dp</item>
        <item name="folderCellWidth">80dp</item>
@@ -301,4 +301,8 @@
        <item name="folderFooterHeight">56dp</item>
    </style>

    <style name="CellStyleDefault">
        <item name="iconDrawablePadding">7dp</item>
    </style>

</resources>
+17 −8
Original line number Diff line number Diff line
@@ -376,19 +376,19 @@ public class DeviceProfile {

        if (inv.folderStyle != INVALID_RESOURCE_HANDLE) {
            TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle,
                    R.styleable.FolderDisplayStyle);
                    R.styleable.FolderStyle);
            // These are re-set in #updateFolderCellSize if the grid is not scalable
            folderCellHeightPx = folderStyle.getDimensionPixelSize(
                    R.styleable.FolderDisplayStyle_folderCellHeight, 0);
                    R.styleable.FolderStyle_folderCellHeight, 0);
            folderCellWidthPx = folderStyle.getDimensionPixelSize(
                    R.styleable.FolderDisplayStyle_folderCellWidth, 0);
                    R.styleable.FolderStyle_folderCellWidth, 0);

            folderContentPaddingTop = folderStyle.getDimensionPixelSize(
                    R.styleable.FolderDisplayStyle_folderTopPadding, 0);
                    R.styleable.FolderStyle_folderTopPadding, 0);
            folderCellLayoutBorderSpacePx = folderStyle.getDimensionPixelSize(
                    R.styleable.FolderDisplayStyle_folderBorderSpace, 0);
                    R.styleable.FolderStyle_folderBorderSpace, 0);
            folderFooterHeightPx = folderStyle.getDimensionPixelSize(
                    R.styleable.FolderDisplayStyle_folderFooterHeight, 0);
                    R.styleable.FolderStyle_folderFooterHeight, 0);
            folderStyle.recycle();
        } else {
            folderCellLayoutBorderSpacePx = 0;
@@ -407,8 +407,17 @@ public class DeviceProfile {
        mWorkspacePageIndicatorOverlapWorkspace =
                res.getDimensionPixelSize(R.dimen.workspace_page_indicator_overlap_workspace);

        iconDrawablePaddingOriginalPx =
                res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
        TypedArray cellStyle;
        if (inv.cellStyle != INVALID_RESOURCE_HANDLE) {
            cellStyle = context.obtainStyledAttributes(inv.cellStyle,
                    R.styleable.CellStyle);
        } else {
            cellStyle = context.obtainStyledAttributes(R.style.CellStyleDefault,
                    R.styleable.CellStyle);
        }
        iconDrawablePaddingOriginalPx = cellStyle.getDimensionPixelSize(
                R.styleable.CellStyle_iconDrawablePadding, 0);
        cellStyle.recycle();

        dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
        dropTargetBarTopMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_top_margin);
+8 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public class InvariantDeviceProfile {

    public @StyleRes int folderStyle;

    public @StyleRes int cellStyle;

    public float[] horizontalMargin;

    public PointF[] allAppsCellSize;
@@ -349,6 +351,8 @@ public class InvariantDeviceProfile {
        numFolderColumns = closestProfile.numFolderColumns;
        folderStyle = closestProfile.folderStyle;

        cellStyle = closestProfile.cellStyle;

        isScalable = closestProfile.isScalable;
        devicePaddingId = closestProfile.devicePaddingId;
        this.deviceType = deviceType;
@@ -783,6 +787,7 @@ public class InvariantDeviceProfile {
        private final int numFolderRows;
        private final int numFolderColumns;
        private final @StyleRes int folderStyle;
        private final @StyleRes int cellStyle;

        private final int numAllAppsColumns;
        private final int numDatabaseAllAppsColumns;
@@ -852,6 +857,9 @@ public class InvariantDeviceProfile {
            folderStyle = a.getResourceId(R.styleable.GridDisplayOption_folderStyle,
                    INVALID_RESOURCE_HANDLE);

            cellStyle = a.getResourceId(R.styleable.GridDisplayOption_cellStyle,
                    R.style.CellStyleDefault);

            isScalable = a.getBoolean(
                    R.styleable.GridDisplayOption_isScalable, false);
            devicePaddingId = a.getResourceId(
Loading