Skip to content

Commit

Permalink
Unify code styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler authored and egorikftp committed Jul 23, 2024
1 parent 8560894 commit dafc372
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 73 deletions.
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ allprojects {
extensions.configure<SpotlessExtension> {
kotlin {
target("src/**/*.kt")
// Sources copied from AndroidX Compose
targetExclude("src/main/kotlin/androidx/**")
ktlint(rootProject.libs.ktlint.get().version)
.customRuleSets(
listOf(
Expand Down
3 changes: 3 additions & 0 deletions components/androidx-compose/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.kt]
# Disable ktlint rules that conflict with the AndroidX code style.
ktlint_standard_property-naming = disabled
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ internal fun rawAsGraphicUnit(raw: String): GraphicUnit {
isStrokeDp -> Dp(raw.removeSuffix("dp").toFloat())
else -> Pixel(raw.toFloat())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IconParser(private val icon: Icon) {
PATH -> {
val pathData = parser.getAttributeValue(
null,
PATH_DATA
PATH_DATA,
)
val fillAlpha = parser.getValueAsFloat(FILL_ALPHA)
val strokeAlpha = parser.getValueAsFloat(STROKE_ALPHA)
Expand Down Expand Up @@ -108,7 +108,7 @@ class IconParser(private val icon: Icon) {
strokeLineJoin = strokeJoin ?: StrokeJoin.Miter,
strokeLineMiter = strokeMiterLimit ?: 4.0f,
fillType = fillType,
nodes = PathParser.parsePathString(pathData)
nodes = PathParser.parsePathString(pathData),
)
if (currentGroup != null) {
currentGroup.paths.add(path)
Expand All @@ -122,7 +122,8 @@ class IconParser(private val icon: Icon) {
currentGroup = group
nodes.add(group)
}
CLIP_PATH -> { /* TODO: b/147418351 - parse clipping paths */
CLIP_PATH -> {
/* TODO: b/147418351 - parse clipping paths */
}
GRADIENT -> {
val gradient = when (parser.getAttributeValue(null, TYPE)) {
Expand All @@ -135,7 +136,7 @@ class IconParser(private val icon: Icon) {
startY = startY,
startX = startX,
endX = endX,
endY = endY
endY = endY,
)
}
RADIAL -> {
Expand All @@ -145,7 +146,7 @@ class IconParser(private val icon: Icon) {
Fill.RadialGradient(
gradientRadius = gradientRadius,
centerX = centerX,
centerY = centerY
centerY = centerY,
)
}
else -> null
Expand Down Expand Up @@ -184,7 +185,7 @@ class IconParser(private val icon: Icon) {
height,
viewportWidth,
viewportHeight,
nodes
nodes,
)
}
}
Expand Down Expand Up @@ -216,8 +217,11 @@ private fun String.toHexColor(): String {
return removePrefix("#")
.let {
if (hexRegex.matches(it)) {
if (it.length > 6) it
else "FF$it"
if (it.length > 6) {
it
} else {
"FF$it"
}
} else {
"FF000000"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ package androidx.compose.material.icons.generator.vector
*/
enum class FillType {
NonZero,
EvenOdd
EvenOdd,
}
Loading

0 comments on commit dafc372

Please sign in to comment.