Bimba.git

commit 2ce0e38ed94ae99030063f0757c73deea3f42445

Author: Adam <git@apiote.xyz>

cleanup

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt b/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt
index b074d8b82c53f55f1ccadf3ae79987693d583418..cc674596de82f8f5dd40e9ecaa83d9887e2e2af2 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/api/Structs.kt
@@ -391,7 +391,7 @@ 			result += "${chOpt.line} → ${chOpt.headsign}\n"
 		return result
 	}
 
-	fun changeOptions(context: Context): Pair<String,String> {
+	fun changeOptions(context: Context): Pair<String, String> {
 		return Pair(changeOptions.groupBy { it.line }
 			.map { Pair(it.key, it.value.joinToString { co -> co.headsign }) }
 			.joinToString {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeViewModel.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeViewModel.kt
index 1b3144477b7a8512448f37c5b962ed63b422b9b1..0e9c6f6774f07dabce5868eb16e16345c3df6ac7 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeViewModel.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeViewModel.kt
@@ -24,7 +24,7 @@
 	fun getItems(cm: ConnectivityManager, server: Server, query: String) {
 		viewModelScope.launch {
 			val itemsResult = queryItems(cm, server, query, limit = 6)
-			if (itemsResult.stream == null) {
+			if (itemsResult.stream == null) { // todo first check error
 				Log.e("HVM.getItems", "$itemsResult")
 			} else {
 				val response = unmarshallItemResponse(itemsResult.stream)




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapFragment.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapFragment.kt
index 5146115ec74ba17dbb13cd2d2355f219d7d2cb7d..6267a6598bbb72421f39492c77ec29ac1c70cc7b 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapFragment.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapFragment.kt
@@ -222,7 +222,7 @@ 		binding.map.onPause()
 		locationOverlay.disableMyLocation()
 		val centre = binding.map.mapCenter
 		context?.let { ctx ->
-			ctx.getSharedPreferences("shp", MODE_PRIVATE).edit {
+			ctx.getSharedPreferences("shp", MODE_PRIVATE).edit(true) {
 				this.putFloat("mapCentreLat", centre.latitude.toFloat())
 				this.putFloat("mapCentreLon", centre.longitude.toFloat())
 				this.putFloat("mapZoom", binding.map.zoomLevelDouble.toFloat())




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapViewModel.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapViewModel.kt
index 0e92face1169bc1ed59c86d5299fe75638b4fd27..63e618f42daa552f00809b26e99af333dc5d886c 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapViewModel.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapViewModel.kt
@@ -34,7 +34,7 @@
 	fun getLocatablesIn(cm: ConnectivityManager, server: Server, bl: Position, tr: Position) {
 		viewModelScope.launch {
 			val locatablesResult = ml.adamsprogs.bimba.api.getLocatablesIn(cm, server, bl, tr)
-			val response = if (locatablesResult.stream != null) {
+			val response = if (locatablesResult.stream != null) { // todo first check error
 				unmarshallLocatablesResponse(locatablesResult.stream)
 			} else {
 				null




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 3bc018c930bcffbcb66bd0c2ab98a2e6dff3ad34..f28c8c14cf358f172cd04f03fe8434c9c8fcc8b8 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
@@ -124,7 +124,7 @@ 	private fun getItemsByQuery(server: Server, query: String) {
 		val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
 		MainScope().launch {
 			val itemsResult = queryItems(cm, server, query)
-			val response = if (itemsResult.stream != null) {
+			val response = if (itemsResult.stream != null) { // todo first check error
 				unmarshallItemResponse(itemsResult.stream)
 			} else {
 				null
@@ -143,7 +143,7 @@ 	private fun getItemsByLocation(server: Server, position: Position) {
 		val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
 		MainScope().launch {
 			val itemsResult = locateItems(cm, server, position)
-			val response = if (itemsResult.stream != null) {
+			val response = if (itemsResult.stream != null) {  // todo first check error
 				unmarshallItemResponse(itemsResult.stream)
 			} else {
 				null




diff --git a/app/src/main/res/layout/activity_departures.xml b/app/src/main/res/layout/activity_departures.xml
index e5aad3ed0e731d53aedb2311a3c1c30fe7f2b9cf..829df58e2ab1a1f337289fe70254abeca25b9bc2 100644
--- a/app/src/main/res/layout/activity_departures.xml
+++ b/app/src/main/res/layout/activity_departures.xml
@@ -11,11 +11,11 @@ 		android:id="@+id/departures_overlay"
 		android:layout_width="match_parent"
 		android:layout_height="match_parent">
 
-		<com.google.android.material.progressindicator.LinearProgressIndicator
+		<com.google.android.material.progressindicator.CircularProgressIndicator
 			android:id="@+id/departures_progress"
-			style="?android:attr/progressBarStyle"
 			android:layout_width="wrap_content"
 			android:layout_height="wrap_content"
+			android:indeterminate="true"
 			app:layout_constraintBottom_toBottomOf="parent"
 			app:layout_constraintEnd_toEndOf="parent"
 			app:layout_constraintStart_toStartOf="parent"




diff --git a/app/src/main/res/layout/activity_results.xml b/app/src/main/res/layout/activity_results.xml
index e080acfa860e7e43c54143e0a930808dd9efa641..076c6fa151bbfbd5e960b8229594a51c76aa13ef 100644
--- a/app/src/main/res/layout/activity_results.xml
+++ b/app/src/main/res/layout/activity_results.xml
@@ -11,11 +11,11 @@ 		android:id="@+id/results_overlay"
 		android:layout_width="match_parent"
 		android:layout_height="match_parent">
 
-		<com.google.android.material.progressindicator.LinearProgressIndicator
+		<com.google.android.material.progressindicator.CircularProgressIndicator
 			android:id="@+id/results_progress"
-			style="?android:attr/progressBarStyle"
 			android:layout_width="wrap_content"
 			android:layout_height="wrap_content"
+			android:indeterminate="true"
 			app:layout_constraintBottom_toBottomOf="parent"
 			app:layout_constraintEnd_toEndOf="parent"
 			app:layout_constraintStart_toStartOf="parent"




diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5195ff82dbe7883a66e34b3aeaa4a6ef63888584..75a4074007c5cb20329c6d27d0e1f5ad5ba30960 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,8 +8,6 @@ 	Search stops and lines
 	<string name="title_activity_results">Results</string>
 	<string name="cont">Continue</string>
 	<string name="save">Save</string>
-	<string name="server_info_rate_limited">this server is rate limited;\nthe server admin can be contacted at\n%s\n\nit offers the following feeds:</string>
-	<string name="server_info_not_rate_limited">this server is not rate limited;\nthe server admin can be contacted at\n%s\n\nit offers the following feeds:</string>
 	<string name="error_400">The application made a malformed request</string>
 	<string name="error_401">A token is needed to use this server</string>
 	<string name="error_403">The token you provided is incorrect</string>