-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Support for Data Binding #28
Comments
The problem as you rightly pointed out is the way the custom attribute and its setter method have been named. The naming is incompatible with data binding. I am considering deprecating the prefix and suffix attributes in favor of a more general mechanism (like a format specifier with positional parameters). See #15 Hence I don't see myself updating the library to include this functionality. However, if you take the time to implement it (simply adding a For your question about the date format - see #19 |
@curioustechizen I think the right course of action consists of including the following class in the codebase, the presence of which should be sufficient for the binding to work correctly. However, the version of gradle has to be updated (is that a bad thing...?) from 1.0.0 to at least 1.5.0-alpha1 as mentioned at the top of the Data Binding guide. The latest version of the android-gradle plugin at the time of writing is 2.0.0-beta2. I was trying to do this locally but ran into some difficulties. (Possibly because one can't have data-binding inside a BTW, not only the gradle plugin, but also the build tools and the target sdk should be updated (to API-23). As per the example class in this link, a class like this should appear in the project:
(Note the custom namespace
Note to users: |
A complete example of |
@Dev-iL This is very helpful. Thanks! |
I'm building an app that relies heavily on data binding. I was trying to include an instance of
RelativeTimeTextView
with XML bindings forapp:relative_time_prefix
andapp:reference_time
- however this results in a compilation-time error:I'm not sure if what's causing this is the fact attributes/fields aren't set as
@Bindable
orObservable..
, or that the property setters aren't named like the binding expects (if I understand the Data Binding documentation correctly).Needless to say that when I remove the bindings of these fields from my XML, the compilation succeeds.
It would be awesome if somebody could add this support - and help make the library more future-proof :)
I'm using the following XML (irrelevant portions removed):
P.S.
Does the format
dd/MM/yyyy HH:mm:ss
constitute a valid forapp:reference_time
?The text was updated successfully, but these errors were encountered: