diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt index 64e4e7242d..870f325741 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersSortBottomSheet.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.manga.chapter import android.os.Bundle import android.view.View import android.view.ViewGroup +import androidx.core.view.isInvisible import androidx.core.view.isVisible import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog @@ -14,7 +15,6 @@ import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.setBottomEdge import eu.kanade.tachiyomi.util.view.setEdgeToEdge -import eu.kanade.tachiyomi.util.view.visInvisIf import kotlin.math.max class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetDialog @@ -74,7 +74,7 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD binding.settingsScrollView.paddingTop + binding.settingsScrollView.paddingBottom binding.closeButton.isVisible = isScrollable // making the view gone somehow breaks the layout so lets make it invisible - binding.pill.visInvisIf(!isScrollable) + binding.pill.isInvisible = isScrollable } setOnDismissListener { @@ -104,16 +104,14 @@ class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetD } ) - binding.setAsDefaultSort.visInvisIf( - defPref != presenter.manga.sortDescending() && - presenter.manga.usesLocalSort() - ) + binding.setAsDefaultSort.isInvisible = defPref == presenter.manga.sortDescending() || + !presenter.manga.usesLocalSort() binding.sortGroup.setOnCheckedChangeListener { _, checkedId -> presenter.setSortOrder(checkedId == R.id.sort_newest) - binding.setAsDefaultSort.visInvisIf( - defPref != presenter.manga.sortDescending() && - presenter.manga.usesLocalSort() - ) + binding.setAsDefaultSort.isInvisible = ( + defPref == presenter.manga.sortDescending() || + !presenter.manga.usesLocalSort() + ) } binding.setAsDefaultSort.setOnClickListener { 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 11121e19f3..ff18c48793 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 @@ -25,6 +25,7 @@ import androidx.core.content.ContextCompat import androidx.core.graphics.ColorUtils import androidx.core.view.GestureDetectorCompat import androidx.core.view.ViewCompat +import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import com.afollestad.materialdialogs.MaterialDialog @@ -93,7 +94,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.visInvisIf import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener @@ -257,7 +257,7 @@ class ReaderActivity : lastShiftDoubleState = savedInstanceState.get(SHIFT_DOUBLE_PAGES) as? Boolean indexPageToShift = savedInstanceState.get(SHIFTED_PAGE_INDEX) as? Int indexChapterToShift = savedInstanceState.get(SHIFTED_CHAP_INDEX) as? Long - binding.readerNav.root.visInvisIf(menuVisible) + binding.readerNav.root.isInvisible = !menuVisible } else { binding.readerNav.root.invisible() } 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 1871736c49..94b86a3d47 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 @@ -4,6 +4,7 @@ import android.view.View import android.view.ViewGroup import android.view.WindowManager import androidx.core.content.ContextCompat +import androidx.core.view.isInvisible import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.tabs.TabLayout import eu.kanade.tachiyomi.R @@ -14,7 +15,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.visInvisIf import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog @@ -99,7 +99,7 @@ class TabbedReaderSettingsSheet( binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab?) { window?.setDimAmount(if (tab?.position == filterTabIndex) 0f else ogDim) - readerActivity.binding.appBar.visInvisIf(tab?.position != filterTabIndex) + readerActivity.binding.appBar.isInvisible = tab?.position == filterTabIndex if (tab?.position == 2) { sheetBehavior.skipCollapsed = false sheetBehavior.peekHeight = 110.dpToPx diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/ThemePreference.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/ThemePreference.kt index 41f6bc62f4..9044ccc1b9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/ThemePreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/ThemePreference.kt @@ -6,6 +6,7 @@ import android.content.res.ColorStateList import android.util.AttributeSet import android.view.View import androidx.appcompat.app.AppCompatDelegate +import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.preference.Preference import androidx.preference.PreferenceViewHolder @@ -25,7 +26,6 @@ import eu.kanade.tachiyomi.util.system.Themes import eu.kanade.tachiyomi.util.system.appDelegateNightMode import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.isInNightMode -import eu.kanade.tachiyomi.util.view.visInvisIf import uy.kohesive.injekt.injectLazy class ThemePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : @@ -146,7 +146,7 @@ class ThemePreference @JvmOverloads constructor(context: Context, attrs: Attribu binding.themeNameText.setText(item.theme.nameRes) binding.checkbox.isVisible = item.isSelected - binding.themeSelected.visInvisIf(item.isSelected) + binding.themeSelected.isInvisible = !item.isSelected if (binding.checkbox.isVisible) { val themeMatchesApp = if (context.isInNightMode()) { 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 12b9721828..8cb5ff1649 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 @@ -114,10 +114,6 @@ inline fun View.gone() { visibility = View.GONE } -inline fun View.visInvisIf(show: Boolean) { - visibility = if (show) View.VISIBLE else View.INVISIBLE -} - inline val View.marginTop: Int get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0