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 eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
class CoverViewTarget(
view: ImageView,
@ -17,7 +16,7 @@ class CoverViewTarget(
) : ImageViewTarget(view) {
override fun onError(error: Drawable?) {
progress?.gone()
progress?.isVisible = false
view.scaleType = ImageView.ScaleType.CENTER
val vector = VectorDrawableCompat.create(
view.context.resources,
@ -35,7 +34,7 @@ class CoverViewTarget(
}
override fun onSuccess(result: Drawable) {
progress?.gone()
progress?.isVisible = false
view.scaleType = scaleType
super.onSuccess(result)
}

View File

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

View File

@ -8,12 +8,12 @@ import android.util.AttributeSet
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import androidx.core.view.isVisible
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.databinding.DownloadButtonBinding
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.widget.EndAnimatorListener
@ -89,24 +89,24 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
)
when (state) {
Download.CHECKED -> {
binding.downloadProgress.gone()
binding.downloadProgress.isVisible = false
binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone()
binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(filledCircle)
binding.downloadBorder.drawable.setTint(activeColor)
binding.downloadIcon.drawable.setTint(Color.WHITE)
}
Download.NOT_DOWNLOADED -> {
binding.downloadBorder.visible()
binding.downloadProgress.gone()
binding.downloadProgressIndeterminate.gone()
binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadBorder.drawable.setTint(activeColor)
binding.downloadIcon.drawable.setTint(activeColor)
}
Download.QUEUE -> {
binding.downloadBorder.gone()
binding.downloadProgress.gone()
binding.downloadBorder.isVisible = false
binding.downloadProgress.isVisible = false
binding.downloadProgressIndeterminate.visible()
binding.downloadProgress.isIndeterminate = true
binding.downloadIcon.drawable.setTint(disabledColor)
@ -114,7 +114,7 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
Download.DOWNLOADING -> {
binding.downloadBorder.visible()
binding.downloadProgress.visible()
binding.downloadProgressIndeterminate.gone()
binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadProgress.isIndeterminate = false
binding.downloadProgress.progress = progress
@ -132,9 +132,9 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
}
}
Download.DOWNLOADED -> {
binding.downloadProgress.gone()
binding.downloadProgress.isVisible = false
binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone()
binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.drawable.setTint(downloadedColor)
if (animated) {
binding.downloadBorder.setImageDrawable(filledAnim)
@ -159,9 +159,9 @@ class DownloadButton @JvmOverloads constructor(context: Context, attrs: Attribut
}
}
Download.ERROR -> {
binding.downloadProgress.gone()
binding.downloadProgress.isVisible = false
binding.downloadBorder.visible()
binding.downloadProgressIndeterminate.gone()
binding.downloadProgressIndeterminate.isVisible = false
binding.downloadBorder.setImageDrawable(borderCircle)
binding.downloadBorder.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.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
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) {
this.isVisible = inLibrary
binding.unreadAngle.gone()
binding.unreadAngle.isVisible = false
binding.unreadText.updatePaddingRelative(start = 5.dpToPx)
binding.unreadText.isVisible = inLibrary
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.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.isExpanded
import eu.kanade.tachiyomi.util.view.isHidden
@ -508,7 +507,7 @@ class LibraryController(
}
},
onLeavingController = {
binding.headerCard.gone()
binding.headerCard.isVisible = false
},
onBottomNavUpdate = {
updateFilterSheetY()
@ -599,7 +598,7 @@ class LibraryController(
@SuppressLint("RtlHardcoded", "ClickableViewAccessibility")
private fun setUpHopper() {
binding.categoryHopperFrame.gone()
binding.categoryHopperFrame.isVisible = false
binding.roundedCategoryHopper.downCategory.setOnClickListener {
jumpToNextCategory(true)
}
@ -922,7 +921,7 @@ class LibraryController(
}
singleCategory = presenter.categories.size <= 1
showDropdown()
binding.progress.gone()
binding.progress.isVisible = false
if (!freshStart) {
justStarted = false
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.image.coil.loadLibraryManga
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.
@ -34,10 +33,10 @@ class LibraryGridHolder(
init {
binding.playLayout.setOnClickListener { playButtonClicked() }
if (compact) {
binding.textLayout.gone()
binding.textLayout.isVisible = false
} else {
binding.compactTitle.gone()
binding.gradient.gone()
binding.compactTitle.isVisible = false
binding.gradient.isVisible = false
val playLayout = binding.playLayout.layoutParams as FrameLayout.LayoutParams
val buttonLayout = binding.playButton.layoutParams as FrameLayout.LayoutParams
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.util.system.dpToPx
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.visible
import uy.kohesive.injekt.Injekt
@ -108,26 +107,26 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd
adapter.mode == SelectableAdapter.Mode.MULTI -> {
binding.checkbox.isVisible = !category.isHidden
binding.collapseArrow.isVisible = category.isHidden && !adapter.isSingleCategory
binding.updateButton.gone()
binding.catProgress.gone()
binding.updateButton.isVisible = false
binding.catProgress.isVisible = false
setSelection()
}
category.id ?: -1 < 0 -> {
binding.collapseArrow.gone()
binding.checkbox.gone()
binding.catProgress.gone()
binding.updateButton.gone()
binding.collapseArrow.isVisible = false
binding.checkbox.isVisible = false
binding.catProgress.isVisible = false
binding.updateButton.isVisible = false
}
LibraryUpdateService.categoryInQueue(category.id) -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.checkbox.gone()
binding.checkbox.isVisible = false
binding.catProgress.isVisible = true
binding.updateButton.isInvisible = true
}
else -> {
binding.collapseArrow.isVisible = !adapter.isSingleCategory
binding.catProgress.gone()
binding.checkbox.gone()
binding.catProgress.isVisible = false
binding.checkbox.isVisible = false
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.databinding.MangaListItemBinding
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.visible
@ -44,15 +43,15 @@ class LibraryListHolder(
}
if (item.manga.status == -1) {
binding.title.text = null
binding.title.gone()
binding.title.isVisible = false
} else {
binding.title.text = itemView.context.getString(R.string.category_is_empty)
}
binding.title.textAlignment = View.TEXT_ALIGNMENT_CENTER
binding.card.gone()
binding.unreadDownloadBadge.badgeView.gone()
binding.padding.gone()
binding.subtitle.gone()
binding.card.isVisible = false
binding.unreadDownloadBadge.badgeView.isVisible = false
binding.padding.isVisible = false
binding.subtitle.isVisible = false
return
}
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.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout
@ -147,8 +146,8 @@ class FilterTagGroup@JvmOverloads constructor(context: Context, attrs: Attribute
} else {
mainButton.isActivated = true
listener?.onFilterClicked(this, index, callBack)
buttons.forEach { if (it != mainButton) it.gone() }
separators.forEach { it.gone() }
buttons.forEach { if (it != mainButton) it.isVisible = false }
separators.forEach { it.isVisible = false }
}
mainButton.setTextColor(
context.getResourceColor(

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.library.filter
import android.view.View
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
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.databinding.CategoriesItemBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.view.gone
/**
* Category item for a recycler view.
@ -76,8 +76,8 @@ class ManageFilterItem(val char: Char) : AbstractFlexibleItem<ManageFilterItem.H
private val binding = CategoriesItemBinding.bind(view)
init {
binding.image.gone()
binding.editButton.gone()
binding.image.isVisible = false
binding.editButton.isVisible = false
binding.editText.isEnabled = false
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.view.doOnApplyWindowInsets
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.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePadding
@ -232,7 +231,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
supportActionBar?.setDisplayShowCustomEnabled(true)
setNavBarColor(content.rootWindowInsets)
binding.bottomView.gone()
binding.bottomView.isVisible = false
content.doOnApplyWindowInsets { v, insets, _ ->
setNavBarColor(insets)
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.Intent
import android.os.Bundle
import androidx.core.view.isVisible
import com.bluelinelabs.conductor.Controller
import com.bluelinelabs.conductor.RouterTransaction
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.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.withFadeTransaction
class SearchActivity : MainActivity() {
@ -68,8 +68,8 @@ class SearchActivity : MainActivity() {
binding.toolbar.navigationIcon = drawerArrow
drawerArrow?.progress = 1f
binding.bottomNav.gone()
binding.bottomView.gone()
binding.bottomNav.isVisible = false
binding.bottomView.isVisible = false
}
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.util.system.getResourceColor
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.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
@ -110,7 +109,7 @@ class MangaHeaderHolder(
binding.mangaSummary.setTextIsSelectable(true)
binding.mangaGenresTags.visible()
binding.lessButton.visible()
binding.moreButtonGroup.gone()
binding.moreButtonGroup.isVisible = false
binding.title.maxLines = Integer.MAX_VALUE
}
}
@ -119,8 +118,8 @@ class MangaHeaderHolder(
binding.mangaSummary.setTextIsSelectable(false)
binding.mangaSummary.isClickable = true
binding.mangaSummary.maxLines = 3
binding.mangaGenresTags.gone()
binding.lessButton.gone()
binding.mangaGenresTags.isVisible = false
binding.lessButton.isVisible = false
binding.moreButtonGroup.visible()
binding.title.maxLines = 4
adapter.recyclerView.post {
@ -159,7 +158,7 @@ class MangaHeaderHolder(
if (binding.subItemGroup.visibility != View.GONE) {
if ((binding.mangaSummary.lineCount < 3 && manga.genre.isNullOrBlank()) || binding.lessButton.isVisible) {
binding.mangaSummary.setTextIsSelectable(true)
binding.moreButtonGroup.gone()
binding.moreButtonGroup.isVisible = false
showMoreButton = binding.lessButton.isVisible
} else {
binding.moreButtonGroup.visible()
@ -258,8 +257,8 @@ class MangaHeaderHolder(
binding.filtersText.text = presenter.currentFilters()
if (manga.source == LocalSource.ID) {
binding.webviewButton.gone()
binding.shareButton.gone()
binding.webviewButton.isVisible = false
binding.shareButton.isVisible = false
}
if (!manga.initialized) return
@ -311,13 +310,13 @@ class MangaHeaderHolder(
}
fun collapse() {
binding.subItemGroup.gone()
binding.startReadingButton.gone()
binding.subItemGroup.isVisible = false
binding.startReadingButton.isVisible = false
if (binding.moreButton.isVisible || binding.moreButton.isInvisible) {
binding.moreButtonGroup.isInvisible = true
} else {
binding.lessButton.gone()
binding.mangaGenresTags.gone()
binding.lessButton.isVisible = false
binding.mangaGenresTags.isVisible = false
}
}
@ -344,7 +343,7 @@ class MangaHeaderHolder(
fun expand() {
binding.subItemGroup.visible()
if (!showMoreButton) binding.moreButtonGroup.gone()
if (!showMoreButton) binding.moreButtonGroup.isVisible = false
else {
if (binding.mangaSummary.maxLines != Integer.MAX_VALUE) binding.moreButtonGroup.visible()
else {

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.manga.MangaDetailsAdapter
import eu.kanade.tachiyomi.util.chapter.ChapterUtil
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.widget.EndAnimatorListener
import eu.kanade.tachiyomi.widget.StartAnimatorListener
@ -115,7 +114,7 @@ class ChapterHolder(
anim2.startDelay = 500
anim2.addUpdateListener {
if (binding.leftView.isVisible && binding.frontView.translationX <= 0) {
binding.leftView.gone()
binding.leftView.isVisible = false
binding.rightView.visible()
}
}
@ -153,7 +152,7 @@ class ChapterHolder(
fun notifyStatus(status: Int, locked: Boolean, progress: Int, animated: Boolean = false) = with(binding.downloadButton.downloadButton) {
if (locked) {
gone()
isVisible = false
return
}
isVisible = !localSource

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import android.view.View
import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import coil.Coil
import coil.request.LoadRequest
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.util.system.getResourceColor
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.visible
import eu.kanade.tachiyomi.util.view.withFadeTransaction
@ -109,12 +109,12 @@ class MigrationProcessHolder(
)
}
} else {
binding.migrationMangaCardTo.progress.gone()
binding.migrationMangaCardTo.progress.isVisible = false
binding.migrationMangaCardTo.title.text =
view.context.getString(R.string.no_alternatives_found)
}
binding.migrationMenu.visible()
binding.skipManga.gone()
binding.skipManga.isVisible = false
adapter.sourceFinished()
}
}
@ -135,7 +135,7 @@ class MigrationProcessHolder(
private fun MangaGridItemBinding.attachManga(manga: Manga, source: Source, isTo: Boolean) {
(root.layoutParams as ConstraintLayout.LayoutParams).verticalBias = 1f
progress.gone()
progress.isVisible = false
val request = LoadRequest.Builder(view.context).data(manga)
.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.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.isCollapsed
import eu.kanade.tachiyomi.util.view.isExpanded
@ -655,7 +654,7 @@ class ReaderActivity :
presenter.loadPreviousChapter()
}
if (result) {
binding.readerNav.leftChapter.gone()
binding.readerNav.leftChapter.isVisible = false
binding.readerNav.leftProgress.visible()
} else {
toast(
@ -678,7 +677,7 @@ class ReaderActivity :
presenter.loadPreviousChapter()
}
if (result) {
binding.readerNav.rightChapter.gone()
binding.readerNav.rightChapter.isVisible = false
binding.readerNav.rightProgress.visible()
} else {
toast(
@ -827,7 +826,7 @@ class ReaderActivity :
toolbarAnimation.setAnimationListener(
object : SimpleAnimationListener() {
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
binding.chaptersSheet.chaptersBottomSheet.sheetBehavior?.hide()
} else {
binding.readerMenu.gone()
binding.readerMenu.isVisible = false
}
}
menuStickyVisible = false
@ -960,7 +959,7 @@ class ReaderActivity :
* method to the current viewer, but also set the subtitle on the binding.toolbar.
*/
fun setChapters(viewerChapters: ViewerChapters) {
binding.pleaseWait.gone()
binding.pleaseWait.isVisible = false
if (indexChapterToShift != null && indexPageToShift != null) {
viewerChapters.currChapter.pages?.find { it.index == indexPageToShift && it.chapter.chapter.id == indexChapterToShift }?.let {
(viewer as? PagerViewer)?.updateShifting(it)
@ -1012,8 +1011,8 @@ class ReaderActivity :
binding.readerNav.leftChapter.visible()
binding.readerNav.rightChapter.visible()
binding.readerNav.leftProgress.gone()
binding.readerNav.rightProgress.gone()
binding.readerNav.leftProgress.isVisible = false
binding.readerNav.rightProgress.isVisible = false
binding.chaptersSheet.root.resetChapter()
}
if (show) {
@ -1512,7 +1511,7 @@ class ReaderActivity :
.onEach { setColorFilterValue(it) }
.launchIn(scope)
} else {
binding.colorOverlay.gone()
binding.colorOverlay.isVisible = false
}
}
@ -1542,7 +1541,7 @@ class ReaderActivity :
val alpha = (abs(value) * 2.56).toInt()
binding.brightnessOverlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
} 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.view.collapse
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.isExpanded
import eu.kanade.tachiyomi.util.view.visible
@ -129,7 +128,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
presenter.loadChapter(item.chapter)
loadingPos = position
val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(position) as? ReaderChapterItem.ViewHolder)?.binding
itemView?.bookmarkImage?.gone()
itemView?.bookmarkImage?.isVisible = false
itemView?.progress?.visible()
}
true
@ -171,7 +170,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
fun resetChapter() {
val itemView = (binding.chapterRecycler.findViewHolderForAdapterPosition(loadingPos) as? ReaderChapterItem.ViewHolder)?.binding
itemView?.bookmarkImage?.visible()
itemView?.progress?.gone()
itemView?.progress?.isVisible = false
}
fun refreshList() {

View File

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

View File

@ -6,6 +6,7 @@ import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup.LayoutParams
import androidx.core.view.isVisible
import androidx.viewpager.widget.ViewPager
import eu.kanade.tachiyomi.R
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.viewer.BaseViewer
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
@ -81,7 +81,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
}
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.offscreenPageLimit = 1
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.util.system.ImageUtil
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.visible
import eu.kanade.tachiyomi.widget.GifViewTarget
@ -239,7 +238,7 @@ class WebtoonPageHolder(
private fun setQueued() {
progressContainer.visible()
progressBar.visible()
retryContainer?.gone()
retryContainer?.isVisible = false
removeDecodeErrorLayout()
}
@ -249,7 +248,7 @@ class WebtoonPageHolder(
private fun setLoading() {
progressContainer.visible()
progressBar.visible()
retryContainer?.gone()
retryContainer?.isVisible = false
removeDecodeErrorLayout()
}
@ -259,7 +258,7 @@ class WebtoonPageHolder(
private fun setDownloading() {
progressContainer.visible()
progressBar.visible()
retryContainer?.gone()
retryContainer?.isVisible = false
removeDecodeErrorLayout()
}
@ -270,7 +269,7 @@ class WebtoonPageHolder(
progressContainer.visible()
progressBar.visible()
progressBar.completeAndFadeOut()
retryContainer?.gone()
retryContainer?.isVisible = false
removeDecodeErrorLayout()
unsubscribeReadImageHeader()
@ -309,7 +308,7 @@ class WebtoonPageHolder(
* Called when the page has an error.
*/
private fun setError() {
progressContainer.gone()
progressContainer.isVisible = false
initRetryLayout().visible()
}
@ -317,14 +316,14 @@ class WebtoonPageHolder(
* Called when the image is decoded and going to be displayed.
*/
private fun onImageDecoded() {
progressContainer.gone()
progressContainer.isVisible = false
}
/**
* Called when the image fails to decode.
*/
private fun onImageDecodeError() {
progressContainer.gone()
progressContainer.isVisible = false
initDecodeErrorLayout().visible()
}

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source
import android.content.res.ColorStateList
import android.view.View
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.SourceItemBinding
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.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.compatToolTipText
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
class SourceHolder(view: View, val adapter: SourceAdapter) :
@ -60,7 +60,7 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
if (source.supportsLatest) {
binding.sourceLatest.visible()
} 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.dpToPx
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.scrollViewWith
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
@ -528,7 +527,7 @@ open class BrowseSourceController(bundle: Bundle) :
* Shows the binding.progress bar.
*/
private fun showProgressBar() {
binding.emptyView.gone()
binding.emptyView.isVisible = false
binding.progress.visible()
snack?.dismiss()
snack = null
@ -538,8 +537,8 @@ open class BrowseSourceController(bundle: Bundle) :
* Hides active binding.progress bars.
*/
private fun hideProgressBar() {
binding.emptyView.gone()
binding.progress.gone()
binding.emptyView.isVisible = false
binding.progress.isVisible = false
}
/**

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.source.browse
import android.app.Activity
import android.view.View
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import coil.Coil
import coil.api.clear
@ -9,10 +10,9 @@ import coil.request.LoadRequest
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible
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.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.
@ -32,10 +32,10 @@ class BrowseSourceGridHolder(
private val binding = MangaGridItemBinding.bind(view)
init {
if (compact) {
binding.textLayout.gone()
binding.textLayout.isVisible = false
} else {
binding.compactTitle.gone()
binding.gradient.gone()
binding.compactTitle.isVisible = false
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.migration.SearchController
import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
/**
@ -68,12 +67,12 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
showHolder()
}
results.isEmpty() -> {
binding.progress.gone()
binding.progress.isVisible = false
binding.noResults.visible()
binding.sourceCard.gone()
binding.sourceCard.isVisible = false
}
else -> {
binding.progress.gone()
binding.progress.isVisible = false
showHolder()
}
}
@ -111,6 +110,6 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
private fun showHolder() {
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.view.Menu
import android.view.View
import androidx.core.view.isVisible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
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].
@ -22,7 +22,7 @@ class LatestUpdatesController(bundle: Bundle) : BrowseSourceController(bundle) {
override fun onViewCreated(view: View) {
super.onViewCreated(view)
binding.fab.gone()
binding.fab.isVisible = false
}
override fun createPresenter(): BrowseSourcePresenter {

View File

@ -106,10 +106,6 @@ inline fun View.visible() {
visibility = View.VISIBLE
}
inline fun View.gone() {
visibility = View.GONE
}
inline val View.marginTop: Int
get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0

View File

@ -6,11 +6,11 @@ import android.view.LayoutInflater
import android.widget.RelativeLayout
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.core.view.isVisible
import com.google.android.material.button.MaterialButton
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.CommonViewEmptyBinding
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.visible
@ -24,7 +24,7 @@ class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
* Hide the information view
*/
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.ViewGroup
import android.widget.ImageView
import androidx.core.view.isVisible
import coil.target.ImageViewTarget
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible
class GifViewTarget(view: ImageView, private val progressBar: View?, private val decodeErrorLayout: ViewGroup?) : ImageViewTarget(view) {
override fun onError(error: Drawable?) {
progressBar?.gone()
progressBar?.isVisible = false
decodeErrorLayout?.visible()
}
override fun onSuccess(result: Drawable) {
progressBar?.gone()
decodeErrorLayout?.gone()
progressBar?.isVisible = false
decodeErrorLayout?.isVisible = false
super.onSuccess(result)
}
}