Currently working on allowing MVVM in Android Application. This include two-way data binding in data-model with the view object properties. I try to make the binding using fluent-style java syntax (inspired by Fluent-NHibernate), which looks like:


<code>Bind(R.id.TextViewId).StringProperty("text").To(HelloMVVMText);
//or
Bind(R.id.TextViewId).ColorProperty("textColorHightLight").To(HelloMVVMColor);</code>

A number of changes need to make on the original Android View/Widget Classes, for example:


<code>public class DataAwareTextView extends TextView implements IDataAwareObject {...</code>

Every view class, in order to support for data awareness, need to implement IDataAwareObject.

Current state:

One-way binding with string, will add binding to two other property types as well.

Future plan:

  • Implement Two-way binding
  • Rewrite most Android basic widget classes
  • Implement Converter:
    Bind(Id).ColorProperty(“propName”).ConvertFromString(…);
Advertisements