-
Notifications
You must be signed in to change notification settings - Fork 306
Configure Review layout for SDC catalog application #2783
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
base: master
Are you sure you want to change the base?
Conversation
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.
Can we directly launch the review mode by providing both the questionnaire JSON and the questionnaire response? This way, when the layout is displayed in review mode, it will show the pre-filled answers. If the user wants to edit those answers, they can click on the edit button at the top.
catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt
Show resolved
Hide resolved
), | ||
REVIEW(R.drawable.ic_reviewlayout, R.string.layout_name_review, ""), | ||
READ_ONLY(R.drawable.ic_readonlylayout, R.string.layout_name_read_only, ""), | ||
REVIEW(R.drawable.ic_reviewlayout, R.string.layout_name_review, "layout_review.json", true), |
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.
@santosh-pingle fyi
I was asking santosh to see if there's a way to use lambda to configure this.. it's sort of annoying to keep adding new arguments to this. @rahulmalhotra can you think of a way to do this?
santosh has a similar pr as well #2803
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.
This is done. I introduced another data class named LayoutConfig
and converted this configuration to use lambda. Please take a look and let me know if this looks good?
4a503f0
to
372ed61
Compare
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.
can you see if something like this might work?
@DrawableRes val iconId: Int, | ||
@StringRes val textId: Int, | ||
val questionnaireFileName: String, | ||
val enableReviewMode: Boolean, |
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.
val enableReviewMode: Boolean, | |
val lambda: QuestionnaireFragment.(), |
iconId = R.drawable.ic_defaultlayout | ||
textId = R.string.layout_name_default_text | ||
questionnaireFileName = "layout_default.json" | ||
enableReviewMode = false |
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.
enableReviewMode = false | |
{}, |
catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt
Show resolved
Hide resolved
catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt
Show resolved
Hide resolved
showReviewPageBeforeSubmit(args.enableReviewMode) | ||
showReviewPageFirst(true) |
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.
showReviewPageBeforeSubmit(args.enableReviewMode) | |
showReviewPageFirst(true) |
@@ -89,6 +89,11 @@ | |||
app:nullable="true" | |||
android:defaultValue="@null" | |||
/> | |||
<argument |
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.
Hi @jingtang10 we cannot pass lambda as an argument in these navigation parameters as it only supports primitive data types. Do you have any recommendation for it?
Some of the solutions me and @MJ1998 discussed were:
- Defining a map of string -> key and lambda and passing the key as an argument and retrieving the lambda by accessing the map in demoquestionnairefragment.
- Using a shared view model to for LayoutListFragment as wel as DemoQuestionnaireFragment
Though I think both the approaches are somewhat different to what's happening at the moment. Please let me know your thoughts on how to proceed here.
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.
We can also serialize it to pass it as a string parameter but I don't think that should be a good way to move forward either.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2777
Description
This change configures Review layout for SDC Catalog Application. It consist of the following updates:
enableReviewMode
to Layout enum underLayoutListViewModel.kt
and pass it astrue
for the REVIEW enum value along withlayout_review.json
to render questionnaireDemoQuestionnaireFragment.kt
and use it to show Review Page when its value istrue
layout_review.json
to render questionnaire properlyAlternative(s) considered
N/A
Type
Bug fix
Screenshots (if applicable)

Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.