add nsfw TvType instead of isAdult property

This commit is contained in:
C10udburst 2022-08-14 16:00:10 +02:00
parent 6c99cd78b6
commit 93c1713702
15 changed files with 36 additions and 155 deletions

View file

@ -555,6 +555,7 @@ enum class TvType {
Documentary, Documentary,
AsianDrama, AsianDrama,
Live, Live,
NSFW,
Others Others
} }

View file

@ -56,7 +56,6 @@ data class PluginData(
null, null,
null, null,
null, null,
null,
null null
) )
} }

View file

@ -60,8 +60,6 @@ data class SitePlugin(
@JsonProperty("tvTypes") val tvTypes: List<String>?, @JsonProperty("tvTypes") val tvTypes: List<String>?,
@JsonProperty("language") val language: String?, @JsonProperty("language") val language: String?,
@JsonProperty("iconUrl") val iconUrl: String?, @JsonProperty("iconUrl") val iconUrl: String?,
// Set to true to get an 18+ symbol next to the plugin
@JsonProperty("adult") val adult: Boolean?,
) )

View file

@ -252,6 +252,7 @@ class HomeFragment : Fragment() {
movies: MaterialButton?, movies: MaterialButton?,
asian: MaterialButton?, asian: MaterialButton?,
livestream: MaterialButton?, livestream: MaterialButton?,
nsfw: MaterialButton?,
others: MaterialButton?, others: MaterialButton?,
): List<Pair<MaterialButton?, List<TvType>>> { ): List<Pair<MaterialButton?, List<TvType>>> {
return listOf( return listOf(
@ -262,6 +263,7 @@ class HomeFragment : Fragment() {
Pair(movies, listOf(TvType.Movie, TvType.Torrent)), Pair(movies, listOf(TvType.Movie, TvType.Torrent)),
Pair(asian, listOf(TvType.AsianDrama)), Pair(asian, listOf(TvType.AsianDrama)),
Pair(livestream, listOf(TvType.Live)), Pair(livestream, listOf(TvType.Live)),
Pair(nsfw, listOf(TvType.NSFW)),
Pair(others, listOf(TvType.Others)), Pair(others, listOf(TvType.Others)),
) )
} }
@ -297,11 +299,12 @@ class HomeFragment : Fragment() {
val movies = dialog.findViewById<MaterialButton>(R.id.home_select_movies) val movies = dialog.findViewById<MaterialButton>(R.id.home_select_movies)
val asian = dialog.findViewById<MaterialButton>(R.id.home_select_asian) val asian = dialog.findViewById<MaterialButton>(R.id.home_select_asian)
val livestream = dialog.findViewById<MaterialButton>(R.id.home_select_livestreams) val livestream = dialog.findViewById<MaterialButton>(R.id.home_select_livestreams)
val nsfw = dialog.findViewById<MaterialButton>(R.id.home_select_nsfw)
val others = dialog.findViewById<MaterialButton>(R.id.home_select_others) val others = dialog.findViewById<MaterialButton>(R.id.home_select_others)
val cancelBtt = dialog.findViewById<MaterialButton>(R.id.cancel_btt) val cancelBtt = dialog.findViewById<MaterialButton>(R.id.cancel_btt)
val applyBtt = dialog.findViewById<MaterialButton>(R.id.apply_btt) val applyBtt = dialog.findViewById<MaterialButton>(R.id.apply_btt)
val pairList = getPairList(anime, cartoons, tvs, docs, movies, asian, livestream, others) val pairList = getPairList(anime, cartoons, tvs, docs, movies, asian, livestream, nsfw, others)
cancelBtt?.setOnClickListener { cancelBtt?.setOnClickListener {
dialog.dismissSafe() dialog.dismissSafe()

View file

@ -198,6 +198,7 @@ fun LoadResponse.toResultData(repo: APIRepository): ResultData {
TvType.AsianDrama -> R.string.asian_drama_singular TvType.AsianDrama -> R.string.asian_drama_singular
TvType.Live -> R.string.live_singular TvType.Live -> R.string.live_singular
TvType.Others -> R.string.other_singular TvType.Others -> R.string.other_singular
TvType.NSFW -> R.string.nsfw_singular
} }
), ),
yearText = txt(year?.toString()), yearText = txt(year?.toString()),
@ -550,6 +551,7 @@ class ResultViewModel2 : ViewModel() {
TvType.Documentary -> "Documentaries" TvType.Documentary -> "Documentaries"
TvType.AsianDrama -> "AsianDrama" TvType.AsianDrama -> "AsianDrama"
TvType.Live -> "LiveStreams" TvType.Live -> "LiveStreams"
TvType.NSFW -> "NSFW"
TvType.Others -> "Others" TvType.Others -> "Others"
} }
} }

