diff --git a/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt index 8bce959..3399546 100644 --- a/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt +++ b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalActivity.kt @@ -5,13 +5,9 @@ import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.databinding.DataBindingUtil -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.lifecycleScope -import androidx.lifecycle.repeatOnLifecycle import com.ftw.hometerview.R import com.ftw.hometerview.databinding.ActivityWithdrawalBinding import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.launch import javax.inject.Inject @AndroidEntryPoint @@ -34,18 +30,9 @@ class WithdrawalActivity : AppCompatActivity() { this, R.layout.activity_withdrawal ).apply { + lifecycleOwner = this@WithdrawalActivity viewModel = this@WithdrawalActivity.viewModel } - observe() } - private fun observe() { - lifecycleScope.launch { - repeatOnLifecycle(Lifecycle.State.STARTED) { - viewModel.withdrawalCheck.collect { showBanner -> - binding.withdrawalButton.isEnabled = showBanner - } - } - } - } } diff --git a/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt index ebc38ba..6b4be03 100644 --- a/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt +++ b/app/src/main/java/com/ftw/hometerview/ui/withdrawal/WithdrawalViewModel.kt @@ -1,12 +1,6 @@ package com.ftw.hometerview.ui.withdrawal -import com.ftw.hometerview.BR -import com.ftw.hometerview.R -import com.ftw.hometerview.adapter.RecyclerItem import com.ftw.hometerview.dispatcher.Dispatcher -import com.ftw.hometerview.ui.main.favorite.favoritelist.FavoriteBuildingItem -import com.ftw.hometerview.ui.main.favorite.favoritelist.FavoriteBuildingsViewModel -import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.* class WithdrawalViewModel( @@ -18,6 +12,7 @@ class WithdrawalViewModel( val withdrawalThirdCheck: MutableStateFlow = MutableStateFlow(false) val withdrawalCheck: MutableStateFlow = MutableStateFlow(false) + fun onClickWithdrawalFirstCheck() { withdrawalFirstCheck.value = !withdrawalFirstCheck.value withdrawalCheck.value = withdrawalCheck()