addisonElliott / SegmentedButton

Segmented Control/Button with animation for Android API 16+
Apache License 2.0
148 stars 39 forks source link

Divider rehaul w/ bug fixes & text size bug fix #22

Closed addisonElliott closed 4 years ago

addisonElliott commented 4 years ago

Changes

Rehaul of Divider Info

The previous setup for drawing dividers was mimicking the LinearLayout params to correctly position the dividers in the right spot. However, this had the drawback that if a layout_weight was not specified or fixed widths were given for the buttons, then the dividers would all get drawn at the left.

The new setup is to pass the SegmentedButton class to the divider LinearLayout objects (renamed class to ButtonActor's) so that the width can be measured based on the actual width of the SegmentedButton. Some additional math is performed to offset the width by the divider width appropriately.

The EmptyView class was split into another class called ButtonActor for the divider empty view.

Added some test cases where some button groups are added at run-time to ensure that works as expected. Added test case with fixed-size buttons to ensure that is working as expected.

Fixes #21