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

SDC: Add Progress Bar for Questionnaire #1587

Merged
merged 18 commits into from
Oct 18, 2022

Conversation

nsabale7
Copy link
Collaborator

@nsabale7 nsabale7 commented Sep 8, 2022

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 using findLastVisibleItemPosition() and getItemCount()

  • Paginated Questionnaire:
    Updates the progress by using QuestionnaireViewModel@questionnaireStateFlow.pagination state which provides progress and total count using currentPageIndex and pages.size

Type
Choose one: Feature

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).

@nsabale7
Copy link
Collaborator Author

nsabale7 commented Sep 8, 2022

progress-bar-questionnaire.mp4

Copy link
Collaborator

@joiskash joiskash left a 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!

Copy link
Collaborator

@joiskash joiskash left a 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

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.

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 :

  1. Open catalog app
  2. Click on layouts bottom navigation menu.
  3. Click on default layout
  4. Scroll questionnaire form

Expectations :
While scrolling top to bottom, indicator increases progress. etc..

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.

Thanks!

@jingtang10 jingtang10 assigned jingtang10 and unassigned nsabale7 Oct 13, 2022
@shelaghm
Copy link

@nsabale7 I forgot to reply earlier, but this looks so great! Nice work!

@jingtang10 jingtang10 assigned nsabale7 and unassigned jingtang10 Oct 17, 2022
Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Thanks

@nsabale7 nsabale7 requested a review from jingtang10 October 18, 2022 10:13
@jingtang10 jingtang10 enabled auto-merge (squash) October 18, 2022 14:31
@jingtang10 jingtang10 merged commit d53f310 into google:master Oct 18, 2022
santosh-pingle pushed a commit to santosh-pingle/android-fhir that referenced this pull request Nov 1, 2022
* 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>
@HenryRae
Copy link

HenryRae commented Jan 20, 2023

Great work on the progress bar for paginated forms.
image

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.
image

@shelaghm shelaghm added ux and removed ux testing labels Jan 24, 2023
@shelaghm
Copy link

@HenryRae

  • Yes, the progress bar at the bottom makes a lot of sense nested with the navigation buttons, especially for paginated layouts.
  • Since this component works on both long scroll layout and paginated layout, we've located it at the top for consistency across the two layout types.

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?

@HenryRae
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Complete
6 participants