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

Improve Dropdown Behavior in Questionnaire Items #2393

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

qaziabubakar-vd
Copy link

@qaziabubakar-vd qaziabubakar-vd commented Dec 29, 2023

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

Fixes # #2228

Description
Improved the dropdown behaviour, disabled the search within the field once an option is selected.
Once the text is cleared, showed the list of options again in the dropdown

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

Type
Choose one: Bug fix

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

@qaziabubakar-vd qaziabubakar-vd marked this pull request as ready for review January 8, 2024 05:58
@qaziabubakar-vd qaziabubakar-vd requested review from santosh-pingle and a team as code owners January 8, 2024 05:58
@qaziabubakar-vd qaziabubakar-vd requested a review from yigit January 8, 2024 05:58
@jingtang10 jingtang10 linked an issue Jan 15, 2024 that may be closed by this pull request
@ellykits
Copy link
Collaborator

@qaziabubakar-vd Any updates on this PR? Update the PR with the functionality to reset/clear the selected item.

@qaziabubakar-vd
Copy link
Author

@qaziabubakar-vd Any updates on this PR? Update the PR with the functionality to reset/clear the selected item.

I was assigned to another project but I will pick this back soon and add the implementation for resetting/clearing the selected item. Will post an update here and on the ticket.

}
}
}

autoCompleteTextView.doAfterTextChanged {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i don't know if you can use draft answer here... try to set draft answer and reset the widget? i guess one problem might be the cursor moving? @aditya-07 do you have experience with this?

@jingtang10
Copy link
Collaborator

Hey @qaziabubakar-vd any progress here? Thanks!

@dubdabasoduba dubdabasoduba requested a review from a team as a code owner October 23, 2024 21:01
- Simpler logic
- Use `questionnaireViewItem.answers` state to check if the AutoComplete is editable or not
- Remove keyListener to make the AutoComplete not editable
- Hide keyboard after typing an option then clicking the shown option
- Add cool ripple effect on clicking the clear input icon
@FikriMilano FikriMilano force-pushed the issue-2228-dropdown-non-editable branch from 079ad81 to a994dc3 Compare January 28, 2025 08:06
Comment on lines 148 to 153
clearInputIcon.setOnClickListener {
context.lifecycleScope.launch {
delay(200) // to show ripple effect on the icon before clearing the answer
questionnaireViewItem.clearAnswer()
}
}
Copy link
Collaborator

@FikriMilano FikriMilano Jan 28, 2025

Choose a reason for hiding this comment

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

On second thoughts, I can probably move this to the init() function, it's currently in bind()

@FikriMilano
Copy link
Collaborator

Remaining todo is test

@FikriMilano FikriMilano force-pushed the issue-2228-dropdown-non-editable branch from 814b8ac to 12fb10b Compare January 28, 2025 08:56
@FikriMilano
Copy link
Collaborator

FikriMilano commented Jan 28, 2025

I couldn't add this new demo to the PR description (after refactor), since it's not my PR, but here you go.

dropdown-behavior-demo-2.webm

}

// Delay the execution to allow the view hierarchy to be fully initialized
Thread.sleep(1000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you check if this is needed. Espresso should handle this automatically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't actually, not sure why it's there

}
clearInputIcon.setOnClickListener {
context.lifecycleScope.launch {
delay(200) // to show ripple effect on the icon before clearing the answer
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unnecessary. May cause flakiness in test cases.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sure

@FikriMilano
Copy link
Collaborator

@jingtang10 @MJ1998 this is ready for review

ndegwamartin added a commit to opensrp/fhircore that referenced this pull request Jan 30, 2025
github-merge-queue bot pushed a commit to opensrp/fhircore that referenced this pull request Jan 31, 2025
* Upgrade SDC Version

Fixes bug with PR google/android-fhir#2645

* rename Kader Job Aids flavor

* Fix typo in add-application-flavors.mdx

* Update SDC with google/android-fhir#2393 Fix
dubdabasoduba pushed a commit to opensrp/fhircore that referenced this pull request Jan 31, 2025
* Upgrade SDC Version

Fixes bug with PR google/android-fhir#2645

* rename Kader Job Aids flavor

* Fix typo in add-application-flavors.mdx

* Update SDC with google/android-fhir#2393 Fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PR under Review
Development

Successfully merging this pull request may close these issues.

Make the selection drop-downs not editable
10 participants