Fix to forget geocoding result when scrolled and then rotated device

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-03-29 12:38:13 +02:00
parent 4ab3d78458
commit bc96ffcd20
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -119,10 +119,14 @@ class LocationPickerActivity :
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
roomToken = intent.getStringExtra(KEY_ROOM_TOKEN)!!
geocodingResult = intent.getParcelableExtra(KEY_GEOCODING_RESULT)
if (savedInstanceState != null) { if (savedInstanceState != null) {
moveToCurrentLocation = savedInstanceState.getBoolean("moveToCurrentLocation") == true moveToCurrentLocation = savedInstanceState.getBoolean("moveToCurrentLocation") == true
mapCenterLat = savedInstanceState.getDouble("mapCenterLat") mapCenterLat = savedInstanceState.getDouble("mapCenterLat")
mapCenterLon = savedInstanceState.getDouble("mapCenterLon") mapCenterLon = savedInstanceState.getDouble("mapCenterLon")
geocodingResult = savedInstanceState.getParcelable("geocodingResult")
} }
binding = ActivityLocationBinding.inflate(layoutInflater) binding = ActivityLocationBinding.inflate(layoutInflater)
@ -131,9 +135,6 @@ class LocationPickerActivity :
setContentView(binding.root) setContentView(binding.root)
getInstance().load(context, PreferenceManager.getDefaultSharedPreferences(context)) getInstance().load(context, PreferenceManager.getDefaultSharedPreferences(context))
roomToken = intent.getStringExtra(KEY_ROOM_TOKEN)!!
geocodingResult = intent.getParcelableExtra(KEY_GEOCODING_RESULT)
} }
override fun onStart() { override fun onStart() {
@ -168,6 +169,7 @@ class LocationPickerActivity :
bundle.putBoolean("moveToCurrentLocation", moveToCurrentLocation) bundle.putBoolean("moveToCurrentLocation", moveToCurrentLocation)
bundle.putDouble("mapCenterLat", binding.map.mapCenter.latitude) bundle.putDouble("mapCenterLat", binding.map.mapCenter.latitude)
bundle.putDouble("mapCenterLon", binding.map.mapCenter.longitude) bundle.putDouble("mapCenterLon", binding.map.mapCenter.longitude)
bundle.putParcelable("geocodingResult", geocodingResult)
} }
private fun setupActionBar() { private fun setupActionBar() {