New TvTypes + General fixes

This commit is contained in:
firelight 2024-03-25 01:38:39 +01:00 committed by GitHub
parent 51d91bf9a7
commit ed2bdf44fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 15 deletions

View file

@ -865,7 +865,11 @@ enum class TvType(value: Int?) {
AsianDrama(9),
Live(10),
NSFW(11),
Others(12)
Others(12),
Music(13),
AudioBook(14),
/** Wont load the built in player, make your own interaction */
CustomMedia(15),
}
public enum class AutoDownloadMode(val value: Int) {

View file

@ -85,7 +85,7 @@ abstract class BaseAdapter<
AsyncDifferConfig.Builder(diffCallback).build()
)
fun submitList(list: List<T>?) {
open fun submitList(list: List<T>?) {
// deep copy at least the top list, because otherwise adapter can go crazy
mDiffer.submitList(list?.let { CopyOnWriteArrayList(it) })
}

View file

@ -63,6 +63,10 @@ open class ParentItemAdapter(
}
}
override fun submitList(list: List<HomeViewModel.ExpandableHomepageList>?) {
super.submitList(list?.sortedBy { it.list.list.isEmpty() })
}
override fun onUpdateContent(
holder: ViewHolderState<Bundle>,
item: HomeViewModel.ExpandableHomepageList,

View file

@ -246,6 +246,9 @@ fun LoadResponse.toResultData(repo: APIRepository): ResultData {
TvType.Live -> R.string.live_singular
TvType.Others -> R.string.other_singular
TvType.NSFW -> R.string.nsfw_singular
TvType.Music -> R.string.music_singlar
TvType.AudioBook -> R.string.audio_book_singular
TvType.CustomMedia -> R.string.custom_media_singluar
}
),
yearText = txt(year?.toString()),
@ -1759,10 +1762,6 @@ class ResultViewModel2 : ViewModel() {
val data = currentResponse?.syncData?.toList() ?: emptyList()
val list =
HashMap<String, String>().apply { putAll(data) }
activity?.navigate(
R.id.global_to_navigation_player,
GeneratorPlayer.newInstance(
generator?.also {
it.getAll() // I know kinda shit to iterate all, but it is 100% sure to work
?.indexOfFirst { value -> value is ResultEpisode && value.id == click.data.id }
@ -1770,10 +1769,22 @@ class ResultViewModel2 : ViewModel() {
if (index >= 0)
it.goto(index)
}
} ?: return, list
}
if (currentResponse?.type == TvType.CustomMedia) {
generator?.generateLinks(
clearCache = true,
LoadType.Unknown,
callback = {},
subtitleCallback = {})
} else {
activity?.navigate(
R.id.global_to_navigation_player,
GeneratorPlayer.newInstance(
generator ?: return, list
)
)
}
}
ACTION_MARK_AS_WATCHED -> {
val isWatched =

View file

@ -764,4 +764,7 @@
<string name="biometric_setting_summary">Unlock the app with Fingerprint, Face ID, PIN, Pattern and Password.</string>
<string name="biometric_prompt_description">This screen was closed due to multiple failed attempts. Please restart the application.</string>
<string name="biometric_warning">Your CloudStream data has been backed up now. Although the possibility of this is very low, all devices can behave differently. In the rare case, that you get locked out from accessing the app, clear the app data completely and restore from a backup. We are very sorry for any inconvenience arising from this.</string>
<string name="music_singlar">Music</string>
<string name="audio_book_singular">Audio Book</string>
<string name="custom_media_singluar">Media</string>
</resources>