-
Notifications
You must be signed in to change notification settings - Fork 532
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
Fix #1930: "Tick icon" disappears on configuration change in QuestionPlayer #2318
Conversation
@MaskedCarrot |
Can we have a test cases checking for this case which fail without this pr implementation |
@chrk2205 yes this pr is ready for review. |
@anandwana001 should I file a different issues to implement the test case or write the test in this PR? |
In this pr only as we are fixing issue here, so test case will justify the correctness of implementation |
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
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.
@MaskedCarrot NIT changes
app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerViewModel.kt
Outdated
Show resolved
Hide resolved
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.
Thanks @MaskedCarrot
Test LGTM
...src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt
Show resolved
Hide resolved
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.
Also add :
after issue number in title.
Fix #XXX :
app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerViewModel.kt
Outdated
Show resolved
Hide resolved
done |
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.
LGTM, thanks.
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.
Thanks @MaskedCarrot. Left one high-level comment on the approach. I don't think we want to solve it in this way since it's changing the design pattern of the assembler's builder, and I also think there might be a simpler approach overall. PTAL.
private val isCorrectAnswer: ObservableField<Boolean> = ObservableField(false) | ||
|
||
/** @param isCorrectAnswer is restored to its updated value on configuration change */ | ||
fun isAnswerCorrect(isCorrectAnswer: Boolean): Builder { |
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 isn't the correct way to be doing this--the builder is designed to set up high-level UI features, not change super specific state.
The underlying issue that we're trying to solve is retaining state across configuration changes. We probably shouldn't be using the view model below, either, since that's set up incorrectly today (view models shouldn't be retrieved using ViewModelProvider since they can leak fragments/activities). Sorry--this probably wasn't clear.
It seems like perhaps the clearest way to solve this is to have the assembler itself ensure isCorrectAnswer is properly set in compute() based on whether we're in a completed state & the answer submitted is correct. I think if you did that approach it might also simplify the overall solution.
closing this PR because I was not able to push a commit without force push. I will be continuing this work on #2493. |
Explanation
Fixes #1930
Checklist
fixed.disappearing.Tick.icon.mp4
Tests