Skip to content

Commit 9c1d43c

Browse files
committed
bug-fix: use API 1 base Path API.
1 parent b64f41d commit 9c1d43c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

library/src/main/java/com/opensource/svgaplayer/SVGAVideoShapeEntity.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.opensource.svgaplayer
33
import android.graphics.Color
44
import android.graphics.Matrix
55
import android.graphics.Path
6+
import android.graphics.RectF
67
import android.os.Build
78

89
import org.json.JSONArray
@@ -169,12 +170,7 @@ class SVGAVideoShapeEntity(obj: JSONObject) {
169170
val y = yv.toFloat()
170171
val rx = rxv.toFloat()
171172
val ry = ryv.toFloat()
172-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
173-
aPath.addOval(x - rx, y - ry, x + rx, y + ry, Path.Direction.CW)
174-
}
175-
else if (Math.abs(rx - ry) < 0.1) {
176-
aPath.addCircle(x, y, rx, Path.Direction.CW)
177-
}
173+
aPath.addOval(RectF(x - rx, y - ry, x + rx, y + ry), Path.Direction.CW)
178174
}
179175
else if (this.type == SVGAVideoShapeEntity.Type.rect) {
180176
val xv = this.args?.get("x") as? Number ?: return
@@ -187,12 +183,7 @@ class SVGAVideoShapeEntity(obj: JSONObject) {
187183
val width = wv.toFloat()
188184
val height = hv.toFloat()
189185
val cornerRadius = crv.toFloat()
190-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
191-
aPath.addRoundRect(x, y, x + width, y + height, cornerRadius, cornerRadius, Path.Direction.CW)
192-
}
193-
else {
194-
aPath.addRect(x, y, x + width, y + height, Path.Direction.CW)
195-
}
186+
aPath.addRoundRect(RectF(x, y, x + width, y + height), cornerRadius, cornerRadius, Path.Direction.CW)
196187
}
197188
this.shapePath = aPath
198189
}

0 commit comments

Comments
 (0)