Merge branch 'dev-axel-saveInstanceState' into fix_data_lost_during_rotation
This commit is contained in:
commit
678250812a
|
@ -37,8 +37,9 @@ class MainActivity : SimpleActivity(), Calculator {
|
||||||
private var savedPreviousCalculation = ""
|
private var savedPreviousCalculation = ""
|
||||||
private var savedLastKey: String = ""
|
private var savedLastKey: String = ""
|
||||||
private var savedLastOperation: String = ""
|
private var savedLastOperation: String = ""
|
||||||
private var savedBaseValue : Double= 5.5
|
private var savedBaseValue : Double= 0.0
|
||||||
private var savedSecondValue : Double = 7.5
|
private var savedSecondValue : Double = 0.0
|
||||||
|
private var savedInputDisplayedFormula : String = "0"
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
@ -52,14 +53,6 @@ class MainActivity : SimpleActivity(), Calculator {
|
||||||
refreshMenuItems()
|
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) {
|
if(savedInstanceState != null) {
|
||||||
Log.v("MainActivity", "LOG TEST");
|
Log.v("MainActivity", "LOG TEST");
|
||||||
|
@ -69,6 +62,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
||||||
savedLastOperation = savedInstanceState?.getCharSequence("savedLastOperation") as String
|
savedLastOperation = savedInstanceState?.getCharSequence("savedLastOperation") as String
|
||||||
savedBaseValue = savedInstanceState.getDouble("savedBaseValue")
|
savedBaseValue = savedInstanceState.getDouble("savedBaseValue")
|
||||||
savedSecondValue = savedInstanceState.getDouble("savedSecondValue")
|
savedSecondValue = savedInstanceState.getDouble("savedSecondValue")
|
||||||
|
savedInputDisplayedFormula = savedInstanceState.getCharSequence("savedInputDisplayedFormula") as String
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +292,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
||||||
bundle.putString("savedLastOperation", calc.lastOperation)
|
bundle.putString("savedLastOperation", calc.lastOperation)
|
||||||
bundle.putDouble("savedBaseValue", calc.baseValue)
|
bundle.putDouble("savedBaseValue", calc.baseValue)
|
||||||
bundle.putDouble("savedSecondValue", calc.getSecondValue())
|
bundle.putDouble("savedSecondValue", calc.getSecondValue())
|
||||||
|
bundle.putString("savedInputDisplayedFormula", calc.inputDisplayedFormula)
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.math.BigDecimal
|
||||||
class CalculatorImpl(
|
class CalculatorImpl(
|
||||||
calculator: Calculator,
|
calculator: Calculator,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
|
||||||
private var decimalSeparator: String = DOT,
|
private var decimalSeparator: String = DOT,
|
||||||
private var groupingSeparator: String = COMMA,
|
private var groupingSeparator: String = COMMA,
|
||||||
|
|
||||||
|
@ -22,7 +21,8 @@ class CalculatorImpl(
|
||||||
aLastKey: String = "",
|
aLastKey: String = "",
|
||||||
aLastOperation: String = "",
|
aLastOperation: String = "",
|
||||||
aBaseValue: Double = 0.0,
|
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 lastOperation = aLastOperation
|
||||||
public var baseValue = aBaseValue
|
public var baseValue = aBaseValue
|
||||||
private var secondValue = aSecondValue
|
private var secondValue = aSecondValue
|
||||||
|
public var inputDisplayedFormula = aInputDisplayedFormula
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
//private var baseValue = 0.0
|
//private var baseValue = 0.0
|
||||||
//private var secondValue = 0.0
|
//private var secondValue = 0.0
|
||||||
private var inputDisplayedFormula = "0"
|
//private var inputDisplayedFormula = "0"
|
||||||
//private var lastKey = ""
|
//private var lastKey = ""
|
||||||
//private var lastOperation = ""
|
//private var lastOperation = ""
|
||||||
private val operations = listOf("+", "-", "×", "÷", "^", "%", "√")
|
private val operations = listOf("+", "-", "×", "÷", "^", "%", "√")
|
||||||
|
|
Loading…
Reference in New Issue