Removing isVisible/visibleIf helper methods for androidx.core.view

This commit is contained in:
Jays2Kings 2021-04-26 01:39:09 -04:00
parent 20f8fac479
commit 18111be272
21 changed files with 71 additions and 88 deletions

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -19,11 +20,9 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.hasSideNavBar import eu.kanade.tachiyomi.util.system.hasSideNavBar
import eu.kanade.tachiyomi.util.system.isInNightMode import eu.kanade.tachiyomi.util.system.isInNightMode
import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.expand
import eu.kanade.tachiyomi.util.view.isVisible
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.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visibleIf
import eu.kanade.tachiyomi.widget.MenuSheetItemView import eu.kanade.tachiyomi.widget.MenuSheetItemView
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
@ -63,7 +62,7 @@ open class MaterialMenuSheet(
} }
} }
binding.divider.visibleIf(showDivider) binding.divider.isVisible = showDivider
var currentIndex: Int? = null var currentIndex: Int? = null
items.forEachIndexed { index, item -> items.forEachIndexed { index, item ->
val view = val view =
@ -104,7 +103,7 @@ open class MaterialMenuSheet(
setBottomEdge(binding.menuLayout, activity) setBottomEdge(binding.menuLayout, activity)
binding.titleLayout.visibleIf(title != null) binding.titleLayout.isVisible = title != null
binding.toolbarTitle.text = title binding.toolbarTitle.text = title
currentIndex?.let { currentIndex?.let {
@ -129,7 +128,7 @@ open class MaterialMenuSheet(
elevationAnimator?.start() elevationAnimator?.start()
} }
elevate(binding.menuScrollView.canScrollVertically(-1)) elevate(binding.menuScrollView.canScrollVertically(-1))
if (binding.titleLayout.isVisible()) { if (binding.titleLayout.isVisible) {
binding.menuScrollView.setOnScrollChangeListener { _: View?, _: Int, _: Int, _: Int, _: Int -> binding.menuScrollView.setOnScrollChangeListener { _: View?, _: Int, _: Int, _: Int, _: Int ->
val notAtTop = binding.menuScrollView.canScrollVertically(-1) val notAtTop = binding.menuScrollView.canScrollVertically(-1)
if (notAtTop != isElevated) { if (notAtTop != isElevated) {

View File

@ -21,7 +21,6 @@ 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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.visibleIf
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -175,7 +174,7 @@ class ManageCategoryDialog(bundle: Bundle? = null) :
shouldShow: Boolean shouldShow: Boolean
) { ) {
val updateCategories = categories.get() val updateCategories = categories.get()
box.visibleIf(updateCategories.isNotEmpty() && shouldShow) box.isVisible = updateCategories.isNotEmpty() && shouldShow
if (updateCategories.isNotEmpty() && shouldShow) box.isChecked = if (updateCategories.isNotEmpty() && shouldShow) box.isChecked =
updateCategories.any { category?.id == it.toIntOrNull() } updateCategories.any { category?.id == it.toIntOrNull() }
} }

View File

@ -2,13 +2,13 @@ package eu.kanade.tachiyomi.ui.download
import android.view.View import android.view.View
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.core.view.isVisible
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.DownloadItemBinding import eu.kanade.tachiyomi.databinding.DownloadItemBinding
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.setVectorCompat import eu.kanade.tachiyomi.util.view.setVectorCompat
import eu.kanade.tachiyomi.util.view.visibleIf
/** /**
* Class used to hold the data of a download. * Class used to hold the data of a download.
@ -53,7 +53,7 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) :
notifyDownloadedPages() notifyDownloadedPages()
} }
binding.downloadMenu.visibleIf(flexibleAdapterPosition != 0 || flexibleAdapterPosition != adapter.itemCount - 1) binding.downloadMenu.isVisible = flexibleAdapterPosition != 0 || flexibleAdapterPosition != adapter.itemCount - 1
binding.downloadMenu.setVectorCompat( binding.downloadMenu.setVectorCompat(
R.drawable.ic_more_vert_24dp, R.drawable.ic_more_vert_24dp,
view.context view.context

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.library
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import androidx.core.view.isVisible
import com.google.android.material.card.MaterialCardView import com.google.android.material.card.MaterialCardView
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.UnreadDownloadBadgeBinding import eu.kanade.tachiyomi.databinding.UnreadDownloadBadgeBinding
@ -10,9 +11,7 @@ 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.gone
import eu.kanade.tachiyomi.util.view.isVisible
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.visibleIf
class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
MaterialCardView(context, attrs) { MaterialCardView(context, attrs) {
@ -32,8 +31,8 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
} else context.getResourceColor(R.attr.colorAccent) } else context.getResourceColor(R.attr.colorAccent)
with(binding.unreadText) { with(binding.unreadText) {
visibleIf(unread > 0 || unread == -1 || showTotalChapters) isVisible = unread > 0 || unread == -1 || showTotalChapters
if (!isVisible()) { if (!isVisible) {
return@with return@with
} }
text = if (unread == -1) "0" else unread.toString() text = if (unread == -1) "0" else unread.toString()
@ -50,8 +49,8 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
// Update the download count or local status and its visibility. // Update the download count or local status and its visibility.
with(binding.downloadText) { with(binding.downloadText) {
visibleIf(downloads == -2 || downloads > 0) isVisible = downloads == -2 || downloads > 0
if (!isVisible()) { return@with } if (!isVisible) { return@with }
text = if (downloads == -2) { text = if (downloads == -2) {
resources.getString(R.string.local) resources.getString(R.string.local)
} else { } else {
@ -67,13 +66,13 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
} }
// Show the badge card if unread or downloads exists // Show the badge card if unread or downloads exists
visibleIf(binding.downloadText.isVisible() || binding.unreadText.isVisible()) isVisible = binding.downloadText.isVisible || binding.unreadText.isVisible
// Show the angles divider if both unread and downloads exists // Show the angles divider if both unread and downloads exists
binding.unreadAngle.visibleIf(binding.downloadText.isVisible() && binding.unreadText.isVisible()) binding.unreadAngle.isVisible = binding.downloadText.isVisible && binding.unreadText.isVisible
binding.unreadAngle.setColorFilter(unreadBadgeBackground) binding.unreadAngle.setColorFilter(unreadBadgeBackground)
if (binding.unreadAngle.isVisible()) { if (binding.unreadAngle.isVisible) {
binding.downloadText.updatePaddingRelative(end = 8.dpToPx) binding.downloadText.updatePaddingRelative(end = 8.dpToPx)
binding.unreadText.updatePaddingRelative(start = 2.dpToPx) binding.unreadText.updatePaddingRelative(start = 2.dpToPx)
} else { } else {
@ -87,10 +86,10 @@ class LibraryBadge @JvmOverloads constructor(context: Context, attrs: AttributeS
} }
fun setInLibrary(inLibrary: Boolean) { fun setInLibrary(inLibrary: Boolean) {
this.visibleIf(inLibrary) this.isVisible = inLibrary
binding.unreadAngle.gone() binding.unreadAngle.gone()
binding.unreadText.updatePaddingRelative(start = 5.dpToPx) binding.unreadText.updatePaddingRelative(start = 5.dpToPx)
binding.unreadText.visibleIf(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

@ -26,6 +26,7 @@ import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
@ -90,7 +91,6 @@ import eu.kanade.tachiyomi.util.view.hide
import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.invisible
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
import eu.kanade.tachiyomi.util.view.isVisible
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
import eu.kanade.tachiyomi.util.view.setStyle import eu.kanade.tachiyomi.util.view.setStyle
@ -99,7 +99,6 @@ 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.visible
import eu.kanade.tachiyomi.util.view.visibleIf
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
@ -342,7 +341,7 @@ class LibraryController(
} }
fun showMiniBar() { fun showMiniBar() {
binding.headerCard.visibleIf(showCategoryInTitle) binding.headerCard.isVisible = showCategoryInTitle
setSubtitle() setSubtitle()
} }
@ -709,8 +708,8 @@ class LibraryController(
} }
fun hideHopper(hide: Boolean) { fun hideHopper(hide: Boolean) {
binding.categoryHopperFrame.visibleIf(!hide) binding.categoryHopperFrame.isVisible = !hide
binding.jumperCategoryText.visibleIf(!hide) binding.jumperCategoryText.isVisible = !hide
} }
private fun jumpToNextCategory(next: Boolean) { private fun jumpToNextCategory(next: Boolean) {
@ -784,7 +783,7 @@ class LibraryController(
} }
private fun anchorView(): View { private fun anchorView(): View {
return if (binding.categoryHopperFrame.isVisible()) { return if (binding.categoryHopperFrame.isVisible) {
binding.categoryHopperFrame binding.categoryHopperFrame
} else { } else {
binding.filterBottomSheet.filterBottomSheet binding.filterBottomSheet.filterBottomSheet
@ -939,7 +938,7 @@ class LibraryController(
setActiveCategory() setActiveCategory()
} }
binding.categoryHopperFrame.visibleIf(!singleCategory && !preferences.hideHopper().get()) binding.categoryHopperFrame.isVisible = !singleCategory && !preferences.hideHopper().get()
adapter.isLongPressDragEnabled = canDrag() adapter.isLongPressDragEnabled = canDrag()
binding.categoryRecycler.setCategories(presenter.categories) binding.categoryRecycler.setCategories(presenter.categories)
with(binding.filterBottomSheet.root) { with(binding.filterBottomSheet.root) {

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.core.view.isVisible
import coil.api.clear import coil.api.clear
import coil.size.Precision import coil.size.Precision
import coil.size.Scale import coil.size.Scale
@ -11,7 +12,6 @@ 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 import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visibleIf
/** /**
* 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.
@ -55,7 +55,7 @@ class LibraryGridHolder(
*/ */
override fun onSetValues(item: LibraryItem) { override fun onSetValues(item: LibraryItem) {
// Update the title and subtitle of the manga. // Update the title and subtitle of the manga.
binding.constraintLayout.visibleIf(!item.manga.isBlank()) binding.constraintLayout.isVisible = !item.manga.isBlank()
binding.title.text = item.manga.title binding.title.text = item.manga.title
binding.subtitle.text = item.manga.author?.trim() binding.subtitle.text = item.manga.author?.trim()

View File

@ -6,6 +6,7 @@ import android.util.TypedValue
import android.view.View import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.github.florent37.viewtooltip.ViewTooltip import com.github.florent37.viewtooltip.ViewTooltip
import eu.davidea.flexibleadapter.SelectableAdapter import eu.davidea.flexibleadapter.SelectableAdapter
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -22,7 +23,6 @@ import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.invisible
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 eu.kanade.tachiyomi.util.view.visibleIf
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -106,8 +106,8 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
) )
when { when {
adapter.mode == SelectableAdapter.Mode.MULTI -> { adapter.mode == SelectableAdapter.Mode.MULTI -> {
binding.checkbox.visibleIf(!category.isHidden) binding.checkbox.isVisible = !category.isHidden
binding.collapseArrow.visibleIf(category.isHidden && !adapter.isSingleCategory) binding.collapseArrow.isVisible = category.isHidden && !adapter.isSingleCategory
binding.updateButton.gone() binding.updateButton.gone()
binding.catProgress.gone() binding.catProgress.gone()
setSelection() setSelection()
@ -119,16 +119,16 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
binding.updateButton.gone() binding.updateButton.gone()
} }
LibraryUpdateService.categoryInQueue(category.id) -> { LibraryUpdateService.categoryInQueue(category.id) -> {
binding.collapseArrow.visibleIf(!adapter.isSingleCategory) binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.checkbox.gone() binding.checkbox.gone()
binding.catProgress.visible() binding.catProgress.visible()
binding.updateButton.invisible() binding.updateButton.invisible()
} }
else -> { else -> {
binding.collapseArrow.visibleIf(!adapter.isSingleCategory) binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.catProgress.gone() binding.catProgress.gone()
binding.checkbox.gone() binding.checkbox.gone()
binding.updateButton.visibleIf(!adapter.isSingleCategory) binding.updateButton.isVisible = !adapter.isSingleCategory
} }
} }
} }

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.library
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import coil.api.clear import coil.api.clear
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga
@ -10,7 +11,6 @@ import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.gone 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 eu.kanade.tachiyomi.util.view.visibleIf
/** /**
* 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.
@ -69,7 +69,7 @@ class LibraryListHolder(
binding.subtitle.text = item.manga.author?.trim() binding.subtitle.text = item.manga.author?.trim()
binding.title.post { binding.title.post {
if (binding.title.text == item.manga.title) { if (binding.title.text == item.manga.title) {
binding.subtitle.visibleIf(binding.title.lineCount == 1 && !item.manga.author.isNullOrBlank()) binding.subtitle.isVisible = binding.title.lineCount == 1 && !item.manga.author.isNullOrBlank()
} }
} }

View File

@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.core.view.isVisible
import com.f2prateek.rx.preferences.Preference import com.f2prateek.rx.preferences.Preference
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
@ -13,7 +14,6 @@ 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.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.visibleIf
class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout
(context, attrs) { (context, attrs) {
@ -69,8 +69,8 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute
val extras = (extra.toList() + listOf<String?>(null, null, null)).take(separators.size) val extras = (extra.toList() + listOf<String?>(null, null, null)).take(separators.size)
extras.forEachIndexed { index, text -> extras.forEachIndexed { index, text ->
buttons[index + 1].text = text buttons[index + 1].text = text
separators[index].visibleIf(text != null) separators[index].isVisible = text != null
buttons[index + 1].visibleIf(text != null) buttons[index + 1].isVisible = text != null
} }
itemCount = buttons.count { !it.text.isNullOrBlank() } itemCount = buttons.count { !it.text.isNullOrBlank() }
this.root = root this.root = root

View File

@ -75,7 +75,6 @@ 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
import eu.kanade.tachiyomi.util.view.visibleIf
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.Dispatchers import kotlinx.coroutines.Dispatchers
@ -251,7 +250,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
top = insets.systemWindowInsetTop top = insets.systemWindowInsetTop
) )
binding.bottomNav.updatePadding(bottom = insets.systemWindowInsetBottom) binding.bottomNav.updatePadding(bottom = insets.systemWindowInsetBottom)
binding.bottomView.visibleIf(insets.systemWindowInsetBottom > 0) binding.bottomView.isVisible = insets.systemWindowInsetBottom > 0
binding.bottomView.updateLayoutParams<ViewGroup.LayoutParams> { binding.bottomView.updateLayoutParams<ViewGroup.LayoutParams> {
height = insets.systemWindowInsetBottom height = insets.systemWindowInsetBottom
} }
@ -283,7 +282,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
binding.cardToolbar.menu.findItem(R.id.action_search)?.expandActionView() binding.cardToolbar.menu.findItem(R.id.action_search)?.expandActionView()
} }
binding.bottomNav.visibleIf(!hideBottomNav) binding.bottomNav.isVisible = !hideBottomNav
binding.bottomView.visibility = if (hideBottomNav) View.GONE else binding.bottomView.visibility binding.bottomView.visibility = if (hideBottomNav) View.GONE else binding.bottomView.visibility
binding.bottomNav.alpha = if (hideBottomNav) 0f else 1f binding.bottomNav.alpha = if (hideBottomNav) 0f else 1f
router.addChangeListener( router.addChangeListener(
@ -746,7 +745,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
} }
alphaAnimation.addListener( alphaAnimation.addListener(
EndAnimatorListener { EndAnimatorListener {
binding.bottomNav.visibleIf(!hideBottomNav) binding.bottomNav.isVisible = !hideBottomNav
binding.bottomView.visibility = binding.bottomView.visibility =
if (hideBottomNav) View.GONE else binding.bottomView.visibility if (hideBottomNav) View.GONE else binding.bottomView.visibility
} }

View File

@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.util.isLocal import eu.kanade.tachiyomi.util.isLocal
import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.lang.chop
import eu.kanade.tachiyomi.util.view.visibleIf
import me.gujun.android.taggroup.TagGroup import me.gujun.android.taggroup.TagGroup
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -145,7 +144,7 @@ class EditMangaDialog : DialogController {
R.string.reset_tags R.string.reset_tags
} }
) )
binding.resetCover.visibleIf(!isLocal) binding.resetCover.isVisible = !isLocal
binding.resetCover.setOnClickListener { binding.resetCover.setOnClickListener {
binding.mangaCover.loadAny( binding.mangaCover.loadAny(
manga, manga,

View File

@ -8,6 +8,7 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
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 coil.api.loadAny import coil.api.loadAny
import coil.request.CachePolicy import coil.request.CachePolicy
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
@ -21,11 +22,9 @@ 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.gone
import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.isVisible
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
import eu.kanade.tachiyomi.util.view.visibleIf
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
class MangaHeaderHolder( class MangaHeaderHolder(
@ -48,7 +47,7 @@ class MangaHeaderHolder(
} }
binding.moreButton.setOnClickListener { expandDesc() } binding.moreButton.setOnClickListener { expandDesc() }
binding.mangaSummary.setOnClickListener { binding.mangaSummary.setOnClickListener {
if (binding.moreButton.isVisible()) { if (binding.moreButton.isVisible) {
expandDesc() expandDesc()
} else if (!hadSelection) { } else if (!hadSelection) {
collapseDesc() collapseDesc()
@ -158,10 +157,10 @@ class MangaHeaderHolder(
binding.mangaSummary.post { binding.mangaSummary.post {
binding.mangaSummary binding.mangaSummary
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.gone()
showMoreButton = binding.lessButton.isVisible() showMoreButton = binding.lessButton.isVisible
} else { } else {
binding.moreButtonGroup.visible() binding.moreButtonGroup.visible()
} }
@ -200,7 +199,7 @@ class MangaHeaderHolder(
val tracked = presenter.isTracked() && !item.isLocked val tracked = presenter.isTracked() && !item.isLocked
with(binding.trackButton) { with(binding.trackButton) {
visibleIf(presenter.hasTrackers()) isVisible = presenter.hasTrackers()
text = itemView.context.getString( text = itemView.context.getString(
if (tracked) R.string.tracked if (tracked) R.string.tracked
else R.string.tracking else R.string.tracking
@ -215,8 +214,8 @@ class MangaHeaderHolder(
with(binding.startReadingButton) { with(binding.startReadingButton) {
val nextChapter = presenter.getNextUnreadChapter() val nextChapter = presenter.getNextUnreadChapter()
visibleIf(presenter.chapters.isNotEmpty() && !item.isLocked && !adapter.hasFilter()) isVisible = presenter.chapters.isNotEmpty() && !item.isLocked && !adapter.hasFilter()
showReadingButton = isVisible() showReadingButton = isVisible
isEnabled = (nextChapter != null) isEnabled = (nextChapter != null)
text = if (nextChapter != null) { text = if (nextChapter != null) {
val number = adapter.decimalFormat.format(nextChapter.chapter_number.toDouble()) val number = adapter.decimalFormat.format(nextChapter.chapter_number.toDouble())
@ -243,7 +242,7 @@ class MangaHeaderHolder(
height = adapter.delegate.topCoverHeight() height = adapter.delegate.topCoverHeight()
} }
binding.mangaStatus.visibleIf(manga.status != 0) binding.mangaStatus.isVisible = manga.status != 0
binding.mangaStatus.text = ( binding.mangaStatus.text = (
itemView.context.getString( itemView.context.getString(
when (manga.status) { when (manga.status) {
@ -353,7 +352,7 @@ class MangaHeaderHolder(
binding.mangaGenresTags.visible() binding.mangaGenresTags.visible()
} }
} }
binding.startReadingButton.visibleIf(showReadingButton) binding.startReadingButton.isVisible = showReadingButton
} }
override fun onLongClick(view: View?): Boolean { override fun onLongClick(view: View?): Boolean {

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.manga.chapter
import android.animation.AnimatorSet import android.animation.AnimatorSet
import android.animation.ObjectAnimator import android.animation.ObjectAnimator
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.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.Download
@ -12,9 +13,7 @@ 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.gone
import eu.kanade.tachiyomi.util.view.isVisible
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.visibleIf
import eu.kanade.tachiyomi.widget.EndAnimatorListener import eu.kanade.tachiyomi.widget.EndAnimatorListener
import eu.kanade.tachiyomi.widget.StartAnimatorListener import eu.kanade.tachiyomi.widget.StartAnimatorListener
@ -45,7 +44,7 @@ class ChapterHolder(
} }
localSource = manga.source == LocalSource.ID localSource = manga.source == LocalSource.ID
binding.downloadButton.downloadButton.visibleIf(!localSource && !isLocked) binding.downloadButton.downloadButton.isVisible = !localSource && !isLocked
ChapterUtil.setTextViewForChapter(binding.chapterTitle, item, hideStatus = isLocked) ChapterUtil.setTextViewForChapter(binding.chapterTitle, item, hideStatus = isLocked)
@ -115,7 +114,7 @@ class ChapterHolder(
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.gone() binding.leftView.gone()
binding.rightView.visible() binding.rightView.visible()
} }
@ -157,7 +156,7 @@ class ChapterHolder(
gone() gone()
return return
} }
visibleIf(!localSource) isVisible = !localSource
setDownloadStatus(status, progress, animated) setDownloadStatus(status, progress, animated)
} }
} }

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.manga.chapter
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -14,7 +15,6 @@ import eu.kanade.tachiyomi.util.view.invisible
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.visInvisIf import eu.kanade.tachiyomi.util.view.visInvisIf
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlin.math.max import kotlin.math.max
class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetDialog class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetDialog
@ -72,7 +72,7 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD
val isScrollable = val isScrollable =
binding.settingsScrollView.height < binding.sortLayout.height + binding.settingsScrollView.height < binding.sortLayout.height +
binding.settingsScrollView.paddingTop + binding.settingsScrollView.paddingBottom binding.settingsScrollView.paddingTop + binding.settingsScrollView.paddingBottom
binding.closeButton.visibleIf(isScrollable) binding.closeButton.isVisible = isScrollable
// making the view gone somehow breaks the layout so lets make it invisible // making the view gone somehow breaks the layout so lets make it invisible
binding.pill.visInvisIf(!isScrollable) binding.pill.visInvisIf(!isScrollable)
} }

View File

@ -3,13 +3,13 @@ package eu.kanade.tachiyomi.ui.manga.track
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.view.View import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.TrackItemBinding import eu.kanade.tachiyomi.databinding.TrackItemBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visibleIf
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.text.DateFormat import java.text.DateFormat
@ -44,8 +44,8 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
} }
val serviceName = binding.trackLogo.context.getString(item.service.nameRes()) val serviceName = binding.trackLogo.context.getString(item.service.nameRes())
binding.trackLogo.contentDescription = serviceName binding.trackLogo.contentDescription = serviceName
binding.trackGroup.visibleIf(track != null) binding.trackGroup.isVisible = track != null
binding.addTracking.visibleIf(track == null) binding.addTracking.isVisible = track == null
if (track != null) { if (track != null) {
binding.trackTitle.text = track.title binding.trackTitle.text = track.title
with(binding.trackChapters) { with(binding.trackChapters) {
@ -70,7 +70,7 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
else binding.trackStatus.text = item.service.getStatus(track.status) else binding.trackStatus.text = item.service.getStatus(track.status)
binding.trackScore.text = if (track.score == 0f) "-" else item.service.displayScore(track) binding.trackScore.text = if (track.score == 0f) "-" else item.service.displayScore(track)
binding.trackScore.setCompoundDrawablesWithIntrinsicBounds(0, 0, starIcon(track), 0) binding.trackScore.setCompoundDrawablesWithIntrinsicBounds(0, 0, starIcon(track), 0)
binding.dateGroup.visibleIf(item.service.supportsReadingDates) binding.dateGroup.isVisible = item.service.supportsReadingDates
if (item.service.supportsReadingDates) { if (item.service.supportsReadingDates) {
binding.trackStartDate.text = binding.trackStartDate.text =
if (track.started_reading_date != 0L) dateFormat.format(track.started_reading_date) else "-" if (track.started_reading_date != 0L) dateFormat.format(track.started_reading_date) else "-"
@ -90,7 +90,7 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
} }
fun setProgress(enabled: Boolean) { fun setProgress(enabled: Boolean) {
binding.progress.visibleIf(enabled) binding.progress.isVisible = enabled
binding.trackLogo.visibleIf(!enabled) binding.trackLogo.isVisible = !enabled
} }
} }

View File

@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
import eu.kanade.tachiyomi.util.bindToPreference import eu.kanade.tachiyomi.util.bindToPreference
import eu.kanade.tachiyomi.util.lang.addBetaTag import eu.kanade.tachiyomi.util.lang.addBetaTag
import eu.kanade.tachiyomi.util.view.visibleIf
import eu.kanade.tachiyomi.widget.BaseReaderSettingsView import eu.kanade.tachiyomi.widget.BaseReaderSettingsView
class ReaderPagedView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class ReaderPagedView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -76,14 +75,14 @@ class ReaderPagedView @JvmOverloads constructor(context: Context, attrs: Attribu
binding.pagerNav, binding.pagerNav,
binding.pagerInvert, binding.pagerInvert,
binding.pageLayout binding.pageLayout
).forEach { it.visibleIf(show) } ).forEach { it.isVisible = show }
listOf( listOf(
binding.cropBordersWebtoon, binding.cropBordersWebtoon,
binding.webtoonSidePadding, binding.webtoonSidePadding,
binding.webtoonEnableZoomOut, binding.webtoonEnableZoomOut,
binding.webtoonNav, binding.webtoonNav,
binding.webtoonInvert binding.webtoonInvert
).forEach { it.visibleIf(!show) } ).forEach { it.isVisible = !show }
val isFullFit = when (preferences.imageScaleType().get()) { val isFullFit = when (preferences.imageScaleType().get()) {
SubsamplingScaleImageView.SCALE_TYPE_FIT_HEIGHT, SubsamplingScaleImageView.SCALE_TYPE_FIT_HEIGHT,
SubsamplingScaleImageView.SCALE_TYPE_SMART_FIT, SubsamplingScaleImageView.SCALE_TYPE_SMART_FIT,

View File

@ -13,11 +13,11 @@ import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.widget.AppCompatButton import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.visibleIf
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
@ -154,7 +154,7 @@ class WebtoonTransitionHolder(
is ReaderChapter.State.Error -> setError(state.error, transition) is ReaderChapter.State.Error -> setError(state.error, transition)
is ReaderChapter.State.Loaded -> setLoaded() is ReaderChapter.State.Loaded -> setLoaded()
} }
pagesContainer.visibleIf(pagesContainer.childCount > 0) pagesContainer.isVisible = pagesContainer.childCount > 0
} }
addSubscription(statusSubscription) addSubscription(statusSubscription)

View File

@ -8,6 +8,7 @@ import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -41,7 +42,6 @@ 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.visible
import eu.kanade.tachiyomi.util.view.visibleIf
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
@ -128,7 +128,7 @@ open class BrowseSourceController(bundle: Bundle) :
adapter = FlexibleAdapter(null, this) adapter = FlexibleAdapter(null, this)
setupRecycler(view) setupRecycler(view)
binding.fab.visibleIf(presenter.sourceFilters.isNotEmpty()) binding.fab.isVisible = presenter.sourceFilters.isNotEmpty()
binding.fab.setOnClickListener { showFilters() } binding.fab.setOnClickListener { showFilters() }
binding.progress.visible() binding.progress.visible()
} }

View File

@ -1,15 +1,15 @@
package eu.kanade.tachiyomi.ui.source.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import androidx.core.view.isVisible
import coil.Coil import coil.Coil
import coil.api.clear import coil.api.clear
import coil.request.CachePolicy import coil.request.CachePolicy
import coil.request.LoadRequest import coil.request.LoadRequest
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.view.visibleIf
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.databinding.SourceGlobalSearchControllerCardItemBinding import eu.kanade.tachiyomi.databinding.SourceGlobalSearchControllerCardItemBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
class GlobalSearchMangaHolder(view: View, adapter: GlobalSearchCardAdapter) : class GlobalSearchMangaHolder(view: View, adapter: GlobalSearchCardAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
@ -31,7 +31,7 @@ class GlobalSearchMangaHolder(view: View, adapter: GlobalSearchCardAdapter) :
fun bind(manga: Manga) { fun bind(manga: Manga) {
binding.title.text = manga.title binding.title.text = manga.title
binding.favoriteButton.visibleIf(manga.favorite) binding.favoriteButton.isVisible = manga.favorite
setImage(manga) setImage(manga)
} }

View File

@ -359,7 +359,7 @@ fun Controller.scrollViewWith(
0f 0f
) )
val tabBar = activityBinding!!.bottomNav val tabBar = activityBinding!!.bottomNav
if (tabBar.isVisible() && isInView) { if (tabBar.isVisible && isInView) {
if (preferences.hideBottomNavOnScroll().get()) { if (preferences.hideBottomNavOnScroll().get()) {
tabBar.translationY += dy tabBar.translationY += dy
tabBar.translationY = MathUtils.clamp( tabBar.translationY = MathUtils.clamp(

View File

@ -114,14 +114,6 @@ inline fun View.gone() {
visibility = View.GONE visibility = View.GONE
} }
inline fun View.isVisible(): Boolean {
return visibility == View.VISIBLE
}
inline fun View.visibleIf(show: Boolean) {
visibility = if (show) View.VISIBLE else View.GONE
}
inline fun View.visInvisIf(show: Boolean) { inline fun View.visInvisIf(show: Boolean) {
visibility = if (show) View.VISIBLE else View.INVISIBLE visibility = if (show) View.VISIBLE else View.INVISIBLE
} }