Skip to content

anvil-ui/anvil-examples

Repository files navigation

Anvil samples

Anvil is a tiny reactive UI library for Android. Inspired by React and Mithril, it brings declarative data binding, unidirectional data flow and componentization and other things that would make your code look cleaner and easier to maintain.

This repository contains small examples of how Anvil can be used.

Example projects

  • Hello - simple static layout with a classical text message
    • how to start Anvil project
    • how to write layouts without XML
  • Counter - simple click counter
    • how to bind variables to views
    • how to bind event listeners to views
    • how easy is to to keep UI in sync with data (automatic rendering)
  • Login form - two input fields, push button and some logic behind them
    • how to use text watcher bindings
    • how to use Java 8 method references as event bindings
  • Item picker - animated item picker component with next/prev buttons
    • how to use animations
    • how to use states
    • how to use currentView() to get access to the real View object
    • how to use Java8 lambdas in Anvil
  • Currency exchange app - fetches latest currency rates from the backend, calculates converted values as you type.
    • how to separate model logic from the view logic
    • how to separate view styling from view hierarchy
    • how to bind adapters
    • how to get two-directional data binding for text input
  • Countdone clone (current Anvil example) - pomodoro-like app: define how long the task should take and see if you finish it in time
    • how to use backstack having just one activity
    • how to save component state
    • how to use custom fonts and icon fonts
  • Todo app - classical MVC example: add tasks, check tasks, remove checked tasks

About

Short and descriptive examples for the Anvil MVC framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published