Allocate insane memory just for CI
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
dd4a08be61
commit
b67168f737
1183 files changed
+71641
-76403
No files matched your search
@@ -44,8 +44,7 @@ public class DropTargetBar extends FrameLayout
|
||||
protected static final int DEFAULT_DRAG_FADE_DURATION = 175;
|
||||
protected static final TimeInterpolator DEFAULT_INTERPOLATOR = Interpolators.ACCELERATE;
|
||||
|
||||
private final Runnable mFadeAnimationEndRunnable =
|
||||
() -> updateVisibility(DropTargetBar.this);
|
||||
private final Runnable mFadeAnimationEndRunnable = () -> updateVisibility(DropTargetBar.this);
|
||||
|
||||
private final Launcher mLauncher;
|
||||
|
||||
@@ -85,9 +84,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,34 +94,33 @@ 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;
|
||||
// that into account here too.
|
||||
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.getDropTargetProfile().getBarTopMarginPx();
|
||||
lp.bottomMargin += deviceProfile.getDropTargetProfile().getBarBottomMarginPx();
|
||||
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.getDropTargetProfile().getBarSizePx();
|
||||
lp.height = grid.dropTargetBarSizePx;
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
||||
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
int horizontalPadding = dp.getDropTargetProfile().getHorizontalPaddingPx();
|
||||
int verticalPadding = dp.getDropTargetProfile().getVerticalPaddingPx();
|
||||
int horizontalPadding = dp.dropTargetHorizontalPaddingPx;
|
||||
int verticalPadding = dp.dropTargetVerticalPaddingPx;
|
||||
setLayoutParams(lp);
|
||||
for (ButtonDropTarget button : mDropTargets) {
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
deviceProfile.getDropTargetProfile().getTextSizePx());
|
||||
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.dropTargetTextSizePx);
|
||||
button.setToolTipLocation(tooltipLocation);
|
||||
button.setPadding(horizontalPadding, verticalPadding, horizontalPadding,
|
||||
verticalPadding);
|
||||
@@ -150,52 +147,51 @@ public class DropTargetBar extends FrameLayout
|
||||
|
||||
ButtonDropTarget firstButton = mTempTargets[0];
|
||||
firstButton.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
mLauncher.getDeviceProfile().getDropTargetProfile().getTextSizePx());
|
||||
mLauncher.getDeviceProfile().dropTargetTextSizePx);
|
||||
firstButton.setTextVisible(true);
|
||||
firstButton.setIconVisible(true);
|
||||
firstButton.measure(widthSpec, heightSpec);
|
||||
firstButton.resizeTextToFit();
|
||||
} else if (visibleCount == 2) {
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
int verticalPadding = dp.getDropTargetProfile().getVerticalPaddingPx();
|
||||
int horizontalPadding = dp.getDropTargetProfile().getHorizontalPaddingPx();
|
||||
int verticalPadding = dp.dropTargetVerticalPaddingPx;
|
||||
int horizontalPadding = dp.dropTargetHorizontalPaddingPx;
|
||||
|
||||
ButtonDropTarget firstButton = mTempTargets[0];
|
||||
firstButton.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
dp.getDropTargetProfile().getTextSizePx());
|
||||
firstButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp.dropTargetTextSizePx);
|
||||
firstButton.setTextVisible(true);
|
||||
firstButton.setIconVisible(true);
|
||||
firstButton.setTextMultiLine(false);
|
||||
// Reset first button padding in case it was previously changed to multi-line text.
|
||||
// Reset first button padding in case it was previously changed to multi-line
|
||||
// text.
|
||||
firstButton.setPadding(horizontalPadding, verticalPadding, horizontalPadding,
|
||||
verticalPadding);
|
||||
|
||||
ButtonDropTarget secondButton = mTempTargets[1];
|
||||
secondButton.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
dp.getDropTargetProfile().getTextSizePx());
|
||||
secondButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp.dropTargetTextSizePx);
|
||||
secondButton.setTextVisible(true);
|
||||
secondButton.setIconVisible(true);
|
||||
secondButton.setTextMultiLine(false);
|
||||
// Reset second button padding in case it was previously changed to multi-line text.
|
||||
// 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.getDropTargetProfile().getGapPx()) / 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.getDropTargetProfile().getGapPx();
|
||||
availableWidth = dp.availableWidthPx - dp.dropTargetGapPx;
|
||||
}
|
||||
|
||||
int widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
|
||||
firstButton.measure(widthSpec, heightSpec);
|
||||
if (!mIsVertical) {
|
||||
// Remove both icons and put the button's text on two lines if text is truncated.
|
||||
// Remove both icons and put the button's text on two lines if text is
|
||||
// truncated.
|
||||
if (firstButton.isTextTruncated(availableWidth)) {
|
||||
firstButton.setIconVisible(false);
|
||||
secondButton.setIconVisible(false);
|
||||
@@ -205,14 +201,14 @@ public class DropTargetBar extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
if (!dp.getDeviceProperties().isTwoPanels()) {
|
||||
availableWidth -= firstButton.getMeasuredWidth()
|
||||
+ dp.getDropTargetProfile().getGapPx();
|
||||
if (!dp.isTwoPanels) {
|
||||
availableWidth -= firstButton.getMeasuredWidth() + dp.dropTargetGapPx;
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
|
||||
}
|
||||
secondButton.measure(widthSpec, heightSpec);
|
||||
if (!mIsVertical) {
|
||||
// Remove both icons and put the button's text on two lines if text is truncated.
|
||||
// Remove both icons and put the button's text on two lines if text is
|
||||
// truncated.
|
||||
if (secondButton.isTextTruncated(availableWidth)) {
|
||||
secondButton.setIconVisible(false);
|
||||
firstButton.setIconVisible(false);
|
||||
@@ -222,9 +218,9 @@ public class DropTargetBar extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
// If text is still truncated, shrink to fit in measured width and resize both targets.
|
||||
float minTextSize =
|
||||
Math.min(firstButton.resizeTextToFit(), secondButton.resizeTextToFit());
|
||||
// If text is still truncated, shrink to fit in measured width and resize both
|
||||
// targets.
|
||||
float minTextSize = Math.min(firstButton.resizeTextToFit(), secondButton.resizeTextToFit());
|
||||
if (firstButton.getTextSize() != minTextSize
|
||||
|| secondButton.getTextSize() != minTextSize) {
|
||||
firstButton.setTextSize(minTextSize);
|
||||
@@ -246,11 +242,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;
|
||||
@@ -261,11 +257,11 @@ public class DropTargetBar extends FrameLayout
|
||||
button.layout(barCenter - (button.getMeasuredWidth() / 2), 0,
|
||||
barCenter + (button.getMeasuredWidth() / 2), button.getMeasuredHeight());
|
||||
} else if (visibleCount == 2) {
|
||||
int buttonGap = dp.getDropTargetProfile().getGapPx();
|
||||
int buttonGap = dp.dropTargetGapPx;
|
||||
|
||||
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,
|
||||
@@ -333,7 +329,8 @@ public class DropTargetBar extends FrameLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called to defer hiding the delete drop target until the drop animation has completed,
|
||||
* This is called to defer hiding the delete drop target until the drop
|
||||
* animation has completed,
|
||||
* instead of hiding immediately when the drag has ended.
|
||||
*/
|
||||
protected void deferOnDragEnd() {
|
||||
@@ -349,10 +346,7 @@ public class DropTargetBar extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all possible drop targets (including ones that aren't visible)
|
||||
*/
|
||||
public ButtonDropTarget[] getDropTargets() {
|
||||
return mDropTargets;
|
||||
return getVisibility() == View.VISIBLE ? mDropTargets : new ButtonDropTarget[0];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user