-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable drop down answer option. #2526
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,12 @@ internal object DropDownViewHolderFactory : | |
hint = questionnaireViewItem.enabledDisplayItems.localizedFlyoverSpanned | ||
helperText = getRequiredOrOptionalText(questionnaireViewItem, context) | ||
} | ||
val initialAnswerString = | ||
if (questionnaireViewItem.questionnaireItem.hasInitial()) { | ||
questionnaireViewItem.questionnaireItem.initial.first().valueStringType.valueAsString | ||
} else { | ||
context.getString(R.string.hyphen) | ||
} | ||
val answerOptionList = | ||
this.questionnaireViewItem.enabledAnswerOptions | ||
.map { | ||
|
@@ -80,8 +86,8 @@ internal object DropDownViewHolderFactory : | |
answerOptionList.add( | ||
0, | ||
DropDownAnswerOption( | ||
context.getString(R.string.hyphen), | ||
context.getString(R.string.hyphen), | ||
initialAnswerString, | ||
initialAnswerString, | ||
Comment on lines
+89
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one thing you do want to be careful is that if there's a clash between the user defined default value and one of the answer options from the questionnaire. in this case you might want to have a mechanism to give them distinct names -- this is a very very edge case though and i'm happy for you to just add a todo in the code. |
||
null, | ||
), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the initial answer is not something the ui shoudl get involved with. the questionnaire view model should have already handled this.