Last active
December 12, 2018 12:14
-
-
Save amadeu01/2b3ac3c22e3752a548ef4fd9916708a8 to your computer and use it in GitHub Desktop.
Injected Fragment for Kodein
This file contains hidden or 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
| abstract class InjectedFragment<T> : Fragment(), KodeinAware { | |
| private val activityKodein by closestKodein() | |
| override val kodein: Kodein by retainedKodein { | |
| extend(activityKodein) | |
| import(fragmentModule(parseBundle(arguments))) | |
| } | |
| open fun fragmentModule(data: T?) = Kodein.Module("activityModule") {} | |
| open fun parseBundle(arguments: Bundle?): T? = null | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment