Fix problem while adding operators with result after rotation
This commit is contained in:
parent
ab579c4737
commit
93fb0125de
|
@ -37,8 +37,9 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
private var savedPreviousCalculation = ""
|
||||
private var savedLastKey: String = ""
|
||||
private var savedLastOperation: String = ""
|
||||
private var savedBaseValue : Double= 5.5
|
||||
private var savedSecondValue : Double = 7.5
|
||||
private var savedBaseValue : Double= 0.0
|
||||
private var savedSecondValue : Double = 0.0
|
||||
private var savedInputDisplayedFormula : String = "0"
|
||||
|
||||
//============================================================
|
||||
|
||||
|
@ -52,14 +53,6 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
refreshMenuItems()
|
||||
|
||||
//============================================================
|
||||
//Log.v("SAVEDRES : ", savedRes)
|
||||
//Log.v("SAVEDPREVIOUS : ", savedPreviousCalculation)
|
||||
//Log.v("SAVEDLASTKEY : ", savedLastKey)
|
||||
//Log.v("SAVEDLASTOP : ", savedLastOperation)
|
||||
//Log.v("DECIMALSEP : ", decimalSeparator)
|
||||
//Log.v("GROUPINGSEP : ", groupingSeparator)
|
||||
//Log.v("BASEVALUE : ", savedBaseValue.toString())
|
||||
//Log.v("SECONDVALUE : ", savedSecondValue.toString())
|
||||
|
||||
if(savedInstanceState != null) {
|
||||
Log.v("MainActivity", "LOG TEST");
|
||||
|
@ -69,6 +62,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
savedLastOperation = savedInstanceState?.getCharSequence("savedLastOperation") as String
|
||||
savedBaseValue = savedInstanceState.getDouble("savedBaseValue")
|
||||
savedSecondValue = savedInstanceState.getDouble("savedSecondValue")
|
||||
savedInputDisplayedFormula = savedInstanceState.getCharSequence("savedInputDisplayedFormula") as String
|
||||
|
||||
}
|
||||
|
||||
|
@ -298,6 +292,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
bundle.putString("savedLastOperation", calc.lastOperation)
|
||||
bundle.putDouble("savedBaseValue", calc.baseValue)
|
||||
bundle.putDouble("savedSecondValue", calc.getSecondValue())
|
||||
bundle.putString("savedInputDisplayedFormula", calc.inputDisplayedFormula)
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.math.BigDecimal
|
|||
class CalculatorImpl(
|
||||
calculator: Calculator,
|
||||
private val context: Context,
|
||||
|
||||
private var decimalSeparator: String = DOT,
|
||||
private var groupingSeparator: String = COMMA,
|
||||
|
||||
|
@ -22,7 +21,8 @@ class CalculatorImpl(
|
|||
aLastKey: String = "",
|
||||
aLastOperation: String = "",
|
||||
aBaseValue: Double = 0.0,
|
||||
aSecondValue: Double = 99.0
|
||||
aSecondValue: Double = 0.0,
|
||||
aInputDisplayedFormula: String = "0"
|
||||
|
||||
//============================================================
|
||||
) {
|
||||
|
@ -36,11 +36,12 @@ class CalculatorImpl(
|
|||
public var lastOperation = aLastOperation
|
||||
public var baseValue = aBaseValue
|
||||
private var secondValue = aSecondValue
|
||||
public var inputDisplayedFormula = aInputDisplayedFormula
|
||||
//============================================================
|
||||
|
||||
//private var baseValue = 0.0
|
||||
//private var secondValue = 0.0
|
||||
private var inputDisplayedFormula = "0"
|
||||
//private var inputDisplayedFormula = "0"
|
||||
//private var lastKey = ""
|
||||
//private var lastOperation = ""
|
||||
private val operations = listOf("+", "-", "×", "÷", "^", "%", "√")
|
||||
|
|
Loading…
Reference in New Issue