룰렛 설정 - 설정된 적이 없을 때 기본 캔 설정 5 -> 0으로 변경
This commit is contained in:
parent
2883c63e07
commit
29e293e6b5
|
@ -93,7 +93,13 @@ class RouletteSettingsFragment : BaseFragment<FragmentRouletteSettingsBinding>(
|
|||
|
||||
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) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
|
|||
val isActiveLiveData: LiveData<Boolean>
|
||||
get() = _isActiveLiveData
|
||||
|
||||
private val _canLiveData = MutableLiveData(5)
|
||||
private val _canLiveData = MutableLiveData(0)
|
||||
val canLiveData: LiveData<Int>
|
||||
get() = _canLiveData
|
||||
|
||||
|
@ -39,7 +39,7 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
|
|||
get() = _roulettePreviewLiveData
|
||||
|
||||
private val options = mutableListOf<RouletteOption>()
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue