Skip to content

Commit f26388d

Browse files
committed
Refine UI components and visual feedback for the accessibility scanner
- Enhance `IssueHighlightBox` with corner accent lines and a semi-transparent fill for improved visibility of identified issues. - Redesign `ScanSummaryBar` into a centered, animated pill-shaped surface with elevation and a glow effect. - Implement a custom `RadarSweepIcon` with an infinite rotation animation to represent active scanning. - Update `ScanSummaryBar` layout to use animated width transitions between scanning, complete, and error states. - Standardize chips for errors, warnings, info, and scores using a pill shape and updated color palette. - Refactor internal content components (`ScanningContent`, `ScanCompleteContent`, `ErrorContent`) for better layout and typography consistency.
1 parent 205dae0 commit f26388d

2 files changed

Lines changed: 258 additions & 128 deletions

File tree

scanner-ui/src/main/java/com/composea11yscanner/ui/IssueHighlightBox.kt

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import androidx.compose.runtime.Composable
77
import androidx.compose.ui.Modifier
88
import androidx.compose.ui.draw.drawBehind
99
import androidx.compose.ui.geometry.CornerRadius
10+
import androidx.compose.ui.geometry.Offset
1011
import androidx.compose.ui.graphics.Color
12+
import androidx.compose.ui.graphics.drawscope.DrawScope
1113
import androidx.compose.ui.graphics.drawscope.Stroke
1214
import androidx.compose.ui.platform.LocalDensity
1315
import androidx.compose.ui.tooling.preview.Preview
@@ -24,6 +26,8 @@ private val InfoBorderColor = Color(0xFF1976D2)
2426

2527
private val BorderStrokeWidth = 2.dp
2628
private val BorderCornerRadius = 4.dp
29+
private val CornerAccentLength = 12.dp
30+
private val CornerAccentStrokeWidth = 3.dp
2731

2832
private fun A11ySeverity.toBorderColor(): Color = when (this) {
2933
A11ySeverity.Error -> ErrorBorderColor
@@ -48,15 +52,57 @@ fun IssueHighlightBox(
4852
.size(width, height)
4953
.clickable { onIssueSelected(issue) }
5054
.drawBehind {
55+
val strokeWidth = BorderStrokeWidth.toPx()
56+
val cornerRadius = BorderCornerRadius.toPx()
57+
val cornerAccentLength = CornerAccentLength.toPx()
58+
val cornerAccentStrokeWidth = CornerAccentStrokeWidth.toPx()
59+
val cornerInset = cornerAccentStrokeWidth / 2f
60+
61+
drawRoundRect(
62+
color = borderColor,
63+
alpha = 0.08f,
64+
cornerRadius = CornerRadius(cornerRadius),
65+
)
5166
drawRoundRect(
5267
color = borderColor,
53-
style = Stroke(width = BorderStrokeWidth.toPx()),
54-
cornerRadius = CornerRadius(BorderCornerRadius.toPx()),
68+
alpha = 0.92f,
69+
style = Stroke(width = strokeWidth),
70+
cornerRadius = CornerRadius(cornerRadius),
71+
)
72+
drawCornerAccents(
73+
color = borderColor,
74+
length = cornerAccentLength,
75+
strokeWidth = cornerAccentStrokeWidth,
76+
inset = cornerInset,
5577
)
5678
},
5779
)
5880
}
5981

82+
private fun DrawScope.drawCornerAccents(
83+
color: Color,
84+
length: Float,
85+
strokeWidth: Float,
86+
inset: Float,
87+
) {
88+
val left = inset
89+
val top = inset
90+
val right = size.width - inset
91+
val bottom = size.height - inset
92+
93+
drawLine(color, Offset(left, top), Offset(left + length, top), strokeWidth)
94+
drawLine(color, Offset(left, top), Offset(left, top + length), strokeWidth)
95+
96+
drawLine(color, Offset(right, top), Offset(right - length, top), strokeWidth)
97+
drawLine(color, Offset(right, top), Offset(right, top + length), strokeWidth)
98+
99+
drawLine(color, Offset(left, bottom), Offset(left + length, bottom), strokeWidth)
100+
drawLine(color, Offset(left, bottom), Offset(left, bottom - length), strokeWidth)
101+
102+
drawLine(color, Offset(right, bottom), Offset(right - length, bottom), strokeWidth)
103+
drawLine(color, Offset(right, bottom), Offset(right, bottom - length), strokeWidth)
104+
}
105+
60106
@Preview(showBackground = true)
61107
@Composable
62108
private fun IssueHighlightBoxErrorPreview() {

0 commit comments

Comments
 (0)