Merge "Update DeviceProfile to calculate responsive grid for folders" into udc-qpr-dev am: 54cfc5ea04
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23658954 Change-Id: I1ede028ee900b114aa1b840e3b872be1222678a5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7b2c02f12e
8 files changed
+95
-38
No files matched your search
@@ -208,6 +208,10 @@
|
|||||||
Needs FeatureFlags.ENABLE_RESPONSIVE_WORKSPACE enabled -->
|
Needs FeatureFlags.ENABLE_RESPONSIVE_WORKSPACE enabled -->
|
||||||
<attr name="allAppsSpecsId" format="reference" />
|
<attr name="allAppsSpecsId" format="reference" />
|
||||||
|
|
||||||
|
<!-- File that contains the specs for the workspace.
|
||||||
|
Needs FeatureFlags.ENABLE_RESPONSIVE_WORKSPACE enabled -->
|
||||||
|
<attr name="folderSpecsId" format="reference" />
|
||||||
|
|
||||||
<!-- By default all categories are enabled -->
|
<!-- By default all categories are enabled -->
|
||||||
<attr name="deviceCategory" format="integer">
|
<attr name="deviceCategory" format="integer">
|
||||||
<!-- Enable on phone only -->
|
<!-- Enable on phone only -->
|
||||||
|
|||||||
@@ -382,8 +382,7 @@ public class CellLayout extends ViewGroup {
|
|||||||
private void resetCellSizeInternal(DeviceProfile deviceProfile) {
|
private void resetCellSizeInternal(DeviceProfile deviceProfile) {
|
||||||
switch (mContainerType) {
|
switch (mContainerType) {
|
||||||
case FOLDER:
|
case FOLDER:
|
||||||
mBorderSpace = new Point(deviceProfile.folderCellLayoutBorderSpacePx,
|
mBorderSpace = new Point(deviceProfile.folderCellLayoutBorderSpacePx);
|
||||||
deviceProfile.folderCellLayoutBorderSpacePx);
|
|
||||||
break;
|
break;
|
||||||
case HOTSEAT:
|
case HOTSEAT:
|
||||||
mBorderSpace = new Point(deviceProfile.hotseatBorderSpace,
|
mBorderSpace = new Point(deviceProfile.hotseatBorderSpace,
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ import com.android.launcher3.icons.IconNormalizer;
|
|||||||
import com.android.launcher3.model.data.ItemInfo;
|
import com.android.launcher3.model.data.ItemInfo;
|
||||||
import com.android.launcher3.responsive.AllAppsSpecs;
|
import com.android.launcher3.responsive.AllAppsSpecs;
|
||||||
import com.android.launcher3.responsive.CalculatedAllAppsSpec;
|
import com.android.launcher3.responsive.CalculatedAllAppsSpec;
|
||||||
|
import com.android.launcher3.responsive.CalculatedFolderSpec;
|
||||||
|
import com.android.launcher3.responsive.FolderSpecs;
|
||||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||||
import com.android.launcher3.util.DisplayController;
|
import com.android.launcher3.util.DisplayController;
|
||||||
import com.android.launcher3.util.DisplayController.Info;
|
import com.android.launcher3.util.DisplayController.Info;
|
||||||
@@ -78,8 +80,7 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
public static final PointF DEFAULT_SCALE = new PointF(1.0f, 1.0f);
|
public static final PointF DEFAULT_SCALE = new PointF(1.0f, 1.0f);
|
||||||
public static final ViewScaleProvider DEFAULT_PROVIDER = itemInfo -> DEFAULT_SCALE;
|
public static final ViewScaleProvider DEFAULT_PROVIDER = itemInfo -> DEFAULT_SCALE;
|
||||||
public static final Consumer<DeviceProfile> DEFAULT_DIMENSION_PROVIDER = dp -> {
|
public static final Consumer<DeviceProfile> DEFAULT_DIMENSION_PROVIDER = dp -> {};
|
||||||
};
|
|
||||||
|
|
||||||
public final InvariantDeviceProfile inv;
|
public final InvariantDeviceProfile inv;
|
||||||
private final Info mInfo;
|
private final Info mInfo;
|
||||||
@@ -120,6 +121,9 @@ public class DeviceProfile {
|
|||||||
private AllAppsSpecs mAllAppsSpecs;
|
private AllAppsSpecs mAllAppsSpecs;
|
||||||
private CalculatedAllAppsSpec mAllAppsResponsiveWidthSpec;
|
private CalculatedAllAppsSpec mAllAppsResponsiveWidthSpec;
|
||||||
private CalculatedAllAppsSpec mAllAppsResponsiveHeightSpec;
|
private CalculatedAllAppsSpec mAllAppsResponsiveHeightSpec;
|
||||||
|
private FolderSpecs mFolderSpecs;
|
||||||
|
private CalculatedFolderSpec mResponsiveFolderWidthSpec;
|
||||||
|
private CalculatedFolderSpec mResponsiveFolderHeightSpec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum amount of left/right workspace padding as a percentage of the screen width.
|
* The maximum amount of left/right workspace padding as a percentage of the screen width.
|
||||||
@@ -178,7 +182,7 @@ public class DeviceProfile {
|
|||||||
public int folderIconOffsetYPx;
|
public int folderIconOffsetYPx;
|
||||||
|
|
||||||
// Folder content
|
// Folder content
|
||||||
public int folderCellLayoutBorderSpacePx;
|
public Point folderCellLayoutBorderSpacePx;
|
||||||
public int folderContentPaddingLeftRight;
|
public int folderContentPaddingLeftRight;
|
||||||
public int folderContentPaddingTop;
|
public int folderContentPaddingTop;
|
||||||
|
|
||||||
@@ -314,7 +318,8 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
// TODO(b/241386436): shouldn't change any launcher behaviour
|
// TODO(b/241386436): shouldn't change any launcher behaviour
|
||||||
mIsResponsiveGrid = inv.workspaceSpecsId != INVALID_RESOURCE_HANDLE
|
mIsResponsiveGrid = inv.workspaceSpecsId != INVALID_RESOURCE_HANDLE
|
||||||
&& inv.allAppsSpecsId != INVALID_RESOURCE_HANDLE;
|
&& inv.allAppsSpecsId != INVALID_RESOURCE_HANDLE
|
||||||
|
&& inv.folderSpecsId != INVALID_RESOURCE_HANDLE;
|
||||||
|
|
||||||
mIsScalableGrid = inv.isScalable && !isVerticalBarLayout() && !isMultiWindowMode;
|
mIsScalableGrid = inv.isScalable && !isVerticalBarLayout() && !isMultiWindowMode;
|
||||||
// Determine device posture.
|
// Determine device posture.
|
||||||
@@ -420,13 +425,15 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
folderContentPaddingTop = folderStyle.getDimensionPixelSize(
|
folderContentPaddingTop = folderStyle.getDimensionPixelSize(
|
||||||
R.styleable.FolderStyle_folderTopPadding, 0);
|
R.styleable.FolderStyle_folderTopPadding, 0);
|
||||||
folderCellLayoutBorderSpacePx = folderStyle.getDimensionPixelSize(
|
|
||||||
|
int gutter = folderStyle.getDimensionPixelSize(
|
||||||
R.styleable.FolderStyle_folderBorderSpace, 0);
|
R.styleable.FolderStyle_folderBorderSpace, 0);
|
||||||
|
folderCellLayoutBorderSpacePx = new Point(gutter, gutter);
|
||||||
folderFooterHeightPx = folderStyle.getDimensionPixelSize(
|
folderFooterHeightPx = folderStyle.getDimensionPixelSize(
|
||||||
R.styleable.FolderStyle_folderFooterHeight, 0);
|
R.styleable.FolderStyle_folderFooterHeight, 0);
|
||||||
folderStyle.recycle();
|
folderStyle.recycle();
|
||||||
} else {
|
} else if (!mIsResponsiveGrid) {
|
||||||
folderCellLayoutBorderSpacePx = 0;
|
folderCellLayoutBorderSpacePx = new Point(0, 0);
|
||||||
folderFooterHeightPx = res.getDimensionPixelSize(R.dimen.folder_footer_height_default);
|
folderFooterHeightPx = res.getDimensionPixelSize(R.dimen.folder_footer_height_default);
|
||||||
folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_top_padding_default);
|
folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_top_padding_default);
|
||||||
}
|
}
|
||||||
@@ -556,6 +563,12 @@ public class DeviceProfile {
|
|||||||
mAllAppsResponsiveHeightSpec = mAllAppsSpecs.getCalculatedHeightSpec(inv.numRows,
|
mAllAppsResponsiveHeightSpec = mAllAppsSpecs.getCalculatedHeightSpec(inv.numRows,
|
||||||
mResponsiveHeightSpec.getAvailableSpace(),
|
mResponsiveHeightSpec.getAvailableSpace(),
|
||||||
mResponsiveHeightSpec);
|
mResponsiveHeightSpec);
|
||||||
|
|
||||||
|
mFolderSpecs = new FolderSpecs(new ResourceHelper(context, inv.folderSpecsId));
|
||||||
|
mResponsiveFolderWidthSpec = mFolderSpecs.getWidthSpec(inv.numFolderColumns,
|
||||||
|
mResponsiveWidthSpec.getAvailableSpace(), mResponsiveWidthSpec);
|
||||||
|
mResponsiveFolderHeightSpec = mFolderSpecs.getHeightSpec(inv.numFolderRows,
|
||||||
|
mResponsiveHeightSpec.getAvailableSpace(), mResponsiveHeightSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res);
|
desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res);
|
||||||
@@ -1179,15 +1192,19 @@ public class DeviceProfile {
|
|||||||
allAppsStyle.recycle();
|
allAppsStyle.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/288075868): Resize the icon size to make sure it will fit inside the cell size
|
||||||
private void updateAvailableFolderCellDimensions(Resources res) {
|
private void updateAvailableFolderCellDimensions(Resources res) {
|
||||||
updateFolderCellSize(1f, res);
|
updateFolderCellSize(1f, res);
|
||||||
|
|
||||||
|
// Responsive grid doesn't need to scale the folder
|
||||||
|
if (mIsResponsiveGrid) return;
|
||||||
|
|
||||||
// For usability we can't have the folder use the whole width of the screen
|
// For usability we can't have the folder use the whole width of the screen
|
||||||
Point totalWorkspacePadding = getTotalWorkspacePadding();
|
Point totalWorkspacePadding = getTotalWorkspacePadding();
|
||||||
|
|
||||||
// Check if the folder fit within the available height.
|
// Check if the folder fit within the available height.
|
||||||
float contentUsedHeight = folderCellHeightPx * inv.numFolderRows
|
float contentUsedHeight = folderCellHeightPx * inv.numFolderRows
|
||||||
+ ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacePx)
|
+ ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacePx.y)
|
||||||
+ folderFooterHeightPx
|
+ folderFooterHeightPx
|
||||||
+ folderContentPaddingTop;
|
+ folderContentPaddingTop;
|
||||||
int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y;
|
int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y;
|
||||||
@@ -1195,7 +1212,7 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
// Check if the folder fit within the available width.
|
// Check if the folder fit within the available width.
|
||||||
float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns
|
float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns
|
||||||
+ ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacePx)
|
+ ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacePx.x)
|
||||||
+ folderContentPaddingLeftRight * 2;
|
+ folderContentPaddingLeftRight * 2;
|
||||||
int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x;
|
int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x;
|
||||||
float scaleX = contentMaxWidth / contentUsedWidth;
|
float scaleX = contentMaxWidth / contentUsedWidth;
|
||||||
@@ -1215,7 +1232,19 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
int textHeight = Utilities.calculateTextHeight(folderChildTextSizePx);
|
int textHeight = Utilities.calculateTextHeight(folderChildTextSizePx);
|
||||||
|
|
||||||
if (mIsScalableGrid) {
|
if (mIsResponsiveGrid) {
|
||||||
|
folderCellWidthPx = mResponsiveFolderWidthSpec.getCellSizePx();
|
||||||
|
|
||||||
|
// Height
|
||||||
|
folderCellHeightPx = mResponsiveFolderHeightSpec.getCellSizePx();
|
||||||
|
folderContentPaddingTop = mResponsiveFolderHeightSpec.getStartPaddingPx();
|
||||||
|
folderFooterHeightPx = mResponsiveFolderHeightSpec.getEndPaddingPx();
|
||||||
|
|
||||||
|
folderCellLayoutBorderSpacePx = new Point(mResponsiveFolderWidthSpec.getGutterPx(),
|
||||||
|
mResponsiveHeightSpec.getGutterPx());
|
||||||
|
|
||||||
|
folderContentPaddingLeftRight = mResponsiveFolderWidthSpec.getStartPaddingPx();
|
||||||
|
} else if (mIsScalableGrid) {
|
||||||
if (inv.folderStyle == INVALID_RESOURCE_HANDLE) {
|
if (inv.folderStyle == INVALID_RESOURCE_HANDLE) {
|
||||||
folderCellWidthPx = roundPxValueFromFloat(getCellSize().x * scale);
|
folderCellWidthPx = roundPxValueFromFloat(getCellSize().x * scale);
|
||||||
folderCellHeightPx = roundPxValueFromFloat(getCellSize().y * scale);
|
folderCellHeightPx = roundPxValueFromFloat(getCellSize().y * scale);
|
||||||
@@ -1225,11 +1254,13 @@ public class DeviceProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
folderContentPaddingTop = roundPxValueFromFloat(folderContentPaddingTop * scale);
|
folderContentPaddingTop = roundPxValueFromFloat(folderContentPaddingTop * scale);
|
||||||
folderCellLayoutBorderSpacePx = roundPxValueFromFloat(
|
folderCellLayoutBorderSpacePx = new Point(
|
||||||
folderCellLayoutBorderSpacePx * scale);
|
roundPxValueFromFloat(folderCellLayoutBorderSpacePx.x * scale),
|
||||||
|
roundPxValueFromFloat(folderCellLayoutBorderSpacePx.y * scale)
|
||||||
|
);
|
||||||
folderFooterHeightPx = roundPxValueFromFloat(folderFooterHeightPx * scale);
|
folderFooterHeightPx = roundPxValueFromFloat(folderFooterHeightPx * scale);
|
||||||
|
|
||||||
folderContentPaddingLeftRight = folderCellLayoutBorderSpacePx;
|
folderContentPaddingLeftRight = folderCellLayoutBorderSpacePx.x;
|
||||||
} else {
|
} else {
|
||||||
int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding)
|
int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding)
|
||||||
* scale);
|
* scale);
|
||||||
@@ -1750,8 +1781,10 @@ public class DeviceProfile {
|
|||||||
writer.println(prefix + pxToDpStr("folderChildTextSizePx", folderChildTextSizePx));
|
writer.println(prefix + pxToDpStr("folderChildTextSizePx", folderChildTextSizePx));
|
||||||
writer.println(prefix + pxToDpStr("folderChildDrawablePaddingPx",
|
writer.println(prefix + pxToDpStr("folderChildDrawablePaddingPx",
|
||||||
folderChildDrawablePaddingPx));
|
folderChildDrawablePaddingPx));
|
||||||
writer.println(prefix + pxToDpStr("folderCellLayoutBorderSpacePx",
|
writer.println(prefix + pxToDpStr("folderCellLayoutBorderSpacePx.x",
|
||||||
folderCellLayoutBorderSpacePx));
|
folderCellLayoutBorderSpacePx.x));
|
||||||
|
writer.println(prefix + pxToDpStr("folderCellLayoutBorderSpacePx.y",
|
||||||
|
folderCellLayoutBorderSpacePx.y));
|
||||||
writer.println(prefix + pxToDpStr("folderContentPaddingLeftRight",
|
writer.println(prefix + pxToDpStr("folderContentPaddingLeftRight",
|
||||||
folderContentPaddingLeftRight));
|
folderContentPaddingLeftRight));
|
||||||
writer.println(prefix + pxToDpStr("folderTopPadding", folderContentPaddingTop));
|
writer.println(prefix + pxToDpStr("folderTopPadding", folderContentPaddingTop));
|
||||||
@@ -1871,6 +1904,8 @@ public class DeviceProfile {
|
|||||||
+ mAllAppsResponsiveHeightSpec.toString());
|
+ mAllAppsResponsiveHeightSpec.toString());
|
||||||
writer.println(prefix + "\tmAllAppsResponsiveWidthSpec:"
|
writer.println(prefix + "\tmAllAppsResponsiveWidthSpec:"
|
||||||
+ mAllAppsResponsiveWidthSpec.toString());
|
+ mAllAppsResponsiveWidthSpec.toString());
|
||||||
|
writer.println(prefix + "\tmResponsiveFolderHeightSpec:" + mResponsiveFolderHeightSpec);
|
||||||
|
writer.println(prefix + "\tmResponsiveFolderWidthSpec:" + mResponsiveFolderWidthSpec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ public class InvariantDeviceProfile {
|
|||||||
public int workspaceSpecsId = INVALID_RESOURCE_HANDLE;
|
public int workspaceSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
@XmlRes
|
@XmlRes
|
||||||
public int allAppsSpecsId = INVALID_RESOURCE_HANDLE;
|
public int allAppsSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
|
@XmlRes
|
||||||
|
public int folderSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
|
|
||||||
public String dbFile;
|
public String dbFile;
|
||||||
public int defaultLayoutId;
|
public int defaultLayoutId;
|
||||||
@@ -356,6 +358,7 @@ public class InvariantDeviceProfile {
|
|||||||
devicePaddingId = closestProfile.devicePaddingId;
|
devicePaddingId = closestProfile.devicePaddingId;
|
||||||
workspaceSpecsId = closestProfile.mWorkspaceSpecsId;
|
workspaceSpecsId = closestProfile.mWorkspaceSpecsId;
|
||||||
allAppsSpecsId = closestProfile.mAllAppsSpecsId;
|
allAppsSpecsId = closestProfile.mAllAppsSpecsId;
|
||||||
|
folderSpecsId = closestProfile.mFolderSpecsId;
|
||||||
this.deviceType = deviceType;
|
this.deviceType = deviceType;
|
||||||
|
|
||||||
inlineNavButtonsEndSpacing = closestProfile.inlineNavButtonsEndSpacing;
|
inlineNavButtonsEndSpacing = closestProfile.inlineNavButtonsEndSpacing;
|
||||||
@@ -803,6 +806,7 @@ public class InvariantDeviceProfile {
|
|||||||
private final int devicePaddingId;
|
private final int devicePaddingId;
|
||||||
private final int mWorkspaceSpecsId;
|
private final int mWorkspaceSpecsId;
|
||||||
private final int mAllAppsSpecsId;
|
private final int mAllAppsSpecsId;
|
||||||
|
private final int mFolderSpecsId;
|
||||||
|
|
||||||
public GridOption(Context context, AttributeSet attrs) {
|
public GridOption(Context context, AttributeSet attrs) {
|
||||||
TypedArray a = context.obtainStyledAttributes(
|
TypedArray a = context.obtainStyledAttributes(
|
||||||
@@ -869,9 +873,12 @@ public class InvariantDeviceProfile {
|
|||||||
R.styleable.GridDisplayOption_workspaceSpecsId, INVALID_RESOURCE_HANDLE);
|
R.styleable.GridDisplayOption_workspaceSpecsId, INVALID_RESOURCE_HANDLE);
|
||||||
mAllAppsSpecsId = a.getResourceId(
|
mAllAppsSpecsId = a.getResourceId(
|
||||||
R.styleable.GridDisplayOption_allAppsSpecsId, INVALID_RESOURCE_HANDLE);
|
R.styleable.GridDisplayOption_allAppsSpecsId, INVALID_RESOURCE_HANDLE);
|
||||||
|
mFolderSpecsId = a.getResourceId(
|
||||||
|
R.styleable.GridDisplayOption_folderSpecsId, INVALID_RESOURCE_HANDLE);
|
||||||
} else {
|
} else {
|
||||||
mWorkspaceSpecsId = INVALID_RESOURCE_HANDLE;
|
mWorkspaceSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
mAllAppsSpecsId = INVALID_RESOURCE_HANDLE;
|
mAllAppsSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
|
mFolderSpecsId = INVALID_RESOURCE_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int inlineForRotation = a.getInt(R.styleable.GridDisplayOption_inlineQsb,
|
int inlineForRotation = a.getInt(R.styleable.GridDisplayOption_inlineQsb,
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
|
|||||||
// No need to add padding when cell layout border spacing is present.
|
// No need to add padding when cell layout border spacing is present.
|
||||||
boolean noPaddingX =
|
boolean noPaddingX =
|
||||||
(dp.cellLayoutBorderSpacePx.x > 0 && mContainerType == WORKSPACE)
|
(dp.cellLayoutBorderSpacePx.x > 0 && mContainerType == WORKSPACE)
|
||||||
|| (dp.folderCellLayoutBorderSpacePx > 0 && mContainerType == FOLDER)
|
|| (dp.folderCellLayoutBorderSpacePx.x > 0 && mContainerType == FOLDER)
|
||||||
|| (dp.hotseatBorderSpace > 0 && mContainerType == HOTSEAT);
|
|| (dp.hotseatBorderSpace > 0 && mContainerType == HOTSEAT);
|
||||||
int cellPaddingX = noPaddingX
|
int cellPaddingX = noPaddingX
|
||||||
? 0
|
? 0
|
||||||
|
|||||||
@@ -236,9 +236,9 @@ public class FolderAnimationManager {
|
|||||||
mFolder, startRect, endRect, finalRadius, !mIsOpening));
|
mFolder, startRect, endRect, finalRadius, !mIsOpening));
|
||||||
|
|
||||||
// Create reveal animator for the folder content (capture the top 4 icons 2x2)
|
// Create reveal animator for the folder content (capture the top 4 icons 2x2)
|
||||||
int width = mDeviceProfile.folderCellLayoutBorderSpacePx
|
int width = mDeviceProfile.folderCellLayoutBorderSpacePx.x
|
||||||
+ mDeviceProfile.folderCellWidthPx * 2;
|
+ mDeviceProfile.folderCellWidthPx * 2;
|
||||||
int height = mDeviceProfile.folderCellLayoutBorderSpacePx
|
int height = mDeviceProfile.folderCellLayoutBorderSpacePx.y
|
||||||
+ mDeviceProfile.folderCellHeightPx * 2;
|
+ mDeviceProfile.folderCellHeightPx * 2;
|
||||||
int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage();
|
int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage();
|
||||||
int left = mContent.getPaddingLeft() + page * lp.width;
|
int left = mContent.getPaddingLeft() + page * lp.width;
|
||||||
|
|||||||
@@ -188,12 +188,12 @@ class FolderSpecs(resourceHelper: ResourceHelper) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class CalculatedFolderSpec(
|
data class CalculatedFolderSpec(
|
||||||
|
val availableSpace: Int,
|
||||||
|
val cells: Int,
|
||||||
val startPaddingPx: Int,
|
val startPaddingPx: Int,
|
||||||
val endPaddingPx: Int,
|
val endPaddingPx: Int,
|
||||||
val gutterPx: Int,
|
val gutterPx: Int,
|
||||||
val cellSizePx: Int,
|
val cellSizePx: Int
|
||||||
val availableSpace: Int,
|
|
||||||
val cells: Int
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,11 +270,11 @@ private fun convertToCalculatedFolderSpec(
|
|||||||
cellSizePx = folderSpec.cellSize.getRemainderSpaceValue(remainderSpace, cellSizePx)
|
cellSizePx = folderSpec.cellSize.getRemainderSpaceValue(remainderSpace, cellSizePx)
|
||||||
|
|
||||||
return CalculatedFolderSpec(
|
return CalculatedFolderSpec(
|
||||||
|
availableSpace = availableSpace,
|
||||||
|
cells = cells,
|
||||||
startPaddingPx = startPaddingPx,
|
startPaddingPx = startPaddingPx,
|
||||||
endPaddingPx = endPaddingPx,
|
endPaddingPx = endPaddingPx,
|
||||||
gutterPx = gutterPx,
|
gutterPx = gutterPx,
|
||||||
cellSizePx = cellSizePx,
|
cellSizePx = cellSizePx
|
||||||
availableSpace = availableSpace,
|
|
||||||
cells = cells
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 147.0px (56.0dp)\n" +
|
"\tfolderChildIconSizePx: 147.0px (56.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 38.0px (14.476191dp)\n" +
|
"\tfolderChildTextSizePx: 38.0px (14.476191dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
@@ -220,7 +221,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 147.0px (56.0dp)\n" +
|
"\tfolderChildIconSizePx: 147.0px (56.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 38.0px (14.476191dp)\n" +
|
"\tfolderChildTextSizePx: 38.0px (14.476191dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
@@ -356,7 +358,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 131.0px (49.904762dp)\n" +
|
"\tfolderChildIconSizePx: 131.0px (49.904762dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 9.0px (3.4285715dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 9.0px (3.4285715dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 56.0px (21.333334dp)\n" +
|
"\tfolderTopPadding: 56.0px (21.333334dp)\n" +
|
||||||
"\tfolderFooterHeight: 131.0px (49.904762dp)\n" +
|
"\tfolderFooterHeight: 131.0px (49.904762dp)\n" +
|
||||||
@@ -492,7 +495,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 123.0px (46.857143dp)\n" +
|
"\tfolderChildIconSizePx: 123.0px (46.857143dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 32.0px (12.190476dp)\n" +
|
"\tfolderChildTextSizePx: 32.0px (12.190476dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 8.0px (3.047619dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 8.0px (3.047619dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 53.0px (20.190475dp)\n" +
|
"\tfolderTopPadding: 53.0px (20.190475dp)\n" +
|
||||||
"\tfolderFooterHeight: 123.0px (46.857143dp)\n" +
|
"\tfolderFooterHeight: 123.0px (46.857143dp)\n" +
|
||||||
@@ -629,7 +633,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
||||||
@@ -766,7 +771,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 16.0px (8.0dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
||||||
@@ -903,7 +909,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
||||||
@@ -1040,7 +1047,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
"\tfolderChildIconSizePx: 120.0px (60.0dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
"\tfolderChildTextSizePx: 28.0px (14.0dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 27.0px (13.5dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 48.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 112.0px (56.0dp)\n" +
|
||||||
@@ -1182,7 +1190,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
@@ -1323,7 +1332,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
@@ -1464,7 +1474,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
@@ -1601,7 +1612,8 @@ class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|||||||
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
"\tfolderChildIconSizePx: 141.0px (53.714287dp)\n" +
|
||||||
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
"\tfolderChildTextSizePx: 34.0px (12.952381dp)\n" +
|
||||||
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
"\tfolderChildDrawablePaddingPx: 10.0px (3.8095238dp)\n" +
|
||||||
"\tfolderCellLayoutBorderSpacePx: 0.0px (0.0dp)\n" +
|
"\tfolderCellLayoutBorderSpacePx.x: 0.0px (0.0dp)\n" +
|
||||||
|
"\tfolderCellLayoutBorderSpacePx.y: 0.0px (0.0dp)\n" +
|
||||||
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
"\tfolderContentPaddingLeftRight: 21.0px (8.0dp)\n" +
|
||||||
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
"\tfolderTopPadding: 63.0px (24.0dp)\n" +
|
||||||
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
"\tfolderFooterHeight: 147.0px (56.0dp)\n" +
|
||||||
|
|||||||
Reference in new issue
Block a user