@@ -108,12 +108,12 @@ class SearchResultView : FrameLayout, SearchResultPresenter.View {
108108 .forEach {criteriaChild ->
109109 when (criteriaChild) {
110110 is EditText -> {
111- if (! list.containsKey(criteriaChild.tag as String? )) {
111+ if (! list.containsKey(criteriaChild.tag as String? ) && criteriaChild.text.isNotEmpty() ) {
112112 list[criteriaChild.tag as String ] = listOf (criteriaChild.text.toString())
113113 }
114114 }
115115 is AutoCompleteTextView -> {
116- if (! list.containsKey(criteriaChild.tag as String? )) {
116+ if (! list.containsKey(criteriaChild.tag as String? ) && criteriaChild.text.isNotEmpty() ) {
117117 list[criteriaChild.tag as String ] = listOf (criteriaChild.text.toString())
118118 }
119119 }
@@ -132,10 +132,12 @@ class SearchResultView : FrameLayout, SearchResultPresenter.View {
132132 }
133133 is AutoCompleteTextView -> {
134134 (linearLayoutChild.tag as String? )?.let { criteria ->
135- list[criteria] = listOf (
136- linearLayoutChild.text.toString(),
137- * list[criteria]?.toTypedArray() ? : arrayOf()
138- )
135+ if (linearLayoutChild.text.isNotEmpty()) {
136+ list[criteria] = listOf (
137+ linearLayoutChild.text.toString(),
138+ * list[criteria]?.toTypedArray() ? : arrayOf()
139+ )
140+ }
139141 }
140142 }
141143 else -> {
@@ -170,13 +172,19 @@ class SearchResultView : FrameLayout, SearchResultPresenter.View {
170172 }
171173 }
172174
173- override fun displaySearchTermWithResultCount (searchTerm : String , count : Int ) {
174- searchTermView.visibility = View .VISIBLE
175+ override fun displayResultCountView (count : Int ) {
175176 resultCount.text = context.resources.getQuantityString(R .plurals.results_for_this_query, count, count)
176- searchTermView.text = context.getString(R .string.results_while_searching, searchTerm)
177177
178178 }
179179
180+ override fun displaySearchTermWithResultCount (searchTerm : String , count : Int , criteria : String ) {
181+ searchTermView.visibility = View .VISIBLE
182+ searchTermView.text = when (searchTerm.isEmpty()) {
183+ false -> context.getString(R .string.results_while_searching_for, searchTerm, criteria)
184+ true -> context.getString(R .string.results_while_searching, criteria)
185+ }
186+ }
187+
180188 override fun hideSearchTermView () {
181189 searchTermView.visibility = View .GONE
182190 }
0 commit comments