mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:25:10 +01:00
Insets for webview and tracking tab
With this all controllers insets should be handled
This commit is contained in:
parent
507807eee0
commit
2ec46a7098
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.manga.info
|
package eu.kanade.tachiyomi.ui.manga.info
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -9,7 +10,11 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
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.WebViewClientCompat
|
||||||
|
import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
||||||
|
import eu.kanade.tachiyomi.util.marginBottom
|
||||||
|
import eu.kanade.tachiyomi.util.updateLayoutParams
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) {
|
class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) {
|
||||||
@ -38,6 +43,14 @@ class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) {
|
|||||||
return true
|
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.javaScriptEnabled = true
|
||||||
web.settings.userAgentString = source.headers["User-Agent"]
|
web.settings.userAgentString = source.headers["User-Agent"]
|
||||||
web.loadUrl(url, headers)
|
web.loadUrl(url, headers)
|
||||||
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||||
|
import eu.kanade.tachiyomi.util.RecyclerWindowInsetsListener
|
||||||
import eu.kanade.tachiyomi.util.toast
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import kotlinx.android.synthetic.main.track_controller.*
|
import kotlinx.android.synthetic.main.track_controller.*
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
@ -44,6 +45,7 @@ class TrackController : NucleusController<TrackPresenter>(),
|
|||||||
with(view) {
|
with(view) {
|
||||||
track_recycler.layoutManager = LinearLayoutManager(context)
|
track_recycler.layoutManager = LinearLayoutManager(context)
|
||||||
track_recycler.adapter = adapter
|
track_recycler.adapter = adapter
|
||||||
|
track_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
|
||||||
swipe_refresh.isEnabled = false
|
swipe_refresh.isEnabled = false
|
||||||
swipe_refresh.refreshes().subscribeUntilDestroy { presenter.refresh() }
|
swipe_refresh.refreshes().subscribeUntilDestroy { presenter.refresh() }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user