diff --git a/catalog/src/main/assets/layout_default_response.json b/catalog/src/main/assets/layout_default_response.json
new file mode 100644
index 0000000000..a86cec91aa
--- /dev/null
+++ b/catalog/src/main/assets/layout_default_response.json
@@ -0,0 +1,317 @@
+{
+ "resourceType": "QuestionnaireResponse",
+ "extension": [
+ {
+ "url": "http://github.com/google-android/questionnaire-lastLaunched-timestamp",
+ "valueDateTime": "2025-03-12T11:09:41+05:30"
+ }
+ ],
+ "authored": "2025-03-12T11:16:54+05:30",
+ "item": [
+ {
+ "linkId": "1",
+ "text": "Personal information"
+ },
+ {
+ "linkId": "2",
+ "answer": [
+ {
+ "valueString": "Jennifer",
+ "item": [
+ {
+ "linkId": "2.1",
+ "text": "First Name"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "3",
+ "answer": [
+ {
+ "valueString": "Symond",
+ "item": [
+ {
+ "linkId": "3.1",
+ "text": "Family Name"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "4",
+ "answer": [
+ {
+ "valueInteger": 1234567890,
+ "item": [
+ {
+ "linkId": "4.1",
+ "text": "ID number"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "5",
+ "answer": [
+ {
+ "valueInteger": 1234567890,
+ "item": [
+ {
+ "linkId": "5.1",
+ "text": "Mobile number"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "6",
+ "answer": [
+ {
+ "valueCoding": {
+ "code": "code",
+ "display": "Receive SMS reminders"
+ }
+ }
+ ]
+ },
+ {
+ "linkId": "7",
+ "text": "Date of birth",
+ "answer": [
+ {
+ "valueDate": "2025-03-12",
+ "item": [
+ {
+ "linkId": "7.1",
+ "text": "If the real DOB is unknown, provide an estimated year."
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "8"
+ },
+ {
+ "linkId": "9",
+ "text": "Address"
+ },
+ {
+ "linkId": "10",
+ "answer": [
+ {
+ "valueString": "141, Jason street",
+ "item": [
+ {
+ "linkId": "10.1",
+ "text": "House number and street"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "11",
+ "answer": [
+ {
+ "valueString": "A-141",
+ "item": [
+ {
+ "linkId": "11.1",
+ "text": "Apartment, unit"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "12",
+ "answer": [
+ {
+ "valueString": "Sydney, vile Parle ",
+ "item": [
+ {
+ "linkId": "12.1",
+ "text": "City, town or village"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "13",
+ "answer": [
+ {
+ "valueString": "Australia ",
+ "item": [
+ {
+ "linkId": "13.1",
+ "text": "County"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "14",
+ "answer": [
+ {
+ "valueString": "412033",
+ "item": [
+ {
+ "linkId": "14.1",
+ "text": "Postal Code"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "15",
+ "text": "Alternative contact person"
+ },
+ {
+ "linkId": "16",
+ "answer": [
+ {
+ "valueString": "Pamela",
+ "item": [
+ {
+ "linkId": "16.1",
+ "text": "Name"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "17",
+ "answer": [
+ {
+ "valueCoding": {
+ "code": "mother",
+ "display": "Mother"
+ },
+ "item": [
+ {
+ "linkId": "17.1",
+ "text": "Relationship"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "18",
+ "answer": [
+ {
+ "valueString": "1234567890",
+ "item": [
+ {
+ "linkId": "18.1",
+ "text": "Phone number"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "19",
+ "text": "What is the highest level of education achieved?",
+ "answer": [
+ {
+ "valueCoding": {
+ "code": "higher-education",
+ "display": "Higher education"
+ },
+ "item": [
+ {
+ "linkId": "19.1",
+ "text": "Select one"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "20",
+ "text": "Who does the client live with?",
+ "answer": [
+ {
+ "valueCoding": {
+ "code": "Parents",
+ "display": "Parents"
+ },
+ "item": [
+ {
+ "linkId": "20.1",
+ "text": "Check all that apply"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "21",
+ "text": "Has the client received this year’s seasonal flu vaccine?",
+ "answer": [
+ {
+ "valueCoding": {
+ "code": "yes",
+ "display": "Yes"
+ },
+ "item": [
+ {
+ "linkId": "21.1",
+ "text": "Select one"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "22",
+ "text": "When was their last menstrual period? (LMP)",
+ "answer": [
+ {
+ "valueDate": "2025-03-12",
+ "item": [
+ {
+ "linkId": "22.1",
+ "text": "First day of the most recent period"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "23",
+ "text": "How many times have they been pregnant?",
+ "answer": [
+ {
+ "valueInteger": 1,
+ "item": [
+ {
+ "linkId": "23.1",
+ "text": "Including this pregnancy. Also referred to as gravida."
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "linkId": "24",
+ "text": "What was the date and time of the ultrasound?",
+ "answer": [
+ {
+ "valueDateTime": "2025-03-12T11:14:00+05:30"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt b/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt
index c672e79136..757b409ec5 100644
--- a/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt
+++ b/catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 Google LLC
+ * Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -146,6 +146,14 @@ class DemoQuestionnaireFragment : Fragment() {
.LOCATION_WIDGET_PROVIDER,
)
setQuestionnaire(args.questionnaireJsonStringKey!!)
+ when (args.layoutMode) {
+ LayoutMode.DEFAULT -> {}
+ LayoutMode.REVIEW -> {}
+ LayoutMode.READ_ONLY -> {
+ setQuestionnaireResponse(args.questionnaireResponseJsonString!!)
+ setIsReadOnly(true)
+ }
+ }
}
.build()
add(R.id.container, questionnaireFragment, QUESTIONNAIRE_FRAGMENT_TAG)
diff --git a/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt b/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt
index fa99fbd0a3..af69b6f6cb 100644
--- a/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt
+++ b/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 Google LLC
+ * Copyright 2022-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,6 +81,13 @@ class LayoutListFragment : Fragment(R.layout.layout_list_fragment) {
backgroundContext = coroutineContext,
fileName = layout.questionnaireFileName,
),
+ questionnaireResponseJsonString =
+ getQuestionnaireJsonStringFromAssets(
+ context = requireContext(),
+ backgroundContext = coroutineContext,
+ fileName = layout.questionnaireResponseFileName,
+ ),
+ layoutMode = layout.layoutMode,
),
)
}
diff --git a/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt b/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt
index afc487b15d..ce190ed94f 100644
--- a/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt
+++ b/catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 Google LLC
+ * Copyright 2022-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,19 +34,35 @@ class LayoutListViewModel(application: Application, private val state: SavedStat
@DrawableRes val iconId: Int,
@StringRes val textId: Int,
val questionnaireFileName: String,
+ val questionnaireResponseFileName: String,
+ val layoutMode: LayoutMode = LayoutMode.DEFAULT,
) {
DEFAULT(
R.drawable.ic_defaultlayout,
R.string.layout_name_default_text,
"layout_default.json",
+ "",
),
PAGINATED(
R.drawable.ic_paginatedlayout,
R.string.layout_name_paginated,
"layout_paginated.json",
+ "",
+ ),
+ REVIEW(
+ R.drawable.ic_reviewlayout,
+ R.string.layout_name_review,
+ "layout_default.json",
+ "",
+ LayoutMode.REVIEW,
+ ),
+ READ_ONLY(
+ R.drawable.ic_readonlylayout,
+ R.string.layout_name_read_only,
+ "layout_default.json",
+ "layout_default_response.json",
+ LayoutMode.READ_ONLY,
),
- REVIEW(R.drawable.ic_reviewlayout, R.string.layout_name_review, ""),
- READ_ONLY(R.drawable.ic_readonlylayout, R.string.layout_name_read_only, ""),
}
fun isDefaultLayout(context: Context, title: String) =
@@ -55,3 +71,9 @@ class LayoutListViewModel(application: Application, private val state: SavedStat
fun isPaginatedLayout(context: Context, title: String) =
context.getString(Layout.PAGINATED.textId) == title
}
+
+enum class LayoutMode {
+ DEFAULT,
+ REVIEW,
+ READ_ONLY,
+}
diff --git a/catalog/src/main/res/navigation/nav_graph.xml b/catalog/src/main/res/navigation/nav_graph.xml
index 0a47cd500b..2b420c1b16 100644
--- a/catalog/src/main/res/navigation/nav_graph.xml
+++ b/catalog/src/main/res/navigation/nav_graph.xml
@@ -89,6 +89,18 @@
app:nullable="true"
android:defaultValue="@null"
/>
+
+