Reader seekbar now above gesture area

Co-Authored-By: tonarii <tonarii@users.noreply.github.com>
This commit is contained in:
Jay 2019-10-30 21:10:31 -07:00
parent 744b0a3f58
commit ace3147479
2 changed files with 11 additions and 12 deletions

View File

@ -145,6 +145,17 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
config = ReaderConfig()
initializeMenu()
val container: ViewGroup = findViewById(R.id.reader_container)
val readerBHeight = reader_menu_bottom.layoutParams.height
container.doOnApplyWindowInsets { _, insets, padding ->
val bottomInset = if (Build.VERSION.SDK_INT >= 29)
(insets.mandatorySystemGestureInsets.bottom - insets.systemWindowInsetBottom)
else 0
reader_menu_bottom.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = readerBHeight + bottomInset
}
reader_menu_bottom.updatePaddingRelative(bottom = padding.bottom + bottomInset)
}
}
/**

View File

@ -20,8 +20,6 @@ class ReaderSeekBar @JvmOverloads constructor(
* Whether the seekbar should draw from right to left.
*/
var isRTL = false
private val boundingBox: Rect = Rect()
private val exclusions = listOf(boundingBox)
/**
* Draws the seekbar, translating the canvas if using a right to left reader.
@ -45,14 +43,4 @@ class ReaderSeekBar @JvmOverloads constructor(
}
return super.onTouchEvent(event)
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
if (Build.VERSION.SDK_INT >= 29) {
if (changed) {
boundingBox.set(left, top, right, bottom)
systemGestureExclusionRects = exclusions
}
}
}
}