mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 05:59:14 +01:00
Minor cleanup
This commit is contained in:
parent
909aed4262
commit
b8ea57e097
@ -34,25 +34,25 @@ class ExtensionDetailsHeaderAdapter(private val presenter: ExtensionDetailsPrese
|
|||||||
val extension = presenter.extension ?: return
|
val extension = presenter.extension ?: return
|
||||||
val context = view.context
|
val context = view.context
|
||||||
|
|
||||||
extension.getApplicationIcon(context)?.let { binding.extensionIcon.setImageDrawable(it) }
|
extension.getApplicationIcon(context)?.let { binding.icon.setImageDrawable(it) }
|
||||||
binding.extensionTitle.text = extension.name
|
binding.title.text = extension.name
|
||||||
binding.extensionVersion.text = context.getString(R.string.ext_version_info, extension.versionName)
|
binding.version.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.lang.text = context.getString(R.string.ext_language_info, LocaleHelper.getSourceDisplayName(extension.lang, context))
|
||||||
binding.extensionNsfw.isVisible = extension.isNsfw
|
binding.nsfw.isVisible = extension.isNsfw
|
||||||
binding.extensionPkg.text = extension.pkgName
|
binding.pkgname.text = extension.pkgName
|
||||||
|
|
||||||
binding.extensionUninstallButton.clicks()
|
binding.btnUninstall.clicks()
|
||||||
.onEach { presenter.uninstallExtension() }
|
.onEach { presenter.uninstallExtension() }
|
||||||
.launchIn(presenter.presenterScope)
|
.launchIn(presenter.presenterScope)
|
||||||
|
|
||||||
if (extension.isObsolete) {
|
if (extension.isObsolete) {
|
||||||
binding.extensionWarningBanner.isVisible = true
|
binding.warningBanner.isVisible = true
|
||||||
binding.extensionWarningBanner.setText(R.string.obsolete_extension_message)
|
binding.warningBanner.setText(R.string.obsolete_extension_message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension.isUnofficial) {
|
if (extension.isUnofficial) {
|
||||||
binding.extensionWarningBanner.isVisible = true
|
binding.warningBanner.isVisible = true
|
||||||
binding.extensionWarningBanner.setText(R.string.unofficial_extension_message)
|
binding.warningBanner.setText(R.string.unofficial_extension_message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ package eu.kanade.tachiyomi.ui.browse.migration.sources
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder
|
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.source.icon
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
|
|
||||||
class SourceHolder(view: View, val adapter: SourceAdapter) :
|
class SourceHolder(view: View, val adapter: SourceAdapter) :
|
||||||
FlexibleViewHolder(view, adapter) {
|
FlexibleViewHolder(view, adapter) {
|
||||||
|
|
||||||
private val binding = SourceMainControllerCardItemBinding.bind(view)
|
private val binding = SourceMainControllerItemBinding.bind(view)
|
||||||
|
|
||||||
fun bind(item: SourceItem) {
|
fun bind(item: SourceItem) {
|
||||||
val source = item.source
|
val source = item.source
|
||||||
|
@ -21,7 +21,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
|
|||||||
* Returns the layout resource of this item.
|
* Returns the layout resource of this item.
|
||||||
*/
|
*/
|
||||||
override fun getLayoutRes(): Int {
|
override fun getLayoutRes(): Int {
|
||||||
return R.layout.source_main_controller_card_item
|
return R.layout.source_main_controller_item
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@ import android.view.View
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder
|
import eu.davidea.viewholders.FlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.R
|
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.LocalSource
|
||||||
import eu.kanade.tachiyomi.source.icon
|
import eu.kanade.tachiyomi.source.icon
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
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) :
|
class SourceHolder(private val view: View, val adapter: SourceAdapter) :
|
||||||
FlexibleViewHolder(view, adapter) {
|
FlexibleViewHolder(view, adapter) {
|
||||||
|
|
||||||
private val binding = SourceMainControllerCardItemBinding.bind(view)
|
private val binding = SourceMainControllerItemBinding.bind(view)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
binding.sourceLatest.setOnClickListener {
|
binding.sourceLatest.setOnClickListener {
|
||||||
|
@ -21,23 +21,14 @@ data class SourceItem(
|
|||||||
) :
|
) :
|
||||||
AbstractSectionableItem<SourceHolder, LangItem>(header) {
|
AbstractSectionableItem<SourceHolder, LangItem>(header) {
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the layout resource of this item.
|
|
||||||
*/
|
|
||||||
override fun getLayoutRes(): Int {
|
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<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
|
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
|
||||||
return SourceHolder(view, adapter as SourceAdapter)
|
return SourceHolder(view, adapter as SourceAdapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds this item to the given view holder.
|
|
||||||
*/
|
|
||||||
override fun bindViewHolder(
|
override fun bindViewHolder(
|
||||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||||
holder: SourceHolder,
|
holder: SourceHolder,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_warning_banner"
|
android:id="@+id/warning_banner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorError"
|
android:background="?attr/colorError"
|
||||||
@ -25,52 +25,52 @@
|
|||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/extension_icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="56dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:src="@mipmap/ic_launcher"
|
android:src="@mipmap/ic_launcher"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/extension_pkg"
|
app:layout_constraintBottom_toBottomOf="@id/pkgname"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_title"
|
android:id="@+id/title"
|
||||||
style="@style/TextAppearance.Regular.SubHeading"
|
style="@style/TextAppearance.Regular.SubHeading"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
app:layout_constraintStart_toEndOf="@id/extension_icon"
|
app:layout_constraintStart_toEndOf="@id/icon"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Tachiyomi: Extension" />
|
tools:text="Tachiyomi: Extension" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_version"
|
android:id="@+id/version"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
app:layout_constraintStart_toStartOf="@id/extension_title"
|
app:layout_constraintStart_toStartOf="@id/title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/extension_title"
|
app:layout_constraintTop_toBottomOf="@id/title"
|
||||||
tools:text="Version: 1.0.0" />
|
tools:text="Version: 1.0.0" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_lang"
|
android:id="@+id/lang"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
app:layout_constraintStart_toStartOf="@id/extension_title"
|
app:layout_constraintStart_toStartOf="@id/title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/extension_version"
|
app:layout_constraintTop_toBottomOf="@id/version"
|
||||||
tools:text="Language: English" />
|
tools:text="Language: English" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_nsfw"
|
android:id="@+id/nsfw"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
@ -80,32 +80,31 @@
|
|||||||
android:text="@string/ext_nsfw_warning"
|
android:text="@string/ext_nsfw_warning"
|
||||||
android:textColor="?attr/colorError"
|
android:textColor="?attr/colorError"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintStart_toStartOf="@id/extension_title"
|
app:layout_constraintStart_toStartOf="@id/title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/extension_lang"
|
app:layout_constraintTop_toBottomOf="@id/lang"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/extension_pkg"
|
android:id="@+id/pkgname"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="3dp"
|
android:elevation="3dp"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/extension_title"
|
app:layout_constraintStart_toStartOf="@id/title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/extension_nsfw"
|
app:layout_constraintTop_toBottomOf="@id/nsfw"
|
||||||
tools:text="eu.kanade.tachiyomi.extension.en.myext" />
|
tools:text="eu.kanade.tachiyomi.extension.en.myext" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/extension_uninstall_button"
|
android:id="@+id/btn_uninstall"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:paddingStart="32dp"
|
|
||||||
android:paddingEnd="32dp"
|
|
||||||
android:text="@string/ext_uninstall"
|
android:text="@string/ext_uninstall"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/extension_pkg" />
|
app:layout_constraintTop_toBottomOf="@id/pkgname" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user