From 2ec46a70981f2f5b8e7147843a1dae99ebe43444 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 27 Oct 2019 20:23:15 -0700 Subject: [PATCH] Insets for webview and tracking tab With this all controllers insets should be handled --- .../ui/manga/info/MangaWebViewController.kt | 13 +++++++++++++ .../tachiyomi/ui/manga/track/TrackController.kt | 2 ++ 2 files changed, 15 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt index 8d7d9687a0..5cef0d4677 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.manga.info +import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -9,7 +10,11 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.BaseController +import eu.kanade.tachiyomi.util.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.WebViewClientCompat +import eu.kanade.tachiyomi.util.doOnApplyWindowInsets +import eu.kanade.tachiyomi.util.marginBottom +import eu.kanade.tachiyomi.util.updateLayoutParams import uy.kohesive.injekt.injectLazy class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) { @@ -38,6 +43,14 @@ class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) { return true } } + val marginB = view.marginBottom + view.doOnApplyWindowInsets{ v, insets, _ -> + val bottomInset = if (Build.VERSION.SDK_INT >= 29) insets.tappableElementInsets.bottom + else insets.systemWindowInsetBottom + v.updateLayoutParams { + bottomMargin = marginB + bottomInset + } + } web.settings.javaScriptEnabled = true web.settings.userAgentString = source.headers["User-Agent"] web.loadUrl(url, headers) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt index 0acf3381d0..cff67f9c17 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackController.kt @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.manga.MangaController +import eu.kanade.tachiyomi.util.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.toast import kotlinx.android.synthetic.main.track_controller.* import timber.log.Timber @@ -44,6 +45,7 @@ class TrackController : NucleusController(), with(view) { track_recycler.layoutManager = LinearLayoutManager(context) track_recycler.adapter = adapter + track_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) swipe_refresh.isEnabled = false swipe_refresh.refreshes().subscribeUntilDestroy { presenter.refresh() } }