test JSONobject method

This commit is contained in:
Axel Labarre 2023-02-22 18:01:44 +01:00
parent f1a8e8c03d
commit d177eef0b2
1 changed files with 17 additions and 12 deletions

View File

@ -40,11 +40,13 @@ class MainActivity : SimpleActivity(), Calculator {
//private var savedBaseValue : Double= 0.0 //private var savedBaseValue : Double= 0.0
//private var savedSecondValue : Double = 0.0 //private var savedSecondValue : Double = 0.0
//private var savedInputDisplayedFormula : String = "0" //private var savedInputDisplayedFormula : String = "0"
private var json: String = ""
//============================================================ //============================================================
private lateinit var calc: CalculatorImpl private lateinit var calc: CalculatorImpl
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true isMaterialActivity = true
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -53,22 +55,13 @@ class MainActivity : SimpleActivity(), Calculator {
setupOptionsMenu() setupOptionsMenu()
refreshMenuItems() refreshMenuItems()
updateMaterialActivityViews(main_coordinator, null, useTransparentNavigation = false, useTopSearchMenu = false) updateMaterialActivityViews(main_coordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)
setupMaterialScrollListener(main_nested_scrollview, main_toolbar) setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
//============================================================ //============================================================
if(savedInstanceState != null) {
Log.v("MainActivity", "LOG TEST");
//savedRes = savedInstanceState?.getCharSequence("res") as String
//savedPreviousCalculation = savedInstanceState?.getCharSequence("savedPreviousCalculation") as String
//savedLastKey = savedInstanceState?.getCharSequence("savedLastKey") as String
//savedLastOperation = savedInstanceState?.getCharSequence("savedLastOperation") as String
//savedBaseValue = savedInstanceState.getDouble("savedBaseValue")
//savedSecondValue = savedInstanceState.getDouble("savedSecondValue")
//savedInputDisplayedFormula = savedInstanceState.getCharSequence("savedInputDisplayedFormula") as String
}
//Log.v("SAVEDRES : ", savedRes) //Log.v("SAVEDRES : ", savedRes)
//Log.v("SAVEDPREVIOUS : ", savedPreviousCalculation) //Log.v("SAVEDPREVIOUS : ", savedPreviousCalculation)
@ -81,7 +74,19 @@ class MainActivity : SimpleActivity(), Calculator {
calc = CalculatorImpl(this, applicationContext,decimalSeparator, groupingSeparator) if(savedInstanceState != null) {
Log.v("MainActivity", "LOG TEST");
//savedRes = savedInstanceState?.getCharSequence("res") as String
//savedPreviousCalculation = savedInstanceState?.getCharSequence("savedPreviousCalculation") as String
//savedLastKey = savedInstanceState?.getCharSequence("savedLastKey") as String
//savedLastOperation = savedInstanceState?.getCharSequence("savedLastOperation") as String
//savedBaseValue = savedInstanceState.getDouble("savedBaseValue")
//savedSecondValue = savedInstanceState.getDouble("savedSecondValue")
//savedInputDisplayedFormula = savedInstanceState.getCharSequence("savedInputDisplayedFormula") as String
json = savedInstanceState.getCharSequence("myJsonObject") as String
}
calc = CalculatorImpl(this, applicationContext,decimalSeparator, groupingSeparator, json)
//============================================================ //============================================================
@ -300,7 +305,7 @@ class MainActivity : SimpleActivity(), Calculator {
bundle.putString("savedInputDisplayedFormula", calc.inputDisplayedFormula) bundle.putString("savedInputDisplayedFormula", calc.inputDisplayedFormula)
*/ */
//JSON //JSON
bundle.putString("myJsonObject", calc.getjson()) bundle.putString("myJsonObject", calc.getJson().toString())
} }
//============================================================ //============================================================
} }