Skip to content

Commit 1b0f981

Browse files
committed
Enhanced Performance and User Interface of the AnalogClock Library
1 parent 3d5c7f8 commit 1b0f981

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

AnalogClock/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ android {
1919
release {
2020
isMinifyEnabled = false
2121
proguardFiles(
22-
getDefaultProguardFile("proguard-android-optimize.txt"),
23-
"proguard-rules.pro"
22+
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2423
)
2524
}
2625
}
@@ -44,7 +43,7 @@ afterEvaluate {
4443
register<MavenPublication>("release") {
4544
groupId = "com.github.Jumman04"
4645
artifactId = "Analogue-Watch"
47-
version = "4.1"
46+
version = "4.2"
4847

4948
afterEvaluate {
5049
from(components["release"])

AnalogClock/src/main/java/com/jummania/AnalogClock.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Step 2. Add the dependency
5454

5555
```groovy
5656
dependencies {
57-
implementation 'com.github.Jumman04:Analogue-Watch:4.1'
57+
implementation 'com.github.Jumman04:Analogue-Watch:4.2'
5858
}
5959
```
6060

app/build.gradle.kts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
applicationId = "com.jummania.analogue_watch"
1212
minSdk = 21
1313
targetSdk = 34
14-
versionCode = 5
15-
versionName = "4.1"
14+
versionCode = 6
15+
versionName = "4.2"
1616

1717
resValue("string", "versionName", versionName.toString())
1818
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -23,8 +23,7 @@ android {
2323
isMinifyEnabled = true
2424
isShrinkResources = true
2525
proguardFiles(
26-
getDefaultProguardFile("proguard-android-optimize.txt"),
27-
"proguard-rules.pro"
26+
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2827
)
2928
}
3029
}
@@ -46,6 +45,6 @@ dependencies {
4645
implementation(libs.material)
4746
implementation(libs.neumorphism)
4847
implementation(libs.androidx.preference)
49-
implementation (libs.android.colorpickerpreference)
48+
implementation(libs.android.colorpickerpreference)
5049
implementation(project(":AnalogClock"))
5150
}

0 commit comments

Comments
 (0)