Revert "Revert "Moving DeviceProfile properties into DevicePrope..."
Revert submission 33716851-revert-33672643-DataDeviceProfile1-XHYRAPLEBK Reason for revert: Error is fixed Reverted changes: /q/submissionid:33716851-revert-33672643-DataDeviceProfile1-XHYRAPLEBK Change-Id: Ib86824134955903c11e51e52dbfd6368aba1cd50
This commit is contained in:
1 parent
1bec329180
commit
e1d31e5406
128 files changed
+727
-597
No files matched your search
@@ -85,8 +85,9 @@ public class DropTargetBar extends FrameLayout
|
||||
@Override
|
||||
public void setInsets(Rect insets) {
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
|
||||
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||
mIsVertical = grid.isVerticalBarLayout();
|
||||
DeviceProfile deviceProfile = mLauncher.getDeviceProfile();
|
||||
mIsVertical = deviceProfile.isVerticalBarLayout();
|
||||
int widthPx = deviceProfile.getDeviceProperties().getWidthPx();
|
||||
|
||||
lp.leftMargin = insets.left;
|
||||
lp.topMargin = insets.top;
|
||||
@@ -95,25 +96,25 @@ public class DropTargetBar extends FrameLayout
|
||||
int tooltipLocation = TOOLTIP_DEFAULT;
|
||||
|
||||
int horizontalMargin;
|
||||
if (grid.isTablet) {
|
||||
if (deviceProfile.getDeviceProperties().isTablet()) {
|
||||
// XXX: If the icon size changes across orientations, we will have to take
|
||||
// that into account here too.
|
||||
horizontalMargin = ((grid.widthPx - 2 * grid.edgeMarginPx
|
||||
- (grid.inv.numColumns * grid.cellWidthPx))
|
||||
/ (2 * (grid.inv.numColumns + 1)))
|
||||
+ grid.edgeMarginPx;
|
||||
horizontalMargin = ((widthPx - 2 * deviceProfile.edgeMarginPx
|
||||
- (deviceProfile.inv.numColumns * deviceProfile.cellWidthPx))
|
||||
/ (2 * (deviceProfile.inv.numColumns + 1)))
|
||||
+ deviceProfile.edgeMarginPx;
|
||||
} else {
|
||||
horizontalMargin = getContext().getResources()
|
||||
.getDimensionPixelSize(R.dimen.drop_target_bar_margin_horizontal);
|
||||
}
|
||||
lp.topMargin += grid.dropTargetBarTopMarginPx;
|
||||
lp.bottomMargin += grid.dropTargetBarBottomMarginPx;
|
||||
lp.width = grid.availableWidthPx - 2 * horizontalMargin;
|
||||
lp.topMargin += deviceProfile.dropTargetBarTopMarginPx;
|
||||
lp.bottomMargin += deviceProfile.dropTargetBarBottomMarginPx;
|
||||
lp.width = deviceProfile.getDeviceProperties().getAvailableWidthPx() - 2 * horizontalMargin;
|
||||
if (mIsVertical) {
|
||||
lp.leftMargin = (grid.widthPx - lp.width) / 2;
|
||||
lp.rightMargin = (grid.widthPx - lp.width) / 2;
|
||||
lp.leftMargin = (widthPx - lp.width) / 2;
|
||||
lp.rightMargin = (widthPx - lp.width) / 2;
|
||||
}
|
||||
lp.height = grid.dropTargetBarSizePx;
|
||||
lp.height = deviceProfile.dropTargetBarSizePx;
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
||||
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
@@ -121,7 +122,7 @@ public class DropTargetBar extends FrameLayout
|
||||
int verticalPadding = dp.dropTargetVerticalPaddingPx;
|
||||
setLayoutParams(lp);
|
||||
for (ButtonDropTarget button : mDropTargets) {
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.dropTargetTextSizePx);
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, deviceProfile.dropTargetTextSizePx);
|
||||
button.setToolTipLocation(tooltipLocation);
|
||||
button.setPadding(horizontalPadding, verticalPadding, horizontalPadding,
|
||||
verticalPadding);
|
||||
@@ -175,15 +176,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.isTwoPanels) {
|
||||
if (dp.getDeviceProperties().isTwoPanels()) {
|
||||
// Each button for two panel fits to half the width of the screen excluding the
|
||||
// center gap between the buttons.
|
||||
availableWidth = (dp.availableWidthPx - dp.dropTargetGapPx) / 2;
|
||||
availableWidth = (dp.getDeviceProperties().getAvailableWidthPx() - dp.dropTargetGapPx) / 2;
|
||||
} else {
|
||||
// Both buttons plus the button gap do not display past the edge of the screen.
|
||||
availableWidth = dp.availableWidthPx - dp.dropTargetGapPx;
|
||||
availableWidth = dp.getDeviceProperties().getAvailableWidthPx() - dp.dropTargetGapPx;
|
||||
}
|
||||
|
||||
int widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
|
||||
@@ -199,7 +200,7 @@ public class DropTargetBar extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
if (!dp.isTwoPanels) {
|
||||
if (!dp.getDeviceProperties().isTwoPanels()) {
|
||||
availableWidth -= firstButton.getMeasuredWidth() + dp.dropTargetGapPx;
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
|
||||
}
|
||||
@@ -239,11 +240,11 @@ public class DropTargetBar extends FrameLayout
|
||||
float scale = dp.getWorkspaceSpringLoadScale(mLauncher);
|
||||
Workspace<?> ws = mLauncher.getWorkspace();
|
||||
int barCenter;
|
||||
if (dp.isTwoPanels) {
|
||||
if (dp.getDeviceProperties().isTwoPanels()) {
|
||||
barCenter = (right - left) / 2;
|
||||
} else {
|
||||
int workspaceCenter = (ws.getLeft() + ws.getRight()) / 2;
|
||||
int cellLayoutCenter = ((dp.getInsets().left + dp.workspacePadding.left) + (dp.widthPx
|
||||
int cellLayoutCenter = ((dp.getInsets().left + dp.workspacePadding.left) + (dp.getDeviceProperties().getWidthPx()
|
||||
- dp.getInsets().right - dp.workspacePadding.right)) / 2;
|
||||
int cellLayoutCenterOffset = (int) ((cellLayoutCenter - workspaceCenter) * scale);
|
||||
barCenter = workspaceCenter + cellLayoutCenterOffset - left;
|
||||
@@ -258,7 +259,7 @@ public class DropTargetBar extends FrameLayout
|
||||
|
||||
ButtonDropTarget leftButton = mTempTargets[0];
|
||||
ButtonDropTarget rightButton = mTempTargets[1];
|
||||
if (dp.isTwoPanels) {
|
||||
if (dp.getDeviceProperties().isTwoPanels()) {
|
||||
leftButton.layout(barCenter - leftButton.getMeasuredWidth() - (buttonGap / 2), 0,
|
||||
barCenter - (buttonGap / 2), leftButton.getMeasuredHeight());
|
||||
rightButton.layout(barCenter + (buttonGap / 2), 0,
|
||||
|
||||
Reference in new issue
Block a user