consideration of remarks : using constants and remove empty line

Co-authored-by: theom <theo.montaigu@gmail.com>
This commit is contained in:
Axel Labarre 2023-03-25 13:59:57 +01:00
parent f9e4629938
commit 95b7c6b995
2 changed files with 15 additions and 10 deletions

View File

@ -243,8 +243,6 @@ class CalculatorImpl(
}
secondValue = parts.getOrNull(1)?.toDouble() ?: secondValue
}
if (lastOperation != "") {
@ -437,15 +435,14 @@ class CalculatorImpl(
fun getCalculatorStateJson(): JSONObject {
val jsonObj = JSONObject()
jsonObj.put("res", currentResult)
jsonObj.put("previousCalculation", previousCalculation)
jsonObj.put("lastKey", lastKey)
jsonObj.put("lastOperation", lastOperation)
jsonObj.put("baseValue", baseValue)
jsonObj.put("secondValue", secondValue)
jsonObj.put("inputDisplayedFormula", inputDisplayedFormula)
jsonObj.put(RES, currentResult)
jsonObj.put(PREVIOUS_CALCULATION, previousCalculation)
jsonObj.put(LAST_KEY, lastKey)
jsonObj.put(LAST_OPERATION, lastOperation)
jsonObj.put(BASE_VALUE, baseValue)
jsonObj.put(SECOND_VALUE, secondValue)
jsonObj.put(INPUT_DISPLAYED_FORMULA, inputDisplayedFormula)
return jsonObj
}

View File

@ -30,3 +30,11 @@ const val COMMA = ","
// shared prefs
const val USE_COMMA_AS_DECIMAL_MARK = "use_comma_as_decimal_mark"
const val RES = "res"
const val PREVIOUS_CALCULATION = "previousCalculation"
const val LAST_KEY = "lastKey"
const val LAST_OPERATION = "lastOperation"
const val BASE_VALUE = "baseValue"
const val SECOND_VALUE = "secondValue"
const val INPUT_DISPLAYED_FORMULA = "inputDisplayedFormula"