iFixed issue https://github.com/BelledonneCommunications/linphone-android/issues/1269 by replacing SearchView by EditText..., TODO: use our own search icon

This commit is contained in:
Sylvain Berfini 2021-01-12 10:33:39 +01:00
parent 908ef58162
commit 0f3c9fb2a0
4 changed files with 21 additions and 45 deletions

View file

@ -505,29 +505,3 @@ fun setEditTextErrorListener(editText: EditText, attrChange: InverseBindingListe
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
})
}
@BindingAdapter("queryValue")
fun setSearchViewQuery(view: SearchView, query: String?) {
if (query != view.query) {
view.setQuery(query, false)
}
}
@InverseBindingAdapter(attribute = "queryValue")
fun getSearchViewQuery(view: SearchView): String? {
return view.query?.toString()
}
@BindingAdapter("queryValueAttrChanged")
fun setSearchViewQueryListener(view: SearchView, attrChange: InverseBindingListener) {
view.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean {
return true
}
override fun onQueryTextChange(newText: String?): Boolean {
attrChange.onChange()
return true
}
})
}

View file

@ -128,18 +128,19 @@
android:layout_alignTop="@id/top_bar"
tools:layout="@layout/list_edit_top_bar_fragment" />
<SearchView
<EditText
android:id="@+id/searchBar"
queryValue="@={viewModel.filter}"
android:text="@={viewModel.filter}"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:iconifiedByDefault="false"
android:inputType="textPersonName"
android:layout_below="@id/top_bar"
android:layout_margin="10dp"
android:queryBackground="@color/transparent_color"
android:queryHint="@string/contact_filter_hint"/>
android:drawableLeft="@android:drawable/ic_menu_search"
android:drawablePadding="10dp"
android:background="@color/transparent_color"
android:backgroundTint="@color/transparent_color"
android:hint="@string/contact_filter_hint"/>
<View
android:layout_width="match_parent"

View file

@ -148,19 +148,19 @@
</LinearLayout>
<SearchView
<EditText
android:id="@+id/searchBar"
queryValue="@={viewModel.filter}"
android:text="@={viewModel.filter}"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:iconifiedByDefault="false"
android:inputType="textPersonName"
android:layout_below="@id/top_bar"
android:layout_margin="10dp"
android:paddingRight="5dp"
android:queryBackground="@color/transparent_color"
android:queryHint="@string/contact_filter_hint"/>
android:drawableLeft="@android:drawable/ic_menu_search"
android:drawablePadding="10dp"
android:background="@color/transparent_color"
android:backgroundTint="@color/transparent_color"
android:hint="@string/contact_filter_hint"/>
<View
android:layout_width="match_parent"

View file

@ -118,18 +118,19 @@
android:layout_alignTop="@id/top_bar"
tools:layout="@layout/list_edit_top_bar_fragment" />
<SearchView
<EditText
android:id="@+id/searchBar"
queryValue="@={viewModel.filter}"
android:text="@={viewModel.filter}"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/top_bar"
android:layout_margin="10dp"
android:gravity="center"
android:iconifiedByDefault="false"
android:inputType="textPersonName"
android:queryBackground="@color/transparent_color"
android:queryHint="@string/contact_filter_hint"/>
android:drawableLeft="@android:drawable/ic_menu_search"
android:drawablePadding="10dp"
android:background="@color/transparent_color"
android:backgroundTint="@color/transparent_color"
android:hint="@string/contact_filter_hint"/>
<View
android:layout_width="match_parent"