Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename google module to androidx-compose #45

Merged
merged 2 commits into from
Jul 23, 2024
Merged
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: 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/**")
Comment on lines -16 to -17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this bypass for src/main/kotlin/androidx/ as I see code under this module has been changed, it's different from the original one.

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