Skip to content

Commit

Permalink
feat: show event count in search placeholder! (#42)
Browse files Browse the repository at this point in the history
fixes #21
  • Loading branch information
williscool authored Oct 1, 2024
1 parent abbeac7 commit c1dfd9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ class EventListAdapter(
return ViewHolder(view);
}

fun getAllItemCount(): Int = allEvents.size

override fun getItemCount(): Int = events.size

val hasActiveEvents: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ class MainActivity : AppCompatActivity(), EventListCallback {
var searchView = searchMenuItem.actionView as SearchView
val manager = getSystemService(Context.SEARCH_SERVICE) as SearchManager

searchView.queryHint = resources.getQuantityString(R.plurals.search_placeholder, adapter.getAllItemCount(), adapter.getAllItemCount())
searchView.setSearchableInfo(manager.getSearchableInfo(componentName))

searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
<string name="snooze_all">Snooze All</string>
<string name="change_all">Change All</string>
<string name="search">Search</string>
<plurals name="search_placeholder">
<item quantity="one">Search %d event...</item>
<item quantity="other">Search %d events...</item>
</plurals>

<string name="snooze_all_confirmation">Snooze ALL events?\nAlready snoozed would also change snooze time unless snoozed to longer period</string>
<string name="change_all_notification">This will change snooze time for all events\nContinue?</string>
Expand Down

0 comments on commit c1dfd9b

Please sign in to comment.