Bimba.git

commit 8845fffa85a21e286f41b3db7ecc7256685d228d

Author: Adam <git@apiote.xyz>

refreshing results

 app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt | 16 +++


diff --git a/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
index 4f1dc4f30f3299cc6bede2235041838b9920044e..623226b31bda88008c0f4050b719a1ad687501d4 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
@@ -98,10 +98,26 @@ 		val code = OpenLocationCode.encode(location.latitude, location.longitude)
 		getItemsByLocation(Server.get(this), code)
 	}
 
+	override fun onResume() {
+		super.onResume()
+		@Suppress("DEPRECATION")  // fix_later getSerializable in API>=33
+		if (intent.extras?.get("mode") == Mode.MODE_LOCATION) {
+			locate()
+		}
+	}
+
+	override fun onPause() {
+		super.onPause()
+		val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
+		locationManager.removeUpdates(this)
+		handler.removeCallbacks(runnable)
+	}
+
 	override fun onDestroy() {
 		super.onDestroy()
 		val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
 		locationManager.removeUpdates(this)
+		handler.removeCallbacks(runnable)
 	}
 
 	private fun getItemsByQuery(server: Server, query: String) {