From b657bba96e333476c89b2e4da2d15f7dfaad1ab0 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 10 Aug 2020 11:26:26 -0400 Subject: [PATCH] Add 18+ warnings in extensions list --- .../ui/browse/extension/ExtensionHolder.kt | 11 +++++----- .../details/ExtensionDetailsHeaderAdapter.kt | 1 + .../res/layout/extension_detail_header.xml | 21 ++++++++++++++++--- app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionHolder.kt index c3a9cbb74..12167abdb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionHolder.kt @@ -44,11 +44,12 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : version.text = extension.versionName lang.text = LocaleHelper.getSourceDisplayName(extension.lang, itemView.context) warning.text = when { - extension is Extension.Untrusted -> itemView.context.getString(R.string.ext_untrusted).toUpperCase() - extension is Extension.Installed && extension.isObsolete -> itemView.context.getString(R.string.ext_obsolete).toUpperCase() - extension is Extension.Installed && extension.isUnofficial -> itemView.context.getString(R.string.ext_unofficial).toUpperCase() - else -> null - } + extension is Extension.Untrusted -> itemView.context.getString(R.string.ext_untrusted) + extension is Extension.Installed && extension.isObsolete -> itemView.context.getString(R.string.ext_obsolete) + extension is Extension.Installed && extension.isUnofficial -> itemView.context.getString(R.string.ext_unofficial) + extension.isNsfw -> itemView.context.getString(R.string.ext_nsfw_short) + else -> "" + }.toUpperCase() GlideApp.with(itemView.context).clear(image) if (extension is Extension.Available) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt index a6926d605..6a98fdf37 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt @@ -42,6 +42,7 @@ class ExtensionDetailsHeaderAdapter(private val presenter: ExtensionDetailsPrese binding.extensionTitle.text = extension.name binding.extensionVersion.text = context.getString(R.string.ext_version_info, extension.versionName) binding.extensionLang.text = context.getString(R.string.ext_language_info, LocaleHelper.getSourceDisplayName(extension.lang, context)) + binding.extensionNsfw.isVisible = extension.isNsfw binding.extensionPkg.text = extension.pkgName binding.extensionUninstallButton.clicks() diff --git a/app/src/main/res/layout/extension_detail_header.xml b/app/src/main/res/layout/extension_detail_header.xml index 158a73ae5..ddd9ec61e 100644 --- a/app/src/main/res/layout/extension_detail_header.xml +++ b/app/src/main/res/layout/extension_detail_header.xml @@ -69,6 +69,21 @@ app:layout_constraintTop_toBottomOf="@id/extension_version" tools:text="Language: English" /> + +