@@ -45,10 +45,6 @@ import kotlin.math.sin
4545 * into layout files and programmatic usage within activities or fragments. By utilizing the provided attributes
4646 * and methods, developers can create highly customizable and visually appealing clock displays tailored to
4747 * 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.
5248<p>
5349 * * Created by Jummania on 23,May,2024.
5450 * * Email: sharifuddinjumman@gmail.com
@@ -59,7 +55,10 @@ class AnalogClock @JvmOverloads constructor(
5955) : View(context, attrs, defStyleAttr) {
6056
6157 // 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+ }
6362 private val rect by lazy { Rect () } // Used for calculating the size and position of drawing elements.
6463
6564 // Integer Variable
@@ -457,7 +456,7 @@ class AnalogClock @JvmOverloads constructor(
457456 }
458457
459458 if (minuteHand || hourHand) {
460- // Draw the clock face
459+ // Draw a circle if enabled
461460 drawCircle(canvas, radius * hourHandWidth * 1.1f , minuteHandColor)
462461 }
463462
@@ -481,6 +480,7 @@ class AnalogClock @JvmOverloads constructor(
481480 true
482481 )
483482
483+ // Draw a circle
484484 drawCircle(canvas, radius * secondHandWidth * 1.3f , secondHandColor)
485485 }
486486 }
@@ -492,9 +492,9 @@ class AnalogClock @JvmOverloads constructor(
492492 * @param canvas The canvas on which the clock hand will be drawn.
493493 * @param width The width of the clock hand.
494494 * @param height The height of the clock hand.
495- * @param extraLine The length of the extra line behind the center.
496495 * @param backgroundColor The background color of the clock hand.
497496 * @param angle The angle at which the clock hand will be drawn.
497+ * * @param isSecondHand The hand is second Hand or not.
498498 */
499499 private fun createHand (
500500 canvas : Canvas ,
@@ -771,7 +771,6 @@ class AnalogClock @JvmOverloads constructor(
771771 /* *
772772 * Converts a size value from scaled pixels (SP) to pixels (PX).
773773 *
774- * @param value The size value in scaled pixels (SP).
775774 * @return The size value in pixels (PX).
776775 */
777776 private fun Float.toSP (): Float {
0 commit comments