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 f5c2277ac..448f1c7c6 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,6 +2,7 @@ package eu.kanade.tachiyomi.ui.base.controller import android.content.pm.PackageManager.PERMISSION_GRANTED import android.os.Build +import android.view.WindowInsets import androidx.core.content.ContextCompat import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Router @@ -32,3 +33,10 @@ 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 + } 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 1673eb7e1..cf91dcaf4 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 @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.browse.extension +import android.os.Build import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater @@ -7,6 +8,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import com.bluelinelabs.conductor.ControllerChangeHandler import com.bluelinelabs.conductor.ControllerChangeType @@ -16,6 +18,7 @@ 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.insets import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsController @@ -59,6 +62,11 @@ open class ExtensionController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = ExtensionControllerBinding.inflate(inflater) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.recycler.updatePadding(bottom = binding.recycler.paddingBottom + insets!!.systemWindowInsetBottom) + } + 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 cb969b5b8..d56a4d2a0 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 @@ -1,16 +1,19 @@ package eu.kanade.tachiyomi.ui.browse.migration.sources +import android.os.Build import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager 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.insets import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController import eu.kanade.tachiyomi.util.system.openInBrowser @@ -31,6 +34,11 @@ class MigrationSourcesController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = MigrationSourcesControllerBinding.inflate(inflater) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.recycler.updatePadding(bottom = binding.recycler.paddingBottom + insets!!.systemWindowInsetBottom) + } + 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 72ce7529c..6ed5cc6a7 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 @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.browse.source import android.Manifest.permission.WRITE_EXTERNAL_STORAGE import android.app.Dialog +import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -10,6 +11,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.list.listItems @@ -27,6 +29,7 @@ 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.insets import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController @@ -81,6 +84,11 @@ class SourceController : */ override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = SourceMainControllerBinding.inflate(inflater) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.recycler.updatePadding(bottom = binding.recycler.paddingBottom + insets!!.systemWindowInsetBottom) + } + 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 9a10c39bf..416d2497d 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 @@ -1,9 +1,11 @@ package eu.kanade.tachiyomi.ui.library import android.content.Context +import android.os.Build import android.util.AttributeSet import android.view.View import android.widget.FrameLayout +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import eu.davidea.flexibleadapter.FlexibleAdapter @@ -14,6 +16,7 @@ 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.insets import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.inflate @@ -83,6 +86,10 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att } } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + recycler.updatePadding(bottom = recycler.paddingBottom + controller.insets!!.systemWindowInsetBottom) + } + adapter = LibraryCategoryAdapter(this) recycler.setHasFixedSize(true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt index b88127cf5..c1a974975 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.ui.more import android.content.Context +import android.os.Build import android.os.Bundle import android.util.AttributeSet import android.view.LayoutInflater @@ -14,6 +15,7 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadService import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController import eu.kanade.tachiyomi.ui.base.controller.RootController +import eu.kanade.tachiyomi.ui.base.controller.insets import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.category.CategoryController import eu.kanade.tachiyomi.ui.download.DownloadController @@ -48,7 +50,12 @@ class MoreController : val view = super.onCreateView(inflater, container, savedInstanceState) // Padding for bottom nav - view.updatePadding(bottom = view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding)) + val paddingBottom = view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + view.updatePadding(bottom = paddingBottom + insets!!.systemWindowInsetBottom) + } else { + view.updatePadding(bottom = paddingBottom) + } return view } 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 57dd83159..89a26b210 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 @@ -1,11 +1,13 @@ package eu.kanade.tachiyomi.ui.recent.history +import android.os.Build import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.SearchView +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.R @@ -16,6 +18,7 @@ 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.insets import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.source.browse.ProgressItem import eu.kanade.tachiyomi.ui.manga.MangaController @@ -80,6 +83,10 @@ class HistoryController : binding.recycler.setHasFixedSize(true) binding.recycler.adapter = adapter adapter?.fastScroller = binding.fastScroller + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.recycler.updatePadding(bottom = binding.recycler.paddingBottom + insets!!.systemWindowInsetBottom) + } } override fun onDestroyView(view: View) { 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 c38af6063..b34f728ae 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 @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.recent.updates +import android.os.Build import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater @@ -8,6 +9,7 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.view.ActionMode +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.SelectableAdapter @@ -20,6 +22,7 @@ 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.insets import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.offsetAppbarHeight @@ -74,6 +77,11 @@ class UpdatesController : override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = UpdatesControllerBinding.inflate(inflater) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + binding.recycler.updatePadding(bottom = binding.recycler.paddingBottom + insets!!.systemWindowInsetBottom) + } + return binding.root }