From 067b14630143e40fe74278ea3eb58711f2925ae8 Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Mon, 6 Dec 2021 18:13:45 +0200 Subject: [PATCH] Add clear button to search input --- .../java/com/ivy/wallet/ui/search/SearchScreen.kt | 14 +++++++++++++- app/src/main/res/drawable/ic_outline_clear_24.xml | 10 ++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_outline_clear_24.xml diff --git a/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt b/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt index 8d5d28759f..4e814ca2e5 100644 --- a/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState @@ -178,7 +179,18 @@ private fun SearchInput( searchFocus.requestFocus() } - Spacer(Modifier.width(16.dp)) + Spacer(Modifier.weight(1f)) + + IvyIcon( + modifier = Modifier + .clickable { + onSetSearchQueryTextField(selectEndTextFieldValue("")) + } + .padding(all = 12.dp), //enlarge click area + icon = R.drawable.ic_outline_clear_24 + ) + + Spacer(Modifier.width(8.dp)) } } diff --git a/app/src/main/res/drawable/ic_outline_clear_24.xml b/app/src/main/res/drawable/ic_outline_clear_24.xml new file mode 100644 index 0000000000..4ebf4a04e2 --- /dev/null +++ b/app/src/main/res/drawable/ic_outline_clear_24.xml @@ -0,0 +1,10 @@ + + +