@@ -45,10 +45,6 @@ import kotlin.math.sin
45
45
* into layout files and programmatic usage within activities or fragments. By utilizing the provided attributes
46
46
* and methods, developers can create highly customizable and visually appealing clock displays tailored to
47
47
* their application's requirements.
48
- *
49
- * @property context The context in which the view is created.
50
- * @property attrs The set of attributes defined in XML for customization.
51
- * @property defStyleAttr An attribute in the current theme that contains a reference to a style resource.
52
48
<p>
53
49
* * Created by Jummania on 23,May,2024.
54
50
* * Email: sharifuddinjumman@gmail.com
@@ -59,7 +55,10 @@ class AnalogClock @JvmOverloads constructor(
59
55
) : View(context, attrs, defStyleAttr) {
60
56
61
57
// Paint and Rect Objects
62
- private val paint = Paint () // Used for drawing shapes and text on the canvas.
58
+ private val paint = Paint ().also {
59
+ // Set stroke cap to round
60
+ it.strokeCap = Paint .Cap .ROUND
61
+ }
63
62
private val rect by lazy { Rect () } // Used for calculating the size and position of drawing elements.
64
63
65
64
// Integer Variable
@@ -457,7 +456,7 @@ class AnalogClock @JvmOverloads constructor(
457
456
}
458
457
459
458
if (minuteHand || hourHand) {
460
- // Draw the clock face
459
+ // Draw a circle if enabled
461
460
drawCircle(canvas, radius * hourHandWidth * 1.1f , minuteHandColor)
462
461
}
463
462
@@ -481,6 +480,7 @@ class AnalogClock @JvmOverloads constructor(
481
480
true
482
481
)
483
482
483
+ // Draw a circle
484
484
drawCircle(canvas, radius * secondHandWidth * 1.3f , secondHandColor)
485
485
}
486
486
}
@@ -492,9 +492,9 @@ class AnalogClock @JvmOverloads constructor(
492
492
* @param canvas The canvas on which the clock hand will be drawn.
493
493
* @param width The width of the clock hand.
494
494
* @param height The height of the clock hand.
495
- * @param extraLine The length of the extra line behind the center.
496
495
* @param backgroundColor The background color of the clock hand.
497
496
* @param angle The angle at which the clock hand will be drawn.
497
+ * * @param isSecondHand The hand is second Hand or not.
498
498
*/
499
499
private fun createHand (
500
500
canvas : Canvas ,
@@ -771,7 +771,6 @@ class AnalogClock @JvmOverloads constructor(
771
771
/* *
772
772
* Converts a size value from scaled pixels (SP) to pixels (PX).
773
773
*
774
- * @param value The size value in scaled pixels (SP).
775
774
* @return The size value in pixels (PX).
776
775
*/
777
776
private fun Float.toSP (): Float {
0 commit comments