remove gone helper

This commit is contained in:
Jays2Kings 2021-04-26 02:19:45 -04:00
parent fa4de0990f
commit 5d2e0ebbe7
31 changed files with 131 additions and 151 deletions

View File

@ -8,7 +8,6 @@ import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import coil.target.ImageViewTarget import coil.target.ImageViewTarget
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
class CoverViewTarget( class CoverViewTarget(
view: ImageView, view: ImageView,
@ -17,7 +16,7 @@ class CoverViewTarget(
) : ImageViewTarget(view) { ) : ImageViewTarget(view) {
override fun onError(error: Drawable?) { override fun onError(error: Drawable?) {
progress?.gone() progress?.isVisible = false
view.scaleType = ImageView.ScaleType.CENTER view.scaleType = ImageView.ScaleType.CENTER
val vector = VectorDrawableCompat.create( val vector = VectorDrawableCompat.create(
view.context.resources, view.context.resources,
@ -35,7 +34,7 @@ class CoverViewTarget(
} }
override fun onSuccess(result: Drawable) { override fun onSuccess(result: Drawable) {
progress?.gone() progress?.isVisible = false
view.scaleType = scaleType view.scaleType = scaleType
super.onSuccess(result) super.onSuccess(result)
} }

View File

@ -8,13 +8,13 @@ import android.view.WindowManager
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Category
import eu.kanade.tachiyomi.databinding.CategoriesItemBinding 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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
/** /**
@ -57,7 +57,7 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie
R.drawable R.drawable
.ic_add_24dp .ic_add_24dp
) )
binding.image.gone() binding.image.isVisible = false
binding.editButton.setImageDrawable(null) binding.editButton.setImageDrawable(null)
binding.editText.setText("") binding.editText.setText("")
binding.editText.hint = binding.title.text binding.editText.hint = 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.gone
import eu.kanade.tachiyomi.util.view.visible 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
@ -120,9 +119,9 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
fun onViewCreated() { fun onViewCreated() {
if (category?.id ?: 0 <= 0 && category != null) { if (category?.id ?: 0 <= 0 && category != null) {
binding.title.gone() binding.title.isVisible = false
binding.downloadNew.gone() binding.downloadNew.isVisible = false
binding.includeGlobal.gone() binding.includeGlobal.isVisible = false
return return
} }
binding.editCategories.isVisible = category != null binding.editCategories.isVisible = category != null
@ -142,7 +141,7 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
true true
) )
if (downloadNew && preferences.downloadNewCategories().get().isEmpty()) { if (downloadNew && preferences.downloadNewCategories().get().isEmpty()) {
binding.downloadNew.gone() binding.downloadNew.isVisible = false
} else if (!downloadNew) { } else if (!downloadNew) {
binding.downloadNew.visible() binding.downloadNew.visible()
} }

View File

@ -8,12 +8,12 @@ import android.util.AttributeSet
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.core.view.isVisible
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
import eu.kanade.tachiyomi.R 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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.EndAnimatorListener import eu.kanade.tachiyomi.widget.EndAnimatorListener
@ -89,24 +89,24 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
) )
when (state) { when (state) {
Download.CHECKED -> { Download.CHECKED -> {
binding.downloadProgress.gone() binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone() 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.visible()
binding.downloadProgress.gone() binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.gone() binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadBorder.drawable.setTint(activeColor) binding.downloadBorder.drawable.setTint(activeColor)
binding.downloadIcon.drawable.setTint(activeColor) binding.downloadIcon.drawable.setTint(activeColor)
} }
Download.QUEUE -> { Download.QUEUE -> {
binding.downloadBorder.gone() binding.downloadBorder.isVisible = false
binding.downloadProgress.gone() binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.visible() binding.downloadProgressIndeterminate.visible()
binding.downloadProgress.isIndeterminate = true binding.downloadProgress.isIndeterminate = true
binding.downloadIcon.drawable.setTint(disabledColor) binding.downloadIcon.drawable.setTint(disabledColor)
@ -114,7 +114,7 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
Download.DOWNLOADING -> { Download.DOWNLOADING -> {
binding.downloadBorder.visible() binding.downloadBorder.visible()
binding.downloadProgress.visible() binding.downloadProgress.visible()
binding.downloadProgressIndeterminate.gone() binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadProgress.isIndeterminate = false binding.downloadProgress.isIndeterminate = false
binding.downloadProgress.progress = progress binding.downloadProgress.progress = progress
@ -132,9 +132,9 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
} }
} }
Download.DOWNLOADED -> { Download.DOWNLOADED -> {
binding.downloadProgress.gone() binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone() binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.drawable.setTint(downloadedColor) binding.downloadBorder.drawable.setTint(downloadedColor)
if (animated) { if (animated) {
binding.downloadBorder.setImageDrawable(filledAnim) binding.downloadBorder.setImageDrawable(filledAnim)
@ -159,9 +159,9 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
} }
} }
Download.ERROR -> { Download.ERROR -> {
binding.downloadProgress.gone() binding.downloadProgress.isVisible = false
binding.downloadBorder.visible() binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone() binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle) binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadBorder.drawable.setTint(errorColor) binding.downloadBorder.drawable.setTint(errorColor)
binding.downloadIcon.drawable.setTint(errorColor) binding.downloadIcon.drawable.setTint(errorColor)

View File

@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.contextCompatColor import eu.kanade.tachiyomi.util.system.contextCompatColor
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.gone
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -87,7 +86,7 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
fun setInLibrary(inLibrary: Boolean) { fun setInLibrary(inLibrary: Boolean) {
this.isVisible = inLibrary this.isVisible = inLibrary
binding.unreadAngle.gone() binding.unreadAngle.isVisible = false
binding.unreadText.updatePaddingRelative(start = 5.dpToPx) binding.unreadText.updatePaddingRelative(start = 5.dpToPx)
binding.unreadText.isVisible = inLibrary binding.unreadText.isVisible = inLibrary
binding.unreadText.text = resources.getText(R.string.in_library) binding.unreadText.text = resources.getText(R.string.in_library)

View File

@ -87,7 +87,6 @@ import eu.kanade.tachiyomi.util.view.activityBinding
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.getItemView import eu.kanade.tachiyomi.util.view.getItemView
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.hide import eu.kanade.tachiyomi.util.view.hide
import eu.kanade.tachiyomi.util.view.isExpanded import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.isHidden import eu.kanade.tachiyomi.util.view.isHidden
@ -508,7 +507,7 @@ class LibraryController(
} }
}, },
onLeavingController = { onLeavingController = {
binding.headerCard.gone() binding.headerCard.isVisible = false
}, },
onBottomNavUpdate = { onBottomNavUpdate = {
updateFilterSheetY() updateFilterSheetY()
@ -599,7 +598,7 @@ class LibraryController(
@SuppressLint("RtlHardcoded", "ClickableViewAccessibility") @SuppressLint("RtlHardcoded", "ClickableViewAccessibility")
private fun setUpHopper() { private fun setUpHopper() {
binding.categoryHopperFrame.gone() binding.categoryHopperFrame.isVisible = false
binding.roundedCategoryHopper.downCategory.setOnClickListener { binding.roundedCategoryHopper.downCategory.setOnClickListener {
jumpToNextCategory(true) jumpToNextCategory(true)
} }
@ -922,7 +921,7 @@ class LibraryController(
} }
singleCategory = presenter.categories.size <= 1 singleCategory = presenter.categories.size <= 1
showDropdown() showDropdown()
binding.progress.gone() binding.progress.isVisible = false
if (!freshStart) { if (!freshStart) {
justStarted = false justStarted = false
if (binding.recyclerLayout.alpha == 0f) binding.recyclerLayout.animate().alpha(1f).setDuration( if (binding.recyclerLayout.alpha == 0f) binding.recyclerLayout.animate().alpha(1f).setDuration(

View File

@ -11,7 +11,6 @@ import coil.size.Scale
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga
import eu.kanade.tachiyomi.databinding.MangaGridItemBinding import eu.kanade.tachiyomi.databinding.MangaGridItemBinding
import eu.kanade.tachiyomi.util.view.gone
/** /**
* Class used to hold the displayed data of a manga in the library, like the cover or the title. * Class used to hold the displayed data of a manga in the library, like the cover or the title.
@ -34,10 +33,10 @@ class LibraryGridHolder(
init { init {
binding.playLayout.setOnClickListener { playButtonClicked() } binding.playLayout.setOnClickListener { playButtonClicked() }
if (compact) { if (compact) {
binding.textLayout.gone() binding.textLayout.isVisible = false
} else { } else {
binding.compactTitle.gone() binding.compactTitle.isVisible = false
binding.gradient.gone() binding.gradient.isVisible = false
val playLayout = binding.playLayout.layoutParams as FrameLayout.LayoutParams val playLayout = binding.playLayout.layoutParams as FrameLayout.LayoutParams
val buttonLayout = binding.playButton.layoutParams as FrameLayout.LayoutParams val buttonLayout = binding.playButton.layoutParams as FrameLayout.LayoutParams
playLayout.gravity = Gravity.BOTTOM or Gravity.END playLayout.gravity = Gravity.BOTTOM or Gravity.END

View File

@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder 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.gone
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.visible
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -108,26 +107,26 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
adapter.mode == SelectableAdapter.Mode.MULTI -> { adapter.mode == SelectableAdapter.Mode.MULTI -> {
binding.checkbox.isVisible = !category.isHidden binding.checkbox.isVisible = !category.isHidden
binding.collapseArrow.isVisible = category.isHidden && !adapter.isSingleCategory binding.collapseArrow.isVisible = category.isHidden && !adapter.isSingleCategory
binding.updateButton.gone() binding.updateButton.isVisible = false
binding.catProgress.gone() binding.catProgress.isVisible = false
setSelection() setSelection()
} }
category.id ?: -1 < 0 -> { category.id ?: -1 < 0 -> {
binding.collapseArrow.gone() binding.collapseArrow.isVisible = false
binding.checkbox.gone() binding.checkbox.isVisible = false
binding.catProgress.gone() binding.catProgress.isVisible = false
binding.updateButton.gone() binding.updateButton.isVisible = false
} }
LibraryUpdateService.categoryInQueue(category.id) -> { LibraryUpdateService.categoryInQueue(category.id) -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.checkbox.gone() binding.checkbox.isVisible = false
binding.catProgress.isVisible = true binding.catProgress.isVisible = true
binding.updateButton.isInvisible = true binding.updateButton.isInvisible = true
} }
else -> { else -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.catProgress.gone() binding.catProgress.isVisible = false
binding.checkbox.gone() binding.checkbox.isVisible = false
binding.updateButton.isVisible = !adapter.isSingleCategory binding.updateButton.isVisible = !adapter.isSingleCategory
} }
} }

View File

@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga 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.gone
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.visible
@ -44,15 +43,15 @@ class LibraryListHolder(
} }
if (item.manga.status == -1) { if (item.manga.status == -1) {
binding.title.text = null binding.title.text = null
binding.title.gone() binding.title.isVisible = false
} else { } else {
binding.title.text = itemView.context.getString(R.string.category_is_empty) binding.title.text = itemView.context.getString(R.string.category_is_empty)
} }
binding.title.textAlignment = View.TEXT_ALIGNMENT_CENTER binding.title.textAlignment = View.TEXT_ALIGNMENT_CENTER
binding.card.gone() binding.card.isVisible = false
binding.unreadDownloadBadge.badgeView.gone() binding.unreadDownloadBadge.badgeView.isVisible = false
binding.padding.gone() binding.padding.isVisible = false
binding.subtitle.gone() binding.subtitle.isVisible = false
return return
} }
binding.constraintLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.constraintLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {

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.gone
import eu.kanade.tachiyomi.util.view.visible 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
@ -147,8 +146,8 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute
} else { } else {
mainButton.isActivated = true mainButton.isActivated = true
listener?.onFilterClicked(this, index, callBack) listener?.onFilterClicked(this, index, callBack)
buttons.forEach { if (it != mainButton) it.gone() } buttons.forEach { if (it != mainButton) it.isVisible = false }
separators.forEach { it.gone() } separators.forEach { it.isVisible = false }
} }
mainButton.setTextColor( mainButton.setTextColor(
context.getResourceColor( context.getResourceColor(

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.library.filter package eu.kanade.tachiyomi.ui.library.filter
import android.view.View import android.view.View
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
@ -8,7 +9,6 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.CategoriesItemBinding 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.util.view.gone
/** /**
* Category item for a recycler view. * Category item for a recycler view.
@ -76,8 +76,8 @@ class ManageFilterItem(val char: Char) : AbstractFlexibleItem<ManageFilterItem.H
private val binding = CategoriesItemBinding.bind(view) private val binding = CategoriesItemBinding.bind(view)
init { init {
binding.image.gone() binding.image.isVisible = false
binding.editButton.gone() binding.editButton.isVisible = false
binding.editText.isEnabled = false binding.editText.isEnabled = false
setDragHandleView(binding.reorder) setDragHandleView(binding.reorder)
} }

View File

@ -71,7 +71,6 @@ import eu.kanade.tachiyomi.util.system.isBottomTappable
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.getItemView import eu.kanade.tachiyomi.util.view.getItemView
import eu.kanade.tachiyomi.util.view.gone
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.updatePadding import eu.kanade.tachiyomi.util.view.updatePadding
@ -232,7 +231,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
supportActionBar?.setDisplayShowCustomEnabled(true) supportActionBar?.setDisplayShowCustomEnabled(true)
setNavBarColor(content.rootWindowInsets) setNavBarColor(content.rootWindowInsets)
binding.bottomView.gone() binding.bottomView.isVisible = false
content.doOnApplyWindowInsets { v, insets, _ -> content.doOnApplyWindowInsets { v, insets, _ ->
setNavBarColor(insets) setNavBarColor(insets)
val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar) val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar)

View File

@ -4,6 +4,7 @@ import android.app.SearchManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.core.view.isVisible
import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Controller
import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
@ -17,7 +18,6 @@ import eu.kanade.tachiyomi.ui.setting.SettingsController
import eu.kanade.tachiyomi.ui.setting.SettingsReaderController import eu.kanade.tachiyomi.ui.setting.SettingsReaderController
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
class SearchActivity : MainActivity() { class SearchActivity : MainActivity() {
@ -68,8 +68,8 @@ class SearchActivity : MainActivity() {
binding.toolbar.navigationIcon = drawerArrow binding.toolbar.navigationIcon = drawerArrow
drawerArrow?.progress = 1f drawerArrow?.progress = 1f
binding.bottomNav.gone() binding.bottomNav.isVisible = false
binding.bottomView.gone() binding.bottomView.isVisible = false
} }
override fun handleIntentAction(intent: Intent): Boolean { override fun handleIntentAction(intent: Intent): Boolean {

View File

@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.source.model.SManga
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.system.isLTR import eu.kanade.tachiyomi.util.system.isLTR
import eu.kanade.tachiyomi.util.view.gone
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 import eu.kanade.tachiyomi.util.view.visible
@ -110,7 +109,7 @@ class MangaHeaderHolder(
binding.mangaSummary.setTextIsSelectable(true) binding.mangaSummary.setTextIsSelectable(true)
binding.mangaGenresTags.visible() binding.mangaGenresTags.visible()
binding.lessButton.visible() binding.lessButton.visible()
binding.moreButtonGroup.gone() binding.moreButtonGroup.isVisible = false
binding.title.maxLines = Integer.MAX_VALUE binding.title.maxLines = Integer.MAX_VALUE
} }
} }
@ -119,8 +118,8 @@ class MangaHeaderHolder(
binding.mangaSummary.setTextIsSelectable(false) binding.mangaSummary.setTextIsSelectable(false)
binding.mangaSummary.isClickable = true binding.mangaSummary.isClickable = true
binding.mangaSummary.maxLines = 3 binding.mangaSummary.maxLines = 3
binding.mangaGenresTags.gone() binding.mangaGenresTags.isVisible = false
binding.lessButton.gone() binding.lessButton.isVisible = false
binding.moreButtonGroup.visible() binding.moreButtonGroup.visible()
binding.title.maxLines = 4 binding.title.maxLines = 4
adapter.recyclerView.post { adapter.recyclerView.post {
@ -159,7 +158,7 @@ class MangaHeaderHolder(
if (binding.subItemGroup.visibility != View.GONE) { if (binding.subItemGroup.visibility != View.GONE) {
if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) { if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) {
binding.mangaSummary.setTextIsSelectable(true) binding.mangaSummary.setTextIsSelectable(true)
binding.moreButtonGroup.gone() binding.moreButtonGroup.isVisible = false
showMoreButton = binding.lessButton.isVisible showMoreButton = binding.lessButton.isVisible
} else { } else {
binding.moreButtonGroup.visible() binding.moreButtonGroup.visible()
@ -258,8 +257,8 @@ class MangaHeaderHolder(
binding.filtersText.text = presenter.currentFilters() binding.filtersText.text = presenter.currentFilters()
if (manga.source == LocalSource.ID) { if (manga.source == LocalSource.ID) {
binding.webviewButton.gone() binding.webviewButton.isVisible = false
binding.shareButton.gone() binding.shareButton.isVisible = false
} }
if (!manga.initialized) return if (!manga.initialized) return
@ -311,13 +310,13 @@ class MangaHeaderHolder(
} }
fun collapse() { fun collapse() {
binding.subItemGroup.gone() binding.subItemGroup.isVisible = false
binding.startReadingButton.gone() binding.startReadingButton.isVisible = false
if (binding.moreButton.isVisible || binding.moreButton.isInvisible) { if (binding.moreButton.isVisible || binding.moreButton.isInvisible) {
binding.moreButtonGroup.isInvisible = true binding.moreButtonGroup.isInvisible = true
} else { } else {
binding.lessButton.gone() binding.lessButton.isVisible = false
binding.mangaGenresTags.gone() binding.mangaGenresTags.isVisible = false
} }
} }
@ -344,7 +343,7 @@ class MangaHeaderHolder(
fun expand() { fun expand() {
binding.subItemGroup.visible() binding.subItemGroup.visible()
if (!showMoreButton) binding.moreButtonGroup.gone() 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.visible()
else { else {

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.gone
import eu.kanade.tachiyomi.util.view.visible 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
@ -115,7 +114,7 @@ class ChapterHolder(
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.gone() binding.leftView.isVisible = false
binding.rightView.visible() binding.rightView.visible()
} }
} }
@ -153,7 +152,7 @@ class ChapterHolder(
fun notifyStatus(status: Int, locked: Boolean, progress: Int, animated: Boolean = false) = with(binding.downloadButton.downloadButton) { fun notifyStatus(status: Int, locked: Boolean, progress: Int, animated: Boolean = false) = with(binding.downloadButton.downloadButton) {
if (locked) { if (locked) {
gone() isVisible = false
return return
} }
isVisible = !localSource isVisible = !localSource

View File

@ -4,12 +4,12 @@ import android.content.Context
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import androidx.core.view.isVisible
import coil.api.clear import coil.api.clear
import coil.api.load import coil.api.load
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.inflate
import java.util.ArrayList import java.util.ArrayList
import java.util.Locale import java.util.Locale
@ -53,22 +53,22 @@ class TrackSearchAdapter(context: Context) :
} }
if (track.publishing_status.isBlank()) { if (track.publishing_status.isBlank()) {
binding.trackSearchStatus.gone() binding.trackSearchStatus.isVisible = false
binding.trackSearchStatusResult.gone() binding.trackSearchStatusResult.isVisible = false
} else { } else {
binding.trackSearchStatusResult.text = track.publishing_status.capitalize(Locale.ROOT) binding.trackSearchStatusResult.text = track.publishing_status.capitalize(Locale.ROOT)
} }
if (track.publishing_type.isBlank()) { if (track.publishing_type.isBlank()) {
binding.trackSearchType.gone() binding.trackSearchType.isVisible = false
binding.trackSearchTypeResult.gone() binding.trackSearchTypeResult.isVisible = false
} else { } else {
binding.trackSearchTypeResult.text = track.publishing_type.capitalize(Locale.ROOT) binding.trackSearchTypeResult.text = track.publishing_type.capitalize(Locale.ROOT)
} }
if (track.start_date.isBlank()) { if (track.start_date.isBlank()) {
binding.trackSearchStart.gone() binding.trackSearchStart.isVisible = false
binding.trackSearchStartResult.gone() binding.trackSearchStartResult.isVisible = false
} else { } else {
binding.trackSearchStartResult.text = track.start_date binding.trackSearchStartResult.text = track.start_date
} }

View File

@ -9,6 +9,7 @@ import android.widget.RadioButton
import android.widget.RadioGroup import android.widget.RadioGroup
import android.widget.Toast import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible
import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Controller
import com.f2prateek.rx.preferences.Preference import com.f2prateek.rx.preferences.Preference
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
@ -20,7 +21,6 @@ import eu.kanade.tachiyomi.ui.migration.MigrationFlags
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.toInt 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.gone
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 eu.kanade.tachiyomi.util.view.visible
@ -103,12 +103,12 @@ class MigrationBottomSheetDialog(
binding.migCategories.setOnCheckedChangeListener { _, _ -> setFlags() } binding.migCategories.setOnCheckedChangeListener { _, _ -> setFlags() }
binding.migTracking.setOnCheckedChangeListener { _, _ -> setFlags() } binding.migTracking.setOnCheckedChangeListener { _, _ -> setFlags() }
binding.extraSearchParamText.gone() binding.extraSearchParamText.isVisible = false
binding.extraSearchParam.setOnCheckedChangeListener { _, isChecked -> binding.extraSearchParam.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { if (isChecked) {
binding.extraSearchParamText.visible() binding.extraSearchParamText.visible()
} else { } else {
binding.extraSearchParamText.gone() binding.extraSearchParamText.isVisible = false
} }
} }
binding.sourceGroup.bindToPreference(preferences.useSourceWithMost()) binding.sourceGroup.bindToPreference(preferences.useSourceWithMost())

View File

@ -4,6 +4,7 @@ import android.view.View
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import coil.Coil import coil.Coil
import coil.request.LoadRequest import coil.request.LoadRequest
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -15,7 +16,6 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController 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.gone
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.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
@ -109,12 +109,12 @@ class MigrationProcessHolder(
) )
} }
} else { } else {
binding.migrationMangaCardTo.progress.gone() binding.migrationMangaCardTo.progress.isVisible = false
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.visible()
binding.skipManga.gone() binding.skipManga.isVisible = false
adapter.sourceFinished() adapter.sourceFinished()
} }
} }
@ -135,7 +135,7 @@ class MigrationProcessHolder(
private fun MangaGridItemBinding.attachManga(manga: Manga, source: Source, isTo: Boolean) { private fun MangaGridItemBinding.attachManga(manga: Manga, source: Source, isTo: Boolean) {
(root.layoutParams as ConstraintLayout.LayoutParams).verticalBias = 1f (root.layoutParams as ConstraintLayout.LayoutParams).verticalBias = 1f
progress.gone() progress.isVisible = false
val request = LoadRequest.Builder(view.context).data(manga) val request = LoadRequest.Builder(view.context).data(manga)
.target(CoverViewTarget(coverThumbnail, progress)).build() .target(CoverViewTarget(coverThumbnail, progress)).build()

View File

@ -85,7 +85,6 @@ import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.collapse import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.compatToolTipText import eu.kanade.tachiyomi.util.view.compatToolTipText
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.hide import eu.kanade.tachiyomi.util.view.hide
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
@ -655,7 +654,7 @@ class ReaderActivity :
presenter.loadPreviousChapter() presenter.loadPreviousChapter()
} }
if (result) { if (result) {
binding.readerNav.leftChapter.gone() binding.readerNav.leftChapter.isVisible = false
binding.readerNav.leftProgress.visible() binding.readerNav.leftProgress.visible()
} else { } else {
toast( toast(
@ -678,7 +677,7 @@ class ReaderActivity :
presenter.loadPreviousChapter() presenter.loadPreviousChapter()
} }
if (result) { if (result) {
binding.readerNav.rightChapter.gone() binding.readerNav.rightChapter.isVisible = false
binding.readerNav.rightProgress.visible() binding.readerNav.rightProgress.visible()
} else { } else {
toast( toast(
@ -827,7 +826,7 @@ class ReaderActivity :
toolbarAnimation.setAnimationListener( toolbarAnimation.setAnimationListener(
object : SimpleAnimationListener() { object : SimpleAnimationListener() {
override fun onAnimationEnd(animation: Animation) { override fun onAnimationEnd(animation: Animation) {
binding.readerMenu.gone() binding.readerMenu.isVisible = false
} }
} }
) )
@ -835,7 +834,7 @@ class ReaderActivity :
BottomSheetBehavior.from(binding.chaptersSheet.chaptersBottomSheet).isHideable = true BottomSheetBehavior.from(binding.chaptersSheet.chaptersBottomSheet).isHideable = true
binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.hide() binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.hide()
} else { } else {
binding.readerMenu.gone() binding.readerMenu.isVisible = false
} }
} }
menuStickyVisible = false menuStickyVisible = false
@ -960,7 +959,7 @@ class ReaderActivity :
* method to the current viewer, but also set the subtitle on the binding.toolbar. * method to the current viewer, but also set the subtitle on the binding.toolbar.
*/ */
fun setChapters(viewerChapters: ViewerChapters) { fun setChapters(viewerChapters: ViewerChapters) {
binding.pleaseWait.gone() binding.pleaseWait.isVisible = false
if (indexChapterToShift != null && indexPageToShift != null) { if (indexChapterToShift != null && indexPageToShift != null) {
viewerChapters.currChapter.pages?.find { it.index == indexPageToShift && it.chapter.chapter.id == indexChapterToShift }?.let { viewerChapters.currChapter.pages?.find { it.index == indexPageToShift && it.chapter.chapter.id == indexChapterToShift }?.let {
(viewer as? PagerViewer)?.updateShifting(it) (viewer as? PagerViewer)?.updateShifting(it)
@ -1012,8 +1011,8 @@ class ReaderActivity :
binding.readerNav.leftChapter.visible() binding.readerNav.leftChapter.visible()
binding.readerNav.rightChapter.visible() binding.readerNav.rightChapter.visible()
binding.readerNav.leftProgress.gone() binding.readerNav.leftProgress.isVisible = false
binding.readerNav.rightProgress.gone() binding.readerNav.rightProgress.isVisible = false
binding.chaptersSheet.root.resetChapter() binding.chaptersSheet.root.resetChapter()
} }
if (show) { if (show) {
@ -1512,7 +1511,7 @@ class ReaderActivity :
.onEach { setColorFilterValue(it) } .onEach { setColorFilterValue(it) }
.launchIn(scope) .launchIn(scope)
} else { } else {
binding.colorOverlay.gone() binding.colorOverlay.isVisible = false
} }
} }
@ -1542,7 +1541,7 @@ class ReaderActivity :
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 {
binding.brightnessOverlay.gone() binding.brightnessOverlay.isVisible = false
} }
} }

View File

@ -24,7 +24,6 @@ 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.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.gone
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 eu.kanade.tachiyomi.util.view.visible
@ -129,7 +128,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
presenter.loadChapter(item.chapter) presenter.loadChapter(item.chapter)
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?.gone() itemView?.bookmarkImage?.isVisible = false
itemView?.progress?.visible() itemView?.progress?.visible()
} }
true true
@ -171,7 +170,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?.visible()
itemView?.progress?.gone() itemView?.progress?.isVisible = false
} }
fun refreshList() { fun refreshList() {

View File

@ -20,6 +20,7 @@ import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.view.isVisible
import coil.api.loadAny import coil.api.loadAny
import coil.request.CachePolicy import coil.request.CachePolicy
import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.ImageSource
@ -38,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.gone
import eu.kanade.tachiyomi.util.view.visible 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
@ -303,8 +303,8 @@ class PagerPageHolder(
*/ */
private fun setQueued() { private fun setQueued() {
progressBar.visible() progressBar.visible()
retryButton?.gone() retryButton?.isVisible = false
decodeErrorLayout?.gone() decodeErrorLayout?.isVisible = false
} }
/** /**
@ -312,8 +312,8 @@ class PagerPageHolder(
*/ */
private fun setLoading() { private fun setLoading() {
progressBar.visible() progressBar.visible()
retryButton?.gone() retryButton?.isVisible = false
decodeErrorLayout?.gone() decodeErrorLayout?.isVisible = false
} }
/** /**
@ -321,8 +321,8 @@ class PagerPageHolder(
*/ */
private fun setDownloading() { private fun setDownloading() {
progressBar.visible() progressBar.visible()
retryButton?.gone() retryButton?.isVisible = false
decodeErrorLayout?.gone() decodeErrorLayout?.isVisible = false
} }
/** /**
@ -335,8 +335,8 @@ class PagerPageHolder(
} else { } else {
progressBar.setProgress(95) progressBar.setProgress(95)
} }
retryButton?.gone() retryButton?.isVisible = false
decodeErrorLayout?.gone() decodeErrorLayout?.isVisible = false
unsubscribeReadImageHeader() unsubscribeReadImageHeader()
val streamFn = page.stream ?: return val streamFn = page.stream ?: return
@ -431,7 +431,7 @@ class PagerPageHolder(
* Called when the page has an error. * Called when the page has an error.
*/ */
private fun setError() { private fun setError() {
progressBar.gone() progressBar.isVisible = false
initRetryButton().visible() initRetryButton().visible()
} }
@ -439,14 +439,14 @@ class PagerPageHolder(
* Called when the image is decoded and going to be displayed. * Called when the image is decoded and going to be displayed.
*/ */
private fun onImageDecoded() { private fun onImageDecoded() {
progressBar.gone() progressBar.isVisible = false
} }
/** /**
* Called when an image fails to decode. * Called when an image fails to decode.
*/ */
private fun onImageDecodeError() { private fun onImageDecodeError() {
progressBar.gone() progressBar.isVisible = false
initDecodeErrorLayout().visible() initDecodeErrorLayout().visible()
} }

View File

@ -6,6 +6,7 @@ import android.view.KeyEvent
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.ViewGroup.LayoutParams import android.view.ViewGroup.LayoutParams
import androidx.core.view.isVisible
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity
@ -14,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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import kotlinx.coroutines.MainScope import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
@ -81,7 +81,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
} }
init { init {
pager.gone() // Don't layout the pager yet pager.isVisible = false // Don't layout the pager yet
pager.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) pager.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
pager.offscreenPageLimit = 1 pager.offscreenPageLimit = 1
pager.id = R.id.reader_pager pager.id = R.id.reader_pager

View File

@ -27,7 +27,6 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar 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.gone
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.visible
import eu.kanade.tachiyomi.widget.GifViewTarget import eu.kanade.tachiyomi.widget.GifViewTarget
@ -239,7 +238,7 @@ class WebtoonPageHolder(
private fun setQueued() { private fun setQueued() {
progressContainer.visible() progressContainer.visible()
progressBar.visible() progressBar.visible()
retryContainer?.gone() retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -249,7 +248,7 @@ class WebtoonPageHolder(
private fun setLoading() { private fun setLoading() {
progressContainer.visible() progressContainer.visible()
progressBar.visible() progressBar.visible()
retryContainer?.gone() retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -259,7 +258,7 @@ class WebtoonPageHolder(
private fun setDownloading() { private fun setDownloading() {
progressContainer.visible() progressContainer.visible()
progressBar.visible() progressBar.visible()
retryContainer?.gone() retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
} }
@ -270,7 +269,7 @@ class WebtoonPageHolder(
progressContainer.visible() progressContainer.visible()
progressBar.visible() progressBar.visible()
progressBar.completeAndFadeOut() progressBar.completeAndFadeOut()
retryContainer?.gone() retryContainer?.isVisible = false
removeDecodeErrorLayout() removeDecodeErrorLayout()
unsubscribeReadImageHeader() unsubscribeReadImageHeader()
@ -309,7 +308,7 @@ class WebtoonPageHolder(
* Called when the page has an error. * Called when the page has an error.
*/ */
private fun setError() { private fun setError() {
progressContainer.gone() progressContainer.isVisible = false
initRetryLayout().visible() initRetryLayout().visible()
} }
@ -317,14 +316,14 @@ class WebtoonPageHolder(
* Called when the image is decoded and going to be displayed. * Called when the image is decoded and going to be displayed.
*/ */
private fun onImageDecoded() { private fun onImageDecoded() {
progressContainer.gone() progressContainer.isVisible = false
} }
/** /**
* Called when the image fails to decode. * Called when the image fails to decode.
*/ */
private fun onImageDecodeError() { private fun onImageDecodeError() {
progressContainer.gone() progressContainer.isVisible = false
initDecodeErrorLayout().visible() initDecodeErrorLayout().visible()
} }

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.view.View import android.view.View
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.SourceItemBinding import eu.kanade.tachiyomi.databinding.SourceItemBinding
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
@ -9,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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
class SourceHolder(view: View, val adapter: SourceAdapter) : class SourceHolder(view: View, val adapter: SourceAdapter) :
@ -60,7 +60,7 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
if (source.supportsLatest) { if (source.supportsLatest) {
binding.sourceLatest.visible() binding.sourceLatest.visible()
} else { } else {
binding.sourceLatest.gone() binding.sourceLatest.isVisible = false
} }
} }

View File

@ -35,7 +35,6 @@ import eu.kanade.tachiyomi.util.addOrRemoveToFavorites
import eu.kanade.tachiyomi.util.system.connectivityManager import eu.kanade.tachiyomi.util.system.connectivityManager
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.system.openInBrowser
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.inflate
import eu.kanade.tachiyomi.util.view.scrollViewWith import eu.kanade.tachiyomi.util.view.scrollViewWith
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
@ -528,7 +527,7 @@ open class BrowseSourceController(bundle: Bundle) :
* Shows the binding.progress bar. * Shows the binding.progress bar.
*/ */
private fun showProgressBar() { private fun showProgressBar() {
binding.emptyView.gone() binding.emptyView.isVisible = false
binding.progress.visible() binding.progress.visible()
snack?.dismiss() snack?.dismiss()
snack = null snack = null
@ -538,8 +537,8 @@ open class BrowseSourceController(bundle: Bundle) :
* Hides active binding.progress bars. * Hides active binding.progress bars.
*/ */
private fun hideProgressBar() { private fun hideProgressBar() {
binding.emptyView.gone() binding.emptyView.isVisible = false
binding.progress.gone() binding.progress.isVisible = false
} }
/** /**

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source.browse
import android.app.Activity import android.app.Activity
import android.view.View import android.view.View
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import coil.Coil import coil.Coil
import coil.api.clear import coil.api.clear
@ -9,10 +10,9 @@ import coil.request.LoadRequest
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.databinding.MangaGridItemBinding import eu.kanade.tachiyomi.databinding.MangaGridItemBinding
import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter
/** /**
* Class used to hold the displayed data of a manga in the library, like the cover or the title. * Class used to hold the displayed data of a manga in the library, like the cover or the title.
@ -32,10 +32,10 @@ class BrowseSourceGridHolder(
private val binding = MangaGridItemBinding.bind(view) private val binding = MangaGridItemBinding.bind(view)
init { init {
if (compact) { if (compact) {
binding.textLayout.gone() binding.textLayout.isVisible = false
} else { } else {
binding.compactTitle.gone() binding.compactTitle.isVisible = false
binding.gradient.gone() binding.gradient.isVisible = false
} }
} }

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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
/** /**
@ -68,12 +67,12 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
showHolder() showHolder()
} }
results.isEmpty() -> { results.isEmpty() -> {
binding.progress.gone() binding.progress.isVisible = false
binding.noResults.visible() binding.noResults.visible()
binding.sourceCard.gone() binding.sourceCard.isVisible = false
} }
else -> { else -> {
binding.progress.gone() binding.progress.isVisible = false
showHolder() showHolder()
} }
} }
@ -111,6 +110,6 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
private fun showHolder() { private fun showHolder() {
binding.sourceCard.visible() binding.sourceCard.visible()
binding.noResults.gone() binding.noResults.isVisible = false
} }
} }

View File

@ -3,11 +3,11 @@ package eu.kanade.tachiyomi.ui.source.latest
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.View import android.view.View
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourcePresenter import eu.kanade.tachiyomi.ui.source.browse.BrowseSourcePresenter
import eu.kanade.tachiyomi.util.view.gone
/** /**
* Controller that shows the latest manga from the catalogue. Inherit [BrowseSourceController]. * Controller that shows the latest manga from the catalogue. Inherit [BrowseSourceController].
@ -22,7 +22,7 @@ class LatestUpdatesController(bundle: Bundle) : BrowseSourceController(bundle) {
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
binding.fab.gone() binding.fab.isVisible = false
} }
override fun createPresenter(): BrowseSourcePresenter { override fun createPresenter(): BrowseSourcePresenter {

View File

@ -106,10 +106,6 @@ inline fun View.visible() {
visibility = View.VISIBLE visibility = View.VISIBLE
} }
inline fun View.gone() {
visibility = View.GONE
}
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

@ -6,11 +6,11 @@ import android.view.LayoutInflater
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.core.view.isVisible
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import eu.kanade.tachiyomi.R 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.gone
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.visible
@ -24,7 +24,7 @@ class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
* Hide the information view * Hide the information view
*/ */
fun hide() { fun hide() {
this.gone() this.isVisible = false
} }
/** /**

View File

@ -4,20 +4,20 @@ import android.graphics.drawable.Drawable
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import androidx.core.view.isVisible
import coil.target.ImageViewTarget import coil.target.ImageViewTarget
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible 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?.gone() progressBar?.isVisible = false
decodeErrorLayout?.visible() decodeErrorLayout?.visible()
} }
override fun onSuccess(result: Drawable) { override fun onSuccess(result: Drawable) {
progressBar?.gone() progressBar?.isVisible = false
decodeErrorLayout?.gone() decodeErrorLayout?.isVisible = false
super.onSuccess(result) super.onSuccess(result)
} }
} }