diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt index c8a18d22..199d05f1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/CalculatorImpl.kt @@ -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 } diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/Constants.kt index a00ac851..71e79989 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/Constants.kt @@ -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"