Skip to content

Commit e1e3027

Browse files
Add review page title (#2796)
1 parent 0b73fb6 commit e1e3027

File tree

6 files changed

+49
-11
lines changed

6 files changed

+49
-11
lines changed

datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import android.os.Bundle
2121
import android.view.LayoutInflater
2222
import android.view.View
2323
import android.view.ViewGroup
24+
import android.widget.TextView
2425
import androidx.annotation.VisibleForTesting
2526
import androidx.appcompat.view.ContextThemeWrapper
2627
import androidx.core.content.res.use
@@ -94,6 +95,7 @@ class QuestionnaireFragment : Fragment() {
9495
view.findViewById<RecyclerView>(R.id.questionnaire_edit_recycler_view)
9596
val questionnaireReviewRecyclerView =
9697
view.findViewById<RecyclerView>(R.id.questionnaire_review_recycler_view)
98+
val questionnaireTitle = view.findViewById<TextView>(R.id.questionnaire_title)
9799

98100
// This container frame floats at the bottom of the view to make navigation controls visible at
99101
// all times when the user scrolls. Use
@@ -170,6 +172,8 @@ class QuestionnaireFragment : Fragment() {
170172
} else {
171173
View.GONE
172174
}
175+
questionnaireTitle.visibility = View.VISIBLE
176+
questionnaireTitle.text = getString(R.string.questionnaire_review_mode_title)
173177

174178
// Set bottom navigation
175179
if (state.bottomNavItem != null) {
@@ -189,6 +193,7 @@ class QuestionnaireFragment : Fragment() {
189193
questionnaireEditAdapter.submitList(state.items)
190194
questionnaireEditRecyclerView.visibility = View.VISIBLE
191195
reviewModeEditButton.visibility = View.GONE
196+
questionnaireTitle.visibility = View.GONE
192197

193198
// Set bottom navigation
194199
if (state.bottomNavItem != null) {

datacapture/src/main/res/layout/questionnaire_fragment.xml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,36 @@
2424
android:layout_alignParentBottom="true"
2525
>
2626

27-
<Button
28-
android:id="@+id/review_mode_edit_button"
29-
style="?attr/questionnaireEditButtonStyle"
30-
android:layout_width="wrap_content"
27+
<LinearLayout
28+
android:id="@+id/questionnaire_title_layout"
29+
android:layout_width="match_parent"
3130
android:layout_height="wrap_content"
32-
android:layout_marginHorizontal="@dimen/action_button_margin_horizontal"
33-
android:layout_marginVertical="@dimen/action_button_margin_vertical"
34-
app:icon="@drawable/ic_outline_edit_24"
31+
android:orientation="horizontal"
32+
android:layout_marginHorizontal="@dimen/title_layout_margin_horizontal"
33+
app:layout_constraintStart_toStartOf="parent"
3534
app:layout_constraintEnd_toEndOf="parent"
3635
app:layout_constraintTop_toTopOf="parent"
37-
/>
36+
>
37+
38+
<TextView
39+
android:id="@+id/questionnaire_title"
40+
android:layout_width="0dp"
41+
android:layout_height="wrap_content"
42+
android:layout_weight="1"
43+
android:layout_marginEnd="@dimen/title_margin_end"
44+
style="?attr/questionnaireTitleStyle"
45+
/>
46+
47+
<Button
48+
android:id="@+id/review_mode_edit_button"
49+
style="?attr/questionnaireEditButtonStyle"
50+
android:layout_width="wrap_content"
51+
android:layout_height="wrap_content"
52+
android:layout_gravity="center_vertical"
53+
app:icon="@drawable/ic_outline_edit_24"
54+
/>
55+
56+
</LinearLayout>
3857

3958
<com.google.android.material.progressindicator.LinearProgressIndicator
4059
android:id="@+id/questionnaire_progress_indicator"
@@ -44,7 +63,7 @@
4463
app:layout_constraintBottom_toTopOf="@id/questionnaire_edit_recycler_view"
4564
app:layout_constraintEnd_toEndOf="parent"
4665
app:layout_constraintStart_toStartOf="parent"
47-
app:layout_constraintTop_toBottomOf="@+id/review_mode_edit_button"
66+
app:layout_constraintTop_toBottomOf="@+id/questionnaire_title_layout"
4867
/>
4968

5069
<androidx.recyclerview.widget.RecyclerView
@@ -62,7 +81,7 @@
6281
android:layout_height="0dp"
6382
android:scrollbars="vertical"
6483
app:layout_constraintBottom_toTopOf="@+id/bottom_nav_container_frame"
65-
app:layout_constraintTop_toBottomOf="@+id/review_mode_edit_button"
84+
app:layout_constraintTop_toBottomOf="@+id/questionnaire_title_layout"
6685
/>
6786

6887
<FrameLayout

datacapture/src/main/res/values/attrs.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@
183183
<!-- Style for attachment preview title. -->
184184
<attr name="questionnaireAttachmentPreviewTitleStyle" format="reference" />
185185

186+
<!-- Style for questionnaire title -->
187+
<attr name="questionnaireTitleStyle" format="reference" />
188+
186189
<declare-styleable name="QuestionnaireTheme">
187190
<!-- The ID of the theme to be applied to the questionnaire. The referenced theme must
188191
extend Theme.Questionnaire. If unspecified, Theme.Questionnaire will be used. -->

datacapture/src/main/res/values/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<dimen name="action_button_margin_horizontal">16dp</dimen>
2626
<dimen name="action_button_margin_vertical">16dp</dimen>
2727

28+
<!-- Title -->
29+
<dimen name="title_layout_margin_horizontal">16dp</dimen>
30+
<dimen name="title_margin_end">2dp</dimen>
31+
2832
<!-- Header -->
2933
<dimen name="error_text_at_header_margin_top">4dp</dimen>
3034
<dimen name="header_padding_bottom">4dp</dimen>

datacapture/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<string name="button_review">Review</string>
1212
<string name="submit_questionnaire">Submit</string>
1313
<string name="cancel_questionnaire">@android:string/cancel</string>
14+
<string
15+
name="questionnaire_review_mode_title"
16+
>Review answers before submitting</string>
1417

1518
<!-- 1.2 Submit Pop-up -->
1619
<string name="questionnaire_validation_error_headline">Errors found</string>

datacapture/src/main/res/values/styles.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@
190190
<item name="questionnaireAttachmentPreviewTitleStyle">
191191
@style/Questionnaire.AttachmentPreviewTitleStyle
192192
</item>
193+
<item
194+
name="questionnaireTitleStyle"
195+
>@style/TextAppearance.Material3.TitleLarge
196+
</item>
193197
</style>
194198

195199
<style name="Questionnaire.GroupTypeHeaderStyle" parent="">

0 commit comments

Comments
 (0)