Fix today icon text alignment
Bug: 6479808 Today icon's number is not centered on phone.
Change-Id: I0775bd3f10554360f8ee8334280dea3741004c74
diff --git a/src/com/android/calendar/DayOfMonthDrawable.java b/src/com/android/calendar/DayOfMonthDrawable.java
index 9bfc85c..461ab31 100644
--- a/src/com/android/calendar/DayOfMonthDrawable.java
+++ b/src/com/android/calendar/DayOfMonthDrawable.java
@@ -25,9 +25,6 @@
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
-
-
-
/**
* A custom view to draw the day of the month in the today button in the options menu
*/
@@ -46,16 +43,16 @@
mPaint.setColor(0xFF777777);
mPaint.setTypeface(Typeface.DEFAULT_BOLD);
mPaint.setTextSize(mTextSize);
+ mPaint.setTextAlign(Paint.Align.CENTER);
}
@Override
public void draw(Canvas canvas) {
mPaint.getTextBounds(mDayOfMonth, 0, mDayOfMonth.length(), mTextBounds);
- int textWidth = mTextBounds.right - mTextBounds.left;
int textHeight = mTextBounds.bottom - mTextBounds.top;
Rect bounds = getBounds();
- canvas.drawText(mDayOfMonth, ((float)(bounds.right - textWidth)) / 2,
- ((float)bounds.bottom + textHeight) / 2, mPaint);
+ canvas.drawText(mDayOfMonth, bounds.right / 2, ((float) bounds.bottom + textHeight + 1) / 2,
+ mPaint);
}
@Override