-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
improvement: use AnkiActivity where possible & refactor dialogs out of AnkiActivity #17511
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
a68637a
to
042d67b
Compare
17d5b25
to
450e06c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
5692cb4
to
b2b2e4a
Compare
fun onCreateCustomStudySession() | ||
fun onExtendStudyLimits() |
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 the main point of the change: we can convert this into a Fragment Result
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.
Wow, that's a nicely shaved yak you've got there
It's a lot, but it all seems okay
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.
Tbh, I think that most of those dialog utils stink so I avoid using them. But the PR is a positive change
AnkiDroid/src/main/java/com/ichi2/anki/utils/ext/FragmentActivity.kt
Outdated
Show resolved
Hide resolved
Agreed, especially |
`CustomStudyDialog` will depend on `AnkiActivity` in a later commit, and Android test infrastructure does not allow a custom activity to be used in `FragmentScenario`, so we need our own Code mostly copied from FragmentScenario, changes in the file header
Code was copied from Android source with minimal modification to adhere to the Apache license in spirit This cleans up the code: * Remove redundant public modifier * Remove deprecated methods * suppress unused methods * use `Closeable by activityScenario` * Don't redefine `FragmentAction` * remove `themeResId` and `containerResId`
The only question here is whether `showDialogFragment` in CongratsPage is necessary showDialogFragment in CongratsPage should not be necessary as the lifetime of the fragment should match the activity
* dismissAllDialogFragments * showDialogFragment **AnkiFragment** * showDialogFragment This affects all callers, as we now use extension methods
This was previously a test method, but also used in production
Since it's now a method on FragmentActivity, we no longer need interface casting
Purpose / Description
Refactor to make
CustomStudyDialog
more compatible with the Fragment Result APII then continued on and removed some methods from AnkiActivity which no longer needed to be there due to Kotlin-related improvements
Approach
AnkiActivity
where possibleNote: this is a net negative line count when the 517 lines of test code are taken into account
How Has This Been Tested?
CongratsPage & DeckPicker
limit to tags
not workingLearning
Time might be well spent adding automated testing on this functionality, it seems to have atrophied badly
Checklist