Skip to content
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

Sdc gallery app, implement single choice workflow. #1008

Merged
merged 38 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b797bc4
Sdc gallery app landing page
santosh-pingle Dec 28, 2021
94df10b
Rename file name.
santosh-pingle Dec 28, 2021
2b3030c
Merge branch 'master' into sp/988-landing-page
santosh-pingle Dec 28, 2021
c129e57
Update components and layouts vector icons.
santosh-pingle Jan 3, 2022
b1525b5
Merge branch 'master' into sp/988-landing-page
santosh-pingle Jan 3, 2022
c67b949
Sdc gallery app single choice workflow.
santosh-pingle Jan 4, 2022
05f8a44
Update it as boolean choice.
santosh-pingle Jan 5, 2022
45d59cb
Address review comments.
santosh-pingle Jan 5, 2022
52121cf
Boolean choice component icon.
santosh-pingle Jan 5, 2022
6efe4b9
Merge branch 'sp/988-landing-page' into sp/992-single-choice
santosh-pingle Jan 5, 2022
d76da21
Spotless apply
santosh-pingle Jan 5, 2022
2e68631
Merge branch 'master' into sp/988-landing-page
santosh-pingle Jan 5, 2022
0dfebad
Build failures
santosh-pingle Jan 5, 2022
9ca677d
Delete gallery drawables.
santosh-pingle Jan 5, 2022
98bba50
fix package name in nav graph
santosh-pingle Jan 5, 2022
2b9e33f
Merge branch 'sp/988-landing-page' into sp/992-single-choice
santosh-pingle Jan 5, 2022
4357509
Spotless apply.
santosh-pingle Jan 5, 2022
f697147
Delete gallery color resource
santosh-pingle Jan 5, 2022
83c3c45
Merge branch 'master' into sp/988-landing-page
santosh-pingle Jan 6, 2022
0adae63
Merge branch 'sp/988-landing-page' into sp/992-single-choice
santosh-pingle Jan 7, 2022
96e30a6
Merge branch 'master' into sp/988-landing-page
santosh-pingle Jan 7, 2022
b050ce4
Merge branch 'sp/988-landing-page' into sp/992-single-choice
santosh-pingle Jan 7, 2022
9931045
Single choice workflow.
santosh-pingle Jan 7, 2022
3664435
theme attributes for color value.
santosh-pingle Jan 10, 2022
2384a9a
bottom view margin
santosh-pingle Jan 10, 2022
38be418
Merge branch 'master' into sp/988-landing-page
santosh-pingle Jan 10, 2022
68486e1
Merge branch 'sp/988-landing-page' into sp/992-single-choice
santosh-pingle Jan 10, 2022
6717f54
Merge branch 'sp/992-single-choice' into sp/issue-1006-single-choice
santosh-pingle Jan 10, 2022
c86efe3
textcolor on checked state.
santosh-pingle Jan 10, 2022
177935f
Merge branch 'master' into sp/992-single-choice
santosh-pingle Jan 13, 2022
1dc445a
Address review comments.
santosh-pingle Jan 25, 2022
85c1659
Merge branch 'master' into sp/992-single-choice
santosh-pingle Jan 25, 2022
33575d7
Merge branch 'sp/992-single-choice' into sp/issue-1006-single-choice
santosh-pingle Jan 25, 2022
f738942
Merge branch 'master' into sp/issue-1006-single-choice
santosh-pingle Jan 25, 2022
b834270
Remove unwanted file.
santosh-pingle Jan 25, 2022
da1a178
Delete unwanted file.
santosh-pingle Jan 25, 2022
cdbb5c4
Add filename field to the component enum.
santosh-pingle Jan 27, 2022
c76066c
Merge branch 'master' into sp/issue-1006-single-choice
santosh-pingle Jan 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions catalog/src/main/assets/single_choice_questionnaire.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"resourceType": "Questionnaire",
"item": [
{
"extension": [
{
"url": "http:https://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http:https://hl7.org/fhir/questionnaire-item-control",
"code": "radio-button",
"display": "Radio Button"
}
]
}
}
],
"linkId": "1",
"text": "What is the highest level of education achieved?",
"type": "choice",
"answerOption": [
{
"valueCoding": {
"system": "http:https://terminology.hl7.org/CodeSystem/v2-0532",
"code": "Y",
"display": "Does not know level of education"
}
},
{
"valueCoding": {
"system": "http:https://terminology.hl7.org/CodeSystem/v2-0532",
"code": "no",
"display": "No education"
}
},
{
"valueCoding": {
"system": "http:https://terminology.hl7.org/CodeSystem/v2-0532",
"code": "primary",
"display": "Primary school"
}
},
{
"valueCoding": {
"system": "http:https://terminology.hl7.org/CodeSystem/v2-0532",
"code": "secondary",
"display": "Secondary school"
}
},
{
"valueCoding": {
"system": "http:https://terminology.hl7.org/CodeSystem/v2-0532",
"code": "higher",
"display": "Higher education"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ComponentListFragment : Fragment(R.layout.component_list_fragment) {
private fun onItemClick(component: ComponentListViewModel.Component) {
// TODO Remove check when all components questionnaire json are updated.
// https://github.com/google/android-fhir/issues/1076
if (viewModel.getQuestionnaire(component).isEmpty()) {
if (component.questionnaireFile.isEmpty()) {
return
}
launchQuestionnaireFragment(component)
Expand All @@ -76,7 +76,7 @@ class ComponentListFragment : Fragment(R.layout.component_list_fragment) {
.navigate(
ComponentListFragmentDirections.actionComponentsFragmentToGalleryQuestionnaireFragment(
context?.getString(component.textId) ?: "",
viewModel.getQuestionnaire(component)
component.questionnaireFile
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,29 @@ class ComponentListViewModel(application: Application, private val state: SavedS
return Component.values().toList()
}

fun getQuestionnaire(component: Component): String {
return when (component) {
Component.BOOLEAN_CHOICE -> "boolean_choice_questionnaire.json"
else -> "" // TODO remove else when all components cases are added to the when.
// https://github.com/google/android-fhir/issues/1076
}
}

enum class Component(@DrawableRes val iconId: Int, @StringRes val textId: Int) {
SINGLE_CHOICE(R.drawable.ic_singlechoice, R.string.component_name_single_choice),
BOOLEAN_CHOICE(R.drawable.ic_booleanchoice, R.string.component_name_boolean_choice),
MULTIPLE_CHOICE(R.drawable.ic_multiplechoice, R.string.component_name_multiple_choice),
DROPDOWN(R.drawable.ic_group_1278, R.string.component_name_dropdown),
MODAL(R.drawable.ic_modal, R.string.component_name_modal),
OPEN_CHOICE(R.drawable.ic_openchoice, R.string.component_name_open_choice),
TEXT_FIELD(R.drawable.ic_textfield, R.string.component_name_text_field),
DATE_PICKER(R.drawable.ic_datepicker, R.string.component_name_date_picker),
TIME_PICKER(R.drawable.ic_timepicker, R.string.component_name_time_picker),
SLIDER(R.drawable.ic_slider, R.string.component_name_slider),
IMAGE(R.drawable.ic_image, R.string.component_name_image),
enum class Component(
@DrawableRes val iconId: Int,
@StringRes val textId: Int,
val questionnaireFile: String
) {
SINGLE_CHOICE(
R.drawable.ic_singlechoice,
R.string.component_name_single_choice,
"single_choice_questionnaire.json"
),
BOOLEAN_CHOICE(
R.drawable.ic_booleanchoice,
R.string.component_name_boolean_choice,
"boolean_choice_questionnaire.json"
),
MULTIPLE_CHOICE(R.drawable.ic_multiplechoice, R.string.component_name_multiple_choice, ""),
DROPDOWN(R.drawable.ic_group_1278, R.string.component_name_dropdown, ""),
MODAL(R.drawable.ic_modal, R.string.component_name_modal, ""),
OPEN_CHOICE(R.drawable.ic_openchoice, R.string.component_name_open_choice, ""),
TEXT_FIELD(R.drawable.ic_textfield, R.string.component_name_text_field, ""),
DATE_PICKER(R.drawable.ic_datepicker, R.string.component_name_date_picker, ""),
TIME_PICKER(R.drawable.ic_timepicker, R.string.component_name_time_picker, ""),
SLIDER(R.drawable.ic_slider, R.string.component_name_slider, ""),
IMAGE(R.drawable.ic_image, R.string.component_name_image, ""),
}
}
1 change: 0 additions & 1 deletion catalog/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<fragment
android:id="@+id/galleryQuestionnaireFragment"
android:name="com.google.android.fhir.catalog.DemoQuestionnaireFragment"
android:label="fragment_dummy"
tools:layout="@layout/fragment_demo_questionnaire"
>
<argument android:name="questionnaireTitleKey" app:argType="string" />
Expand Down
1 change: 1 addition & 0 deletions catalog/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
name="Questionnaire.Widget.AppCompat.CompoundButton.RadioButton"
parent="Widget.MaterialComponents.CompoundButton.RadioButton"
>
<item name="android:textColor">@color/checked_text_color</item>
<item
name="materialThemeOverlay"
>@style/ThemeOverlay.App.RadioButton</item>
Expand Down