Open
Description
🐛 Bug Report
Describe the Bug
Using the WormIndicatorType can cause a crash (IllegalArgumentException: Padding must be non-negative
) if the user forces RTL layout direction.
Steps to Reproduce
Steps to reproduce the behavior:
- Go to System Settings > Developer Options
- Enable 'Force RTL layout direction'
- Open a sample app that implements
WormIndicatorType
- Sample app crashes with
IllegalArgumentException
Expected Behavior
App should not crash.
Actual Behavior
App crashes.
Screenshots or Videos
N/A
Environment
- Library version: [5.1.0]
- Android version: [14]
- Device: [Samsung S22]
- ViewPager for Jetpack Compose or XML: Jetpack Compose
- ViewPager type: ViewPager2
Additional Context
The width measurements stays LTR direction, which results a bigger value of firstDotPositionX
than the lastDotPositionX
. The value of distanceBetween2DotsDp
will be negative and multiplying with this value cause negative paddings.
Locally, I could fix the issue by getting the current LayoutDirection and setting the firstDotPositionX
and lastDotPositionX
based on that's value.