Support detached Fragments by removing references to the Activity
🎯 Goal
Previously if we create a fragment that is not yet attached to the activity and reference the balloon, this will throw an IllegalStateException. This is because the lazy loader requires an Activity even thought the implementation only requires Context.
This change removes all references to activities, so the balloon can be successfully attached to the anchor without needing the activity context.
🛠 Implementation details
- Update Lazy helpers to use
requireContextinstead ofrequireActivity - Remove unused
getActivitymethod - Remove unneccesary
Context.isFinishingmethod becauseisAttachedToWindowshould resolve issue #92
Code reviews
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
Hey @jimmithy, checking out the isFinishing is needed for working correctly with Activity. I'm wondering if you can resolve this issue by calling the show method inside the If statements, which has isAttachedToWindow as a condition.
Hey @jimmithy, checking out the
isFinishingis needed for working correctly with Activity. I'm wondering if you can resolve this issue by calling the show method inside the If statements, which hasisAttachedToWindowas a condition.
Hey, I wasn't entirely sure what you were suggesting, but I've restored the isFinishing check in a way that makes the context implementation not necessary.