-
Notifications
You must be signed in to change notification settings - Fork 249
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
Update the UI using the answers in the view model #134
Conversation
db8751c
to
c84e1b5
Compare
...java/com/google/android/fhir/datacapture/views/QuestionnaireItemCheckBoxViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...java/com/google/android/fhir/datacapture/views/QuestionnaireItemCheckBoxViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...va/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...va/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...va/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
thanks yigit :) ptal! |
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.
ptal
) | ||
) { | ||
var singleAnswerOrNull | ||
get() = questionnaireResponseItemComponent.answer.singleOrNull() |
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.
not sure if you meant this but singleOrNull returns null if there are more than 1 items:
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/single-or-null.html
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.
I think basically there's something really wrong if we have multiple answers here. I'm happy with this rather lenient method rather than throwing exception or returning first.
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.
👍
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.
might be good to add a comment here to specify it is intentional.
) | ||
) { | ||
var singleAnswerOrNull | ||
get() = questionnaireResponseItemComponent.answer.singleOrNull() |
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.
👍
) | ||
) { | ||
var singleAnswerOrNull | ||
get() = questionnaireResponseItemComponent.answer.singleOrNull() |
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.
might be good to add a comment here to specify it is intentional.
We had not implemented this because we assumed that it's ok to render the UI without providing an initial value until we implement the initial value to the SDC specification.
However, this already caused issue because the recycler view reuses the questionnaire item views, and if we don't try to set the answer the view might still carry what the user had input for a different question.