-
Notifications
You must be signed in to change notification settings - Fork 306
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
SDC: Add Progress Bar for Questionnaire #1587
SDC: Add Progress Bar for Questionnaire #1587
Conversation
progress-bar-questionnaire.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Please add style to the bar, so that it can be customized. Good work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Please wait for a review by the google team.
cc: @Tarun-Bhardwaj
…ns/progress_bar_for_questionnaires
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me.
Can you please update short summary about implementation in the description.
Optional : Can you please also add manual test case to test this feature manually
e.g
Steps :
- Open catalog app
- Click on layouts bottom navigation menu.
- Click on default layout
- Scroll questionnaire form
Expectations :
While scrolling top to bottom, indicator increases progress. etc..
…ns/progress_bar_for_questionnaires
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt
Outdated
Show resolved
Hide resolved
@nsabale7 I forgot to reply earlier, but this looks so great! Nice work! |
…ns/progress_bar_for_questionnaires
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
…ns/progress_bar_for_questionnaires
datacapture/src/main/java/com/google/android/fhir/datacapture/utilities/MoreNumberUtil.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/utilities/MoreNumberUtil.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt
Show resolved
Hide resolved
* Added Linear Progress Indicator for Paginated Questionnaire * Added Linear Progress Indicator for Non-Paginated Questionnaire * Removed print statement * Added style for linear progressIndicator * Tests to scroll default and navigate paginated questionnaire * Renamed MainActivityTest to LayoutsFragmentTest * Removed tests for scroll behaviour from catalog module * Changes as per JT feedback * Moved progress percentage calculation to QuestionnaireFragment * Update datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt Co-authored-by: Jing Tang <jingtang@google.com>
Great work on the progress bar for paginated forms. Wondering what @shelaghm you think about the idea of having the paginated form progress bar at the bottom of the page with actions that actually control this form. The assumption behind this is: new users(in tech) maybe can easily relate to it. |
Are you recommending (1) we make the progress bar always anchored at the bottom OR (2) we make this configurable so developers can make their own decision where to place it? |
@shelaghm understood why it was done that way, well thought out. In that case(to work for both long scroll layouts and paginated layouts), I do agree to keep it at the top. |
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #1523
Description
A visual progress bar at the top of the questionnaire.
Implementation:
Default Questionnaire:
Updates the progress by listening to the scroll overriding
RecyclerView.addOnScrollListener@onScrolled()
which helps to get progress and total count usingfindLastVisibleItemPosition()
andgetItemCount()
Paginated Questionnaire:
Updates the progress by using
QuestionnaireViewModel@questionnaireStateFlow.pagination
state which provides progress and total count usingcurrentPageIndex
andpages.size
Type
Choose one: Feature
Screenshots (if applicable)
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.