Fix a small display issue.
This commit is contained in:
parent
b9aad61d5f
commit
8f8df3ce80
2 changed files with 16 additions and 16 deletions
|
|
@ -313,7 +313,7 @@ private fun MainContent(
|
||||||
withStyle(packageStyleSpan) {
|
withStyle(packageStyleSpan) {
|
||||||
append("Forfait IS (")
|
append("Forfait IS (")
|
||||||
append(it.packageISInput)
|
append(it.packageISInput)
|
||||||
append(") : ")
|
append("€) : ")
|
||||||
}
|
}
|
||||||
withStyle(amountStyleSpan) { append("${it.packageISValue}") }
|
withStyle(amountStyleSpan) { append("${it.packageISValue}") }
|
||||||
},
|
},
|
||||||
|
|
@ -324,7 +324,7 @@ private fun MainContent(
|
||||||
withStyle(packageStyleSpan) {
|
withStyle(packageStyleSpan) {
|
||||||
append("Forfait 2B (")
|
append("Forfait 2B (")
|
||||||
append(it.package2BInput)
|
append(it.package2BInput)
|
||||||
append(") : ")
|
append("€) : ")
|
||||||
}
|
}
|
||||||
withStyle(amountStyleSpan) { append("${it.package2BValue}") }
|
withStyle(amountStyleSpan) { append("${it.package2BValue}") }
|
||||||
},
|
},
|
||||||
|
|
@ -335,7 +335,7 @@ private fun MainContent(
|
||||||
withStyle(packageStyleSpan) {
|
withStyle(packageStyleSpan) {
|
||||||
append("Forfait IS (")
|
append("Forfait IS (")
|
||||||
append(it.packageISInput)
|
append(it.packageISInput)
|
||||||
append(") : ")
|
append("€) : ")
|
||||||
}
|
}
|
||||||
withStyle(amountStyleSpan) { append("${it.packageISValue}") }
|
withStyle(amountStyleSpan) { append("${it.packageISValue}") }
|
||||||
},
|
},
|
||||||
|
|
@ -412,11 +412,11 @@ private fun MainContentPreview() {
|
||||||
listOf(
|
listOf(
|
||||||
MainScreenResult(
|
MainScreenResult(
|
||||||
id = "0-1",
|
id = "0-1",
|
||||||
packageISInput = "77.29€",
|
packageISInput = "77.29",
|
||||||
packageISValue = 3,
|
packageISValue = 3,
|
||||||
package2BInput = "96.26€",
|
package2BInput = "96.26",
|
||||||
package2BValue = 80,
|
package2BValue = 80,
|
||||||
packageFAInput = "107.97€",
|
packageFAInput = "107.97",
|
||||||
packageFAValue = 64,
|
packageFAValue = 64,
|
||||||
result = 14841.52,
|
result = 14841.52,
|
||||||
delta = 0.0,
|
delta = 0.0,
|
||||||
|
|
|
||||||
|
|
@ -91,27 +91,27 @@ class MainViewModel @Inject constructor() : ViewModel() {
|
||||||
precision: Double = 10.0.pow(DECIMALS),
|
precision: Double = 10.0.pow(DECIMALS),
|
||||||
) {
|
) {
|
||||||
val input = expected.value(precision)
|
val input = expected.value(precision)
|
||||||
if (input == null) {
|
if (input == null || input <= 0) {
|
||||||
expected.errorFlow.value = true
|
expected.errorFlow.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val valueIS = packageIS.value(precision)
|
val valueIS = packageIS.value(precision)
|
||||||
if (valueIS == null) {
|
if (valueIS == null || valueIS <= 0) {
|
||||||
packageIS.errorFlow.value = true
|
packageIS.errorFlow.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val maxIS = (input / valueIS) + 1
|
val maxIS = (input / valueIS) + 1
|
||||||
|
|
||||||
val value2B = package2B.value(precision)
|
val value2B = package2B.value(precision)
|
||||||
if (value2B == null) {
|
if (value2B == null || value2B <= 0) {
|
||||||
package2B.errorFlow.value = true
|
package2B.errorFlow.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val max2B = (input / value2B) + 1
|
val max2B = (input / value2B) + 1
|
||||||
|
|
||||||
val valueFA = packageFA.value(precision)
|
val valueFA = packageFA.value(precision)
|
||||||
if (valueFA == null) {
|
if (valueFA == null || valueFA <= 0) {
|
||||||
packageFA.errorFlow.value = true
|
packageFA.errorFlow.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -161,11 +161,11 @@ class MainViewModel @Inject constructor() : ViewModel() {
|
||||||
_results.value = listOf(
|
_results.value = listOf(
|
||||||
MainScreenResult(
|
MainScreenResult(
|
||||||
id = "$delta-0",
|
id = "$delta-0",
|
||||||
packageISInput = inputs.value.packageIS.labelFlow.value ?: "",
|
packageISInput = inputs.value.packageIS.valueFlow.value,
|
||||||
packageISValue = indexIS,
|
packageISValue = indexIS,
|
||||||
package2BInput = inputs.value.package2B.labelFlow.value ?: "",
|
package2BInput = inputs.value.package2B.valueFlow.value,
|
||||||
package2BValue = index2B,
|
package2BValue = index2B,
|
||||||
packageFAInput = inputs.value.packageFA.labelFlow.value ?: "",
|
packageFAInput = inputs.value.packageFA.valueFlow.value,
|
||||||
packageFAValue = indexFA,
|
packageFAValue = indexFA,
|
||||||
result = previousResult / precision,
|
result = previousResult / precision,
|
||||||
delta = delta,
|
delta = delta,
|
||||||
|
|
@ -179,11 +179,11 @@ class MainViewModel @Inject constructor() : ViewModel() {
|
||||||
list.add(
|
list.add(
|
||||||
MainScreenResult(
|
MainScreenResult(
|
||||||
id = "$delta-${list.size}",
|
id = "$delta-${list.size}",
|
||||||
packageISInput = inputs.value.packageIS.labelFlow.value ?: "",
|
packageISInput = inputs.value.packageIS.valueFlow.value,
|
||||||
packageISValue = indexIS,
|
packageISValue = indexIS,
|
||||||
package2BInput = inputs.value.package2B.labelFlow.value ?: "",
|
package2BInput = inputs.value.package2B.valueFlow.value,
|
||||||
package2BValue = index2B,
|
package2BValue = index2B,
|
||||||
packageFAInput = inputs.value.packageFA.labelFlow.value ?: "",
|
packageFAInput = inputs.value.packageFA.valueFlow.value,
|
||||||
packageFAValue = indexFA,
|
packageFAValue = indexFA,
|
||||||
result = previousResult / precision,
|
result = previousResult / precision,
|
||||||
delta = delta,
|
delta = delta,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue