Insets for webview and tracking tab

With this all controllers insets should be handled
This commit is contained in:
Jay 2019-10-27 20:23:15 -07:00
parent 507807eee0
commit 2ec46a7098
2 changed files with 15 additions and 0 deletions

View File

@ -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<ViewGroup.MarginLayoutParams> {
bottomMargin = marginB + bottomInset
}
}
web.settings.javaScriptEnabled = true
web.settings.userAgentString = source.headers["User-Agent"]
web.loadUrl(url, headers)

View File

@ -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<TrackPresenter>(),
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() }
}