remove visible helper

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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