Created
February 1, 2020 09:18
-
-
Save diousk/e330c6c43f1d9b77ed956682eb0a91f9 to your computer and use it in GitHub Desktop.
This file contains 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
class DaggerFragmentFactory @Inject constructor( | |
private val providers: @JvmSuppressWildcards Map<Class<out Fragment>, Provider<Fragment>> | |
) : FragmentFactory() { | |
override fun instantiate(classLoader: ClassLoader, className: String): Fragment { | |
val fragmentClass = loadFragmentClass(classLoader, className) | |
val provider = providers[fragmentClass] | |
return provider?.get() ?: super.instantiate(classLoader, className) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment