-
Notifications
You must be signed in to change notification settings - Fork 302
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
base: master
Are you sure you want to change the base?
Improve Dropdown Behavior in Questionnaire Items #2393
Conversation
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
@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. |
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
…views/factories/DropDownViewHolderFactory.kt Co-authored-by: santosh-pingle <[email protected]>
…' into issue-2228-dropdown-non-editable # Conflicts: # datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
… is selected or once user types in some text
…opdown-non-editable # Conflicts: # datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
...java/com/google/android/fhir/datacapture/test/views/DropDownViewHolderFactoryEspressoTest.kt
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
} | ||
|
||
autoCompleteTextView.doAfterTextChanged { |
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.
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?
Hey @qaziabubakar-vd any progress here? Thanks! |
…28-dropdown-non-editable
- 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
079ad81
to
a994dc3
Compare
clearInputIcon.setOnClickListener { | ||
context.lifecycleScope.launch { | ||
delay(200) // to show ripple effect on the icon before clearing the answer | ||
questionnaireViewItem.clearAnswer() | ||
} | ||
} |
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.
On second thoughts, I can probably move this to the init()
function, it's currently in bind()
Remaining todo is test |
814b8ac
to
12fb10b
Compare
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) |
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.
Can you check if this is needed. Espresso should handle this automatically.
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.
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 |
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.
This is unnecessary. May cause flakiness in test cases.
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.
sure
@jingtang10 @MJ1998 this is ready for review |
* 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
* 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
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
./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.