mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-05-02 05:26:25 +00:00
Close search bar when clicking on clear filter button if filter is empty
This commit is contained in:
parent
00b92a61b4
commit
e9f0bed2d2
2 changed files with 6 additions and 2 deletions
|
|
@ -201,8 +201,13 @@ open class AbstractMainViewModel @UiThread constructor() : ViewModel() {
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun clearFilter() {
|
fun clearFilter() {
|
||||||
|
if (searchFilter.value.orEmpty().isEmpty()) {
|
||||||
|
searchBarVisible.value = false
|
||||||
|
focusSearchBarEvent.value = Event(false)
|
||||||
|
} else {
|
||||||
searchFilter.value = ""
|
searchFilter.value = ""
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun applyFilter(filter: String = currentFilter) {
|
fun applyFilter(filter: String = currentFilter) {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/clear_field"
|
android:id="@+id/clear_field"
|
||||||
android:onClick="@{() -> viewModel.clearFilter()}"
|
android:onClick="@{() -> viewModel.clearFilter()}"
|
||||||
android:enabled="@{viewModel.searchFilter.length() > 0}"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue