-
Notifications
You must be signed in to change notification settings - Fork 4
Propoid ui
svenmeier edited this page Jan 18, 2012
·
9 revisions
With propoid-ui you can bind a property to a view with a single line of code:
TextBinding.string(foo.stringProperty, editText);All changes to the property are automatically propagated to the view and vice versa.
Converters allow conversion for a TextBinding:
new TextBinding(foo.intProperty, editText, new NumberConverter(R.string.NO_NUMBER));Factory methods make it convenient for the following property types:
TextBinding.string(foo.stringProperty, editText);
TextBinding.number(foo.intProperty, editText);Conversion errors are automatically reported on the view.
Boolean properties can be bound to CheckBox views view CheckBinding:
new CheckBinding(foo.booleanProperty, checkBox);Properties can be bound to a spinner via SpinnerBinding:
new SpinnerBinding(foo.barProperty, spinner, listAdapter);You don't need to implement your own list adapter though. With a Converter you can conveniently use a list (or varargs) for the choices:
new SpinnerBinding(foo.barProperty, spinner, converter, bar1, bar2, bar3);Factory methods make it even simpler for the following property types:
SpinnerBinding.string(foo.stringProperty, spinner, "A", "B", "C");
SpinnerBinding.number(foo.intProperty, spinner, 100, 200, 300);
SpinnerBinding.enumeration(foo.barProperty, spinner, Bar.values());