From 29e293e6b5eedd04c0016078de54028f5c2e0561 Mon Sep 17 00:00:00 2001 From: klaus Date: Thu, 7 Dec 2023 11:06:21 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A3=B0=EB=A0=9B=20=EC=84=A4=EC=A0=95=20-=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EB=90=9C=20=EC=A0=81=EC=9D=B4=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EB=95=8C=20=EA=B8=B0=EB=B3=B8=20=EC=BA=94=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=205=20->=200=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/roulette/config/RouletteSettingsFragment.kt | 8 +++++++- .../live/roulette/config/RouletteSettingsViewModel.kt | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsFragment.kt index 0a23595..73fdae1 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsFragment.kt @@ -93,7 +93,13 @@ class RouletteSettingsFragment : BaseFragment( viewModel.toastLiveData.observe(viewLifecycleOwner) { it?.let { showToast(it) } } - viewModel.canLiveData.observe(viewLifecycleOwner) { binding.etSetPrice.setText("$it") } + viewModel.canLiveData.observe(viewLifecycleOwner) { + if (it > 0) { + binding.etSetPrice.setText("$it") + } else { + binding.etSetPrice.setText("") + } + } viewModel.isLoading.observe(viewLifecycleOwner) { if (it) { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsViewModel.kt index f0f7aeb..9676641 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/roulette/config/RouletteSettingsViewModel.kt @@ -30,7 +30,7 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba val isActiveLiveData: LiveData get() = _isActiveLiveData - private val _canLiveData = MutableLiveData(5) + private val _canLiveData = MutableLiveData(0) val canLiveData: LiveData get() = _canLiveData @@ -39,7 +39,7 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba get() = _roulettePreviewLiveData private val options = mutableListOf() - var can = 5 + var can = 0 var isActive = false fun plusWeight(optionIndex: Int) { @@ -195,10 +195,10 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba recalculatePercentages(options) } else { _isActiveLiveData.value = false - _canLiveData.value = 5 + _canLiveData.value = 0 isActive = false - can = 5 + can = 0 options.add(RouletteOption(title = "", weight = 1)) options.add(RouletteOption(title = "", weight = 1))