diff --git a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt index 6471b9c..2a0ab35 100644 --- a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt +++ b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt @@ -20,6 +20,7 @@ import jackall.moncalc.db.MonstDataRealmHelper import jackall.moncalc.utils.MySharedPref import jackall.moncalc.viewmodel.OverlayRegistViewModel +import jackall.moncalc.viewmodel.OverlayViewModel import jackall.moncalc.vo.Fruit import jackall.moncalc.vo.Grade import jackall.moncalc.vo.Temple @@ -46,6 +47,9 @@ } var isLongClick: Boolean = false + val overlayRegistViewModel by lazy { OverlayRegistViewModel(this as MainServiceContract, this) } + val overlayViewModel by lazy { OverlayViewModel(this as MainServiceContract) } + val monstDataRealmHelper = MonstDataRealmHelper() override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { @@ -117,7 +121,8 @@ } fun setSpinnerConfig() { - registBinding.registViewModel = OverlayRegistViewModel(this as MainServiceContract, this) + registBinding.registViewModel = overlayRegistViewModel + registBinding.viewModel = overlayViewModel val templeSpinnerAdapter = CustomSpinnerAdapter(this, monstDataRealmHelper.findNames(Temple::class.java)) val fruitSpinnerAdapter = CustomSpinnerAdapter(this, monstDataRealmHelper.findNames(Fruit::class.java)) val gradeSpinnerAdapter = CustomSpinnerAdapter(this, monstDataRealmHelper.findNames(Grade::class.java))