remove invisible helper

This commit is contained in:
Jays2Kings 2021-04-26 02:03:59 -04:00
parent dc80b37dbc
commit fa4de0990f
9 changed files with 20 additions and 26 deletions

View File

@ -26,6 +26,7 @@ import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.SearchView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.GestureDetectorCompat
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
@ -88,7 +89,6 @@ import eu.kanade.tachiyomi.util.view.expand
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.invisible
import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.isHidden
import eu.kanade.tachiyomi.util.view.scrollViewWith
@ -857,7 +857,7 @@ class LibraryController(
updateFilterSheetY()
closeTip()
if (binding.filterBottomSheet.filterBottomSheet.sheetBehavior.isHidden()) {
binding.filterBottomSheet.filterBottomSheet.invisible()
binding.filterBottomSheet.filterBottomSheet.isInvisible = true
}
activityBinding?.toolbar?.hideDropdown()
}

View File

@ -6,6 +6,7 @@ import android.util.TypedValue
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import com.github.florent37.viewtooltip.ViewTooltip
import eu.davidea.flexibleadapter.SelectableAdapter
@ -20,7 +21,6 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
import uy.kohesive.injekt.Injekt
@ -121,8 +121,8 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
LibraryUpdateService.categoryInQueue(category.id) -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.checkbox.gone()
binding.catProgress.visible()
binding.updateButton.invisible()
binding.catProgress.isVisible = true
binding.updateButton.isInvisible = true
}
else -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory
@ -136,7 +136,7 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
private fun addCategoryToUpdate() {
if (adapter.libraryListener.updateCategory(flexibleAdapterPosition)) {
binding.catProgress.visible()
binding.updateButton.invisible()
binding.updateButton.isInvisible = true
}
}

View File

@ -8,6 +8,7 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import coil.api.loadAny
import coil.request.CachePolicy
@ -21,7 +22,6 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.isLTR
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.resetStrokeColor
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
@ -313,8 +313,8 @@ class MangaHeaderHolder(
fun collapse() {
binding.subItemGroup.gone()
binding.startReadingButton.gone()
if (binding.moreButton.visibility == View.VISIBLE || binding.moreButton.visibility == View.INVISIBLE) {
binding.moreButtonGroup.invisible()
if (binding.moreButton.isVisible || binding.moreButton.isInvisible) {
binding.moreButtonGroup.isInvisible = true
} else {
binding.lessButton.gone()
binding.mangaGenresTags.gone()

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.databinding.ChapterSortBottomSheetBinding
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.setBottomEdge
import eu.kanade.tachiyomi.util.view.setEdgeToEdge
import kotlin.math.max
@ -118,7 +117,7 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD
val desc = binding.sortGroup.checkedRadioButtonId == R.id.sort_newest
presenter.setGlobalChapterSort(desc)
defPref = desc
binding.setAsDefaultSort.invisible()
binding.setAsDefaultSort.isInvisible = true
}
binding.sortMethodGroup.setOnCheckedChangeListener { _, checkedId ->

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.migration.manga.process
import android.view.View
import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible
import coil.Coil
import coil.request.LoadRequest
import eu.kanade.tachiyomi.R
@ -15,7 +16,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.setVectorCompat
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction
@ -61,7 +61,7 @@ class MigrationProcessHolder(
android.R.attr.textColorPrimary
)
)
binding.migrationMenu.invisible()
binding.migrationMenu.isInvisible = true
binding.skipManga.visible()
binding.migrationMangaCardTo.resetManga()
if (manga != null) {

View File

@ -87,7 +87,6 @@ import eu.kanade.tachiyomi.util.view.compatToolTipText
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.invisible
import eu.kanade.tachiyomi.util.view.isCollapsed
import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.popupMenu
@ -259,7 +258,7 @@ class ReaderActivity :
indexChapterToShift = savedInstanceState.get(SHIFTED_CHAP_INDEX) as? Long
binding.readerNav.root.isInvisible = !menuVisible
} else {
binding.readerNav.root.invisible()
binding.readerNav.root.isInvisible = true
}
binding.chaptersSheet.chaptersBottomSheet.setup(this)

View File

@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -24,7 +25,6 @@ import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.expand
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.isCollapsed
import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.visible
@ -101,14 +101,14 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
activity.binding.readerNav.root.visible()
}
if (state == BottomSheetBehavior.STATE_EXPANDED) {
activity.binding.readerNav.root.invisible()
activity.binding.readerNav.root.isInvisible = true
activity.binding.readerNav.root.alpha = 0f
binding.chapterRecycler.alpha = 1f
if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary
}
if (state == BottomSheetBehavior.STATE_HIDDEN) {
activity.binding.readerNav.root.alpha = 0f
activity.binding.readerNav.root.invisible()
activity.binding.readerNav.root.isInvisible = true
}
binding.chapterRecycler.isClickable = state == BottomSheetBehavior.STATE_EXPANDED
binding.chapterRecycler.isFocusable = state == BottomSheetBehavior.STATE_EXPANDED
@ -123,8 +123,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
false
} else {
if (item.chapter.id != presenter.getCurrentChapter()?.chapter?.id) {
activity.binding.readerNav.leftChapter.invisible()
activity.binding.readerNav.rightChapter.invisible()
activity.binding.readerNav.leftChapter.isInvisible = true
activity.binding.readerNav.rightChapter.isInvisible = true
presenter.loadChapter(item.chapter)
loadingPos = position

View File

@ -11,6 +11,7 @@ import android.webkit.WebChromeClient
import android.webkit.WebView
import android.widget.LinearLayout
import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.WebviewActivityBinding
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
@ -18,7 +19,6 @@ import eu.kanade.tachiyomi.util.system.getPrefTheme
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.isInNightMode
import eu.kanade.tachiyomi.util.system.setDefaultSettings
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.marginBottom
import eu.kanade.tachiyomi.util.view.setStyle
import eu.kanade.tachiyomi.util.view.updateLayoutParams
@ -114,7 +114,7 @@ open class BaseWebViewActivity : BaseActivity<WebviewActivityBinding>() {
binding.progressBar.visible()
binding.progressBar.progress = newProgress
if (newProgress == 100) {
binding.progressBar.invisible()
binding.progressBar.isInvisible = true
}
super.onProgressChanged(view, newProgress)
}

View File

@ -106,10 +106,6 @@ inline fun View.visible() {
visibility = View.VISIBLE
}
inline fun View.invisible() {
visibility = View.INVISIBLE
}
inline fun View.gone() {
visibility = View.GONE
}