There are hardly any android apps built without forms. It can be daunting especially when you have forms all over the place. Usually they lead to never ending xml files or really long xml files. And then there is the case where the form contains other elements which are not inputs eg info cards, images etc. Most at times we will just repeat the form code in all xmls that they are needed in or probably use the include tag (but there is no for-loop for (not that I know of though.)). We have already achieved component reuse by Componentization in Ogya. All we needed to do was to
https://gist.github.com/6e0a960d9266a2b001f3be9e67d2e232
I see the confusion in type and inputType. So lets break that down.
type This just toggles between date,time and input. Basically they are all inputs but time gives you the opportunity to select from the android TimePicker, date also does the same but gives you a DatePicker instead. Both type time and date gives you an un-editable input. Type input allows you to use the keyboard as the input source.
https://gist.github.com/e9280e514f7f8f639191472429676d27
As you can see the inputType parameter expects the android textInput type. Pass any of these and you will get its respective keyboard.
https://gist.github.com/a8dbd6364705d0590821fe0dafc447c4
https://gist.github.com/048776281b3550ed20183ea22b36556f
This means you can pass any layout you prefer. Just make sure of the following.
-
The layout has an EditText with tag "input". If absent the watcher wont recognize any changes since its only watching for changes on an EditText with tag input.
-
Your component's signature is https://gist.github.com/5ba8eafc66fa42fb09df635727b90cd9
ListableAdapter has been extended with one more function : retrieveFormValues https://gist.github.com/94a12e404f747ae40d2c1b2c652a5e04
And you use it like this: https://gist.github.com/ad4280b2da123377979f680667344ff0
And that's it!