mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add clear search query icons (#687)
This commit is contained in:
parent
fd1620f3d7
commit
b7322ffb19
8 changed files with 36 additions and 6 deletions
|
@ -8,12 +8,14 @@ import android.os.Bundle
|
|||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.FOCUS_AFTER_DESCENDANTS
|
||||
import android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS
|
||||
import android.view.animation.AlphaAnimation
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
|
@ -137,6 +139,13 @@ class LibraryFragment : Fragment() {
|
|||
tag = "tv_no_focus_tag"
|
||||
}
|
||||
|
||||
// Set the color for the search exit icon to the correct theme text color
|
||||
val searchExitIcon = binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||
val searchExitIconColor = TypedValue()
|
||||
|
||||
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
||||
searchExitIcon?.setColorFilter(searchExitIconColor.data)
|
||||
|
||||
binding?.mainSearch?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
||||
libraryViewModel.sort(ListSorting.Query, query)
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Activity
|
|||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -215,11 +216,17 @@ class QuickSearchFragment : Fragment() {
|
|||
binding?.quickSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||
|
||||
//val searchMagIcon =
|
||||
// binding.quickSearch.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
// binding?.quickSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
|
||||
// searchMagIcon?.scaleX = 0.65f
|
||||
// searchMagIcon?.scaleY = 0.65f
|
||||
|
||||
// Set the color for the search exit icon to the correct theme text color
|
||||
val searchExitIconColor = TypedValue()
|
||||
|
||||
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
||||
searchExitIcon?.setColorFilter(searchExitIconColor.data)
|
||||
|
||||
binding?.quickSearch?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String): Boolean {
|
||||
if (search(context, query, false))
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.lagradost.cloudstream3.ui.search
|
|||
import android.content.DialogInterface
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -231,10 +232,16 @@ class SearchFragment : Fragment() {
|
|||
val searchExitIcon =
|
||||
binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||
// val searchMagIcon =
|
||||
// main_search.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
// binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
// searchMagIcon.scaleX = 0.65f
|
||||
// searchMagIcon.scaleY = 0.65f
|
||||
|
||||
// Set the color for the search exit icon to the correct theme text color
|
||||
val searchExitIconColor = TypedValue()
|
||||
|
||||
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
||||
searchExitIcon?.setColorFilter(searchExitIconColor.data)
|
||||
|
||||
selectedApis = DataStoreHelper.searchPreferenceProviders.toMutableSet()
|
||||
|
||||
binding?.searchFilter?.setOnClickListener { searchView ->
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="25dp"
|
||||
|
||||
android:iconifiedByDefault="false"
|
||||
android:imeOptions="actionSearch"
|
||||
|
@ -81,6 +82,7 @@
|
|||
app:queryBackground="@color/transparent"
|
||||
app:queryHint="@string/search_hint"
|
||||
app:searchIcon="@drawable/search_icon"
|
||||
app:closeIcon="@drawable/ic_baseline_close_24"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
</androidx.appcompat.widget.SearchView>
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
app:queryBackground="@color/transparent"
|
||||
app:queryHint="@string/search_hint"
|
||||
app:searchIcon="@drawable/search_icon"
|
||||
app:closeIcon="@drawable/ic_baseline_close_24"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
</androidx.appcompat.widget.SearchView>
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
app:queryBackground="@color/transparent"
|
||||
app:queryHint="@string/search_hint"
|
||||
app:searchIcon="@drawable/search_icon"
|
||||
app:closeIcon="@drawable/ic_baseline_close_24"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<requestFocus />
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
app:queryBackground="@color/transparent"
|
||||
app:queryHint="@string/search_hint"
|
||||
app:searchIcon="@drawable/search_icon"
|
||||
app:closeIcon="@drawable/ic_baseline_close_24"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<requestFocus />
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
app:queryBackground="@color/transparent"
|
||||
|
||||
app:searchIcon="@drawable/search_icon"
|
||||
app:closeIcon="@drawable/ic_baseline_close_24"
|
||||
|
||||
android:paddingStart="-10dp"
|
||||
android:iconifiedByDefault="false"
|
||||
app:queryHint="@string/search_hint"
|
||||
|
|
Loading…
Reference in a new issue