Skip to content

Commit 2e8ba1e

Browse files
committed
add clear icon (clear search input)
1 parent 1ddd876 commit 2e8ba1e

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
minSdk = 21
1515
targetSdk = 36
1616

17-
versionCode = 34
18-
versionName = "1.0-34"
17+
versionCode = 35
18+
versionName = "1.0-35"
1919

2020
}
2121

app/src/main/java/jisho/MainActivity.kt

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,29 @@ class MainActivity : ComponentActivity() {
126126
focusedIndicatorColor = Color.Transparent
127127
),
128128
trailingIcon = {
129-
IconButton(
130-
onClick = { }, // @todo
131-
modifier = Modifier
132-
.padding(6.dp)
133-
.background(color = Color(0xFF6A6A6A))
129+
Row(
130+
horizontalArrangement = Arrangement.spacedBy((-6).dp),
131+
verticalAlignment = Alignment.CenterVertically // @note adapt with ic_search padding
134132
) {
135-
Icon(
136-
painter = painterResource(R.drawable.ic_search),
137-
contentDescription = "Search"
138-
)
133+
IconButton(
134+
onClick = { onValueChange("") }
135+
) {
136+
Icon(
137+
painter = painterResource(R.drawable.ic_clear),
138+
contentDescription = "Clear"
139+
)
140+
}
141+
IconButton(
142+
onClick = { }, // @todo
143+
modifier = Modifier
144+
.padding(6.dp)
145+
.background(color = Color(0xFF6A6A6A))
146+
) {
147+
Icon(
148+
painter = painterResource(R.drawable.ic_search),
149+
contentDescription = "Search"
150+
)
151+
}
139152
}
140153
}
141154
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="40dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="40dp">
2+
3+
<path android:fillColor="@android:color/white" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
4+
5+
</vector>

0 commit comments

Comments
 (0)