Revert "Moving DeviceProfile properties into DeviceProperties da..."

Revert submission 33672643-DataDeviceProfile1

Reason for revert: Droidmonitor created revert due to b/419867875. Will be verifying through ABTD before submission.

Fix: 419867875

Reverted changes: /q/submissionid:33672643-DataDeviceProfile1

Change-Id: Icb66aefbbcee24e05806b2139923e1f2ea1c65e3
This commit is contained in:
Priyanka Advani (xWF) authored and Android (Google) Code Review committed 2025-05-23 13:53:04 -07:00
1 parent e1111e28c2
commit 7705e92d93
127 files changed
+596 -726

No files matched your search

+22 -23
View File
@@ -85,9 +85,8 @@ public class DropTargetBar extends FrameLayout
@Override
public void setInsets(Rect insets) {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
DeviceProfile deviceProfile = mLauncher.getDeviceProfile();
mIsVertical = deviceProfile.isVerticalBarLayout();
int widthPx = deviceProfile.getDeviceProperties().getWidthPx();
DeviceProfile grid = mLauncher.getDeviceProfile();
mIsVertical = grid.isVerticalBarLayout();
lp.leftMargin = insets.left;
lp.topMargin = insets.top;
@@ -96,25 +95,25 @@ public class DropTargetBar extends FrameLayout
int tooltipLocation = TOOLTIP_DEFAULT;
int horizontalMargin;
if (deviceProfile.getDeviceProperties().isTablet()) {
if (grid.isTablet) {
// XXX: If the icon size changes across orientations, we will have to take
// that into account here too.
horizontalMargin = ((widthPx - 2 * deviceProfile.edgeMarginPx
- (deviceProfile.inv.numColumns * deviceProfile.cellWidthPx))
/ (2 * (deviceProfile.inv.numColumns + 1)))
+ deviceProfile.edgeMarginPx;
horizontalMargin = ((grid.widthPx - 2 * grid.edgeMarginPx
- (grid.inv.numColumns * grid.cellWidthPx))
/ (2 * (grid.inv.numColumns + 1)))
+ grid.edgeMarginPx;
} else {
horizontalMargin = getContext().getResources()
.getDimensionPixelSize(R.dimen.drop_target_bar_margin_horizontal);
}
lp.topMargin += deviceProfile.dropTargetBarTopMarginPx;
lp.bottomMargin += deviceProfile.dropTargetBarBottomMarginPx;
lp.width = deviceProfile.getDeviceProperties().getAvailableWidthPx() - 2 * horizontalMargin;
lp.topMargin += grid.dropTargetBarTopMarginPx;
lp.bottomMargin += grid.dropTargetBarBottomMarginPx;
lp.width = grid.availableWidthPx - 2 * horizontalMargin;
if (mIsVertical) {
lp.leftMargin = (widthPx - lp.width) / 2;
lp.rightMargin = (widthPx - lp.width) / 2;
lp.leftMargin = (grid.widthPx - lp.width) / 2;
lp.rightMargin = (grid.widthPx - lp.width) / 2;
}
lp.height = deviceProfile.dropTargetBarSizePx;
lp.height = grid.dropTargetBarSizePx;
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
DeviceProfile dp = mLauncher.getDeviceProfile();
@@ -122,7 +121,7 @@ public class DropTargetBar extends FrameLayout
int verticalPadding = dp.dropTargetVerticalPaddingPx;
setLayoutParams(lp);
for (ButtonDropTarget button : mDropTargets) {
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, deviceProfile.dropTargetTextSizePx);
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.dropTargetTextSizePx);
button.setToolTipLocation(tooltipLocation);
button.setPadding(horizontalPadding, verticalPadding, horizontalPadding,
verticalPadding);
@@ -176,15 +175,15 @@ public class DropTargetBar extends FrameLayout
// Reset second button padding in case it was previously changed to multi-line text.
secondButton.setPadding(horizontalPadding, verticalPadding, horizontalPadding,
verticalPadding);
int availableWidth;
if (dp.getDeviceProperties().isTwoPanels()) {
if (dp.isTwoPanels) {
// Each button for two panel fits to half the width of the screen excluding the
// center gap between the buttons.
availableWidth = (dp.getDeviceProperties().getAvailableWidthPx() - dp.dropTargetGapPx) / 2;
availableWidth = (dp.availableWidthPx - dp.dropTargetGapPx) / 2;
} else {
// Both buttons plus the button gap do not display past the edge of the screen.
availableWidth = dp.getDeviceProperties().getAvailableWidthPx() - dp.dropTargetGapPx;
availableWidth = dp.availableWidthPx - dp.dropTargetGapPx;
}
int widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
@@ -200,7 +199,7 @@ public class DropTargetBar extends FrameLayout
}
}
if (!dp.getDeviceProperties().isTwoPanels()) {
if (!dp.isTwoPanels) {
availableWidth -= firstButton.getMeasuredWidth() + dp.dropTargetGapPx;
widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
}
@@ -240,11 +239,11 @@ public class DropTargetBar extends FrameLayout
float scale = dp.getWorkspaceSpringLoadScale(mLauncher);
Workspace<?> ws = mLauncher.getWorkspace();
int barCenter;
if (dp.getDeviceProperties().isTwoPanels()) {
if (dp.isTwoPanels) {
barCenter = (right - left) / 2;
} else {
int workspaceCenter = (ws.getLeft() + ws.getRight()) / 2;
int cellLayoutCenter = ((dp.getInsets().left + dp.workspacePadding.left) + (dp.getDeviceProperties().getWidthPx()
int cellLayoutCenter = ((dp.getInsets().left + dp.workspacePadding.left) + (dp.widthPx
- dp.getInsets().right - dp.workspacePadding.right)) / 2;
int cellLayoutCenterOffset = (int) ((cellLayoutCenter - workspaceCenter) * scale);
barCenter = workspaceCenter + cellLayoutCenterOffset - left;
@@ -259,7 +258,7 @@ public class DropTargetBar extends FrameLayout
ButtonDropTarget leftButton = mTempTargets[0];
ButtonDropTarget rightButton = mTempTargets[1];
if (dp.getDeviceProperties().isTwoPanels()) {
if (dp.isTwoPanels) {
leftButton.layout(barCenter - leftButton.getMeasuredWidth() - (buttonGap / 2), 0,
barCenter - (buttonGap / 2), leftButton.getMeasuredHeight());
rightButton.layout(barCenter + (buttonGap / 2), 0,