diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-27 11:05:57 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-11-29 13:43:11 +0100 |
commit | 615705acd731150e029587daafc1226d1e07a108 (patch) | |
tree | e1cc9076762c6dc9d2723f6103f4cb1e8ecd4a62 /android | |
parent | f4d9f597d1192a688900fda7f11f75c5804196ce (diff) |
tdf#158398 android: Draw light gray background for Calc headers
Similar to the desktop version, use a light gray background
color for the Calc header cells.
There was already code in place to draw darker gray background
to highlight the header cell when a cell in that row/column is
selected.
(The actually highlighted header cell didn't wasn't always the
correct one in a quick test, but that's independent of this change.)
Adapt that to always fill the rectangle, but use a lighter gray
(lower alpha value) when not selected.
Use a separate `Paint` object for the frame (stroke).
Set the frame color and text color to black instead of gray, for
better contrast to the light gray fill/background.
Change-Id: I0490811e928ebd1b3840242fc1aa4682b2786b00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159989
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160026
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java b/android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java index eec0b5e4a88d..a285234bc8b0 100644 --- a/android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java +++ b/android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java @@ -10,6 +10,8 @@ import android.text.TextPaint; public class CalcHeaderCell extends CommonCanvasElement { private final TextPaint mTextPaint = new TextPaint(); + + private final Paint mFramePaint = new Paint(); private final Paint mBgPaint = new Paint(); private final RectF mBounds; private final Rect mTextBounds = new Rect(); @@ -17,16 +19,20 @@ public class CalcHeaderCell extends CommonCanvasElement { public CalcHeaderCell(float left, float top, float width, float height, String text, boolean selected) { mBounds = new RectF(left, top, left + width, top + height); + + mFramePaint.setStyle(Style.STROKE); + mFramePaint.setColor(Color.BLACK); + + mBgPaint.setStyle(Style.FILL); + mBgPaint.setColor(Color.GRAY); + // draw background more intensely when cell is selected if (selected) { - // if the cell is selected, display filled - mBgPaint.setStyle(Style.FILL_AND_STROKE); + mBgPaint.setAlpha(100); } else { - // if not, display only the frame - mBgPaint.setStyle(Style.STROKE); + mBgPaint.setAlpha(25); } - mBgPaint.setColor(Color.GRAY); - mBgPaint.setAlpha(100); // hard coded for now - mTextPaint.setColor(Color.GRAY); + + mTextPaint.setColor(Color.BLACK); mTextPaint.setTextSize(24f); // hard coded for now mTextPaint.setTextAlign(Paint.Align.CENTER); mText = text; @@ -54,6 +60,7 @@ public class CalcHeaderCell extends CommonCanvasElement { @Override public void onDraw(Canvas canvas) { canvas.drawRect(mBounds, mBgPaint); + canvas.drawRect(mBounds, mFramePaint); canvas.drawText(mText, mBounds.centerX(), mBounds.centerY() - mTextBounds.centerY(), mTextPaint); } } |