remove visible helper

big ups to android studio for breaking indexing hard while I refactor
This commit is contained in:
Jays2Kings 2021-04-26 02:28:04 -04:00
parent 5d2e0ebbe7
commit 5ca4e8ade0
24 changed files with 84 additions and 109 deletions

View File

@ -15,7 +15,6 @@ import eu.kanade.tachiyomi.databinding.CategoriesItemBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.category.CategoryPresenter.Companion.CREATE_CATEGORY_ORDER import eu.kanade.tachiyomi.ui.category.CategoryPresenter.Companion.CREATE_CATEGORY_ORDER
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.visible
/** /**
* Holder used to display category items. * Holder used to display category items.
@ -68,7 +67,7 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie
R.drawable R.drawable
.ic_drag_handle_24dp .ic_drag_handle_24dp
) )
binding.image.visible() binding.image.isVisible = true
binding.editText.setText(binding.title.text) binding.editText.setText(binding.title.text)
} }
} }

View File

@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.MangaCategoryDialogBinding import eu.kanade.tachiyomi.databinding.MangaCategoryDialogBinding
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -143,7 +142,7 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
if (downloadNew && preferences.downloadNewCategories().get().isEmpty()) { if (downloadNew && preferences.downloadNewCategories().get().isEmpty()) {
binding.downloadNew.isVisible = false binding.downloadNew.isVisible = false
} else if (!downloadNew) { } else if (!downloadNew) {
binding.downloadNew.visible() binding.downloadNew.isVisible = true
} }
binding.downloadNew.isChecked = binding.downloadNew.isChecked =
preferences.downloadNew().get() && binding.downloadNew.isChecked preferences.downloadNew().get() && binding.downloadNew.isChecked

View File

@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.databinding.DownloadButtonBinding import eu.kanade.tachiyomi.databinding.DownloadButtonBinding
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.EndAnimatorListener import eu.kanade.tachiyomi.widget.EndAnimatorListener
class DownloadButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class DownloadButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -90,14 +89,14 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
when (state) { when (state) {
Download.CHECKED -> { Download.CHECKED -> {
binding.downloadProgress.isVisible = false binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.isVisible = true
binding.downloadProgressIndeterminate.isVisible = false binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(filledCircle) binding.downloadBorder.setImageDrawable(filledCircle)
binding.downloadBorder.drawable.setTint(activeColor) binding.downloadBorder.drawable.setTint(activeColor)
binding.downloadIcon.drawable.setTint(Color.WHITE) binding.downloadIcon.drawable.setTint(Color.WHITE)
} }
Download.NOT_DOWNLOADED -> { Download.NOT_DOWNLOADED -> {
binding.downloadBorder.visible() binding.downloadBorder.isVisible = true
binding.downloadProgress.isVisible = false binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.isVisible = false binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
@ -107,13 +106,13 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
Download.QUEUE -> { Download.QUEUE -> {
binding.downloadBorder.isVisible = false binding.downloadBorder.isVisible = false
binding.downloadProgress.isVisible = false binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.visible() binding.downloadProgressIndeterminate.isVisible = true
binding.downloadProgress.isIndeterminate = true binding.downloadProgress.isIndeterminate = true
binding.downloadIcon.drawable.setTint(disabledColor) binding.downloadIcon.drawable.setTint(disabledColor)
} }
Download.DOWNLOADING -> { Download.DOWNLOADING -> {
binding.downloadBorder.visible() binding.downloadBorder.isVisible = true
binding.downloadProgress.visible() binding.downloadProgress.isVisible = true
binding.downloadProgressIndeterminate.isVisible = false binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadProgress.isIndeterminate = false binding.downloadProgress.isIndeterminate = false
@ -133,7 +132,7 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
} }
Download.DOWNLOADED -> { Download.DOWNLOADED -> {
binding.downloadProgress.isVisible = false binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.isVisible = true
binding.downloadProgressIndeterminate.isVisible = false binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.drawable.setTint(downloadedColor) binding.downloadBorder.drawable.setTint(downloadedColor)
if (animated) { if (animated) {
@ -160,7 +159,7 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
} }
Download.ERROR -> { Download.ERROR -> {
binding.downloadProgress.isVisible = false binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.isVisible = true
binding.downloadProgressIndeterminate.isVisible = false binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadBorder.drawable.setTint(errorColor) binding.downloadBorder.drawable.setTint(errorColor)

View File

@ -97,7 +97,6 @@ import eu.kanade.tachiyomi.util.view.smoothScrollToTop
import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.EndAnimatorListener import eu.kanade.tachiyomi.widget.EndAnimatorListener
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -844,7 +843,7 @@ class LibraryController(
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) { override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type) super.onChangeStarted(handler, type)
if (type.isEnter) { if (type.isEnter) {
binding.filterBottomSheet.filterBottomSheet.visible() binding.filterBottomSheet.filterBottomSheet.isVisible = true
presenter.getLibrary() presenter.getLibrary()
DownloadService.callListeners() DownloadService.callListeners()
LibraryUpdateService.setListener(this) LibraryUpdateService.setListener(this)

View File

@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -134,7 +133,7 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
private fun addCategoryToUpdate() { private fun addCategoryToUpdate() {
if (adapter.libraryListener.updateCategory(flexibleAdapterPosition)) { if (adapter.libraryListener.updateCategory(flexibleAdapterPosition)) {
binding.catProgress.visible() binding.catProgress.isVisible = true
binding.updateButton.isInvisible = true binding.updateButton.isInvisible = true
} }
} }

View File

@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga
import eu.kanade.tachiyomi.databinding.MangaListItemBinding import eu.kanade.tachiyomi.databinding.MangaListItemBinding
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
/** /**
* Class used to hold the displayed data of a manga in the library, like the cover or the binding.title. * Class used to hold the displayed data of a manga in the library, like the cover or the binding.title.
@ -34,7 +33,7 @@ class LibraryListHolder(
* @param item the manga item to bind. * @param item the manga item to bind.
*/ */
override fun onSetValues(item: LibraryItem) { override fun onSetValues(item: LibraryItem) {
binding.title.visible() binding.title.isVisible = true
binding.constraintLayout.minHeight = 56.dpToPx binding.constraintLayout.minHeight = 56.dpToPx
if (item.manga.isBlank()) { if (item.manga.isBlank()) {
binding.constraintLayout.minHeight = 0 binding.constraintLayout.minHeight = 0
@ -57,8 +56,8 @@ class LibraryListHolder(
binding.constraintLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.constraintLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = 52.dpToPx height = 52.dpToPx
} }
binding.padding.visible() binding.padding.isVisible = true
binding.card.visible() binding.card.isVisible = true
binding.title.textAlignment = View.TEXT_ALIGNMENT_TEXT_START binding.title.textAlignment = View.TEXT_ALIGNMENT_TEXT_START
// Update the binding.title of the manga. // Update the binding.title of the manga.

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.FilterTagGroupBinding import eu.kanade.tachiyomi.databinding.FilterTagGroupBinding
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.visible
class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout
(context, attrs) { (context, attrs) {
@ -95,10 +94,10 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute
it.isActivated = false it.isActivated = false
} }
for (i in 0 until itemCount) { for (i in 0 until itemCount) {
buttons[i].visible() buttons[i].isVisible = true
buttons[i].setTextColor(context.getResourceColor(android.R.attr.textColorPrimary)) buttons[i].setTextColor(context.getResourceColor(android.R.attr.textColorPrimary))
} }
for (i in 0 until (itemCount - 1)) separators[i].visible() for (i in 0 until (itemCount - 1)) separators[i].isVisible = true
} }
private fun toggleButton(index: Int, callBack: Boolean = true) { private fun toggleButton(index: Int, callBack: Boolean = true) {
@ -137,9 +136,9 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute
listener?.onFilterClicked(this, -1, callBack) listener?.onFilterClicked(this, -1, callBack)
buttons.forEachIndexed { viewIndex, textView -> buttons.forEachIndexed { viewIndex, textView ->
if (!textView.text.isNullOrBlank()) { if (!textView.text.isNullOrBlank()) {
textView.visible() textView.isVisible = true
if (viewIndex > 0) { if (viewIndex > 0) {
separators[viewIndex - 1].visible() separators[viewIndex - 1].isVisible = true
} }
} }
} }

View File

@ -23,7 +23,6 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.isLTR import eu.kanade.tachiyomi.util.system.isLTR
import eu.kanade.tachiyomi.util.view.resetStrokeColor import eu.kanade.tachiyomi.util.view.resetStrokeColor
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
class MangaHeaderHolder( class MangaHeaderHolder(
@ -107,8 +106,8 @@ class MangaHeaderHolder(
if (binding.moreButton.visibility == View.VISIBLE) { if (binding.moreButton.visibility == View.VISIBLE) {
binding.mangaSummary.maxLines = Integer.MAX_VALUE binding.mangaSummary.maxLines = Integer.MAX_VALUE
binding.mangaSummary.setTextIsSelectable(true) binding.mangaSummary.setTextIsSelectable(true)
binding.mangaGenresTags.visible() binding.mangaGenresTags.isVisible = true
binding.lessButton.visible() binding.lessButton.isVisible = true
binding.moreButtonGroup.isVisible = false binding.moreButtonGroup.isVisible = false
binding.title.maxLines = Integer.MAX_VALUE binding.title.maxLines = Integer.MAX_VALUE
} }
@ -120,7 +119,7 @@ class MangaHeaderHolder(
binding.mangaSummary.maxLines = 3 binding.mangaSummary.maxLines = 3
binding.mangaGenresTags.isVisible = false binding.mangaGenresTags.isVisible = false
binding.lessButton.isVisible = false binding.lessButton.isVisible = false
binding.moreButtonGroup.visible() binding.moreButtonGroup.isVisible = true
binding.title.maxLines = 4 binding.title.maxLines = 4
adapter.recyclerView.post { adapter.recyclerView.post {
adapter.delegate.updateScroll() adapter.delegate.updateScroll()
@ -161,7 +160,7 @@ class MangaHeaderHolder(
binding.moreButtonGroup.isVisible = false binding.moreButtonGroup.isVisible = false
showMoreButton = binding.lessButton.isVisible showMoreButton = binding.lessButton.isVisible
} else { } else {
binding.moreButtonGroup.visible() binding.moreButtonGroup.isVisible = true
} }
} }
if (adapter.hasFilter()) collapse() if (adapter.hasFilter()) collapse()
@ -342,13 +341,13 @@ class MangaHeaderHolder(
} }
fun expand() { fun expand() {
binding.subItemGroup.visible() binding.subItemGroup.isVisible = true
if (!showMoreButton) binding.moreButtonGroup.isVisible = false if (!showMoreButton) binding.moreButtonGroup.isVisible = false
else { else {
if (binding.mangaSummary.maxLines != Integer.MAX_VALUE) binding.moreButtonGroup.visible() if (binding.mangaSummary.maxLines != Integer.MAX_VALUE) binding.moreButtonGroup.isVisible = true
else { else {
binding.lessButton.visible() binding.lessButton.isVisible = true
binding.mangaGenresTags.visible() binding.mangaGenresTags.isVisible = true
} }
} }
binding.startReadingButton.isVisible = showReadingButton binding.startReadingButton.isVisible = showReadingButton

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.manga.MangaDetailsAdapter import eu.kanade.tachiyomi.ui.manga.MangaDetailsAdapter
import eu.kanade.tachiyomi.util.chapter.ChapterUtil import eu.kanade.tachiyomi.util.chapter.ChapterUtil
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.EndAnimatorListener import eu.kanade.tachiyomi.widget.EndAnimatorListener
import eu.kanade.tachiyomi.widget.StartAnimatorListener import eu.kanade.tachiyomi.widget.StartAnimatorListener
@ -108,14 +107,14 @@ class ChapterHolder(
val animatorSet = AnimatorSet() val animatorSet = AnimatorSet()
val anim1 = slideAnimation(0f, slide) val anim1 = slideAnimation(0f, slide)
anim1.startDelay = 1000 anim1.startDelay = 1000
anim1.addListener(StartAnimatorListener { binding.leftView.visible() }) anim1.addListener(StartAnimatorListener { binding.leftView.isVisible = true })
val anim2 = slideAnimation(slide, -slide) val anim2 = slideAnimation(slide, -slide)
anim2.duration = 600 anim2.duration = 600
anim2.startDelay = 500 anim2.startDelay = 500
anim2.addUpdateListener { anim2.addUpdateListener {
if (binding.leftView.isVisible && binding.frontView.translationX <= 0) { if (binding.leftView.isVisible && binding.frontView.translationX <= 0) {
binding.leftView.isVisible = false binding.leftView.isVisible = false
binding.rightView.visible() binding.rightView.isVisible = true
} }
} }
val anim3 = slideAnimation(-slide, 0f) val anim3 = slideAnimation(-slide, 0f)

View File

@ -23,7 +23,6 @@ import eu.kanade.tachiyomi.util.system.toInt
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.setBottomEdge import eu.kanade.tachiyomi.util.view.setBottomEdge
import eu.kanade.tachiyomi.util.view.setEdgeToEdge import eu.kanade.tachiyomi.util.view.setEdgeToEdge
import eu.kanade.tachiyomi.util.view.visible
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
class MigrationBottomSheetDialog( class MigrationBottomSheetDialog(
@ -106,7 +105,7 @@ class MigrationBottomSheetDialog(
binding.extraSearchParamText.isVisible = false binding.extraSearchParamText.isVisible = false
binding.extraSearchParam.setOnCheckedChangeListener { _, isChecked -> binding.extraSearchParam.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { if (isChecked) {
binding.extraSearchParamText.visible() binding.extraSearchParamText.isVisible = true
} else { } else {
binding.extraSearchParamText.isVisible = false binding.extraSearchParamText.isVisible = false
} }

View File

@ -10,6 +10,9 @@ import coil.request.LoadRequest
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.databinding.MangaGridItemBinding
import eu.kanade.tachiyomi.databinding.MigrationProcessItemBinding
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
@ -17,11 +20,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.setVectorCompat import eu.kanade.tachiyomi.util.view.setVectorCompat
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.databinding.MangaGridItemBinding
import eu.kanade.tachiyomi.databinding.MigrationProcessItemBinding
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -62,7 +61,7 @@ class MigrationProcessHolder(
) )
) )
binding.migrationMenu.isInvisible = true binding.migrationMenu.isInvisible = true
binding.skipManga.visible() binding.skipManga.isVisible = true
binding.migrationMangaCardTo.resetManga() binding.migrationMangaCardTo.resetManga()
if (manga != null) { if (manga != null) {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@ -113,7 +112,7 @@ class MigrationProcessHolder(
binding.migrationMangaCardTo.title.text = binding.migrationMangaCardTo.title.text =
view.context.getString(R.string.no_alternatives_found) view.context.getString(R.string.no_alternatives_found)
} }
binding.migrationMenu.visible() binding.migrationMenu.isVisible = true
binding.skipManga.isVisible = false binding.skipManga.isVisible = false
adapter.sourceFinished() adapter.sourceFinished()
} }
@ -122,7 +121,7 @@ class MigrationProcessHolder(
} }
private fun MangaGridItemBinding.resetManga() { private fun MangaGridItemBinding.resetManga() {
progress.visible() progress.isVisible = true
coverThumbnail.setImageDrawable(null) coverThumbnail.setImageDrawable(null)
compactTitle.text = "" compactTitle.text = ""
title.text = "" title.text = ""
@ -141,15 +140,15 @@ class MigrationProcessHolder(
.target(CoverViewTarget(coverThumbnail, progress)).build() .target(CoverViewTarget(coverThumbnail, progress)).build()
Coil.imageLoader(view.context).execute(request) Coil.imageLoader(view.context).execute(request)
compactTitle.visible() compactTitle.isVisible = true
gradient.visible() gradient.isVisible = true
compactTitle.text = if (manga.title.isBlank()) { compactTitle.text = if (manga.title.isBlank()) {
view.context.getString(R.string.unknown) view.context.getString(R.string.unknown)
} else { } else {
manga.title manga.title
} }
gradient.visible() gradient.isVisible = true
title.text = /*if (source.id == MERGED_SOURCE_ID) { title.text = /*if (source.id == MERGED_SOURCE_ID) {
MergedSource.MangaConfig.readFromUrl(gson, manga.url).children.map { MergedSource.MangaConfig.readFromUrl(gson, manga.url).children.map {
sourceManager.getOrStub(it.source).toString() sourceManager.getOrStub(it.source).toString()

View File

@ -92,7 +92,6 @@ import eu.kanade.tachiyomi.util.view.popupMenu
import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleAnimationListener
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -246,7 +245,7 @@ class ReaderActivity :
} }
presenter.init(manga, chapter) presenter.init(manga, chapter)
} else { } else {
binding.pleaseWait.visible() binding.pleaseWait.isVisible = true
} }
} }
@ -655,7 +654,7 @@ class ReaderActivity :
} }
if (result) { if (result) {
binding.readerNav.leftChapter.isVisible = false binding.readerNav.leftChapter.isVisible = false
binding.readerNav.leftProgress.visible() binding.readerNav.leftProgress.isVisible = true
} else { } else {
toast( toast(
if (viewer is R2LPagerViewer) { if (viewer is R2LPagerViewer) {
@ -678,7 +677,7 @@ class ReaderActivity :
} }
if (result) { if (result) {
binding.readerNav.rightChapter.isVisible = false binding.readerNav.rightChapter.isVisible = false
binding.readerNav.rightProgress.visible() binding.readerNav.rightProgress.isVisible = true
} else { } else {
toast( toast(
if (viewer !is R2LPagerViewer) { if (viewer !is R2LPagerViewer) {
@ -796,7 +795,7 @@ class ReaderActivity :
if (visible) { if (visible) {
snackbar?.dismiss() snackbar?.dismiss()
systemUi?.show() systemUi?.show()
binding.readerMenu.visible() binding.readerMenu.isVisible = true
if (binding.chaptersSheet.chaptersBottomSheet.sheetBehavior.isExpanded()) { if (binding.chaptersSheet.chaptersBottomSheet.sheetBehavior.isExpanded()) {
binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.isHideable = false binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.isHideable = false
@ -915,7 +914,7 @@ class ReaderActivity :
binding.readerNav.pageSeekbar.isRTL = newViewer is R2LPagerViewer binding.readerNav.pageSeekbar.isRTL = newViewer is R2LPagerViewer
binding.pleaseWait.visible() binding.pleaseWait.isVisible = true
binding.pleaseWait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long)) binding.pleaseWait.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in_long))
invalidateOptionsMenu() invalidateOptionsMenu()
updateCropBordersShortcut() updateCropBordersShortcut()
@ -1008,8 +1007,8 @@ class ReaderActivity :
*/ */
fun setProgressDialog(show: Boolean) { fun setProgressDialog(show: Boolean) {
if (!show) { if (!show) {
binding.readerNav.leftChapter.visible() binding.readerNav.leftChapter.isVisible = true
binding.readerNav.rightChapter.visible() binding.readerNav.rightChapter.isVisible = true
binding.readerNav.leftProgress.isVisible = false binding.readerNav.leftProgress.isVisible = false
binding.readerNav.rightProgress.isVisible = false binding.readerNav.rightProgress.isVisible = false
@ -1305,7 +1304,7 @@ class ReaderActivity :
} }
if (sheetManageNavColor) window.navigationBarColor = if (sheetManageNavColor) window.navigationBarColor =
getResourceColor(R.attr.colorSecondary) getResourceColor(R.attr.colorSecondary)
binding.readerMenu.visible() binding.readerMenu.isVisible = true
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top) val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
toolbarAnimation.setAnimationListener( toolbarAnimation.setAnimationListener(
object : SimpleAnimationListener() { object : SimpleAnimationListener() {
@ -1537,7 +1536,7 @@ class ReaderActivity :
// Set black overlay visibility. // Set black overlay visibility.
if (value < 0) { if (value < 0) {
binding.brightnessOverlay.visible() binding.brightnessOverlay.isVisible = true
val alpha = (abs(value) * 2.56).toInt() val alpha = (abs(value) * 2.56).toInt()
binding.brightnessOverlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0)) binding.brightnessOverlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
} else { } else {
@ -1549,7 +1548,7 @@ class ReaderActivity :
* Sets the color filter [value]. * Sets the color filter [value].
*/ */
private fun setColorFilterValue(value: Int) { private fun setColorFilterValue(value: Int) {
binding.colorOverlay.visible() binding.colorOverlay.isVisible = true
binding.colorOverlay.setFilterColor(value, preferences.colorFilterMode().get()) binding.colorOverlay.setFilterColor(value, preferences.colorFilterMode().get())
} }
} }

View File

@ -26,7 +26,6 @@ import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.expand
import eu.kanade.tachiyomi.util.view.isCollapsed import eu.kanade.tachiyomi.util.view.isCollapsed
import eu.kanade.tachiyomi.util.view.isExpanded import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.visible
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
@ -93,11 +92,11 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
adapter?.getPosition(presenter.getCurrentChapter()?.chapter?.id ?: 0L) ?: 0, adapter?.getPosition(presenter.getCurrentChapter()?.chapter?.id ?: 0L) ?: 0,
binding.chapterRecycler.height / 2 - 30.dpToPx binding.chapterRecycler.height / 2 - 30.dpToPx
) )
activity.binding.readerNav.root.visible() activity.binding.readerNav.root.isVisible = true
activity.binding.readerNav.root.alpha = 1f activity.binding.readerNav.root.alpha = 1f
} }
if (state == BottomSheetBehavior.STATE_DRAGGING || state == BottomSheetBehavior.STATE_SETTLING) { if (state == BottomSheetBehavior.STATE_DRAGGING || state == BottomSheetBehavior.STATE_SETTLING) {
activity.binding.readerNav.root.visible() activity.binding.readerNav.root.isVisible = true
} }
if (state == BottomSheetBehavior.STATE_EXPANDED) { if (state == BottomSheetBehavior.STATE_EXPANDED) {
activity.binding.readerNav.root.isInvisible = true activity.binding.readerNav.root.isInvisible = true
@ -129,7 +128,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
loadingPos = position loadingPos = position
val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(position) as? ReaderChapterItem.ViewHolder)?.binding val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(position) as? ReaderChapterItem.ViewHolder)?.binding
itemView?.bookmarkImage?.isVisible = false itemView?.bookmarkImage?.isVisible = false
itemView?.progress?.visible() itemView?.progress?.isVisible = true
} }
true true
} }
@ -169,7 +168,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
fun resetChapter() { fun resetChapter() {
val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(loadingPos) as? ReaderChapterItem.ViewHolder)?.binding val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(loadingPos) as? ReaderChapterItem.ViewHolder)?.binding
itemView?.bookmarkImage?.visible() itemView?.bookmarkImage?.isVisible = true
itemView?.progress?.isVisible = false itemView?.progress?.isVisible = false
} }

View File

@ -5,6 +5,7 @@ import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -15,7 +16,6 @@ import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.collapse import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.expand
import eu.kanade.tachiyomi.util.view.isCollapsed import eu.kanade.tachiyomi.util.view.isCollapsed
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
class TabbedReaderSettingsSheet( class TabbedReaderSettingsSheet(
@ -76,7 +76,7 @@ class TabbedReaderSettingsSheet(
} }
} }
binding.menu.visible() binding.menu.isVisible = true
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
binding.menu.tooltipText = context.getString(R.string.reader_settings) binding.menu.tooltipText = context.getString(R.string.reader_settings)
} }
@ -131,7 +131,7 @@ class TabbedReaderSettingsSheet(
override fun dismiss() { override fun dismiss() {
super.dismiss() super.dismiss()
readerActivity.binding.appBar.visible() readerActivity.binding.appBar.isVisible = true
} }
fun updateTabs(isWebtoon: Boolean) { fun updateTabs(isWebtoon: Boolean) {

View File

@ -39,7 +39,6 @@ import eu.kanade.tachiyomi.util.system.ThemeUtil
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.isInNightMode import eu.kanade.tachiyomi.util.system.isInNightMode
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.GifViewTarget import eu.kanade.tachiyomi.widget.GifViewTarget
import eu.kanade.tachiyomi.widget.ViewPagerAdapter import eu.kanade.tachiyomi.widget.ViewPagerAdapter
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -302,7 +301,7 @@ class PagerPageHolder(
* Called when the page is queued. * Called when the page is queued.
*/ */
private fun setQueued() { private fun setQueued() {
progressBar.visible() progressBar.isVisible = true
retryButton?.isVisible = false retryButton?.isVisible = false
decodeErrorLayout?.isVisible = false decodeErrorLayout?.isVisible = false
} }
@ -311,7 +310,7 @@ class PagerPageHolder(
* Called when the page is loading. * Called when the page is loading.
*/ */
private fun setLoading() { private fun setLoading() {
progressBar.visible() progressBar.isVisible = true
retryButton?.isVisible = false retryButton?.isVisible = false
decodeErrorLayout?.isVisible = false decodeErrorLayout?.isVisible = false
} }
@ -320,7 +319,7 @@ class PagerPageHolder(
* Called when the page is downloading. * Called when the page is downloading.
*/ */
private fun setDownloading() { private fun setDownloading() {
progressBar.visible() progressBar.isVisible = true
retryButton?.isVisible = false retryButton?.isVisible = false
decodeErrorLayout?.isVisible = false decodeErrorLayout?.isVisible = false
} }
@ -329,7 +328,7 @@ class PagerPageHolder(
* Called when the page is ready. * Called when the page is ready.
*/ */
private fun setImage() { private fun setImage() {
progressBar.visible() progressBar.isVisible = true
if (extraPage == null) { if (extraPage == null) {
progressBar.completeAndFadeOut() progressBar.completeAndFadeOut()
} else { } else {
@ -432,7 +431,7 @@ class PagerPageHolder(
*/ */
private fun setError() { private fun setError() {
progressBar.isVisible = false progressBar.isVisible = false
initRetryButton().visible() initRetryButton().isVisible = true
} }
/** /**
@ -447,7 +446,7 @@ class PagerPageHolder(
*/ */
private fun onImageDecodeError() { private fun onImageDecodeError() {
progressBar.isVisible = false progressBar.isVisible = false
initDecodeErrorLayout().visible() initDecodeErrorLayout().isVisible = true
} }
/** /**

View File

@ -15,7 +15,6 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.coroutines.MainScope import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import timber.log.Timber import timber.log.Timber
@ -266,7 +265,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
Timber.d("Pager first layout") Timber.d("Pager first layout")
val pages = chapters.currChapter.pages ?: return val pages = chapters.currChapter.pages ?: return
moveToPage(pages[chapters.currChapter.requestedPage]) moveToPage(pages[chapters.currChapter.requestedPage])
pager.visible() pager.isVisible = true
} }
activity.invalidateOptionsMenu() activity.invalidateOptionsMenu()
} }

View File

@ -28,7 +28,6 @@ import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.GifViewTarget import eu.kanade.tachiyomi.widget.GifViewTarget
import rx.Observable import rx.Observable
import rx.Subscription import rx.Subscription
@ -236,8 +235,8 @@ class WebtoonPageHolder(
* Called when the page is queued. * Called when the page is queued.
*/ */
private fun setQueued() { private fun setQueued() {
progressContainer.visible() progressContainer.isVisible = true
progressBar.visible() progressBar.isVisible = true
retryContainer?.isVisible = false retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -246,8 +245,8 @@ class WebtoonPageHolder(
* Called when the page is loading. * Called when the page is loading.
*/ */
private fun setLoading() { private fun setLoading() {
progressContainer.visible() progressContainer.isVisible = true
progressBar.visible() progressBar.isVisible = true
retryContainer?.isVisible = false retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -256,8 +255,8 @@ class WebtoonPageHolder(
* Called when the page is downloading * Called when the page is downloading
*/ */
private fun setDownloading() { private fun setDownloading() {
progressContainer.visible() progressContainer.isVisible = true
progressBar.visible() progressBar.isVisible = true
retryContainer?.isVisible = false retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -266,8 +265,8 @@ class WebtoonPageHolder(
* Called when the page is ready. * Called when the page is ready.
*/ */
private fun setImage() { private fun setImage() {
progressContainer.visible() progressContainer.isVisible = true
progressBar.visible() progressBar.isVisible = true
progressBar.completeAndFadeOut() progressBar.completeAndFadeOut()
retryContainer?.isVisible = false retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
@ -288,11 +287,11 @@ class WebtoonPageHolder(
.doOnNext { isAnimated -> .doOnNext { isAnimated ->
if (!isAnimated) { if (!isAnimated) {
val subsamplingView = initSubsamplingImageView() val subsamplingView = initSubsamplingImageView()
subsamplingView.visible() subsamplingView.isVisible = true
subsamplingView.setImage(ImageSource.inputStream(openStream!!)) subsamplingView.setImage(ImageSource.inputStream(openStream!!))
} else { } else {
val imageView = initImageView() val imageView = initImageView()
imageView.visible() imageView.isVisible = true
imageView.setImage(openStream!!) imageView.setImage(openStream!!)
} }
} }
@ -309,7 +308,7 @@ class WebtoonPageHolder(
*/ */
private fun setError() { private fun setError() {
progressContainer.isVisible = false progressContainer.isVisible = false
initRetryLayout().visible() initRetryLayout().isVisible = true
} }
/** /**
@ -324,7 +323,7 @@ class WebtoonPageHolder(
*/ */
private fun onImageDecodeError() { private fun onImageDecodeError() {
progressContainer.isVisible = false progressContainer.isVisible = false
initDecodeErrorLayout().visible() initDecodeErrorLayout().isVisible = true
} }
/** /**

View File

@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.source.icon
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.compatToolTipText import eu.kanade.tachiyomi.util.view.compatToolTipText
import eu.kanade.tachiyomi.util.view.visible
class SourceHolder(view: View, val adapter: SourceAdapter) : class SourceHolder(view: View, val adapter: SourceAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
@ -58,7 +57,7 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
} }
if (source.supportsLatest) { if (source.supportsLatest) {
binding.sourceLatest.visible() binding.sourceLatest.isVisible = true
} else { } else {
binding.sourceLatest.isVisible = false binding.sourceLatest.isVisible = false
} }

View File

@ -40,7 +40,6 @@ import eu.kanade.tachiyomi.util.view.scrollViewWith
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.AutofitRecyclerView import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import eu.kanade.tachiyomi.widget.EmptyView import eu.kanade.tachiyomi.widget.EmptyView
@ -129,7 +128,7 @@ open class BrowseSourceController(bundle: Bundle) :
binding.fab.isVisible = presenter.sourceFilters.isNotEmpty() binding.fab.isVisible = presenter.sourceFilters.isNotEmpty()
binding.fab.setOnClickListener { showFilters() } binding.fab.setOnClickListener { showFilters() }
binding.progress.visible() binding.progress.isVisible = true
} }
override fun onDestroyView(view: View) { override fun onDestroyView(view: View) {
@ -528,7 +527,7 @@ open class BrowseSourceController(bundle: Bundle) :
*/ */
private fun showProgressBar() { private fun showProgressBar() {
binding.emptyView.isVisible = false binding.emptyView.isVisible = false
binding.progress.visible() binding.progress.isVisible = true
snack?.dismiss() snack?.dismiss()
snack = null snack = null
} }

View File

@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.migration.SearchController import eu.kanade.tachiyomi.ui.migration.SearchController
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.view.visible
/** /**
* Holder that binds the [GlobalSearchItem] containing catalogue cards. * Holder that binds the [GlobalSearchItem] containing catalogue cards.
@ -63,12 +62,12 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
when { when {
results == null -> { results == null -> {
binding.progress.visible() binding.progress.isVisible = true
showHolder() showHolder()
} }
results.isEmpty() -> { results.isEmpty() -> {
binding.progress.isVisible = false binding.progress.isVisible = false
binding.noResults.visible() binding.noResults.isVisible = true
binding.sourceCard.isVisible = false binding.sourceCard.isVisible = false
} }
else -> { else -> {
@ -109,7 +108,7 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
} }
private fun showHolder() { private fun showHolder() {
binding.sourceCard.visible() binding.sourceCard.isVisible = true
binding.noResults.isVisible = false binding.noResults.isVisible = false
} }
} }

View File

@ -12,6 +12,7 @@ import android.webkit.WebView
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.WebviewActivityBinding import eu.kanade.tachiyomi.databinding.WebviewActivityBinding
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
@ -23,7 +24,6 @@ import eu.kanade.tachiyomi.util.view.marginBottom
import eu.kanade.tachiyomi.util.view.setStyle import eu.kanade.tachiyomi.util.view.setStyle
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePadding import eu.kanade.tachiyomi.util.view.updatePadding
import eu.kanade.tachiyomi.util.view.visible
open class BaseWebViewActivity : BaseActivity<WebviewActivityBinding>() { open class BaseWebViewActivity : BaseActivity<WebviewActivityBinding>() {
@ -111,7 +111,7 @@ open class BaseWebViewActivity : BaseActivity<WebviewActivityBinding>() {
binding.webview.webChromeClient = object : WebChromeClient() { binding.webview.webChromeClient = object : WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) { override fun onProgressChanged(view: WebView?, newProgress: Int) {
binding.progressBar.visible() binding.progressBar.isVisible = true
binding.progressBar.progress = newProgress binding.progressBar.progress = newProgress
if (newProgress == 100) { if (newProgress == 100) {
binding.progressBar.isInvisible = true binding.progressBar.isInvisible = true

View File

@ -102,10 +102,6 @@ fun Snackbar.getText(): CharSequence {
return textView.text return textView.text
} }
inline fun View.visible() {
visibility = View.VISIBLE
}
inline val View.marginTop: Int inline val View.marginTop: Int
get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0 get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.CommonViewEmptyBinding import eu.kanade.tachiyomi.databinding.CommonViewEmptyBinding
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.setVectorCompat import eu.kanade.tachiyomi.util.view.setVectorCompat
import eu.kanade.tachiyomi.util.view.visible
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
RelativeLayout(context, attrs) { RelativeLayout(context, attrs) {
@ -62,7 +61,7 @@ class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
} }
} }
this.visible() this.isVisible = true
} }
data class Action( data class Action(

View File

@ -6,13 +6,12 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import coil.target.ImageViewTarget import coil.target.ImageViewTarget
import eu.kanade.tachiyomi.util.view.visible
class GifViewTarget(view: ImageView, private val progressBar: View?, private val decodeErrorLayout: ViewGroup?) : ImageViewTarget(view) { class GifViewTarget(view: ImageView, private val progressBar: View?, private val decodeErrorLayout: ViewGroup?) : ImageViewTarget(view) {
override fun onError(error: Drawable?) { override fun onError(error: Drawable?) {
progressBar?.isVisible = false progressBar?.isVisible = false
decodeErrorLayout?.visible() decodeErrorLayout?.isVisible = true
} }
override fun onSuccess(result: Drawable) { override fun onSuccess(result: Drawable) {