File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
feature-search/src/main/java/com/hoc/flowmvi/ui/search Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -109,18 +109,24 @@ class SearchActivity :
109
109
override fun onCreateOptionsMenu (menu : Menu ): Boolean {
110
110
menuInflater.inflate(R .menu.menu_search, menu)
111
111
112
- (menu.findItem(R .id.action_search)!! .actionView as SearchView ).run {
113
- isIconified = false
114
- queryHint = " Search user..."
115
-
116
- vm.viewState.value
117
- .originalQuery
118
- .takeUnless { it.isNullOrBlank() }
119
- ?.let { setQuery(it, false ) }
120
-
121
- queryTextEvents()
122
- .onEach { searchViewQueryTextEventChannel.send(it) }
123
- .launchIn(lifecycleScope)
112
+ menu.findItem(R .id.action_search)!! .let { menuItem ->
113
+ (menuItem.actionView as SearchView ).run {
114
+ isIconified = false
115
+ queryHint = " Search user..."
116
+
117
+ vm.viewState.value
118
+ .originalQuery
119
+ .takeUnless { it.isNullOrBlank() }
120
+ ?.let {
121
+ menuItem.expandActionView()
122
+ setQuery(it, true )
123
+ clearFocus()
124
+ }
125
+
126
+ queryTextEvents()
127
+ .onEach { searchViewQueryTextEventChannel.send(it) }
128
+ .launchIn(lifecycleScope)
129
+ }
124
130
}
125
131
126
132
return true
You can’t perform that action at this time.
0 commit comments