Add 18+ warnings in extensions list

This commit is contained in:
arkon 2020-08-10 11:26:26 -04:00
parent dbaac69fad
commit b657bba96e
4 changed files with 27 additions and 8 deletions

View File

@ -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) {

View File

@ -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()

View File

@ -69,6 +69,21 @@
app:layout_constraintTop_toBottomOf="@id/extension_version"
tools:text="Language: English" />
<TextView
android:id="@+id/extension_nsfw"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:elevation="3dp"
android:gravity="center"
android:text="@string/ext_nsfw_warning"
android:textColor="?attr/colorError"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/extension_title"
app:layout_constraintTop_toBottomOf="@id/extension_lang"
tools:visibility="visible" />
<TextView
android:id="@+id/extension_pkg"
android:layout_width="0dp"
@ -78,7 +93,7 @@
android:singleLine="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/extension_title"
app:layout_constraintTop_toBottomOf="@id/extension_lang"
app:layout_constraintTop_toBottomOf="@id/extension_nsfw"
tools:text="eu.kanade.tachiyomi.extension.en.myext" />
<Button
@ -86,12 +101,12 @@
style="@style/Theme.Widget.Button.FilledAccent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginTop="8dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="@string/ext_uninstall"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/extension_lang" />
app:layout_constraintTop_toBottomOf="@id/extension_pkg" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -231,6 +231,8 @@
<string name="unofficial_extension_message">This extension is not from the official Tachiyomi extensions list.</string>
<string name="ext_version_info">Version: %1$s</string>
<string name="ext_language_info">Language: %1$s</string>
<string name="ext_nsfw_short">18+</string>
<string name="ext_nsfw_warning">May contain 18+ content</string>
<!-- Reader section -->
<string name="pref_fullscreen">Fullscreen</string>