chore: upgrade ktlint to 1.8.0 and format codebase (#1024)
Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
3f3b853758
commit
cfe3e736fd
66 files changed
+1287
-541
No files matched your search
@@ -107,21 +107,25 @@ fun ActionProgressDialog(
|
||||
Text(
|
||||
text =
|
||||
when (state.phase) {
|
||||
ActionProgressPhase.STARTING ->
|
||||
ActionProgressPhase.STARTING -> {
|
||||
stringResource(R.string.action_progress_starting)
|
||||
}
|
||||
|
||||
ActionProgressPhase.RUNNING ->
|
||||
ActionProgressPhase.RUNNING -> {
|
||||
stringResource(R.string.action_progress_running)
|
||||
}
|
||||
|
||||
ActionProgressPhase.SUCCEEDED ->
|
||||
ActionProgressPhase.SUCCEEDED -> {
|
||||
stringResource(R.string.action_progress_succeeded)
|
||||
}
|
||||
|
||||
ActionProgressPhase.FAILED ->
|
||||
ActionProgressPhase.FAILED -> {
|
||||
if (exitCode != null) {
|
||||
stringResource(R.string.action_progress_failed_exit, exitCode)
|
||||
} else {
|
||||
stringResource(R.string.action_progress_failed)
|
||||
}
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
|
||||
@@ -87,7 +87,8 @@ fun BotAvatar(
|
||||
if (imageUrl != null) {
|
||||
AsyncImage(
|
||||
model =
|
||||
ImageRequest.Builder(LocalContext.current)
|
||||
ImageRequest
|
||||
.Builder(LocalContext.current)
|
||||
.data(imageUrl)
|
||||
.crossfade(true)
|
||||
.build(),
|
||||
@@ -137,21 +138,20 @@ fun BotAvatar(
|
||||
fun resolveAvatarShape(
|
||||
shapeKey: String?,
|
||||
size: Dp,
|
||||
): Shape {
|
||||
return when (shapeKey?.lowercase()?.trim()) {
|
||||
): Shape =
|
||||
when (shapeKey?.lowercase()?.trim()) {
|
||||
"square", "box", "boxy" -> RoundedCornerShape(size * 0.15f)
|
||||
"rounded", "nub", "organic" -> RoundedCornerShape(size * 0.32f)
|
||||
"hexagon", "cut", "diamond", "cloud", "sun" -> CutCornerShape(size * 0.25f)
|
||||
"circle", "round" -> CircleShape
|
||||
else -> CircleShape
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps known icon keys to Material [ImageVector] icons.
|
||||
*/
|
||||
fun resolveAvatarIcon(iconKey: String?): ImageVector? {
|
||||
return when (iconKey?.lowercase()?.trim()) {
|
||||
fun resolveAvatarIcon(iconKey: String?): ImageVector? =
|
||||
when (iconKey?.lowercase()?.trim()) {
|
||||
"code", "dev", "terminal" -> Icons.Filled.Code
|
||||
"build", "tool", "tools" -> Icons.Filled.Build
|
||||
"psychology", "brain", "ai", "research", "intel" -> Icons.Filled.Psychology
|
||||
@@ -162,7 +162,6 @@ fun resolveAvatarIcon(iconKey: String?): ImageVector? {
|
||||
"robot", "bot", "smart_toy" -> Icons.Filled.SmartToy
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract 1-2 uppercase letters from name for initials fallback.
|
||||
|
||||
@@ -16,41 +16,42 @@ import com.m57.hermescontrol.theme.IconDefaultFill
|
||||
* original path data (viewBox 0 -960 960 960, translated into compose space).
|
||||
*/
|
||||
val NeurologyIcon: ImageVector by lazy {
|
||||
ImageVector.Builder(
|
||||
name = "Neurology",
|
||||
defaultWidth = 24.dp,
|
||||
defaultHeight = 24.dp,
|
||||
viewportWidth = 960f,
|
||||
viewportHeight = 960f,
|
||||
).apply {
|
||||
addGroup(
|
||||
name = "translate",
|
||||
rotate = 0f,
|
||||
pivotX = 0f,
|
||||
pivotY = 0f,
|
||||
scaleX = 1f,
|
||||
scaleY = 1f,
|
||||
translationX = 0f,
|
||||
translationY = 960f,
|
||||
clipPathData = emptyList(),
|
||||
)
|
||||
addPath(
|
||||
pathData = addPathNodes(PATH),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
name = "NeurologyPath",
|
||||
fill = SolidColor(IconDefaultFill),
|
||||
fillAlpha = 1f,
|
||||
stroke = null,
|
||||
strokeAlpha = 1f,
|
||||
strokeLineWidth = 1f,
|
||||
strokeLineCap = StrokeCap.Butt,
|
||||
strokeLineJoin = StrokeJoin.Miter,
|
||||
strokeLineMiter = 4f,
|
||||
trimPathStart = 0f,
|
||||
trimPathEnd = 1f,
|
||||
trimPathOffset = 0f,
|
||||
)
|
||||
}.build()
|
||||
ImageVector
|
||||
.Builder(
|
||||
name = "Neurology",
|
||||
defaultWidth = 24.dp,
|
||||
defaultHeight = 24.dp,
|
||||
viewportWidth = 960f,
|
||||
viewportHeight = 960f,
|
||||
).apply {
|
||||
addGroup(
|
||||
name = "translate",
|
||||
rotate = 0f,
|
||||
pivotX = 0f,
|
||||
pivotY = 0f,
|
||||
scaleX = 1f,
|
||||
scaleY = 1f,
|
||||
translationX = 0f,
|
||||
translationY = 960f,
|
||||
clipPathData = emptyList(),
|
||||
)
|
||||
addPath(
|
||||
pathData = addPathNodes(PATH),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
name = "NeurologyPath",
|
||||
fill = SolidColor(IconDefaultFill),
|
||||
fillAlpha = 1f,
|
||||
stroke = null,
|
||||
strokeAlpha = 1f,
|
||||
strokeLineWidth = 1f,
|
||||
strokeLineCap = StrokeCap.Butt,
|
||||
strokeLineJoin = StrokeJoin.Miter,
|
||||
strokeLineMiter = 4f,
|
||||
trimPathStart = 0f,
|
||||
trimPathEnd = 1f,
|
||||
trimPathOffset = 0f,
|
||||
)
|
||||
}.build()
|
||||
}
|
||||
|
||||
private const val PATH =
|
||||
|
||||
@@ -82,22 +82,27 @@ fun PressureBanner(
|
||||
|
||||
val message =
|
||||
when (trigger) {
|
||||
PressureTrigger.DISK_CRITICAL ->
|
||||
PressureTrigger.DISK_CRITICAL -> {
|
||||
stringResource(R.string.pressure_banner_disk_critical) +
|
||||
diskFreeSuffix(disk)
|
||||
}
|
||||
|
||||
PressureTrigger.DISK_ELEVATED ->
|
||||
PressureTrigger.DISK_ELEVATED -> {
|
||||
stringResource(R.string.pressure_banner_disk_elevated) +
|
||||
diskFreeSuffix(disk)
|
||||
}
|
||||
|
||||
PressureTrigger.MEMORY_CRITICAL ->
|
||||
PressureTrigger.MEMORY_CRITICAL -> {
|
||||
stringResource(R.string.pressure_banner_memory_critical)
|
||||
}
|
||||
|
||||
PressureTrigger.OOM_RESTART ->
|
||||
PressureTrigger.OOM_RESTART -> {
|
||||
stringResource(R.string.pressure_banner_memory_oom)
|
||||
}
|
||||
|
||||
PressureTrigger.MEMORY_ELEVATED ->
|
||||
PressureTrigger.MEMORY_ELEVATED -> {
|
||||
stringResource(R.string.pressure_banner_memory_elevated)
|
||||
}
|
||||
}
|
||||
|
||||
Surface(
|
||||
|
||||
Reference in new issue
Block a user