[Deprecation] forward port Fragment startActivityForResult/onActvityResult to new Activity APIs
The androidx.fragment library (and associated androidx.activity library) have taken over a lot of the basic android.Activity object's work with regard to starting activities outside the current Actvitiy or Fragment, and receiving results from them.
In general the Android team is recommending doing this inter-fragment/inter-activity communication now using their AndroidX libraries, and they have specifically deprecated the fragment APIs that we were using in CardTemplateEditor and StudyOptionsFragment (and really, any place we are doing startActivityForResult and onActivityResult throughout the code)
At minimum we need to forward port CardTemplateEditor and StudyOptionsFragment to the new style following these guides:
https://developer.android.com/training/basics/intents/result https://developer.android.com/guide/fragments/communicate#fragment-result
In the meantime I have suppressed the error in the code with a reference to this issue.
Marking this as help wanted, but I will note it is not necessarily a good first issue.
You must have a very strong knowledge of the Android Activity Lifecycle, and everything in the two linked documents should make perfect sense before attempting to restructure the start/result behavior of these fragments
Some functions in AnkiActivity https://github.com/ankidroid/Anki-Android/blame/aec2d6489422a51d3d8a9665ae164541583e5980/src/com/ichi2/anki/AnkiActivity.java have been marked as deprecated since 2012 when they were introduced. Do you think it's related? Otherwise, I believe an extra issue should deal with this and figure out what to do with those function we have been calling for a decade and have always been deprecated without anything indicating why
Some functions in AnkiActivity https://github.com/ankidroid/Anki-Android/blame/aec2d6489422a51d3d8a9665ae164541583e5980/src/com/ichi2/anki/AnkiActivity.java have been marked as deprecated since 2012 when they were introduced. Do you think it's related? Otherwise, I believe an extra issue should deal with this and figure out what to do with those function we have been calling for a decade and have always been deprecated without anything indicating why
I believe those are deprecated because we're not specifying an animation when we launch the activity.
Would love to work on this if available
Can I work on this?
@kartikeysaran asked first so I think we should let them have a go at it
Please keep the first PR very small and focused as this will be a new way of starting activities and getting results for us. These are fundamental concepts in Android programming so it's important that we all get a chance to look at it from a design perspective before a lot of implementation takes place, but one single implementation to demonstrate the new design is how to check the design.
So please post a change that just moves CardTemplateEditor to the new APIs and post that, then we can all look?
@kartikeysaran asked first so I think we should let them have a go at it
Please keep the first PR very small and focused as this will be a new way of starting activities and getting results for us. These are fundamental concepts in Android programming so it's important that we all get a chance to look at it from a design perspective before a lot of implementation takes place, but one single implementation to demonstrate the new design is how to check the design.
So please post a change that just moves CardTemplateEditor to the new APIs and post that, then we can all look?
Okay !