Bimba.git

commit 459b6294c1a664dfb1350d50e88013f5852028da

Author: Adam <git@apiote.xyz>

todos

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


diff --git a/app/src/main/java/ml/adamsprogs/bimba/api/Api.kt b/app/src/main/java/ml/adamsprogs/bimba/api/Api.kt
index 673a603bcbb414dae90c71f1eb7eec1d2230c9a7..db337e6501eacb2db359c1a0d07169c80cdf2ce2 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/api/Api.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/api/Api.kt
@@ -11,7 +11,7 @@
 data class Server(val host: String, val token: String, val feeds: String)
 
 @Suppress("BlockingMethodInNonBlockingContext")
-suspend fun getFeeds(server: Server): InputStream? {  // todo if 401 then needs token
+suspend fun getFeeds(server: Server): InputStream? {  // todo(error-handling) if 401 then needs token
 	return rawRequest(URL("${hostWithScheme(server.host)}/api/"), server)
 }
 




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
index 1e1db600a542b551fc02a4e8479c6bf0a060dac8..5034bc457a778d3284aa02db0798a7257a070b92 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/MainActivity.kt
@@ -66,12 +66,17 @@ 								permissions[Manifest.permission.ACCESS_COARSE_LOCATION] ?: false -> {
 					showResults(ResultsActivity.Mode.MODE_LOCATION)
 				}
 				else -> {
+					// todo(ux,ui) dialog
 					Toast.makeText(this, "No location access given", Toast.LENGTH_SHORT).show()
 				}
 			}
 		}
 	}
 
+	@Suppress(
+		"OVERRIDE_DEPRECATION",
+		"DEPRECATION"
+	)  // fix_later https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher
 	override fun onBackPressed() {
 		if (binding.container.isDrawerOpen(binding.navigationDrawer)) {
 			binding.container.closeDrawer(binding.navigationDrawer)
@@ -94,7 +99,7 @@ 			ContextCompat.checkSelfPermission(
 				this,
 				Manifest.permission.ACCESS_COARSE_LOCATION
 			) -> {
-				/* todo animation
+				/* todo(ux,low) animation
 					https://developer.android.com/guide/fragments/animate
 					https://github.com/raheemadamboev/fab-explosion-animation-app
 				*/




diff --git a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
index 75a59703aebdf54c2ea9c9e5e41a97cf50dc0eba..2f3a65df25748b68bc7294bc1af3b82cfac9d41a 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/home/HomeFragment.kt
@@ -73,7 +73,13 @@ 		binding.floatingActionButton.setOnClickListener {
 			binding.searchBar.clearSuggestions()
 			(context as MainActivity).onGpsClicked(it)
 		}
-		// todo on searchbar focus && if != '' -> populate suggestions
+		/* todo(ux,low) on searchbar focus && if != '' -> populate suggestions
+		binding.searchBar.searchEditText.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
+			Log.v("Focus", "$hasFocus")
+			if(binding.searchBar.text != "" && hasFocus) {
+				binding.searchBar.lastSuggestions = lastSuggestions
+			}
+		}*/
 
 		return root
 	}




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 eeba8562591e33fb4434dde98e994810f5d18176..9ef7fa066249335b95328fc21c70eaeb5c86abc7 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/search/ResultsActivity.kt
@@ -62,6 +62,7 @@ 		setSupportActionBar(binding.topAppBar)
 
 		WindowCompat.setDecorFitsSystemWindows(window, false)
 
+		@Suppress("DEPRECATION")  // fix_later getSerializable in API>=33
 		when (intent.extras?.get("mode")) {
 			Mode.MODE_LOCATION -> {
 				supportActionBar?.title = "Stops nearby"
@@ -114,7 +115,7 @@ 	private fun getItemsByQuery(server: Server, query: String) {
 		MainScope().launch {
 			val itemsStream = queryItems(server, query)
 			if (itemsStream == null) {
-				// todo show empty state
+				// todo(error-handling) show empty state
 			} else {
 				updateItems(unmarshallItemResponse(itemsStream))
 			}
@@ -127,7 +128,7 @@ 		Log.v("RESPONSE", "getting ItemsByLocation")
 		MainScope().launch {
 			val itemsStream = locateItems(server, plusCode)
 			if (itemsStream == null) {
-				// todo show empty state
+				// todo(error-handling) show empty state
 			} else {
 				updateItems(unmarshallItemResponse(itemsStream))
 			}




diff --git a/app/src/main/res/layout/departure.xml b/app/src/main/res/layout/departure.xml
index d9ce2b6980d6ace911615353fb90b9b8b85f72ff..906911d4c1f911da7ed8d86df5989c7956ce993d 100644
--- a/app/src/main/res/layout/departure.xml
+++ b/app/src/main/res/layout/departure.xml
@@ -27,6 +27,7 @@ 		android:textAppearance="@style/TextAppearance.Material3.DisplaySmall"
 		app:layout_constraintStart_toEndOf="@+id/line_icon"
 		app:layout_constraintTop_toTopOf="parent" />
 
+	<!-- todo(ux) bigger -->
 	<TextView
 		android:id="@+id/departure_headsign"
 		android:layout_width="wrap_content"




diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index bdb3cbee08edf79c6d1c669f7e9acb5ab1820668..73c4810b2d9228a96bd4c5f6f1dd592158a6ce91 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -43,7 +43,7 @@ 	
 
 	<style name="Theme.Bimba.SearchResult.Description" parent="Theme.Bimba">
 		<item name="android:textColor">@color/md_theme_light_onSurfaceVariant
-		</item> <!-- todo grey out -->
+		</item> <!-- todo(ui) grey out -->
 		<item name="android:textSize">9sp</item>
 	</style>
 




diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index 4d90afca85cd7032c4dd5c0c74b619a01f11385d..3a2f3bed9f39d20105092b1978daa69342c10ea6 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -42,7 +42,7 @@
 	<style name="Theme.Bimba.SearchBar" parent="MaterialSearchBarLight">
 		<item name="mt_searchBarColor">@color/md_theme_dark_surfaceVariant</item>
 		<item name="mt_textColor">@color/md_theme_dark_onSurfaceVariant</item>
-		<item name="mt_placeholderColor">@color/md_theme_dark_onSurfaceVariant</item> <!-- todo grey out -->
+		<item name="mt_placeholderColor">@color/md_theme_dark_onSurfaceVariant</item> <!-- todo(ui) grey out -->
 		<item name="mt_backIconTint">@color/md_theme_dark_onSurfaceVariant</item>
 		<item name="mt_navIconTint">@color/md_theme_dark_onSurfaceVariant</item>
 		<item name="mt_searchIconTint">@color/md_theme_dark_onSurfaceVariant</item>
@@ -56,7 +56,7 @@ 		16sp
 	</style>
 
 	<style name="Theme.Bimba.SearchResult.Description" parent="Theme.Bimba">
-		<item name="android:textColor">@color/md_theme_dark_onSurfaceVariant</item> <!-- todo grey out -->
+		<item name="android:textColor">@color/md_theme_dark_onSurfaceVariant</item> <!-- todo(ui) grey out -->
 		<item name="android:textSize">9sp</item>
 	</style>
 </resources>
\ No newline at end of file