I'll try to explain my problem.
In my application I have a bunch of forms. Around 13 forms. Its a institutional application, so the forms are required to work within the app.
The first form I did, the field labels and the drop down options were not a problem, they were short and concise. In this second form I'm having a problem as you can see in the two images below.
This first image represents the field label, its not that short:
IMAGE REMOVED
When the user clicks the drop down related to this field, the options are shown:
IMAGE REMOVED
There is no way for me to decrease the length of text (only if I could...). So as you can see they are pretty long. When I select one of this options, I got this result, which is not that pretty and the text is incomplete:
IMAGE REMOVED
The same thing happens when the drop down is multi choice.
So my only way out would be to specify that only in this form, only in drop down fields, I want the formElementValue
to be:
android:inputType="textMultiLine"
maxLines="5"
I know there is two other ways:
- Overwrite the
form_element
. Downside is that it would be applicable to all forms in my application, to all fields.
- Create a custom field. My problem with custom fields in this package (not that I don't appreciate your work on this) is that its too much boilerplate code to write.
My idea would be something like this:
textArea(Fields.MyField.ordinal) {
title = "Ocupation"
layout = R.layout.my_text_area_layout
}
switch<String>(Fields.MyField.ordinal) {
title = "This is my title"
onValue = "Yes"
offValue = "No"
layout = R.layout.switch_with_additional_text
}
Or, if we could specify that for only the form being built, something like this:
// Build the form
val formBuilder = form(context!!, my_recycler, cacheForm = true) {
dropDown<SpinnerOption>(Field.MyField.ordinal) {
title = "My Field"
options = listOf()
hint = getString(R.string.form_selecione)
dialogTitle = hint
// Specify custom only for this
layout = R.layout.special_layout
}
}
// Specify custom layouts
// Dont mind this sytax, I'm a kotlin beginner
formBuilder.layouts {
dropDown(R.layout.multiline_dropdown)
textArea(R.layout.textarea_additional_info)
text(R.layout.no_text_option)
}
What do you think? Is this something possible to implement? Difficult, maybe?