Created
October 24, 2020 21:16
-
-
Save skywall/bc8a465d31b4337861db7fad08b8156f to your computer and use it in GitHub Desktop.
BaseFragment in Home module
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
abstract class BaseFragment : Fragment() { | |
private object ModuleComponent : SingletonHolder<HomeComponent, Context>({ context -> | |
DaggerHomeComponent | |
.factory() | |
.create(CoreComponentHolder.getInstance(context.applicationContext as App)) | |
}) | |
val homeComponent: HomeComponent | |
get() = ModuleComponent.getInstance(requireContext()) | |
override fun onAttach(context: Context) { | |
super.onAttach(context) | |
inject() | |
} | |
abstract fun inject() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment