Skip to content

Commit

Permalink
Removed not necessary dependencies from the library.
Browse files Browse the repository at this point in the history
  • Loading branch information
mckrpk committed Sep 11, 2024
1 parent 5faf679 commit a0bdd4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Your app's build.gradle:
```groovy
dependencies {
implementation 'io.github.mckrpk:AnimatedProgressBar:0.3.1'
implementation 'io.github.mckrpk:AnimatedProgressBar:1.0.0'
}
```

Expand Down
4 changes: 1 addition & 3 deletions animatedprogressbar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.graphics.Canvas
import android.graphics.Path
import android.graphics.RectF
import android.view.animation.DecelerateInterpolator
import androidx.core.graphics.withClip
import kotlin.math.max

internal class ProgressDrawer(
Expand Down Expand Up @@ -51,16 +50,25 @@ internal class ProgressDrawer(
}

override fun draw(canvas: Canvas) {
canvas.withClip(clipPath) {
drawRoundRect(progressRect, attrs.cornerRadius, attrs.cornerRadius, attrs.progressPaint)
val checkpoint = canvas.save()
canvas.clipPath(clipPath)
try {
canvas.drawRoundRect(
progressRect,
attrs.cornerRadius,
attrs.cornerRadius,
attrs.progressPaint
)
if (attrs.progressTipEnabled) {
drawRoundRect(
canvas.drawRoundRect(
progressTipRect,
attrs.cornerRadius,
attrs.cornerRadius,
attrs.progressTipPaint
)
}
} finally {
canvas.restoreToCount(checkpoint)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.util.DisplayMetrics
import android.util.TypedValue
import androidx.annotation.AttrRes
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat


fun getThemeColor(context: Context, @AttrRes resName: Int, @ColorRes fallbackColorRes: Int): Int {
Expand All @@ -15,7 +14,7 @@ fun getThemeColor(context: Context, @AttrRes resName: Int, @ColorRes fallbackCol
return if (wasResolved)
outValue.data
else
ContextCompat.getColor(context, fallbackColorRes)
context.resources.getColor(fallbackColorRes)
}

fun getThemeAccentColor(context: Context, @ColorRes fallbackColorRes: Int): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Context
import android.content.res.TypedArray
import android.graphics.Paint
import android.graphics.RectF
import androidx.core.content.ContextCompat
import kotlin.math.min

internal class ViewProperties(attrs: TypedArray, context: Context) {
Expand Down Expand Up @@ -79,7 +78,7 @@ internal class ViewProperties(attrs: TypedArray, context: Context) {
)
trackColor = attrs.getColor(
R.styleable.AnimatedProgressBar_trackColor,
ContextCompat.getColor(context, R.color.defaultTrack)
context.resources.getColor(R.color.defaultTrack)
)

progressTipWidth =
Expand Down

0 comments on commit a0bdd4b

Please sign in to comment.