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

Commit 1b33e3e4 authored by Pierre-Louis's avatar Pierre-Louis Committed by Pierre-Louis Guidez
Browse files

Draw 4x5 graph for grid options

Simplified the draw method

Screenshot: https://screenshot.googleplex.com/8hsf2bUJXM3osH3.png
Screenshot (high density): https://screenshot.googleplex.com/6A7fpV3ow5FWHdW.png
Screenshot (low density): https://screenshot.googleplex.com/AJDAgo5jWfDBgSe.png

Bug: 186606404
Test: manual, at different screen densities
Change-Id: Ibe4080be00d492028b1cb74ed1700498ad812196
parent 3aaed127
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);