Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Add clear button to search input
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliyan Germanov committed Dec 6, 2021
1 parent bc90f9d commit 067b146
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_outline_clear_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<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,12 19,6.41z" />
</vector>

0 comments on commit 067b146

Please sign in to comment.