Always show search view
This commit is contained in:
@@ -125,9 +125,7 @@ class MainActivity : AppCompatActivity(R.layout.main_activity) {
|
||||
|
||||
searchView.queryHint = getString(R.string.search_recipes_hint)
|
||||
searchView.isSubmitButtonEnabled = false
|
||||
|
||||
searchView.setQuery(viewModel.lastSearchQuery, false)
|
||||
searchView.isIconified = viewModel.lastSearchQuery.isNullOrBlank()
|
||||
searchView.setIconifiedByDefault(false)
|
||||
|
||||
searchView.setOnCloseListener {
|
||||
logger.v { "onClose() called" }
|
||||
|
||||
@@ -32,9 +32,6 @@ class MainActivityViewModel @Inject constructor(
|
||||
private val _startDestination = MutableLiveData<Int>()
|
||||
val startDestination: LiveData<Int> = _startDestination
|
||||
|
||||
var lastSearchQuery: String? = null
|
||||
private set
|
||||
|
||||
init {
|
||||
authRepo.isAuthorizedFlow
|
||||
.onEach { isAuthorized -> updateUiState { it.copy(isAuthorized = isAuthorized) } }
|
||||
@@ -60,9 +57,6 @@ class MainActivityViewModel @Inject constructor(
|
||||
|
||||
fun onSearchQuery(query: String?) {
|
||||
logger.v { "onSearchQuery() called with: query = $query" }
|
||||
if (lastSearchQuery != query) {
|
||||
lastSearchQuery = query
|
||||
recipeRepo.updateNameQuery(query)
|
||||
}
|
||||
recipeRepo.updateNameQuery(query)
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/search_recipe_action"
|
||||
android:icon="@drawable/ic_search"
|
||||
android:title="@string/search_recipes_hint"
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
||||
Reference in New Issue
Block a user