-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix SearchSessionFragment : remember query text #364
fix SearchSessionFragment : remember query text #364
Conversation
@@ -157,6 +157,7 @@ class SearchSessionsFragment : DaggerFragment() { | |||
ContextCompat.getColor(requireContext(), R.color.search_close_icon) | |||
) | |||
searchView.isIconified = false | |||
searchView.setQuery(searchSessionsViewModel.uiModel.value!!.searchResult.query, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
You can use uiModel.requireValue() for it 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me think some minutes 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR. I thought a little based on your plan.
We can setQuery when not empty
data class UiModel(val searchResult: SearchResult) {
fun isEmpty() = this == EMPTY
companion object {
val EMPTY = UiModel(SearchResult.EMPTY)
}
}
val searchResult = searchSessionsViewModel.uiModel.requireValue().searchResult
if (!searchResult.isEmpty()) {
searchView.setQuery(searchResult.query, false)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked about LiveData.requireValue(). I should have used that.
Thank you for teaching 🙏🙏
and...
thank you code sample😭 I'll repair PR now.
… query searching and SearchResult is not Empty
49d2131
to
ec5132f
Compare
sorry! I missed the sample...🙇
or
|
Thanks for suggestions! 🔍 |
thank you review.🙏 (「 |
Sorry for my bad English 🙇 |
LGTM! Thank you for fixing this issue! |
thank you comment! |
fix SearchSessionFragment : remember query text, when come back after query searching
Issue
Overview (Required)
SearchSessionsFragment::onCreateOptionsMenu
.(
SearchSessionsFragment::onCreateOptionsMenu
でクエリテキストの設定をしました。)searchView.setQuery()
isfalse
. Because I think submit is unnecessary, In this casesearchResult
is remembered inSearchSessionsViewModel
.(
searchView.setQuery()
の第2引数はfalse
にしています。この時検索結果はViewModelに覚えられていて、submitが不要と考えているためです。)Links
Screenshot
Please let me know if there are strange points in my code & PR.🙏🙏🙏
(変なところがあったら教えてください!🙏🙏🙏)