mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Adding animation so the CellLayout is properly spaced on Foldables
Flag: LEGACY FOLDABLE_SINGLE_PAGE DISABLED Fix: 294841331 Test: atest HomeScreenEditStateImageTest Change-Id: I5dc94b63ca322748b952ce4bd55b6951d51d190f
This commit is contained in:
@@ -57,6 +57,7 @@ import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Px;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
@@ -175,6 +176,8 @@ public class CellLayout extends ViewGroup {
|
||||
|
||||
private final TimeInterpolator mEaseOutInterpolator;
|
||||
protected final ShortcutAndWidgetContainer mShortcutsAndWidgets;
|
||||
@Px
|
||||
protected int mSpaceBetweenCellLayoutsPx = 0;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({WORKSPACE, HOTSEAT, FOLDER})
|
||||
@@ -636,12 +639,19 @@ public class CellLayout extends ViewGroup {
|
||||
mVisualizeGridPaint.setColor(Color.argb((int) (alpha),
|
||||
Color.red(mGridColor), Color.green(mGridColor), Color.blue(mGridColor)));
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(getMarginForGivenCellParams(params), 0);
|
||||
canvas.drawRoundRect(mVisualizeGridRect, mGridVisualizationRoundingRadius,
|
||||
mGridVisualizationRoundingRadius, mVisualizeGridPaint);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected float getMarginForGivenCellParams(CellLayoutLayoutParams params) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
@@ -2844,4 +2854,8 @@ public class CellLayout extends ViewGroup {
|
||||
public boolean isRegionVacant(int x, int y, int spanX, int spanY) {
|
||||
return mOccupied.isRegionVacant(x, y, spanX, spanY);
|
||||
}
|
||||
|
||||
public void setSpaceBetweenCellLayoutsPx(@Px int spaceBetweenCellLayoutsPx) {
|
||||
mSpaceBetweenCellLayoutsPx = spaceBetweenCellLayoutsPx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user