Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gaugelibrary/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
compileSdk = 34

defaultConfig {
minSdk = 24
minSdk = 21

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
Expand Down
5 changes: 3 additions & 2 deletions gaugelibrary/src/main/java/com/imsalman/gaugelibrary/Gauge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class Gauge : View {
// calculating one point sweep
mPointAngle = (abs(sweepAngle.toDouble()) / (mEndValue - startValue))

mValue = a.getInt(styleable.CustomGauge_gaugeValue, startValue)

// calculating divider step
if (dividerSize > 0) {
mDividerSize =
Expand All @@ -130,8 +132,7 @@ class Gauge : View {
mPaint!!.style = Paint.Style.STROKE
mRect = RectF()

mValue = startValue
mPoint = startAngle
mPoint = (startAngle + (mValue - startValue) * mPointAngle).toInt()
}

override fun onDraw(canvas: Canvas) {
Expand Down
1 change: 1 addition & 0 deletions gaugelibrary/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<attr name="gaugeStrokeCap" format="string" />
<attr name="gaugeStartAngle" format="integer" />
<attr name="gaugeSweepAngle" format="integer" />
<attr name="gaugeValue" format="integer" />
<attr name="gaugeStartValue" format="integer" />
<attr name="gaugeEndValue" format="integer" />
<attr name="gaugePointSize" format="integer" />
Expand Down