android/source/src/java/org/libreoffice/canvas/CalcHeaderCell.java |   21 
++++++----
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 615705acd731150e029587daafc1226d1e07a108
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Nov 27 11:05:57 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 29 13:43:11 2023 +0100

    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.wegh...@posteo.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160026

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);
     }
 }

Reply via email to