turing-tech / MaterialScrollBar

An Android library that brings the Material Design 5.1 sidebar to pre-5.1 devices.
Apache License 2.0
779 stars 126 forks source link

Too strict attribute definitions #43

Closed MarcinOrlowski closed 8 years ago

MarcinOrlowski commented 8 years ago

Some attributes like i.e. barThickness are not accepting dimentions ("dp") values, just raw values. This is bad and unnecesary, and can be easily corrected by fixing faulty definition of the attributes. Instead of

<attr name="barThickness" format="integer"/>

it should rather be

<attr name="barThickness" format="dimension"/>

or even better

<attr name="barThickness" format="dimension|reference"/>

The same for majority of other attributes. All of then should be extended by adding |reference. As this is small change I do not bother doing PR, but imho attr.xml should be looking like this:

<resources>

    <declare-styleable name="MaterialScrollBar">
        <attr name="recyclerView" format="reference"/>
        <attr name="lightOnTouch" format="boolean|reference"/>
        <attr name="handleColour" format="color|reference"/>
        <attr name="barColour" format="color|reference"/>
        <attr name="handleOffColour" format="color|reference"/>
        <attr name="textColour" format="color|reference"/>
        <attr name="barThickness" format="dimension|reference"/>
    </declare-styleable>

    <declare-styleable name="TouchScrollBar">
        <attr name="hideDelayInMilliseconds" format="integer|reference"/>
        <attr name="autoHide" format="boolean|reference"/>
    </declare-styleable>

</resources>
MarcinOrlowski commented 8 years ago

I sent PR #44

turing-tech commented 8 years ago

I've already got it in the dev environment and I'll push it in a few minutes, but thanks.