From 5ca4e8ade0d1f0fb90b38f66993f31776f4c7ad5 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Mon, 26 Apr 2021 02:28:04 -0400 Subject: [PATCH] remove visible helper big ups to android studio for breaking indexing hard while I refactor --- .../tachiyomi/ui/category/CategoryHolder.kt | 3 +-- .../ui/category/ManageCategoryDialog.kt | 3 +-- .../tachiyomi/ui/download/DownloadButton.kt | 15 ++++++----- .../tachiyomi/ui/library/LibraryController.kt | 3 +-- .../ui/library/LibraryHeaderHolder.kt | 3 +-- .../tachiyomi/ui/library/LibraryListHolder.kt | 7 +++--- .../ui/library/filter/FilterTagGroup.kt | 9 +++---- .../tachiyomi/ui/manga/MangaHeaderHolder.kt | 17 ++++++------- .../ui/manga/chapter/ChapterHolder.kt | 5 ++-- .../design/MigrationBottomSheetDialog.kt | 3 +-- .../manga/process/MigrationProcessHolder.kt | 19 +++++++------- .../tachiyomi/ui/reader/ReaderActivity.kt | 21 ++++++++-------- .../ui/reader/chapter/ReaderChapterSheet.kt | 9 +++---- .../settings/TabbedReaderSettingsSheet.kt | 6 ++--- .../ui/reader/viewer/pager/PagerPageHolder.kt | 13 +++++----- .../ui/reader/viewer/pager/PagerViewer.kt | 3 +-- .../viewer/webtoon/WebtoonPageHolder.kt | 25 +++++++++---------- .../tachiyomi/ui/source/SourceHolder.kt | 3 +-- .../source/browse/BrowseSourceController.kt | 5 ++-- .../global_search/GlobalSearchHolder.kt | 7 +++--- .../ui/webview/BaseWebViewActivity.kt | 4 +-- .../tachiyomi/util/view/ViewExtensions.kt | 4 --- .../eu/kanade/tachiyomi/widget/EmptyView.kt | 3 +-- .../kanade/tachiyomi/widget/GifViewTarget.kt | 3 +-- 24 files changed, 84 insertions(+), 109 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt index 3b4691434e..e459b16862 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt @@ -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) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/ManageCategoryDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/ManageCategoryDialog.kt index 91496d73f6..f16546b073 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/ManageCategoryDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/ManageCategoryDialog.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadButton.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadButton.kt index 287468b0db..6d6f94f280 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadButton.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadButton.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 33ade990df..8f9b825d2d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt index e3fd9bddfd..1119fcbd5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt @@ -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 } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt index fcd57880bf..0a9897df0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt @@ -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 { 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. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt index 4a62bd8d1b..3fbfa48565 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/FilterTagGroup.kt @@ -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 } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt index e66ac83b4d..9e49759699 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt index f793024fe4..c3eb50897d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt index 5ff9332bbf..23ee5f896e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/design/MigrationBottomSheetDialog.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt index e81f24bfe9..53dacf8cfb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt @@ -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() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 7ad6b8f824..5f6e28d755 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -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()) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt index 3815f124f8..bafd419248 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt index 94b86a3d47..50613fd3f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/settings/TabbedReaderSettingsSheet.kt @@ -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) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index 4caff14df8..fd09d9d2ef 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -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 } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index 0e6fa5208a..6cf80af8e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -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() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt index 96a6f339e7..46d307c197 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt @@ -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 } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt index 6abd91ec0b..1dd48ec3b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt index 3226dc0474..4e4d7649b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt @@ -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 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt index ddba0d64db..2914cbd2de 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/GlobalSearchHolder.kt @@ -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 } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt index 5f335d8523..75c636e8b5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/BaseWebViewActivity.kt @@ -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() { @@ -111,7 +111,7 @@ open class BaseWebViewActivity : BaseActivity() { 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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index e766fcf4af..dfa2c6821c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -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 diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt index fc60783baa..9a476a7386 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt @@ -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( diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/GifViewTarget.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/GifViewTarget.kt index 1d9a6729c7..408688c115 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/GifViewTarget.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/GifViewTarget.kt @@ -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) {