mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/17377 - Fix for empty awesomeBar on searchFragment open (https://github.com/mozilla-mobile/fenix/pull/17435)
The awesomeBar was set to stay hidden for the first consumeFrom(store) if the SearchDialogFragment.kt. However, recent changes send an additional store update when the view is created. To work around it we can take a look at AwesomeBarView.update(), we see that the awesomeBar suggestions get provided only if the query != url. So we can use the same method to keep the awesomeBar hidden until the user changes anything in the url.
This commit is contained in:
parent
92c425a71c
commit
b309321f54
@ -313,23 +313,26 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
||||
}
|
||||
|
||||
consumeFrom(store) {
|
||||
val shouldShowAwesomebar =
|
||||
!firstUpdate &&
|
||||
it.query.isNotBlank() ||
|
||||
it.showSearchShortcuts
|
||||
|
||||
awesome_bar?.visibility = if (shouldShowAwesomebar) View.VISIBLE else View.INVISIBLE
|
||||
/*
|
||||
* firstUpdate is used to make sure we keep the awesomebar hidden on the first run
|
||||
* of the searchFragmentDialog. We only turn it false after the user has changed the
|
||||
* query as consumeFrom may run several times on fragment start due to state updates.
|
||||
* */
|
||||
if (it.url != it.query) firstUpdate = false
|
||||
awesome_bar?.visibility = if (shouldShowAwesomebar(it)) View.VISIBLE else View.INVISIBLE
|
||||
updateSearchSuggestionsHintVisibility(it)
|
||||
updateClipboardSuggestion(it, requireContext().components.clipboardHandler.url)
|
||||
updateToolbarContentDescription(it)
|
||||
updateSearchShortcutsIcon(it)
|
||||
toolbarView.update(it)
|
||||
awesomeBarView.update(it)
|
||||
firstUpdate = false
|
||||
addVoiceSearchButton(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun shouldShowAwesomebar(searchFragmentState: SearchFragmentState) =
|
||||
!firstUpdate && searchFragmentState.query.isNotBlank() || searchFragmentState.showSearchShortcuts
|
||||
|
||||
private fun updateAccessibilityTraversalOrder() {
|
||||
val searchWrapperId = search_wrapper.id
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
|
Loading…
Reference in New Issue
Block a user