Fix searching in repos & search provider selection bottom sheet

This commit is contained in:
Blatzar 2022-10-14 23:56:21 +02:00
parent 63c713fc68
commit e67d248f7f
4 changed files with 16 additions and 15 deletions

View File

@ -17,6 +17,7 @@ import androidx.fragment.app.activityViewModels
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
@ -232,6 +233,7 @@ class SearchFragment : Fragment() {
val builder = val builder =
BottomSheetDialog(ctx) BottomSheetDialog(ctx)
builder.behavior.state = BottomSheetBehavior.STATE_EXPANDED
builder.setContentView(R.layout.home_select_mainpage) builder.setContentView(R.layout.home_select_mainpage)
builder.show() builder.show()
builder.let { dialog -> builder.let { dialog ->

View File

@ -1,27 +1,22 @@
package com.lagradost.cloudstream3.ui.settings.extensions package com.lagradost.cloudstream3.ui.settings.extensions
import android.os.Bundle import android.os.Bundle
import android.view.* import android.view.LayoutInflater
import android.widget.SearchView import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.SearchView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.map
import com.lagradost.cloudstream3.AcraApplication
import com.lagradost.cloudstream3.CommonActivity
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.getPairList import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.getPairList
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
import com.lagradost.cloudstream3.ui.settings.appLanguages import com.lagradost.cloudstream3.ui.settings.appLanguages
import com.lagradost.cloudstream3.ui.settings.getCurrentLocale
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
import com.lagradost.cloudstream3.utils.SubtitleHelper import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.toPx import com.lagradost.cloudstream3.utils.UIHelper.toPx
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
import kotlinx.android.synthetic.main.fragment_plugins.* import kotlinx.android.synthetic.main.fragment_plugins.*
const val PLUGINS_BUNDLE_NAME = "name" const val PLUGINS_BUNDLE_NAME = "name"

View File

@ -210,7 +210,7 @@ class PluginsViewModel : ViewModel() {
// Return list to base state if no query // Return list to base state if no query
this.sortedBy { it.plugin.second.name } this.sortedBy { it.plugin.second.name }
} else { } else {
this.sortedBy { -FuzzySearch.ratio(it.plugin.second.name, query) } this.sortedBy { -FuzzySearch.partialRatio(it.plugin.second.name.lowercase(), query.lowercase()) }
} }
} }

View File

@ -1,13 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- app:searchHintIcon="@drawable/search_icon"-->
<!-- android:icon="@drawable/search_icon"-->
<item <item
android:id="@+id/search_button" android:id="@+id/search_button"
android:icon="@drawable/search_icon"
android:title="@string/title_search" android:title="@string/title_search"
app:actionViewClass="android.widget.SearchView" android:icon="@drawable/search_icon"
app:searchHintIcon="@drawable/search_icon" android:searchIcon="@drawable/search_icon"
app:showAsAction="ifRoom" /> app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="always|collapseActionView"
tools:ignore="AppCompatResource" />
<item <item
android:id="@+id/lang_filter" android:id="@+id/lang_filter"
android:icon="@drawable/ic_baseline_language_24" android:icon="@drawable/ic_baseline_language_24"