View file

@ -167,8 +167,8 @@ class SearchFragment : Fragment() {
val docs = dialog.findViewById<MaterialButton>(R.id.home_select_documentaries) val docs = dialog.findViewById<MaterialButton>(R.id.home_select_documentaries)
val movies = dialog.findViewById<MaterialButton>(R.id.home_select_movies) val movies = dialog.findViewById<MaterialButton>(R.id.home_select_movies)
val asian = dialog.findViewById<MaterialButton>(R.id.home_select_asian) val asian = dialog.findViewById<MaterialButton>(R.id.home_select_asian)
val livestream = val livestream = dialog.findViewById<MaterialButton>(R.id.home_select_livestreams)
dialog.findViewById<MaterialButton>(R.id.home_select_livestreams) val nsfw = dialog.findViewById<MaterialButton>(R.id.home_select_nsfw)
val other = dialog.findViewById<MaterialButton>(R.id.home_select_others) val other = dialog.findViewById<MaterialButton>(R.id.home_select_others)
val cancelBtt = dialog.findViewById<MaterialButton>(R.id.cancel_btt) val cancelBtt = dialog.findViewById<MaterialButton>(R.id.cancel_btt)
val applyBtt = dialog.findViewById<MaterialButton>(R.id.apply_btt) val applyBtt = dialog.findViewById<MaterialButton>(R.id.apply_btt)
@ -182,6 +182,7 @@ class SearchFragment : Fragment() {
movies, movies,
asian, asian,
livestream, livestream,
nsfw,
other other
) )
@ -300,6 +301,7 @@ class SearchFragment : Fragment() {
search_select_movies, search_select_movies,
search_select_asian, search_select_asian,
search_select_livestreams, search_select_livestreams,
search_select_nsfw,
search_select_others search_select_others
) )

View file

