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

Per question custom style #2636

Merged
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2fc5790
per question custom style
Jul 24, 2024
5cacca5
adding missing file.
Jul 25, 2024
26215c9
update default style.
Aug 1, 2024
e55fa8a
textAppearance support
Aug 2, 2024
4e05007
rename custom attributes.
Aug 2, 2024
4094268
github documentation for custom style example.
Aug 6, 2024
d746d06
Address review comments.
Aug 6, 2024
d532701
address review comment.
Aug 6, 2024
ad00fff
update text format icon as component icon.
Aug 7, 2024
60accde
code cleanup.
Aug 7, 2024
83c4e2a
Code refactoring and cleanup.
Aug 7, 2024
89f468c
custom style example with multiple question items.
Aug 13, 2024
7dbb60a
Address review comments.
Aug 14, 2024
e1cd2aa
support prefix per question item custom style
Aug 14, 2024
26863e7
Revert dataconfig changes for custom style mapping.
Aug 14, 2024
8c41bd3
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Aug 14, 2024
f414f68
Address review comments.
Aug 20, 2024
7fc7ecb
Address review comments.
Aug 20, 2024
5e21f7b
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Aug 21, 2024
7c4e9b1
Address review comments.
Sep 2, 2024
c82bbe1
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Sep 2, 2024
6088d27
Address review comments.
Sep 3, 2024
e64ed22
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Sep 3, 2024
bd6f0b7
Address review comment.
Sep 4, 2024
63caac8
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Sep 4, 2024
9d5cdee
Merge branch 'master' into sp/per-question-custom-style
santosh-pingle Sep 4, 2024
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
151 changes: 119 additions & 32 deletions catalog/src/main/assets/component_per_question_custom_style.json
santosh-pingle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"item": [
{
"linkId": "1",
"text": "Question text custom style",
"text": "Question text",
"type": "display",
"extension": [
{
Expand All @@ -19,50 +19,137 @@
}
]
}
],
"item": [
]
},
{
"linkId": "3",
"text": "Question text",
santosh-pingle marked this conversation as resolved.
Show resolved Hide resolved
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_3"
}
]
}
]
},
{
"linkId": "4",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_4"
}
]
}
]
},
{
"linkId": "5",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_5"
}
]
}
]
},

{
"linkId": "6",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_6"
}
]
}
]
},
{
"linkId": "7",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-display-category",
"code": "instructions"
}
]
}
"url": "question_text_view",
"valueString": "CustomStyle_7"
}
],
"linkId": "1.3",
"text": "Instructions custom style.",
"type": "display"
]
}
]
},

{
"linkId": "2",
"text": "Question text default style",
"linkId": "8",
"text": "Question text",
"type": "display",
"item": [
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-display-category",
"code": "instructions"
}
]
}
"url": "question_text_view",
"valueString": "CustomStyle_8"
}
],
"linkId": "1.3",
"text": "Instructions default style.",
"type": "display"
]
}
]
},

{
"linkId": "9",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_9"
}
]
}
]
},

{
"linkId": "10",
"text": "Question text",
"type": "display",
"extension": [
{
"url": "https://github.com/google/android-fhir/tree/master/datacapture/android-style",
"extension": [
{
"url": "question_text_view",
"valueString": "CustomStyle_10"
}
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ class CatalogApplication : Application(), DataCaptureConfig.Provider {

FhirEngineProvider.init(FhirEngineConfiguration())

val styleMap =
mapOf(
"CustomStyle_1" to R.style.CustomStyle_1,
"CustomStyle_2" to R.style.CustomStyle_2,
)
dataCaptureConfig =
DataCaptureConfig(
xFhirQueryResolver = { fhirEngine.search(it).map { it.resource } },
questionnaireItemViewHolderFactoryMatchersProviderFactory =
ContribQuestionnaireItemViewHolderFactoryMatchersProviderFactory,
questionnaireItemViewStyleResolver = { styleMap[it]!! },
)

CoroutineScope(Dispatchers.IO).launch {
Expand Down
36 changes: 36 additions & 0 deletions catalog/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<color name="custom_style_primary_100">#000000</color>
<color name="custom_style_primary_200">#0C0A20</color>
<color name="custom_style_primary_300">#201441</color>
<color name="custom_style_primary_400">#341F63</color>
<color name="custom_style_primary_500">#482A85</color>
<color name="custom_style_primary_600">#5C35A6</color>
<color name="custom_style_primary_700">#7F5FBA</color>
<color name="custom_style_primary_800">#A289CF</color>
<color name="custom_style_primary_900">#C5B3E3</color>
<color name="custom_style_on_primary_100">#FFFFFF</color>
<color name="custom_style_on_primary_200">#FFFFFF</color>
<color name="custom_style_on_primary_300">#FFFFFF</color>
<color name="custom_style_on_primary_400">#FFFFFF</color>
<color name="custom_style_on_primary_500">#FFFFFF</color>
<color name="custom_style_on_primary_600">#FFFFFF</color>
<color name="custom_style_on_primary_700">#FFFFFF</color>
<color name="custom_style_on_primary_800">#000000</color>
<color name="custom_style_on_primary_900">#000000</color>
</resources>
22 changes: 22 additions & 0 deletions catalog/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,26 @@
<color name="onSurfaceVariant_neutral_variant_80">#C4C7C5</color>

<color name="outline_neutral_variant_60">#8E918F</color>

<!-- colors for custom style example -->
<color name="custom_style_primary_900">#7A9FFF</color>
<color name="custom_style_primary_800">#668FFF</color>
<color name="custom_style_primary_700">#5581FF</color>
<color name="custom_style_primary_600">#476FFF</color>
<color name="custom_style_primary_500">#3B5CFF</color>
<color name="custom_style_primary_400">#3249FF</color>
<color name="custom_style_primary_300">#2936FF</color>
<color name="custom_style_primary_200">#2024FF</color>
<color name="custom_style_primary_100">#1816FF</color>
<color name="custom_style_on_primary">#FFFFFF</color>
<color name="custom_style_on_primary_900">#FFFFFF</color>
<color name="custom_style_on_primary_800">#FFFFFF</color>
<color name="custom_style_on_primary_700">#FFFFFF</color>
<color name="custom_style_on_primary_600">#FFFFFF</color>
<color name="custom_style_on_primary_500">#FFFFFF</color>
<color name="custom_style_on_primary_400">#FFFFFF</color>
<color name="custom_style_on_primary_300">#FFFFFF</color>
<color name="custom_style_on_primary_200">#FFFFFF</color>
<color name="custom_style_on_primary_100">#FFFFFF</color>

</resources>
Loading
Loading