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

Add ability to open a link #2732

Merged
merged 7 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.google.android.fhir.datacapture.extensions
import android.content.Context
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.method.LinkMovementMethod
import android.view.View.GONE
import android.view.View.VISIBLE
import android.widget.Button
Expand Down Expand Up @@ -82,7 +83,10 @@ fun initHelpViews(
}
}
}
helpTextView.updateTextAndVisibility(questionnaireItem.localizedHelpSpanned)
helpTextView.apply {
updateTextAndVisibility(questionnaireItem.localizedHelpSpanned)
movementMethod = LinkMovementMethod.getInstance()
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.android.fhir.datacapture.views

import android.content.Context
import android.text.method.LinkMovementMethod
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
Expand Down Expand Up @@ -55,11 +56,17 @@ class GroupHeaderView(context: Context, attrs: AttributeSet?) : LinearLayout(con
helpCardStateChangedCallback = questionnaireViewItem.helpCardStateChangedCallback,
)
prefix.updateTextAndVisibility(questionnaireViewItem.questionnaireItem.localizedPrefixSpanned)
// CQF expression takes precedence over static question text
question.updateTextAndVisibility(questionnaireViewItem.questionText)
hint.updateTextAndVisibility(
questionnaireViewItem.enabledDisplayItems.getLocalizedInstructionsSpanned(),
)
question.apply {
// CQF expression takes precedence over static question text
updateTextAndVisibility(questionnaireViewItem.questionText)
movementMethod = LinkMovementMethod.getInstance()
}
hint.apply {
updateTextAndVisibility(
questionnaireViewItem.enabledDisplayItems.getLocalizedInstructionsSpanned(),
)
movementMethod = LinkMovementMethod.getInstance()
}
visibility = getHeaderViewVisibility(prefix, question, hint)
applyCustomOrDefaultStyle(
questionnaireViewItem.questionnaireItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.android.fhir.datacapture.views

import android.content.Context
import android.text.method.LinkMovementMethod
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
Expand Down Expand Up @@ -55,13 +56,17 @@ class HeaderView(context: Context, attrs: AttributeSet?) : LinearLayout(context,
helpCardStateChangedCallback = questionnaireViewItem.helpCardStateChangedCallback,
)
prefix.updateTextAndVisibility(questionnaireViewItem.questionnaireItem.localizedPrefixSpanned)
// CQF expression takes precedence over static question text
question.updateTextAndVisibility(
appendAsteriskToQuestionText(question.context, questionnaireViewItem),
)
hint.updateTextAndVisibility(
questionnaireViewItem.enabledDisplayItems.getLocalizedInstructionsSpanned(),
)
question.apply {
// CQF expression takes precedence over static question text
updateTextAndVisibility(appendAsteriskToQuestionText(question.context, questionnaireViewItem))
movementMethod = LinkMovementMethod.getInstance()
}
hint.apply {
updateTextAndVisibility(
questionnaireViewItem.enabledDisplayItems.getLocalizedInstructionsSpanned(),
)
movementMethod = LinkMovementMethod.getInstance()
}
// Make the entire view GONE if there is nothing to show. This is to avoid an empty row in the
// questionnaire.
visibility = getHeaderViewVisibility(prefix, question, hint)
Expand Down
Loading