diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 6cf23ad10a..7b5252949a 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -31,9 +31,6 @@
0dp
5.5dp
-
- 2dp
-
0dp
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f8f9c2ae99..a2f7286794 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -137,8 +137,6 @@
1dp
-
- 10dp
8dp
9dp
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 14d8b93da8..6f35752601 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -28,6 +28,7 @@ import android.util.DisplayMetrics;
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.badge.BadgeRenderer;
+import com.android.launcher3.graphics.IconNormalizer;
public class DeviceProfile {
@@ -81,9 +82,8 @@ public class DeviceProfile {
public int workspaceCellPaddingXPx;
// Folder
- public int folderBackgroundOffset;
public int folderIconSizePx;
- public int folderIconPreviewPadding;
+ public int folderIconOffsetYPx;
// Folder cell
public int folderCellWidthPx;
@@ -340,9 +340,8 @@ public class DeviceProfile {
}
// Folder icon
- folderBackgroundOffset = -iconDrawablePaddingPx;
- folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
- folderIconPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
+ folderIconSizePx = IconNormalizer.getNormalizedCircleSize(iconSizePx);
+ folderIconOffsetYPx = (iconSizePx - folderIconSizePx) / 2;
}
private void updateAvailableFolderCellDimensions(DisplayMetrics dm, Resources res) {
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index a0912a4a06..069ec4ba11 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -129,18 +129,15 @@ public class PreviewBackground {
};
public void setup(Launcher launcher, View invalidateDelegate,
- int availableSpace, int topPadding) {
+ int availableSpaceX, int topPadding) {
mInvalidateDelegate = invalidateDelegate;
mBgColor = Themes.getAttrColor(launcher, android.R.attr.colorPrimary);
DeviceProfile grid = launcher.getDeviceProfile();
- final int previewSize = grid.folderIconSizePx;
- final int previewPadding = grid.folderIconPreviewPadding;
+ previewSize = grid.folderIconSizePx;
- this.previewSize = (previewSize - 2 * previewPadding);
-
- basePreviewOffsetX = (availableSpace - this.previewSize) / 2;
- basePreviewOffsetY = previewPadding + grid.folderBackgroundOffset + topPadding;
+ basePreviewOffsetX = (availableSpaceX - previewSize) / 2;
+ basePreviewOffsetY = topPadding + grid.folderIconOffsetYPx;
// Stroke width is 1dp
mStrokeWidth = launcher.getResources().getDisplayMetrics().density;
diff --git a/src/com/android/launcher3/graphics/IconNormalizer.java b/src/com/android/launcher3/graphics/IconNormalizer.java
index 5d99ba09ff..680c020228 100644
--- a/src/com/android/launcher3/graphics/IconNormalizer.java
+++ b/src/com/android/launcher3/graphics/IconNormalizer.java
@@ -376,4 +376,12 @@ public class IconNormalizer {
last = i;
}
}
+
+ /**
+ * @return The diameter of the normalized circle that fits inside of the square (size x size).
+ */
+ public static int getNormalizedCircleSize(int size) {
+ float area = size * size * MAX_CIRCLE_AREA_FACTOR;
+ return (int) Math.round(Math.sqrt((4 * area) / Math.PI));
+ }
}