From f6c609cfdf02c666aae050d48e3dbd559ed9696a Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Wed, 25 Jan 2023 00:55:01 +0100 Subject: [PATCH] Fix embarrassing crash when using different languages in library --- .../cloudstream3/ui/library/LibraryFragment.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt index c421f600..95e57473 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt @@ -152,13 +152,13 @@ class LibraryFragment : Fragment() { (APIHolder.getApiFromNameNull(apiName)?.let { listOf(it.name) } ?: emptyList()) val baseOptions = listOf( - txt(LibraryOpenerType.Default.stringRes).asString(this), - txt(LibraryOpenerType.None.stringRes).asString(this), - txt(LibraryOpenerType.Browser.stringRes).asString(this), - txt(LibraryOpenerType.Search.stringRes).asString(this), + LibraryOpenerType.Default, + LibraryOpenerType.None, + LibraryOpenerType.Browser, + LibraryOpenerType.Search ) - val items = baseOptions + availableProviders + val items = baseOptions.map { txt(it.stringRes).asString(this) } + availableProviders val savedSelection = getKey(LIBRARY_FOLDER, key) val selectedIndex = @@ -172,7 +172,7 @@ class LibraryFragment : Fragment() { ?.plus(baseOptions.size) ?: 0 } // Else base option - else -> baseOptions.indexOf(savedSelection.openType.name) + else -> baseOptions.indexOf(savedSelection.openType) } this.showBottomDialog( @@ -184,7 +184,7 @@ class LibraryFragment : Fragment() { ) { val savedData = if (it < baseOptions.size) { LibraryOpener( - LibraryOpenerType.valueOf(baseOptions[it]), + baseOptions[it], null ) } else {