Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53599843 authored by Pierre-Louis Guidez's avatar Pierre-Louis Guidez Committed by Automerger Merge Worker
Browse files

Merge "Draw 4x5 graph for grid options" into sc-dev am: e274b318

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/14353227

Change-Id: I04d6f66eb61536269b5ac31f2974f6c246b3002e
parents eae30aec e274b318
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public class LauncherGridOptionsProvider {
                int rows = c.getInt(c.getColumnIndex(COL_ROWS));
                int cols = c.getInt(c.getColumnIndex(COL_COLS));
                int previewCount = c.getInt(c.getColumnIndex(COL_PREVIEW_COUNT));
                boolean isSet = Boolean.valueOf(c.getString(c.getColumnIndex(COL_IS_DEFAULT)));
                boolean isSet = Boolean.parseBoolean(c.getString(c.getColumnIndex(COL_IS_DEFAULT)));
                String title = GRID_NAME_NORMAL.equals(name)
                        ? mContext.getString(R.string.default_theme_title)
                        : mContext.getString(R.string.grid_title_pattern, cols, rows);
+6 −3
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ public class GridTileDrawable extends Drawable {
    @Override
    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        mCellSize = (float) bounds.height() / mRows;
        int longestSide = Math.max(mRows, mCols);
        mCellSize = (float) bounds.width() / longestSide;

        float scaleFactor = (mCellSize - 2 * SPACE_BETWEEN_ICONS) / PATH_SIZE;
        mScaleMatrix.setScale(scaleFactor, scaleFactor);
@@ -49,11 +50,13 @@ public class GridTileDrawable extends Drawable {

    @Override
    public void draw(Canvas canvas) {
        double size = getBounds().width();

        for (int r = 0; r < mRows; r++) {
            for (int c = 0; c < mCols; c++) {
                int saveCount = canvas.save();
                float x = (c * mCellSize) + SPACE_BETWEEN_ICONS;
                float y = (r * mCellSize) + SPACE_BETWEEN_ICONS;
                float x = (float) ((r * size / mRows) + SPACE_BETWEEN_ICONS);
                float y = (float) ((c * size / mCols) + SPACE_BETWEEN_ICONS);
                canvas.translate(x, y);
                canvas.drawPath(mTransformedPath, mPaint);
                canvas.restoreToCount(saveCount);