fix: add padding to last item in recycler (#293)

* fix: add padding to last item in recycler

Stop guessing numbers to compensate for a view we can measure. by adding a method to measure them.

* fix: avoid scrolling artifacts in nested
This commit is contained in:
TwistedUmbrellaX 2024-03-26 17:10:02 -04:00 committed by GitHub
parent 19b5b11b07
commit 77c57846ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 47 additions and 8 deletions

View file

@ -270,6 +270,29 @@ fun Activity.setNavigationTheme() {
}
}
/**
* Sets clipToPadding false and sets the combined height of navigation bars as bottom padding.
*
* When nesting multiple scrolling views, only call this method on the inner most scrolling view.
*/
fun ViewGroup.setBaseline(navBar: AnimatedBottomBar) {
navBar.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
clipToPadding = false
setPadding(paddingLeft, paddingTop, paddingRight, navBarHeight + navBar.measuredHeight)
}
/**
* Sets clipToPadding false and sets the combined height of navigation bars as bottom padding.
*
* When nesting multiple scrolling views, only call this method on the inner most scrolling view.
*/
fun ViewGroup.setBaseline(navBar: AnimatedBottomBar, overlayView: View) {
navBar.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
overlayView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
clipToPadding = false
setPadding(paddingLeft, paddingTop, paddingRight, navBarHeight + navBar.measuredHeight + overlayView.measuredHeight)
}
fun Activity.reloadActivity() {
Refresh.all()
finish()