From ad9bad3d17aa01140e5dc339c71e19f405caaf90 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 17 Apr 2021 13:07:25 -0400 Subject: [PATCH] Adjust ActionToolbar positioning Have I ever mentioned that I hate insets? --- .../eu/kanade/tachiyomi/ui/library/LibraryController.kt | 6 ++++++ .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 3 ++- .../java/eu/kanade/tachiyomi/ui/manga/MangaController.kt | 5 +++++ .../kanade/tachiyomi/ui/recent/updates/UpdatesController.kt | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) 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 f9ada2c8c3..d6f73899eb 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 @@ -18,6 +18,7 @@ import com.google.android.material.tabs.TabLayout import com.jakewharton.rxrelay.BehaviorRelay import com.jakewharton.rxrelay.PublishRelay import com.tfcporciuncula.flow.Preference +import dev.chrisbanes.insetter.applyInsetter import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Manga @@ -165,6 +166,11 @@ class LibraryController( override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { binding = LibraryControllerBinding.inflate(inflater) + binding.actionToolbar.applyInsetter { + type(navigationBars = true) { + margin(bottom = true) + } + } return binding.root } 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 12d91a95df..0865205403 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 @@ -13,6 +13,7 @@ import androidx.core.view.ViewCompat import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.isVisible +import androidx.core.view.marginTop import androidx.core.view.updateLayoutParams import androidx.lifecycle.lifecycleScope import androidx.preference.PreferenceDialogController @@ -448,7 +449,7 @@ class MainActivity : BaseViewBindingActivity() { fun fixViewToBottom(view: View) { val listener = AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset -> val maxAbsOffset = appBarLayout.measuredHeight - binding.tabs.measuredHeight - view.translationY = -maxAbsOffset - verticalOffset.toFloat() + view.translationY = -maxAbsOffset - verticalOffset.toFloat() + appBarLayout.marginTop } binding.appbar.addOnOffsetChangedListener(listener) fixedViewsToBottom[view] = listener 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 96f4ceb132..d4512d7c6e 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 @@ -206,6 +206,11 @@ class MangaController : padding() } } + binding.actionToolbar.applyInsetter { + type(navigationBars = true) { + margin(bottom = true) + } + } 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 3f1f3e5773..4dca1f14ac 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 @@ -78,6 +78,11 @@ class UpdatesController : padding() } } + binding.actionToolbar.applyInsetter { + type(navigationBars = true) { + margin(bottom = true) + } + } return binding.root }