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 the next button navigation view to a default long scroll #2134

Merged
merged 20 commits into from
Jun 21, 2024

Conversation

LZRS
Copy link
Collaborator

@LZRS LZRS commented Aug 15, 2023

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

Fixes #1764

Description
Adds support for having the bottom navigation buttons as part of the Questionnaire recyclerview, that would ensure the user has viewed all the field items before clicking next

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Detecting scroll to the bottom of the Recyclerview to toggle visibility of the bottom buttons - was not smooth and the bottom buttons were not showing in a predictable manner

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)

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

@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch 2 times, most recently from 1c3d155 to ed74d4d Compare August 23, 2023 04:54
@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch 3 times, most recently from 5d423ec to bc9abd3 Compare September 21, 2023 02:31
@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch from bc9abd3 to 0ccb597 Compare September 21, 2023 02:34
@LZRS LZRS marked this pull request as ready for review September 21, 2023 02:34
@LZRS LZRS requested review from santosh-pingle and a team as code owners September 21, 2023 02:34
@LZRS LZRS changed the title Enable next button when user scrolls to the bottom Add the next button navigation view to a default long scroll Sep 22, 2023
@LZRS LZRS marked this pull request as draft October 26, 2023 09:39
@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch from 5ed31e7 to 3e31e93 Compare October 27, 2023 12:00
@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch from 3e31e93 to f695551 Compare November 1, 2023 12:55
@LZRS LZRS force-pushed the 1764-scroll-to-bottom-to-enable-next branch from f695551 to fbb6ba3 Compare November 9, 2023 01:17
@LZRS LZRS marked this pull request as ready for review November 9, 2023 06:47
@MJ1998
Copy link
Collaborator

MJ1998 commented Nov 16, 2023

@santosh-pingle Since you are looking into this PR, its ready for review.
@LZRS Requesting to confirm and check all the items under checklist in the issue description.

@jingtang10
Copy link
Collaborator

@LZRS thanks for this PR - it's a very well written PR!

I want to highlight though in @shelaghm's comment here #1764 (comment) she said My concern with option 1 is hiding/disabling buttons can also lead to user confusion, and I have a preference for keeping paginated navigation buttons anchored and always visible. We have some [design guidelines](https://developers.google.com/open-health-stack/design/data-capture-guideline#navigation_buttons) here with the rationale.

Your PR changes this right? is there an option to keep the current behaviour? if so can you add a video?

@LZRS
Copy link
Collaborator Author

LZRS commented Feb 26, 2024

@LZRS thanks for this PR - it's a very well written PR!

I want to highlight though in @shelaghm's comment here #1764 (comment) she said My concern with option 1 is hiding/disabling buttons can also lead to user confusion, and I have a preference for keeping paginated navigation buttons anchored and always visible. We have some [design guidelines](https://developers.google.com/open-health-stack/design/data-capture-guideline#navigation_buttons) here with the rationale.

Your PR changes this right? is there an option to keep the current behaviour? if so can you add a video?

Yeah, the PR changes that. Within the PR, I tried to set it as configurable in the QuestionnaireFragment.Builder with QuestionnaireFragment.Builder#setShowNavigationInDefaultLongScroll

I will attach video for both cases

@LZRS
Copy link
Collaborator Author

LZRS commented Feb 29, 2024

Navigation buttons always Visible

Navigation buttons as part of scroll

@jingtang10
Copy link
Collaborator

looks good - can you please add tests @LZRS ?

@LZRS
Copy link
Collaborator Author

LZRS commented Mar 11, 2024

looks good - can you please add tests @LZRS ?

Cool, I'll add the tests and ping once done

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 @LZRS again for this. I've updated this PR and done a couple of improvements:

  1. removed the unnecessary navigation recycler view. in the case where the navigation controls are floating at the bottom of the screen, they can just be a simple reused layout instead of using a recycler view which is costly.
  2. removed the disabled state for pagination controls which I don't think is ever used actually.

I also want to simplify the QuestionnaireNavigationViewUIState class altogether as I find it to be overly complicated.

I'll try to merge this PR asap.

Thanks

@LZRS
Copy link
Collaborator Author

LZRS commented Jun 21, 2024

Thanks @LZRS again for this. I've updated this PR and done a couple of improvements:

  1. removed the unnecessary navigation recycler view. in the case where the navigation controls are floating at the bottom of the screen, they can just be a simple reused layout instead of using a recycler view which is costly.
  2. removed the disabled state for pagination controls which I don't think is ever used actually.

I also want to simplify the QuestionnaireNavigationViewUIState class altogether as I find it to be overly complicated.

I'll try to merge this PR asap.

Thanks

Okay, thanks @jingtang10

@jingtang10 jingtang10 merged commit 5dfb936 into google:master Jun 21, 2024
4 checks passed
@jingtang10 jingtang10 deleted the 1764-scroll-to-bottom-to-enable-next branch June 21, 2024 19:53
questionnaireEditRecyclerView.visibility = View.VISIBLE
reviewModeEditButton.visibility = View.GONE

// Set bottom navigation
bottomNavContainerFrame.visibility = View.VISIBLE
NavigationViewHolder(bottomNavContainerFrame)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

state.bottomNavItems.single() crashes when QuestionnaireFragment.Builder.setShowNavigationInDefaultLongScroll is set to true since it's empty

santosh-pingle pushed a commit to santosh-pingle/android-fhir that referenced this pull request Jul 8, 2024
…2134)

* Configurable bottom navigation to be part of page scroll

* Shared layout for bottom navigation items, for scroll and sticky

* Use separate recyclerview for bottom navigation items

* Fix build errors

* Remove unnecessary disabled state

* Delete the unnecessary navigation recycler view

* Simplify unnecessary .apply

---------

Co-authored-by: Francis Odhiambo <[email protected]>
Co-authored-by: Jing Tang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Only enable next button when user scrolls to the bottom of the page
5 participants