Improve spaces for folders

Bug: 214582832
Test: DeviceProfileTest
Change-Id: I7c5cae0792d51baf111d0aec46be302ac6ca9994
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 635f400..0c6f340 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -18,6 +18,7 @@
 
 import static com.android.launcher3.Utilities.dpiFromPx;
 import static com.android.launcher3.config.FeatureFlags.ENABLE_TWO_PANEL_HOME;
+import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE;
 import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
 import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
 import static com.android.launcher3.util.DisplayController.CHANGE_SUPPORTED_BOUNDS;
@@ -43,8 +44,10 @@
 import android.util.Xml;
 import android.view.Display;
 
+import androidx.annotation.DimenRes;
 import androidx.annotation.IntDef;
 import androidx.annotation.Nullable;
+import androidx.annotation.StyleRes;
 import androidx.annotation.VisibleForTesting;
 import androidx.core.content.res.ResourcesCompat;
 
@@ -129,11 +132,9 @@
     public PointF[] minCellSize;
 
     public PointF[] borderSpaces;
-    public int inlineNavButtonsEndSpacing;
+    public @DimenRes int inlineNavButtonsEndSpacing;
 
-    public PointF folderBorderSpaces;
-    public PointF folderCellSize;
-    public float folderTopPadding;
+    public @StyleRes int folderStyle;
 
     public float[] horizontalMargin;
 
@@ -333,8 +334,11 @@
         dbFile = closestProfile.dbFile;
         defaultLayoutId = closestProfile.defaultLayoutId;
         demoModeLayoutId = closestProfile.demoModeLayoutId;
+
         numFolderRows = closestProfile.numFolderRows;
         numFolderColumns = closestProfile.numFolderColumns;
+        folderStyle = closestProfile.folderStyle;
+
         isScalable = closestProfile.isScalable;
         devicePaddingId = closestProfile.devicePaddingId;
         this.deviceType = deviceType;
@@ -357,10 +361,6 @@
 
         borderSpaces = displayOption.borderSpaces;
 
-        folderBorderSpaces = displayOption.folderBorderSpaces;
-        folderCellSize = displayOption.folderCellSize;
-        folderTopPadding = displayOption.folderTopPadding;
-
         horizontalMargin = displayOption.horizontalMargin;
 
         numShownHotseatIcons = closestProfile.numHotseatIcons;
@@ -749,6 +749,7 @@
 
         private final int numFolderRows;
         private final int numFolderColumns;
+        private final @StyleRes int folderStyle;
 
         private final int numAllAppsColumns;
         private final int numDatabaseAllAppsColumns;
@@ -759,7 +760,7 @@
 
         private final boolean[] inlineQsb = new boolean[COUNT_SIZES];
 
-        private int inlineNavButtonsEndSpacing;
+        private @DimenRes int inlineNavButtonsEndSpacing;
         private final String dbFile;
 
         private final int defaultLayoutId;
@@ -811,11 +812,15 @@
             inlineNavButtonsEndSpacing =
                     a.getResourceId(R.styleable.GridDisplayOption_inlineNavButtonsEndSpacing,
                     R.dimen.taskbar_button_margin_default);
+
             numFolderRows = a.getInt(
                     R.styleable.GridDisplayOption_numFolderRows, numRows);
             numFolderColumns = a.getInt(
                     R.styleable.GridDisplayOption_numFolderColumns, numColumns);
 
+            folderStyle = a.getResourceId(R.styleable.GridDisplayOption_folderStyle,
+                    INVALID_RESOURCE_HANDLE);
+
             isScalable = a.getBoolean(
                     R.styleable.GridDisplayOption_isScalable, false);
             devicePaddingId = a.getResourceId(
@@ -860,10 +865,6 @@
 
         private final PointF[] minCellSize = new PointF[COUNT_SIZES];
 
-        private final PointF folderCellSize;
-        private final PointF folderBorderSpaces;
-        private float folderTopPadding;
-
         private final PointF[] borderSpaces = new PointF[COUNT_SIZES];
         private final float[] horizontalMargin = new float[COUNT_SIZES];
         private final float[] hotseatBarBottomSpace = new float[COUNT_SIZES];
@@ -946,21 +947,6 @@
                     borderSpaceTwoPanelLandscape);
             borderSpaces[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
 
-            x = a.getFloat(R.styleable.ProfileDisplayOption_folderCellWidth,
-                    minCellSize[INDEX_DEFAULT].x);
-            y = a.getFloat(R.styleable.ProfileDisplayOption_folderCellHeight,
-                    minCellSize[INDEX_DEFAULT].y);
-            folderCellSize = new PointF(x, y);
-
-            float folderBorderSpace = a.getFloat(R.styleable.ProfileDisplayOption_folderBorderSpace,
-                    borderSpace);
-
-            x = y = folderBorderSpace;
-            folderBorderSpaces = new PointF(x, y);
-
-            folderTopPadding = a.getFloat(R.styleable.ProfileDisplayOption_folderTopPadding,
-                    folderBorderSpaces.y);
-
             x = a.getFloat(R.styleable.ProfileDisplayOption_allAppsCellWidth,
                     minCellSize[INDEX_DEFAULT].x);
             y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsCellHeight,
@@ -1133,9 +1119,6 @@
                 allAppsIconTextSizes[i] = 0;
                 allAppsBorderSpaces[i] = new PointF();
             }
-            folderBorderSpaces = new PointF();
-            folderCellSize = new PointF();
-            folderTopPadding = 0f;
         }
 
         private DisplayOption multiply(float w) {
@@ -1156,11 +1139,6 @@
                 allAppsBorderSpaces[i].x *= w;
                 allAppsBorderSpaces[i].y *= w;
             }
-            folderBorderSpaces.x *= w;
-            folderBorderSpaces.y *= w;
-            folderCellSize.x *= w;
-            folderCellSize.y *= w;
-            folderTopPadding *= w;
 
             return this;
         }
@@ -1183,11 +1161,6 @@
                 allAppsBorderSpaces[i].x += p.allAppsBorderSpaces[i].x;
                 allAppsBorderSpaces[i].y += p.allAppsBorderSpaces[i].y;
             }
-            folderBorderSpaces.x += p.folderBorderSpaces.x;
-            folderBorderSpaces.y += p.folderBorderSpaces.y;
-            folderCellSize.x += p.folderCellSize.x;
-            folderCellSize.y += p.folderCellSize.y;
-            folderTopPadding += p.folderTopPadding;
 
             return this;
         }