From e048d66f74c95941ef90b76dfe0da062d4db8744 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 29 Nov 2020 11:08:06 -0500 Subject: [PATCH] Revert edge to edge This was a bigger headache than it was worth. To note, phone landscape wasn't considered, so the navbar overlaps the content on the side. Additionally, the ability to programatically control the navbar scrim is missing, so it'd have to manually be added. --- .../ui/base/activity/BaseActivity.kt | 5 ----- .../ui/base/controller/ConductorExtensions.kt | 15 ------------- .../browse/extension/ExtensionController.kt | 3 --- .../details/ExtensionDetailsController.kt | 2 -- .../sources/MigrationSourcesController.kt | 2 -- .../ui/browse/source/SourceController.kt | 2 -- .../source/browse/BrowseSourceController.kt | 4 ++-- .../globalsearch/GlobalSearchController.kt | 3 --- .../ui/category/CategoryController.kt | 2 -- .../ui/download/DownloadController.kt | 2 -- .../ui/library/LibraryCategoryView.kt | 3 --- .../kanade/tachiyomi/ui/main/MainActivity.kt | 18 --------------- .../tachiyomi/ui/manga/MangaController.kt | 2 -- .../ui/recent/history/HistoryController.kt | 2 -- .../ui/recent/updates/UpdatesController.kt | 2 -- .../ui/setting/SettingsController.kt | 9 ++------ .../tachiyomi/util/view/ViewExtensions.kt | 11 ---------- .../tachiyomi/util/view/WindowExtensions.kt | 22 ------------------- 18 files changed, 4 insertions(+), 105 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt index 49f276cea5..fabb20102d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.util.system.LocaleHelper -import eu.kanade.tachiyomi.util.view.edgeToEdge import uy.kohesive.injekt.injectLazy import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values @@ -79,10 +78,6 @@ abstract class BaseActivity : AppCompatActivity() { super.onCreate(savedInstanceState) secureActivityDelegate.onCreate() - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - window.edgeToEdge(!isDarkMode && lightTheme != R.style.Theme_Tachiyomi_LightBlue) - } } override fun onResume() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt index da682e408c..f5c2277ace 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt @@ -2,10 +2,7 @@ package eu.kanade.tachiyomi.ui.base.controller import android.content.pm.PackageManager.PERMISSION_GRANTED import android.os.Build -import android.view.View -import android.view.WindowInsets import androidx.core.content.ContextCompat -import androidx.core.view.updatePadding import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.RouterTransaction @@ -35,15 +32,3 @@ fun Controller.withFadeTransaction(): RouterTransaction { .pushChangeHandler(OneWayFadeChangeHandler()) .popChangeHandler(OneWayFadeChangeHandler()) } - -val Controller.insets: WindowInsets? - get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - activity?.window?.decorView?.rootWindowInsets - } else { - null - } - -fun Controller.applyBottomInsetPadding(view: View, paddingBottom: Int = view.paddingBottom) { - val bottomInset = insets?.stableInsetBottom ?: 0 - view.updatePadding(bottom = paddingBottom + bottomInset) -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt index 74ee8341c9..7fe30b04f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt @@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.ExtensionControllerBinding import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsController @@ -25,7 +24,6 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import reactivecircus.flowbinding.appcompat.queryTextChanges import reactivecircus.flowbinding.swiperefreshlayout.refreshes -import uy.kohesive.injekt.api.get /** * Controller to manage the catalogues available in the app. @@ -60,7 +58,6 @@ open class ExtensionController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = ExtensionControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt index b5972a2dd1..a4232d3478 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt @@ -35,7 +35,6 @@ import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.getPreferenceKey import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.util.preference.DSL import eu.kanade.tachiyomi.util.preference.onChange @@ -67,7 +66,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { val themedInflater = inflater.cloneInContext(getPreferenceThemeContext()) binding = ExtensionDetailControllerBinding.inflate(themedInflater) - applyBottomInsetPadding(binding.extensionPrefsRecycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt index 61ce5ea647..cb969b5b8d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt @@ -11,7 +11,6 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.MigrationSourcesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController import eu.kanade.tachiyomi.util.system.openInBrowser @@ -32,7 +31,6 @@ class MigrationSourcesController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = MigrationSourcesControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt index f0874d6211..72ce7529c9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt @@ -27,7 +27,6 @@ import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController @@ -82,7 +81,6 @@ class SourceController : */ override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = SourceMainControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt index 75659df6bc..330c81ffee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt @@ -10,6 +10,7 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView import androidx.core.view.isVisible +import androidx.core.view.updatePadding import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -33,7 +34,6 @@ import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.main.MainActivity @@ -238,7 +238,7 @@ open class BrowseSourceController(bundle: Bundle) : if (filterSheet != null) { // Add bottom padding if filter FAB is visible - applyBottomInsetPadding(recycler, view.resources.getDimensionPixelOffset(R.dimen.fab_list_padding)) + recycler.updatePadding(bottom = view.resources.getDimensionPixelOffset(R.dimen.fab_list_padding)) recycler.clipToPadding = false actionFab?.shrinkOnScroll(recycler) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt index 5d255bab81..9f18df694e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt @@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.manga.MangaController @@ -25,7 +24,6 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import reactivecircus.flowbinding.appcompat.QueryTextEvent import reactivecircus.flowbinding.appcompat.queryTextEvents -import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy /** @@ -60,7 +58,6 @@ open class GlobalSearchController( */ override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = GlobalSearchControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt index fc34bd68e1..dd56920d29 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt @@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.databinding.CategoriesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.shrinkOnScroll @@ -79,7 +78,6 @@ class CategoryController : */ override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = CategoriesControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt index ae57efbc5f..5fb2d934a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt @@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.databinding.DownloadControllerBinding import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.util.view.shrinkOnScroll import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -60,7 +59,6 @@ class DownloadController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = DownloadControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt index bc20680bcc..5043df10de 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.data.preference.PreferenceValues.DisplayMode import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.inflate @@ -84,8 +83,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att } } - controller.applyBottomInsetPadding(recycler) - adapter = LibraryCategoryAdapter(this) recycler.setHasFixedSize(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 86f6c02833..820f72624c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -2,16 +2,13 @@ package eu.kanade.tachiyomi.ui.main import android.app.SearchManager import android.content.Intent -import android.os.Build import android.os.Bundle import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.view.isVisible -import androidx.core.view.marginBottom import androidx.core.view.updateLayoutParams -import androidx.core.view.updatePadding import androidx.preference.PreferenceDialogController import com.bluelinelabs.conductor.Conductor import com.bluelinelabs.conductor.Controller @@ -45,7 +42,6 @@ import eu.kanade.tachiyomi.ui.recent.history.HistoryController import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.lang.launchUI -import eu.kanade.tachiyomi.util.view.applyInsets import kotlinx.coroutines.delay import kotlinx.coroutines.flow.launchIn import timber.log.Timber @@ -85,20 +81,6 @@ class MainActivity : BaseActivity() { setContentView(binding.root) setSupportActionBar(binding.toolbar) - // Inset paddings when drawing edge-to-edge in Android 9+ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - binding.bottomNav.applyInsets { view, systemInsets -> - view.updatePadding(bottom = systemInsets.bottom) - } - - val initialFabBottomMargin = binding.rootFab.marginBottom - binding.rootFab.applyInsets { view, systemInsets -> - view.updateLayoutParams { - bottomMargin = initialFabBottomMargin + systemInsets.bottom - } - } - } - tabAnimator = ViewHeightAnimator(binding.tabs, 0L) bottomNavAnimator = ViewHeightAnimator(binding.bottomNav) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index e4666bfe2f..126c4f8aba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -44,7 +44,6 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController @@ -192,7 +191,6 @@ class MangaController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = MangaControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt index 4825f9d490..57dd831591 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt @@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.databinding.HistoryControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.source.browse.ProgressItem import eu.kanade.tachiyomi.ui.manga.MangaController @@ -69,7 +68,6 @@ class HistoryController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = HistoryControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt index 37cffbc792..ad2a51a3c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt @@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.databinding.UpdatesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController @@ -74,7 +73,6 @@ class UpdatesController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = UpdatesControllerBinding.inflate(inflater) - applyBottomInsetPadding(binding.recycler) return binding.root } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt index bc83df2601..f1f2ecda3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt @@ -11,6 +11,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.updatePadding import androidx.preference.PreferenceController import androidx.preference.PreferenceGroup import androidx.preference.PreferenceScreen @@ -20,7 +21,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.BaseController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding import eu.kanade.tachiyomi.util.system.getResourceColor import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -48,12 +48,7 @@ abstract class SettingsController : PreferenceController() { val view = super.onCreateView(inflater, container, savedInstanceState) if (this is RootController) { - applyBottomInsetPadding( - view, - view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding) - ) - } else { - applyBottomInsetPadding(view) + view.updatePadding(bottom = view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding)) } return view 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 8efd8e5369..c50f111bf7 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 @@ -11,9 +11,6 @@ import androidx.annotation.MenuRes import androidx.annotation.StringRes import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.TooltipCompat -import androidx.core.graphics.Insets -import androidx.core.view.ViewCompat -import androidx.core.view.WindowInsetsCompat import androidx.recyclerview.widget.RecyclerView import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup @@ -120,11 +117,3 @@ inline fun ChipGroup.setChips( addView(chip) } } - -inline fun View.applyInsets(noinline block: (view: View, systemInsets: Insets) -> Unit) { - ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets -> - val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()) - block(view, systemInsets) - insets - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt index 1d5b42ac6a..f7c68eed7b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt @@ -1,29 +1,7 @@ package eu.kanade.tachiyomi.util.view -import android.graphics.Color -import android.os.Build import android.view.View import android.view.Window -import androidx.annotation.RequiresApi - -@RequiresApi(Build.VERSION_CODES.P) -fun Window.edgeToEdge(lightSystemUi: Boolean = false) { - decorView.systemUiVisibility = when { - // Handle light status and navigation bars programmatically to avoid duplicate themes - lightSystemUi -> { - View.SYSTEM_UI_FLAG_LAYOUT_STABLE or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or - View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or - View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - } - else -> { - View.SYSTEM_UI_FLAG_LAYOUT_STABLE or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - } - } - - navigationBarColor = Color.TRANSPARENT -} fun Window.showBar() { decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or