mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 16:55:26 +02:00
Fix batch converter for negative values
This commit is contained in:
parent
47a8800206
commit
532931914e
@ -183,7 +183,7 @@ internal class ConverterViewModel @Inject constructor(
|
|||||||
unitTo = unitTo,
|
unitTo = unitTo,
|
||||||
sorting = prefs.unitConverterSorting,
|
sorting = prefs.unitConverterSorting,
|
||||||
favorites = prefs.unitConverterFavoritesOnly,
|
favorites = prefs.unitConverterFavoritesOnly,
|
||||||
input = calculation?.toPlainString() ?: input.text,
|
input = (calculation?.toPlainString() ?: input.text).replace(Token.Operator.minus, "-"),
|
||||||
scale = prefs.precision,
|
scale = prefs.precision,
|
||||||
outputFormat = prefs.outputFormat,
|
outputFormat = prefs.outputFormat,
|
||||||
formatterSymbols = AllFormatterSymbols.getById(prefs.separator),
|
formatterSymbols = AllFormatterSymbols.getById(prefs.separator),
|
||||||
|
@ -110,7 +110,6 @@ private fun RightSideScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
items(units, { it.id }) {
|
items(units, { it.id }) {
|
||||||
|
|
||||||
BasicUnitListItem(
|
BasicUnitListItem(
|
||||||
modifier = Modifier.animateItemPlacement(),
|
modifier = Modifier.animateItemPlacement(),
|
||||||
name = stringResource(it.displayName),
|
name = stringResource(it.displayName),
|
||||||
@ -154,11 +153,10 @@ private fun formatUnitToSupportLabel(
|
|||||||
formatterSymbols: FormatterSymbols,
|
formatterSymbols: FormatterSymbols,
|
||||||
readyCurrencies: Boolean,
|
readyCurrencies: Boolean,
|
||||||
): String {
|
): String {
|
||||||
try {
|
if ((unitFrom?.group == UnitGroup.CURRENCY) and !readyCurrencies) return shortName
|
||||||
if ((unitFrom?.group == UnitGroup.CURRENCY) and !readyCurrencies) {
|
if (input.isEmpty()) return shortName
|
||||||
return shortName
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
if ((unitFrom is DefaultUnit) and (unitTo is DefaultUnit)) {
|
if ((unitFrom is DefaultUnit) and (unitTo is DefaultUnit)) {
|
||||||
unitFrom as DefaultUnit
|
unitFrom as DefaultUnit
|
||||||
unitTo as DefaultUnit
|
unitTo as DefaultUnit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user