Skip to content

Commit

Permalink
Fix: Reiterated results not found toast (#369)
Browse files Browse the repository at this point in the history
* fix: reiterated results not found toast

* feat: update leku version

Co-authored-by: roman-rodriguez <[email protected]>
  • Loading branch information
romadespub and roman-rodriguez authored Nov 8, 2022
1 parent 6e5f749 commit c83fc45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx2048m
org.gradle.configureondemand=false
android.useAndroidX=true
libGroup=com.adevinta.android
libVersion=10.0.2
libVersion=10.0.3
15 changes: 11 additions & 4 deletions leku/src/main/java/com/adevinta/leku/LocationPickerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class LocationPickerActivity :
private var clearLocationButton: ImageButton? = null
private var searchEditLayout: LinearLayout? = null
private var searchFrameLayout: FrameLayout? = null
private var suggestionsToast: Toast? = null
private var locationsToast: Toast? = null

private val locationList = ArrayList<Address>()
private val suggestionList = ArrayList<PlaceSuggestion>()
Expand Down Expand Up @@ -810,11 +812,15 @@ class LocationPickerActivity :
changeListResultVisibility(View.GONE)
}

private fun makeEmptyResultsToast(): Toast =
Toast.makeText(applicationContext, R.string.leku_no_search_results, Toast.LENGTH_LONG)

override fun showLocations(addresses: List<Address>) {
fillLocationList(addresses)
if (addresses.isEmpty()) {
Toast.makeText(applicationContext, R.string.leku_no_search_results, Toast.LENGTH_LONG)
.show()
locationsToast?.cancel()
locationsToast = makeEmptyResultsToast()
locationsToast!!.show()
} else {
updateLocationNameList(addresses)
if (hasWiderZoom) {
Expand All @@ -834,8 +840,9 @@ class LocationPickerActivity :
override fun showSuggestions(suggestions: List<PlaceSuggestion>) {
fillSuggestionList(suggestions)
if (suggestions.isEmpty()) {
Toast.makeText(applicationContext, R.string.leku_no_search_results, Toast.LENGTH_LONG)
.show()
suggestionsToast?.cancel()
suggestionsToast = makeEmptyResultsToast()
suggestionsToast!!.show()
} else {
updateSuggestionNameList(suggestions)
if (hasWiderZoom) {
Expand Down

0 comments on commit c83fc45

Please sign in to comment.