mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	fixed langs hopefully
This commit is contained in:
		
							parent
							
								
									099ce7a975
								
							
						
					
					
						commit
						99717ef1f1
					
				
					 3 changed files with 14 additions and 28 deletions
				
			
		|  | @ -76,14 +76,14 @@ object APIHolder { | |||
|         val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) | ||||
| 
 | ||||
|         val hashSet = HashSet<String>() | ||||
|         hashSet.addAll(apis.map { it.name }) | ||||
|         val activeLangs = getApiProviderLangSettings() | ||||
|         hashSet.addAll(apis.filter { activeLangs.contains(it.lang) }.map { it.name }) | ||||
| 
 | ||||
|         val set = settingsManager.getStringSet( | ||||
|             this.getString(R.string.search_providers_list_key), | ||||
|             hashSet | ||||
|         )?.toHashSet() ?: hashSet | ||||
| 
 | ||||
|         val activeLangs = getApiProviderLangSettings() | ||||
|         val list = HashSet<String>() | ||||
|         for (name in set) { | ||||
|             val api = getApiFromNameNull(name) ?: continue | ||||
|  | @ -361,6 +361,7 @@ interface LoadResponse { | |||
|     val tags: List<String>? | ||||
|     val duration: String? | ||||
|     val trailerUrl: String? | ||||
|     val recommendations: List<SearchResponse>? | ||||
| } | ||||
| 
 | ||||
| fun LoadResponse?.isEpisodeBased(): Boolean { | ||||
|  | @ -396,7 +397,8 @@ data class TorrentLoadResponse( | |||
|     override val rating: Int? = null, | ||||
|     override val tags: List<String>? = null, | ||||
|     override val duration: String? = null, | ||||
|     override val trailerUrl: String? = null | ||||
|     override val trailerUrl: String? = null, | ||||
|     override val recommendations: List<SearchResponse>? = null, | ||||
| ) : LoadResponse | ||||
| 
 | ||||
| data class AnimeLoadResponse( | ||||
|  | @ -423,6 +425,7 @@ data class AnimeLoadResponse( | |||
|     override val rating: Int? = null, | ||||
|     override val duration: String? = null, | ||||
|     override val trailerUrl: String? = null, | ||||
|     override val recommendations: List<SearchResponse>? = null, | ||||
| ) : LoadResponse | ||||
| 
 | ||||
| data class MovieLoadResponse( | ||||
|  | @ -441,6 +444,7 @@ data class MovieLoadResponse( | |||
|     override val tags: List<String>? = null, | ||||
|     override val duration: String? = null, | ||||
|     override val trailerUrl: String? = null, | ||||
|     override val recommendations: List<SearchResponse>? = null, | ||||
| ) : LoadResponse | ||||
| 
 | ||||
| data class TvSeriesEpisode( | ||||
|  | @ -471,4 +475,5 @@ data class TvSeriesLoadResponse( | |||
|     override val tags: List<String>? = null, | ||||
|     override val duration: String? = null, | ||||
|     override val trailerUrl: String? = null, | ||||
|     override val recommendations: List<SearchResponse>? = null, | ||||
| ) : LoadResponse | ||||
|  |  | |||
|  | @ -1,13 +1,11 @@ | |||
| package com.lagradost.cloudstream3.ui.search | ||||
| 
 | ||||
| import android.content.Context | ||||
| import android.content.res.Configuration | ||||
| import android.os.Bundle | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.view.WindowManager | ||||
| import android.view.inputmethod.InputMethodManager | ||||
| import android.widget.* | ||||
| import androidx.appcompat.app.AlertDialog | ||||
| import androidx.appcompat.widget.SearchView | ||||
|  | @ -19,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView | |||
| import com.google.android.material.switchmaterial.SwitchMaterial | ||||
| import com.lagradost.cloudstream3.* | ||||
| import com.lagradost.cloudstream3.APIHolder.apis | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiSettings | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiTypeSettings | ||||
| import com.lagradost.cloudstream3.mvvm.Resource | ||||
|  | @ -115,8 +114,9 @@ class SearchFragment : Fragment() { | |||
|         searchMagIcon.scaleY = 0.65f | ||||
|         search_filter.setOnClickListener { searchView -> | ||||
|             val apiNamesSetting = activity?.getApiSettings() | ||||
|             if (apiNamesSetting != null) { | ||||
|                 val apiNames = apis.map { it.name } | ||||
|             val langs = activity?.getApiProviderLangSettings() | ||||
|             if (apiNamesSetting != null && langs != null) { | ||||
|                 val apiNames = apis.filter { langs.contains(it.lang) }.map { it.name } | ||||
|                 val builder = | ||||
|                     AlertDialog.Builder(searchView.context, R.style.AlertDialogCustom).setView(R.layout.provider_list) | ||||
| 
 | ||||
|  | @ -150,25 +150,6 @@ class SearchFragment : Fragment() { | |||
|                 listView2.adapter = arrayAdapter2 | ||||
|                 listView2.choiceMode = AbsListView.CHOICE_MODE_MULTIPLE | ||||
| 
 | ||||
| 
 | ||||
|                 /*fun updateMulti() { | ||||
|                     val set = HashSet<TvType>() | ||||
| 
 | ||||
|                     for ((index, api) in apis.withIndex()) { | ||||
|                         if (listView?.checkedItemPositions[index]) { | ||||
|                             set.addAll(api.supportedTypes) | ||||
|                         } | ||||
|                     } | ||||
| 
 | ||||
|                     if (set.size == 0) { | ||||
|                         set.addAll(TvType.values()) | ||||
|                     } | ||||
| 
 | ||||
|                     for ((index, choice) in typeChoices.withIndex()) { | ||||
|                         listView2?.setItemChecked(index, choice.second.any { set.contains(it) }) | ||||
|                     } | ||||
|                 }*/ | ||||
| 
 | ||||
|                 for ((index, item) in apiNames.withIndex()) { | ||||
|                     listView.setItemChecked(index, apiNamesSetting.contains(item)) | ||||
|                 } | ||||
|  | @ -227,8 +208,6 @@ class SearchFragment : Fragment() { | |||
|                             isSupported | ||||
|                         ) | ||||
|                     } | ||||
| 
 | ||||
|                     //updateMulti() | ||||
|                 } | ||||
| 
 | ||||
|                 dialog.setOnDismissListener { | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ import androidx.preference.PreferenceManager | |||
| import com.lagradost.cloudstream3.APIHolder.apis | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiDubstatusSettings | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings | ||||
| import com.lagradost.cloudstream3.APIHolder.getApiSettings | ||||
| import com.lagradost.cloudstream3.APIHolder.restrictedApis | ||||
| import com.lagradost.cloudstream3.DubStatus | ||||
| import com.lagradost.cloudstream3.MainActivity.Companion.setLocale | ||||
|  | @ -128,6 +129,7 @@ class SettingsFragment : PreferenceFragmentCompat() { | |||
|                         this.getString(R.string.provider_lang_key), | ||||
|                         selectedList.map { names[it].first }.toMutableSet() | ||||
|                     ).apply() | ||||
|                     APIRepository.providersActive = it.context.getApiSettings() | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue