From 150ea29a706b85c358b6607a7ac7ebd467f16928 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 13 Jun 2020 17:27:03 -0400 Subject: [PATCH] Move untrusted/obsolete/unofficial extension text --- .../ui/browse/extension/ExtensionHolder.kt | 25 ++++++------------- .../main/res/layout/extension_card_item.xml | 13 ++++++++++ .../layout/extension_detail_controller.xml | 4 +-- app/src/main/res/values/strings.xml | 1 - 4 files changed, 23 insertions(+), 20 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 00645722c2..4abd865c47 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 @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder import eu.kanade.tachiyomi.util.system.LocaleHelper -import eu.kanade.tachiyomi.util.system.getResourceColor import io.github.mthli.slice.Slice import kotlinx.android.synthetic.main.extension_card_item.card import kotlinx.android.synthetic.main.extension_card_item.ext_button @@ -16,6 +15,7 @@ import kotlinx.android.synthetic.main.extension_card_item.ext_title import kotlinx.android.synthetic.main.extension_card_item.image import kotlinx.android.synthetic.main.extension_card_item.lang import kotlinx.android.synthetic.main.extension_card_item.version +import kotlinx.android.synthetic.main.extension_card_item.warning class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : BaseFlexibleViewHolder(view, adapter), @@ -38,13 +38,14 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : val extension = item.extension setCardEdges(item) - // Set source name ext_title.text = extension.name version.text = extension.versionName - lang.text = if (extension !is Extension.Untrusted) { - LocaleHelper.getSourceDisplayName(extension.lang, itemView.context) - } else { - itemView.context.getString(R.string.ext_untrusted).toUpperCase() + 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 } GlideApp.with(itemView.context).clear(image) @@ -63,8 +64,6 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : isEnabled = true isClickable = true - setTextColor(context.getResourceColor(R.attr.colorAccent)) - val extension = item.extension val installStep = item.installStep @@ -87,16 +86,8 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : extension.hasUpdate -> { setText(R.string.ext_update) } - extension.isObsolete -> { - setTextColor(context.getResourceColor(R.attr.colorError)) - setText(R.string.ext_obsolete) - } - extension.isUnofficial -> { - setTextColor(context.getResourceColor(R.attr.colorError)) - setText(R.string.ext_unofficial) - } else -> { - setText(R.string.ext_details) + setText(R.string.action_settings) } } } else if (extension is Extension.Untrusted) { diff --git a/app/src/main/res/layout/extension_card_item.xml b/app/src/main/res/layout/extension_card_item.xml index da2b215745..a96f142df4 100644 --- a/app/src/main/res/layout/extension_card_item.xml +++ b/app/src/main/res/layout/extension_card_item.xml @@ -64,6 +64,19 @@ app:layout_constraintTop_toBottomOf="@+id/ext_title" tools:text="Version" /> + +