@@ -57,10 +57,15 @@ private Bitmap render() {
5757 clearClockBitmap ();
5858
5959 Calendar calendar = Calendar .getInstance ();
60- final boolean is24Hour = ClockWidgetSettings .shouldUse24HourFormat () || calendar . get ( Calendar . AM_PM ) == Calendar . AM ;
60+ final boolean is24Hour = ClockWidgetSettings .shouldUse24HourFormat ();
6161 final int nHourBits = is24Hour ? ClockWidgetSettings .shouldUse6bitsForHour () ? 6 : 5 : 4 ;
6262 final int hour = calendar .get (is24Hour ? Calendar .HOUR_OF_DAY : Calendar .HOUR );
6363 final int minute = calendar .get (Calendar .MINUTE );
64+ final int onBitColor = is24Hour || calendar .get (Calendar .AM_PM ) == Calendar .AM
65+ ? ClockWidgetSettings .getClockAMOnColor () : ClockWidgetSettings .getClockPMOnColor ();
66+
67+ final int offBitColor = is24Hour || calendar .get (Calendar .AM_PM ) == Calendar .AM
68+ ? ClockWidgetSettings .getClockAMOffColor () : ClockWidgetSettings .getClockPMOffColor ();
6469
6570 final float sx = width * (is24Hour ? 0.5f : 0.4f );
6671 final float sp = px (5 );
@@ -70,10 +75,10 @@ private Bitmap render() {
7075 canvas .drawRoundRect (new RectF (0 , 0 , width , height ), px (5 ), px (5 ), mPaint );
7176
7277 RectF bounds = new RectF (padding , padding , sx - sp , height - padding );
73- renderBits (is24Hour , bounds , 2 , is24Hour ? 3 : 2 , nHourBits , hour );
78+ renderBits (onBitColor , offBitColor , bounds , 2 , is24Hour ? 3 : 2 , nHourBits , hour );
7479
7580 bounds .set (sx + sp , padding , width - padding , height - padding );
76- renderBits (is24Hour , bounds , 2 , 3 , 6 , minute );
81+ renderBits (onBitColor , offBitColor , bounds , 2 , 3 , 6 , minute );
7782
7883 if (ClockWidgetSettings .shouldDisplaySeparator ()) {
7984 mPaint .setAlpha (SEPARATOR_LINE_ALPHA );
@@ -84,7 +89,7 @@ private Bitmap render() {
8489 }
8590
8691 @ SuppressWarnings ("SameParameterValue" )
87- private void renderBits (boolean is24Hour , RectF bounds , int rows , int cols , int nBits , int bits ) {
92+ private void renderBits (int onColor , int offColor , RectF bounds , int rows , int cols , int nBits , int bits ) {
8893 final float dr = px (ClockWidgetSettings .getDotSize ());
8994 final float cw = bounds .width () / cols ;
9095 final float ch = bounds .height () / rows ;
@@ -100,13 +105,9 @@ private void renderBits(boolean is24Hour, RectF bounds, int rows, int cols, int
100105 }
101106
102107 if ((bits >> ((i * cols ) + j ) & 1 ) == 1 ) {
103- mPaint .setColor (
104- is24Hour ? ClockWidgetSettings .getClockAMOnColor () : ClockWidgetSettings .getClockPMOnColor ()
105- );
108+ mPaint .setColor (onColor );
106109 } else {
107- mPaint .setColor (
108- is24Hour ? ClockWidgetSettings .getClockAMOffColor () : ClockWidgetSettings .getClockPMOffColor ()
109- );
110+ mPaint .setColor (offColor );
110111 }
111112
112113 canvas .drawCircle (x - cpx - dr , y - cpy - dr , dr , mPaint );
0 commit comments