@ -85,7 +85,7 @@ class PluginAdapter(
R.drawable.ic_baseline_delete_outline_24 R.drawable.ic_baseline_delete_outline_24
else R.drawable.netflix_download else R.drawable.netflix_download
itemView.nsfw_marker?.isVisible = metadata.adult == true itemView.nsfw_marker?.isVisible = metadata.tvTypes?.contains("NSFW") ?: false
itemView.action_button?.setImageResource(drawableInt) itemView.action_button?.setImageResource(drawableInt)
itemView.action_button?.setOnClickListener { itemView.action_button?.setOnClickListener {

View file

@ -113,6 +113,7 @@ class PluginsFragment : Fragment() {
home_select_movies, home_select_movies,
home_select_asian, home_select_asian,
home_select_livestreams, home_select_livestreams,
home_select_nsfw,
home_select_others home_select_others
) )

View file

@ -111,9 +111,15 @@
android:text="@string/livestreams" /> android:text="@string/livestreams" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/home_select_others" android:id="@+id/home_select_nsfw"
style="@style/RoundedSelectableButton" style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/home_select_livestreams" android:nextFocusLeft="@id/home_select_livestreams"
android:text="@string/nsfw" />
<com.google.android.material.button.MaterialButton
android:id="@+id/home_select_others"
style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/home_select_nsfw"
android:text="@string/others" /> android:text="@string/others" />
</LinearLayout> </LinearLayout>

View file

@ -148,9 +148,15 @@
android:text="@string/livestreams" /> android:text="@string/livestreams" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/search_select_others" android:id="@+id/search_select_nsfw"
style="@style/RoundedSelectableButton" style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/search_select_livestreams" android:nextFocusLeft="@id/search_select_livestreams"
android:text="@string/nsfw" />
<com.google.android.material.button.MaterialButton
android:id="@+id/search_select_others"
style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/search_select_nsfw"
android:text="@string/others" /> android:text="@string/others" />
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>

View file

@ -105,9 +105,15 @@
android:text="@string/livestreams" /> android:text="@string/livestreams" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/home_select_others" android:id="@+id/home_select_nsfw"
style="@style/RoundedSelectableButton" style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/home_select_livestreams" android:nextFocusLeft="@id/home_select_livestreams"
android:text="@string/nsfw" />
<com.google.android.material.button.MaterialButton
android:id="@+id/home_select_others"
style="@style/RoundedSelectableButton"
android:nextFocusLeft="@id/home_select_nsfw"
android:text="@string/others" /> android:text="@string/others" />
</LinearLayout> </LinearLayout>

View file

@ -1,55 +1,7 @@
<!--https://newbedev.com/concatenate-multiple-strings-in-xml--> <!--https://newbedev.com/concatenate-multiple-strings-in-xml-->
<resources> <resources>
<!-- KEYS DON'T TRANSLATE --> <!-- KEYS DON'T TRANSLATE -->
<string name="search_providers_list_key" translatable="false">search_providers_list</string>
<string name="locale_key" translatable="false">app_locale</string>
<string name="search_types_list_key" translatable="false">search_type_list</string>
<string name="auto_update_key" translatable="false">auto_update</string>
<string name="skip_update_key" translatable="false">skip_update_key</string>
<string name="prerelease_update_key" translatable="false">prerelease_update</string>
<string name="manual_check_update_key" translatable="false">manual_check_update</string>
<string name="fast_forward_button_time_key" translatable="false">fast_forward_button_time</string>
<string name="benene_count" translatable="false">benene_count</string>
<string name="subtitle_settings_key" translatable="false">subtitle_settings_key</string>
<string name="subtitle_settings_chromecast_key" translatable="false">subtitle_settings_chromecast_key</string>
<string name="quality_pref_key" translatable="false">quality_pref_key</string>
<string name="prefer_limit_title_key" translatable="false">prefer_limit_title_key</string>
<string name="prefer_limit_title_rez_key" translatable="false">prefer_limit_title_rez_key</string>
<string name="video_buffer_size_key" translatable="false">video_buffer_size_key</string>
<string name="video_buffer_length_key" translatable="false">video_buffer_length_key</string>
<string name="video_buffer_clear_key" translatable="false">video_buffer_clear_key</string>
<string name="video_buffer_disk_key" translatable="false">video_buffer_disk_key</string>
<string name="prerelease_commit_hash" translatable="false">unknown_prerelease</string>
<string name="use_system_brightness_key" translatable="false">use_system_brightness_key</string>
<string name="swipe_enabled_key" translatable="false">swipe_enabled_key</string>
<string name="playback_speed_enabled_key" translatable="false">playback_speed_enabled_key</string>
<string name="player_resize_enabled_key" translatable="false">player_resize_enabled_key</string>
<string name="pip_enabled_key" translatable="false">pip_enabled_key</string>
<string name="double_tap_enabled_key" translatable="false">double_tap_enabled_key</string>
<string name="double_tap_pause_enabled_key" translatable="false">double_tap_pause_enabled_key</string>
<string name="double_tap_seek_time_key" translatable="false">double_tap_seek_time_key</string>
<string name="swipe_vertical_enabled_key" translatable="false">swipe_vertical_enabled_key</string>
<string name="display_sub_key" translatable="false">display_sub_key</string>
<string name="show_fillers_key" translatable="false">show_fillers_key</string>
<string name="show_trailers_key" translatable="false">show_trailers_key</string>
<string name="show_kitsu_posters_key" translatable="false">show_kitsu_posters_key</string>
<string name="random_button_key" translatable="false">random_button_key</string>
<string name="provider_lang_key" translatable="false">provider_lang_key</string>
<string name="dns_key" translatable="false">dns_key</string>
<string name="download_path_key" translatable="false">download_path_key</string>
<string name="app_name_download_path" translatable="false">Cloudstream</string>
<string name="app_layout_key" translatable="false">app_layout_key</string>
<string name="primary_color_key" translatable="false">primary_color_key</string>
<string name="restore_key" translatable="false">restore_key</string>
<string name="backup_key" translatable="false">backup_key</string>
<string name="prefer_media_type_key" translatable="false">prefer_media_type_key</string>
<string name="app_theme_key" translatable="false">app_theme_key</string>
<string name="episode_sync_enabled_key" translatable="false">episode_sync_enabled_key</string>
<string name="log_enabled_key" translatable="false">log_enabled_key</string>
<string name="show_logcat_key" translatable="false">show_logcat_key</string>
<string name="bottom_title_key" translatable="false">bottom_title_key</string> <string name="bottom_title_key" translatable="false">bottom_title_key</string>
<string name="poster_ui_key" translatable="false">poster_ui_key</string>
<string name="subtitles_encoding_key" translatable="false">subtitles_encoding_key</string>
<string name="override_site_key" translatable="false">override_site_key</string> <string name="override_site_key" translatable="false">override_site_key</string>
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG --> <!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->

View file

@ -1,53 +1,6 @@
<!--https://newbedev.com/concatenate-multiple-strings-in-xml--> <!--https://newbedev.com/concatenate-multiple-strings-in-xml-->
<resources> <resources>
<!-- KEYS DON'T TRANSLATE --> <!-- KEYS DON'T TRANSLATE -->
<string name="search_providers_list_key" translatable="false">search_providers_list</string>
<string name="locale_key" translatable="false">app_locale</string>
<string name="search_types_list_key" translatable="false">search_type_list</string>
<string name="auto_update_key" translatable="false">auto_update</string>
<string name="skip_update_key" translatable="false">skip_update_key</string>
<string name="prerelease_update_key" translatable="false">prerelease_update</string>
<string name="manual_check_update_key" translatable="false">manual_check_update</string>
<string name="fast_forward_button_time_key" translatable="false">fast_forward_button_time</string>
<string name="benene_count" translatable="false">benene_count</string>
<string name="subtitle_settings_key" translatable="false">subtitle_settings_key</string>
<string name="subtitle_settings_chromecast_key" translatable="false">subtitle_settings_chromecast_key</string>
<string name="quality_pref_key" translatable="false">quality_pref_key</string>
<string name="prefer_limit_title_key" translatable="false">prefer_limit_title_key</string>
<string name="prefer_limit_title_rez_key" translatable="false">prefer_limit_title_rez_key</string>
<string name="video_buffer_size_key" translatable="false">video_buffer_size_key</string>
<string name="video_buffer_length_key" translatable="false">video_buffer_length_key</string>
<string name="video_buffer_clear_key" translatable="false">video_buffer_clear_key</string>
<string name="video_buffer_disk_key" translatable="false">video_buffer_disk_key</string>
<string name="prerelease_commit_hash" translatable="false">unknown_prerelease</string>
<string name="use_system_brightness_key" translatable="false">use_system_brightness_key</string>
<string name="swipe_enabled_key" translatable="false">swipe_enabled_key</string>
<string name="playback_speed_enabled_key" translatable="false">playback_speed_enabled_key</string>
<string name="player_resize_enabled_key" translatable="false">player_resize_enabled_key</string>
<string name="pip_enabled_key" translatable="false">pip_enabled_key</string>
<string name="double_tap_enabled_key" translatable="false">double_tap_enabled_key</string>
<string name="double_tap_pause_enabled_key" translatable="false">double_tap_pause_enabled_key</string>
<string name="double_tap_seek_time_key" translatable="false">double_tap_seek_time_key</string>
<string name="swipe_vertical_enabled_key" translatable="false">swipe_vertical_enabled_key</string>
<string name="display_sub_key" translatable="false">display_sub_key</string>
<string name="show_fillers_key" translatable="false">show_fillers_key</string>
<string name="random_button_key" translatable="false">random_button_key</string>
<string name="provider_lang_key" translatable="false">provider_lang_key</string>
<string name="dns_key" translatable="false">dns_key</string>
<string name="download_path_key" translatable="false">download_path_key</string>
<string name="app_name_download_path" translatable="false">Cloudstream</string>
<string name="app_layout_key" translatable="false">app_layout_key</string>
<string name="primary_color_key" translatable="false">primary_color_key</string>
<string name="restore_key" translatable="false">restore_key</string>
<string name="backup_key" translatable="false">backup_key</string>
<string name="prefer_media_type_key" translatable="false">prefer_media_type_key</string>
<string name="app_theme_key" translatable="false">app_theme_key</string>
<string name="episode_sync_enabled_key" translatable="false">episode_sync_enabled_key</string>
<string name="log_enabled_key" translatable="false">log_enabled_key</string>
<string name="show_logcat_key" translatable="false">show_logcat_key</string>
<string name="bottom_title_key" translatable="false">bottom_title_key</string>
<string name="poster_ui_key" translatable="false">poster_ui_key</string>
<string name="subtitles_encoding_key" translatable="false">subtitles_encoding_key</string>
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG --> <!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->
<string name="extra_info_format" translatable="false" formatted="true">%d %s | %sMB</string> <string name="extra_info_format" translatable="false" formatted="true">%d %s | %sMB</string>

View file

@ -1,56 +1,6 @@
<!--https://newbedev.com/concatenate-multiple-strings-in-xml--> <!--https://newbedev.com/concatenate-multiple-strings-in-xml-->
<resources> <resources>
<!-- KEYS DON'T TRANSLATE --> <!-- KEYS DON'T TRANSLATE -->
<string name="search_providers_list_key" translatable="false">search_providers_list</string>
<string name="locale_key" translatable="false">app_locale</string>
<string name="search_types_list_key" translatable="false">search_type_list</string>
<string name="auto_update_key" translatable="false">auto_update</string>
<string name="skip_update_key" translatable="false">skip_update_key</string>
<string name="prerelease_update_key" translatable="false">prerelease_update</string>
<string name="manual_check_update_key" translatable="false">manual_check_update</string>
<string name="fast_forward_button_time_key" translatable="false">fast_forward_button_time</string>
<string name="benene_count" translatable="false">benene_count</string>
<string name="subtitle_settings_key" translatable="false">subtitle_settings_key</string>
<string name="subtitle_settings_chromecast_key" translatable="false">subtitle_settings_chromecast_key</string>
<string name="quality_pref_key" translatable="false">quality_pref_key</string>
<string name="prefer_limit_title_key" translatable="false">prefer_limit_title_key</string>
<string name="prefer_limit_title_rez_key" translatable="false">prefer_limit_title_rez_key</string>
<string name="video_buffer_size_key" translatable="false">video_buffer_size_key</string>
<string name="video_buffer_length_key" translatable="false">video_buffer_length_key</string>
<string name="video_buffer_clear_key" translatable="false">video_buffer_clear_key</string>
<string name="video_buffer_disk_key" translatable="false">video_buffer_disk_key</string>
<string name="prerelease_commit_hash" translatable="false">unknown_prerelease</string>
<string name="use_system_brightness_key" translatable="false">use_system_brightness_key</string>
<string name="swipe_enabled_key" translatable="false">swipe_enabled_key</string>
<string name="playback_speed_enabled_key" translatable="false">playback_speed_enabled_key</string>
<string name="player_resize_enabled_key" translatable="false">player_resize_enabled_key</string>
<string name="pip_enabled_key" translatable="false">pip_enabled_key</string>
<string name="double_tap_enabled_key" translatable="false">double_tap_enabled_key</string>
<string name="double_tap_pause_enabled_key" translatable="false">double_tap_pause_enabled_key</string>
<string name="double_tap_seek_time_key" translatable="false">double_tap_seek_time_key</string>
<string name="swipe_vertical_enabled_key" translatable="false">swipe_vertical_enabled_key</string>
<string name="display_sub_key" translatable="false">display_sub_key</string>
<string name="show_fillers_key" translatable="false">show_fillers_key</string>
<string name="show_trailers_key" translatable="false">show_trailers_key</string>
<string name="show_kitsu_posters_key" translatable="false">show_kitsu_posters_key</string>
<string name="random_button_key" translatable="false">random_button_key</string>
<string name="provider_lang_key" translatable="false">provider_lang_key</string>
<string name="dns_key" translatable="false">dns_key</string>
<string name="download_path_key" translatable="false">download_path_key</string>
<string name="app_name_download_path" translatable="false">Cloudstream</string>
<string name="app_layout_key" translatable="false">app_layout_key</string>
<string name="primary_color_key" translatable="false">primary_color_key</string>
<string name="restore_key" translatable="false">restore_key</string>
<string name="backup_key" translatable="false">backup_key</string>
<string name="prefer_media_type_key" translatable="false">prefer_media_type_key</string>
<string name="app_theme_key" translatable="false">app_theme_key</string>
<string name="episode_sync_enabled_key" translatable="false">episode_sync_enabled_key</string>
<string name="log_enabled_key" translatable="false">log_enabled_key</string>
<string name="show_logcat_key" translatable="false">show_logcat_key</string>
<string name="bottom_title_key" translatable="false">bottom_title_key</string>
<string name="poster_ui_key" translatable="false">poster_ui_key</string>
<string name="subtitles_encoding_key" translatable="false">subtitles_encoding_key</string>
<string name="override_site_key" translatable="false">override_site_key</string>
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG --> <!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->
<string name="extra_info_format" translatable="false" formatted="true">%d %s | %sMB</string> <string name="extra_info_format" translatable="false" formatted="true">%d %s | %sMB</string>

View file

@ -333,6 +333,7 @@
<string name="ova">OVA</string> <string name="ova">OVA</string>
<string name="asian_drama">Asian Dramas</string> <string name="asian_drama">Asian Dramas</string>
<string name="livestreams">Livestreams</string> <string name="livestreams">Livestreams</string>
<string name="nsfw">NSFW</string>
<string name="others">Others</string> <string name="others">Others</string>
<!--singular--> <!--singular-->
@ -345,6 +346,7 @@
<string name="documentaries_singular">Documentary</string> <string name="documentaries_singular">Documentary</string>
<string name="asian_drama_singular">Asian Drama</string> <string name="asian_drama_singular">Asian Drama</string>
<string name="live_singular">Livestream</string> <string name="live_singular">Livestream</string>
<string name="nsfw_singular">NSFW</string>
<string name="other_singular">Video</string> <string name="other_singular">Video</string>
<string name="source_error">Source error</string> <string name="source_error">Source error</string>