Merge pull request #397 from Bnyro/master

clear search button
This commit is contained in:
Bnyro 2022-06-06 18:10:49 +02:00 committed by GitHub
commit f97735532c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -65,6 +65,7 @@ class SearchFragment : Fragment() {
searchRecView = view.findViewById<RecyclerView>(R.id.search_recycler)
val autoTextView = view.findViewById<AutoCompleteTextView>(R.id.autoCompleteTextView)
val clearSearchButton = view.findViewById<ImageView>(R.id.clearSearch_imageView)
val historyRecycler = view.findViewById<RecyclerView>(R.id.history_recycler)
val filterImageView = view.findViewById<ImageView>(R.id.filterMenu_imageView)
@ -73,6 +74,10 @@ class SearchFragment : Fragment() {
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
clearSearchButton.setOnClickListener {
autoTextView.text.clear()
}
filterImageView.setOnClickListener {
val filterOptions = arrayOf(
getString(R.string.all),

View File

@ -28,29 +28,44 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginRight="30dp"
android:background="@android:color/transparent"
app:hintEnabled="false">
app:hintEnabled="false" >
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:dropDownWidth="match_parent"
android:hint="@string/search_hint"
android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1"
android:padding="12dp"
android:dropDownWidth="match_parent" />
android:padding="12dp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="@+id/clearSearch_imageView"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:src="@drawable/ic_close"
android:layout_centerVertical="true"
android:layout_marginRight="16dp" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<ImageView