From d177eef0b2331782109612bd30c97994a93c1466 Mon Sep 17 00:00:00 2001 From: Axel Labarre Date: Wed, 22 Feb 2023 18:01:44 +0100 Subject: [PATCH] test JSONobject method --- .../calculator/activities/MainActivity.kt | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/activities/MainActivity.kt index 31ff1ac2..e7a2d245 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/activities/MainActivity.kt @@ -40,11 +40,13 @@ class MainActivity : SimpleActivity(), Calculator { //private var savedBaseValue : Double= 0.0 //private var savedSecondValue : Double = 0.0 //private var savedInputDisplayedFormula : String = "0" + private var json: String = "" //============================================================ private lateinit var calc: CalculatorImpl + override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true super.onCreate(savedInstanceState) @@ -53,22 +55,13 @@ class MainActivity : SimpleActivity(), Calculator { setupOptionsMenu() refreshMenuItems() + updateMaterialActivityViews(main_coordinator, null, useTransparentNavigation = false, useTopSearchMenu = false) 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("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) */ //JSON - bundle.putString("myJsonObject", calc.getjson()) + bundle.putString("myJsonObject", calc.getJson().toString()) } //============================================================ }