|
| 1 | +package com.smarttoolfactory.home.propertylist |
| 2 | + |
| 3 | +import android.os.Bundle |
| 4 | +import com.smarttoolfactory.core.di.CoreModuleDependencies |
| 5 | +import com.smarttoolfactory.core.ui.fragment.DynamicNavigationFragment |
| 6 | +import com.smarttoolfactory.home.R |
| 7 | +import com.smarttoolfactory.home.databinding.FragmentPropertyListBinding |
| 8 | +import com.smarttoolfactory.home.di.DaggerHomeComponent |
| 9 | +import com.smarttoolfactory.home.viewmodel.PropertyListViewModelRxJava3 |
| 10 | +import dagger.hilt.android.EntryPointAccessors |
| 11 | +import javax.inject.Inject |
| 12 | + |
| 13 | +class PropertyListRxjava3Fragment : DynamicNavigationFragment<FragmentPropertyListBinding>() { |
| 14 | + |
| 15 | + @Inject |
| 16 | + lateinit var viewModel: PropertyListViewModelRxJava3 |
| 17 | + |
| 18 | + override fun getLayoutRes(): Int = R.layout.fragment_property_list |
| 19 | + |
| 20 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 21 | + initCoreDependentInjection() |
| 22 | + super.onCreate(savedInstanceState) |
| 23 | + viewModel.getPropertyList() |
| 24 | + } |
| 25 | + |
| 26 | + override fun bindViews() { |
| 27 | + super.bindViews() |
| 28 | + } |
| 29 | + |
| 30 | + private fun initCoreDependentInjection() { |
| 31 | + |
| 32 | + val coreModuleDependencies = EntryPointAccessors.fromApplication( |
| 33 | + requireActivity().applicationContext, |
| 34 | + CoreModuleDependencies::class.java |
| 35 | + ) |
| 36 | + |
| 37 | + DaggerHomeComponent.factory().create( |
| 38 | + dependentModule = coreModuleDependencies, |
| 39 | + fragment = this |
| 40 | + ) |
| 41 | + .inject(this) |
| 42 | + } |
| 43 | +} |
0 commit comments