-
Notifications
You must be signed in to change notification settings - Fork 291
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
Clearing the old state of date and date-time ViewHolders #1581
Merged
aditya-07
merged 5 commits into
google:master
from
aditya-07:ak/bugfix-1580-date-picker
Sep 12, 2022
Merged
Clearing the old state of date and date-time ViewHolders #1581
aditya-07
merged 5 commits into
google:master
from
aditya-07:ak/bugfix-1580-date-picker
Sep 12, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aditya-07
requested review from
jingtang10,
jjtswan,
joiskash,
kevinmost,
omarismail94,
stevenckngaa,
vvikramraj,
wantingzhang77 and
yigit
as code owners
September 5, 2022 15:08
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.
If possible, can you please add one positive and negative test case in both pickers, otherwise it looks ok to me. thanks!
...om/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactoryTest.kt
Show resolved
Hide resolved
...oogle/android/fhir/datacapture/views/QuestionnaireItemDateTimePickerViewHolderFactoryTest.kt
Show resolved
Hide resolved
...om/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactoryTest.kt
Show resolved
Hide resolved
...om/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactoryTest.kt
Show resolved
Hide resolved
...oogle/android/fhir/datacapture/views/QuestionnaireItemDateTimePickerViewHolderFactoryTest.kt
Show resolved
Hide resolved
jingtang10
requested changes
Sep 9, 2022
...va/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...va/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
...om/google/android/fhir/datacapture/views/QuestionnaireItemDateTimePickerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
jingtang10
approved these changes
Sep 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #1580
Description
Cause:
The date and date time view holders only set text to the TextInput if it was empty before. This logic is required when answer update causes an update in the adapter and subsequent bindView on the ViewHolder.
But, this causes issue when the ViewHolder is recycled for a new QuestionnaireItem and the ViewHolder retains the old text (date).
Fix:
Cleanup up the the ViewHolder state when bind is called for a different QuestionnaireItem.
UPDATE
As per discussion with @jingtang10 , instead of cleaning state using a hack,
isTextUpdateRequired
is added to the particularQuestionnaireItemViewHolderDelegate
s to check if textview has to be update or not based on current text and theQuestionnaireResponse.QuestionnaireResponseItemAnswerComponent
.Alternative(s) considered
QuestionnaireItemViewHolderDelegate
to do cleanup.QuestionnaireItemViewHolderDelegate
to know that the bind is called as an update for the same item user is updating or is a regular bind.Both of these require refactoring in all the
QuestionnaireItemViewHolderDelegate
and can be taken as a separate PR if required.Type
Choose one: Bug fix
Screenshots (if applicable)
Date Picker
Date Time Picker
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.