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

Create QuestionnaireItemHeaderView for the common question header (prefix+question+hint) #1299

Merged
merged 7 commits into from
Apr 18, 2022

Conversation

jingtang10
Copy link
Collaborator

@jingtang10 jingtang10 commented Apr 15, 2022

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #1291

Description

Extract common view for question headers.

  • Create QuestionnaireItemHeaderView for the prefix, question and hint text which shares the same look-and-feel for all widgets
  • Create tests for this view and simplify tests for other widgets

Additional refactoring:

  • Add missing hint for auto complete
  • Rename custom extension URLs from EXTENSION_***_UNOFFICIAL to EXTENSION_***_ANDROID_FHIR
  • Rename Questionnaire.QuestionnaireItemComponent.subtitleText to Questionnaire.QuestionnaireItemComponent.localizedHintSpanned because it's localized and hint is slightly more accurate than subtitle
  • Rename Questionnaire.QuestionnaireItemComponent.flyOverText to Questionnaire.QuestionnaireItemComponent.localizedFlyoverSpanned because it's localized

Alternative(s) considered
NA

Type
Bug fix + Code health

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@codecov
Copy link

codecov bot commented Apr 15, 2022

Codecov Report

Merging #1299 (433c528) into master (3bc6ef9) will increase coverage by 0.45%.
The diff coverage is 58.66%.

@@             Coverage Diff              @@
##             master    #1299      +/-   ##
============================================
+ Coverage     84.15%   84.61%   +0.45%     
- Complexity      678      684       +6     
============================================
  Files           147      148       +1     
  Lines         10738    10677      -61     
  Branches        883      825      -58     
============================================
- Hits           9037     9034       -3     
+ Misses         1235     1234       -1     
+ Partials        466      409      -57     
Impacted Files Coverage Δ
...ws/QuestionnaireItemDatePickerViewHolderFactory.kt 31.08% <20.00%> (+0.59%) ⬆️
...uestionnaireItemDateTimePickerViewHolderFactory.kt 66.92% <33.33%> (+1.95%) ⬆️
.../QuestionnaireItemDialogSelectViewHolderFactory.kt 66.25% <33.33%> (+1.96%) ⬆️
...iews/QuestionnaireItemDropDownViewHolderFactory.kt 51.42% <33.33%> (+3.80%) ⬆️
...iews/QuestionnaireItemEditTextViewHolderFactory.kt 42.42% <33.33%> (+2.42%) ⬆️
.../QuestionnaireItemAutoCompleteViewHolderFactory.kt 25.00% <50.00%> (+0.17%) ⬆️
...tionnaireItemBooleanTypePickerViewHolderFactory.kt 59.64% <50.00%> (+3.39%) ⬆️
...QuestionnaireItemCheckBoxGroupViewHolderFactory.kt 76.47% <50.00%> (+3.64%) ⬆️
...views/QuestionnaireItemDisplayViewHolderFactory.kt 81.81% <50.00%> (+21.81%) ⬆️
...e/views/QuestionnaireItemGroupViewHolderFactory.kt 80.00% <50.00%> (+19.13%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bc6ef9...433c528. Read the comment docs.

Copy link
Collaborator

@santosh-pingle santosh-pingle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, code owner can also review it. thanks!

@santosh-pingle santosh-pingle self-requested a review April 18, 2022 10:27
Copy link
Collaborator

@santosh-pingle santosh-pingle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jingtang10 Thanks!

private var hint: TextView = findViewById(R.id.hint)

fun bind(questionnaireItem: Questionnaire.QuestionnaireItemComponent) {
questionnaireItem.localizedPrefixSpanned.also {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a misuse of also instead of declare a variable + if
If you lean to use scope function here, i'd suggest run or maybe 'let'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to let.

actually i have been wondering myself the case for using scope function vs declaring variables. any more insight into pros and cons of these two approache regarding readability?

@jingtang10 jingtang10 enabled auto-merge (squash) April 18, 2022 17:50
@jingtang10 jingtang10 merged commit 91fce32 into google:master Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working type:code health
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Extra blank space get added below question text if subtitle text is not present.
4 participants