-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Cleanup icons-extension and use local references
- Loading branch information
1 parent
94a371b
commit 096be8e
Showing
6 changed files
with
165 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
appcues/src/main/java/com/appcues/debugger/ui/icons/CloseIcon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.appcues.debugger.ui.icons | ||
|
||
import androidx.compose.ui.graphics.vector.ImageVector | ||
|
||
private var filled: ImageVector? = null | ||
|
||
@Suppress("UnusedReceiverParameter", "MagicNumber") | ||
internal val DebuggerIcons.Filled.Close: ImageVector | ||
get() { | ||
if (filled != null) { | ||
return filled!! | ||
} | ||
filled = debuggerIcon(name = "Filled.Close") { | ||
iconPath { | ||
moveTo(19.0f, 6.41f) | ||
lineTo(17.59f, 5.0f) | ||
lineTo(12.0f, 10.59f) | ||
lineTo(6.41f, 5.0f) | ||
lineTo(5.0f, 6.41f) | ||
lineTo(10.59f, 12.0f) | ||
lineTo(5.0f, 17.59f) | ||
lineTo(6.41f, 19.0f) | ||
lineTo(12.0f, 13.41f) | ||
lineTo(17.59f, 19.0f) | ||
lineTo(19.0f, 17.59f) | ||
lineTo(13.41f, 12.0f) | ||
close() | ||
} | ||
} | ||
return filled!! | ||
} |
71 changes: 71 additions & 0 deletions
71
appcues/src/main/java/com/appcues/debugger/ui/icons/DebuggerIcons.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.appcues.debugger.ui.icons | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.PathFillType | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.graphics.StrokeJoin | ||
import androidx.compose.ui.graphics.vector.DefaultFillType | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.graphics.vector.PathBuilder | ||
import androidx.compose.ui.graphics.vector.path | ||
import androidx.compose.ui.unit.dp | ||
|
||
/** | ||
* Similar solution for icons used in Material-Icons-Extensions library | ||
*/ | ||
internal object DebuggerIcons { | ||
|
||
object Filled | ||
|
||
object Outlined | ||
} | ||
|
||
/** | ||
* Utility delegate to construct an Icon with default size information. | ||
* This is used by generated icons, and should not be used manually. | ||
* | ||
* @param name the full name of the generated icon | ||
* @param autoMirror determines if the vector asset should automatically be mirrored for right to | ||
* left locales | ||
* @param block builder lambda to add paths to this vector asset | ||
*/ | ||
internal inline fun debuggerIcon( | ||
name: String, | ||
autoMirror: Boolean = false, | ||
block: ImageVector.Builder.() -> ImageVector.Builder | ||
): ImageVector = ImageVector.Builder( | ||
name = name, | ||
defaultWidth = 24.dp, | ||
defaultHeight = 24.dp, | ||
viewportWidth = 24F, | ||
viewportHeight = 24F, | ||
autoMirror = autoMirror | ||
).block().build() | ||
|
||
/** | ||
* Adds a vector path to this icon with Material defaults. | ||
* | ||
* @param fillAlpha fill alpha for this path | ||
* @param strokeAlpha stroke alpha for this path | ||
* @param pathFillType [PathFillType] for this path | ||
* @param pathBuilder builder lambda to add commands to this path | ||
*/ | ||
internal inline fun ImageVector.Builder.iconPath( | ||
fillAlpha: Float = 1f, | ||
strokeAlpha: Float = 1f, | ||
pathFillType: PathFillType = DefaultFillType, | ||
pathBuilder: PathBuilder.() -> Unit | ||
) = | ||
path( | ||
fill = SolidColor(Color.Black), | ||
fillAlpha = fillAlpha, | ||
stroke = null, | ||
strokeAlpha = strokeAlpha, | ||
strokeLineWidth = 1f, | ||
strokeLineCap = StrokeCap.Butt, | ||
strokeLineJoin = StrokeJoin.Bevel, | ||
strokeLineMiter = 1f, | ||
pathFillType = pathFillType, | ||
pathBuilder = pathBuilder | ||
) |
40 changes: 40 additions & 0 deletions
40
appcues/src/main/java/com/appcues/debugger/ui/icons/InfoIcon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.appcues.debugger.ui.icons | ||
|
||
import androidx.compose.ui.graphics.vector.ImageVector | ||
|
||
private var outlined: ImageVector? = null | ||
|
||
@Suppress("UnusedReceiverParameter", "MagicNumber") | ||
internal val DebuggerIcons.Outlined.Info: ImageVector | ||
get() { | ||
if (outlined != null) { | ||
return outlined!! | ||
} | ||
outlined = debuggerIcon(name = "Outlined.Info") { | ||
iconPath { | ||
moveTo(11.0f, 7.0f) | ||
horizontalLineToRelative(2.0f) | ||
verticalLineToRelative(2.0f) | ||
horizontalLineToRelative(-2.0f) | ||
close() | ||
moveTo(11.0f, 11.0f) | ||
horizontalLineToRelative(2.0f) | ||
verticalLineToRelative(6.0f) | ||
horizontalLineToRelative(-2.0f) | ||
close() | ||
moveTo(12.0f, 2.0f) | ||
curveTo(6.48f, 2.0f, 2.0f, 6.48f, 2.0f, 12.0f) | ||
reflectiveCurveToRelative(4.48f, 10.0f, 10.0f, 10.0f) | ||
reflectiveCurveToRelative(10.0f, -4.48f, 10.0f, -10.0f) | ||
reflectiveCurveTo(17.52f, 2.0f, 12.0f, 2.0f) | ||
close() | ||
moveTo(12.0f, 20.0f) | ||
curveToRelative(-4.41f, 0.0f, -8.0f, -3.59f, -8.0f, -8.0f) | ||
reflectiveCurveToRelative(3.59f, -8.0f, 8.0f, -8.0f) | ||
reflectiveCurveToRelative(8.0f, 3.59f, 8.0f, 8.0f) | ||
reflectiveCurveToRelative(-3.59f, 8.0f, -8.0f, 8.0f) | ||
close() | ||
} | ||
} | ||
return outlined!! | ||
} |