From b8ea57e097f26403171ac70e90fd67cfb8f7aec0 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 22 Aug 2021 14:00:07 -0400 Subject: [PATCH] Minor cleanup --- .../details/ExtensionDetailsHeaderAdapter.kt | 22 +++++----- .../browse/migration/sources/SourceHolder.kt | 4 +- .../ui/browse/migration/sources/SourceItem.kt | 2 +- .../ui/browse/source/SourceHolder.kt | 4 +- .../tachiyomi/ui/browse/source/SourceItem.kt | 11 +---- .../res/layout/extension_detail_header.xml | 41 +++++++++---------- ...em.xml => source_main_controller_item.xml} | 0 7 files changed, 37 insertions(+), 47 deletions(-) rename app/src/main/res/layout/{source_main_controller_card_item.xml => source_main_controller_item.xml} (100%) 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 93099bbbd..b65d74ade 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 @@ -34,25 +34,25 @@ class ExtensionDetailsHeaderAdapter(private val presenter: ExtensionDetailsPrese val extension = presenter.extension ?: return val context = view.context - extension.getApplicationIcon(context)?.let { binding.extensionIcon.setImageDrawable(it) } - 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 + extension.getApplicationIcon(context)?.let { binding.icon.setImageDrawable(it) } + binding.title.text = extension.name + binding.version.text = context.getString(R.string.ext_version_info, extension.versionName) + binding.lang.text = context.getString(R.string.ext_language_info, LocaleHelper.getSourceDisplayName(extension.lang, context)) + binding.nsfw.isVisible = extension.isNsfw + binding.pkgname.text = extension.pkgName - binding.extensionUninstallButton.clicks() + binding.btnUninstall.clicks() .onEach { presenter.uninstallExtension() } .launchIn(presenter.presenterScope) if (extension.isObsolete) { - binding.extensionWarningBanner.isVisible = true - binding.extensionWarningBanner.setText(R.string.obsolete_extension_message) + binding.warningBanner.isVisible = true + binding.warningBanner.setText(R.string.obsolete_extension_message) } if (extension.isUnofficial) { - binding.extensionWarningBanner.isVisible = true - binding.extensionWarningBanner.setText(R.string.unofficial_extension_message) + binding.warningBanner.isVisible = true + binding.warningBanner.setText(R.string.unofficial_extension_message) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt index 04ad60af4..bf956f1f0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt @@ -3,14 +3,14 @@ package eu.kanade.tachiyomi.ui.browse.migration.sources import android.view.View import androidx.core.view.isVisible import eu.davidea.viewholders.FlexibleViewHolder -import eu.kanade.tachiyomi.databinding.SourceMainControllerCardItemBinding +import eu.kanade.tachiyomi.databinding.SourceMainControllerItemBinding import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.util.system.LocaleHelper class SourceHolder(view: View, val adapter: SourceAdapter) : FlexibleViewHolder(view, adapter) { - private val binding = SourceMainControllerCardItemBinding.bind(view) + private val binding = SourceMainControllerItemBinding.bind(view) fun bind(item: SourceItem) { val source = item.source diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt index 4494ac1db..08dd11846 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt @@ -21,7 +21,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec * Returns the layout resource of this item. */ override fun getLayoutRes(): Int { - return R.layout.source_main_controller_card_item + return R.layout.source_main_controller_item } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt index 0f05512e0..2a5a02f43 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceHolder.kt @@ -4,7 +4,7 @@ import android.view.View import androidx.core.view.isVisible import eu.davidea.viewholders.FlexibleViewHolder import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.databinding.SourceMainControllerCardItemBinding +import eu.kanade.tachiyomi.databinding.SourceMainControllerItemBinding import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.util.system.LocaleHelper @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.util.view.setVectorCompat class SourceHolder(private val view: View, val adapter: SourceAdapter) : FlexibleViewHolder(view, adapter) { - private val binding = SourceMainControllerCardItemBinding.bind(view) + private val binding = SourceMainControllerItemBinding.bind(view) init { binding.sourceLatest.setOnClickListener { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt index c5a2094f9..5360f582a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt @@ -21,23 +21,14 @@ data class SourceItem( ) : AbstractSectionableItem(header) { - /** - * Returns the layout resource of this item. - */ override fun getLayoutRes(): Int { - return R.layout.source_main_controller_card_item + return R.layout.source_main_controller_item } - /** - * Creates a new view holder for this item. - */ override fun createViewHolder(view: View, adapter: FlexibleAdapter>): SourceHolder { return SourceHolder(view, adapter as SourceAdapter) } - /** - * Binds this item to the given view holder. - */ override fun bindViewHolder( adapter: FlexibleAdapter>, holder: SourceHolder, diff --git a/app/src/main/res/layout/extension_detail_header.xml b/app/src/main/res/layout/extension_detail_header.xml index 95bf05f95..8abf18b1e 100644 --- a/app/src/main/res/layout/extension_detail_header.xml +++ b/app/src/main/res/layout/extension_detail_header.xml @@ -7,7 +7,7 @@ android:orientation="vertical">