Default value as a parameter to xml file is not working.
Closed this issue · 4 comments
Any one please suggest me why default value is not working, it is always getting 50% as default value.
I also see this when trying to edit my preferences. I looked into the code, and I believe this is the bug. In MaterialSeekBarController.java, line 89:
mCurrentValue = attrs.getAttributeIntValue(android.R.attr.defaultValue, DEFAULT_CURRENT_VALUE);
The AttributeSet method getAttributeValue takes an int which is an index into the set, but android.R.attr.defaultValue is a constant value (16843245 in my case). So this throws an exception. It is caught, so it defaults to 50.
From reading, I think the correct call should be:
mCurrentValue = attrs.getAttributeIntValue("http://schemas.android.com/apk/res/android", "defaultValue", DEFAULT_CURRENT_VALUE);
I cannot test since I am hooking into the original package via gradle, and am not up for forking and testing that way. :-) I would be curious to know if I am right though.
- Tyler
Update: After posting this comment, I saw the pull request that is waiting. This is the fix for this issue. Request to author to accept the pull request.
This pull request solves the problem: #23
I understand that, but the owner of this repo needs to accept this pull request, yes? I tried a trick to get your fork via gradle and jitpick.io, but haven't gotten it working quite yet. I wasn't really up for doing my own fork just for a one line fix. Thanks!
@manj1790 @tylerwilson @dmytroKarataiev
Sorry for not responding for so long, but I finally came back to work on this lib. I just pushed a new release that fixed most of the known bugs(and added a bit of a new stuff). Though notice that it has some breaking changes, so you'll have to edit couple of xml/java lines manually to make it to work.
Read README.md for more deteils :D