Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main
README.md
build.gradle
screenshot.png

README.md

Counter app

Counter displays a text view and a button and counts the number of button clicks.

screenshot

Here's how data binding happens:

// Data
int mClicks = 0;

// Click listener
View.OnClickListener mOnButtonClicked = new View.OnClickListener() {
	public void onClick(View v) {
		mClicks++;
	}
};

// View layout (updated automatically when data changes)
public ViewNode view() {
	return
		v(LinearLayout.class,
			size(FILL, WRAP),
			orientation(LinearLayout.VERTICAL),

			v(TextView.class,
				text("Clicks: " + mClicks)),

			v(Button.class,
				size(FILL, WRAP),
				text("Click me"),
				onClick(mOnButtonClicked)));
}