Fixing Source List Displaying Empty Items (#810)

* Fixing source list displaying empty items
This commit is contained in:
yueehaoo 2023-12-14 03:49:42 +08:00 committed by GitHub
parent 410cedc128
commit 6e5a52e440
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -112,7 +112,7 @@ class RepoLinkGenerator(
isCasting = LoadType.Chromecast == type, isCasting = LoadType.Chromecast == type,
subtitleCallback = { file -> subtitleCallback = { file ->
val correctFile = PlayerSubtitleHelper.getSubtitleData(file) val correctFile = PlayerSubtitleHelper.getSubtitleData(file)
if (!currentSubsUrls.contains(correctFile.url)) { if (correctFile.url.isNotEmpty() && !currentSubsUrls.contains(correctFile.url)) {
currentSubsUrls.add(correctFile.url) currentSubsUrls.add(correctFile.url)
// this part makes sure that all names are unique for UX // this part makes sure that all names are unique for UX
@ -135,15 +135,15 @@ class RepoLinkGenerator(
}, },
callback = { link -> callback = { link ->
Log.d(TAG, "Loaded ExtractorLink: $link") Log.d(TAG, "Loaded ExtractorLink: $link")
if (!currentLinks.contains(link.url)) { if (link.url.isNotEmpty() && !currentLinks.contains(link.url) && !currentLinkCache.contains(link)) {
if (!currentLinkCache.contains(link)) { currentLinks.add(link.url)
currentLinks.add(link.url)
if (allowedTypes.contains(link.type)) { if (allowedTypes.contains(link.type)) {
callback(Pair(link, null)) callback(Pair(link, null))
}
currentLinkCache.add(link)
//linkCache[index] = currentLinkCache
} }
currentLinkCache.add(link)
// linkCache[index] = currentLinkCache
} }
} }
) )