No issue: Clean up SearchFragment a bit
parent
011a9e7d96
commit
d33edd8841
|
@ -33,6 +33,7 @@ import mozilla.components.browser.session.Session
|
|||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.browser.session.runWithSessionIdOrSelected
|
||||
import mozilla.components.concept.engine.prompt.ShareData
|
||||
import mozilla.components.feature.accounts.FxaCapability
|
||||
import mozilla.components.feature.accounts.FxaWebChannelFeature
|
||||
import mozilla.components.feature.app.links.AppLinksFeature
|
||||
import mozilla.components.feature.contextmenu.ContextMenuCandidate
|
||||
|
@ -481,8 +482,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
view.swipeRefresh.setOnChildScrollUpCallback { _, _ -> true }
|
||||
}
|
||||
|
||||
// @Suppress("ConstantConditionIf")
|
||||
/*
|
||||
@Suppress("ConstantConditionIf")
|
||||
if (!FeatureFlags.asFeatureWebChannelsDisabled) {
|
||||
webchannelIntegration.set(
|
||||
feature = FxaWebChannelFeature(
|
||||
|
@ -499,8 +499,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
)
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
initializeEngineView(toolbarHeight)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,14 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||
private lateinit var searchStore: SearchFragmentStore
|
||||
private lateinit var searchInteractor: SearchInteractor
|
||||
|
||||
private fun shouldShowSearchSuggestions(isPrivate: Boolean): Boolean =
|
||||
if (isPrivate) {
|
||||
requireContext().settings().shouldShowSearchSuggestions &&
|
||||
requireContext().settings().shouldShowSearchSuggestionsInPrivate
|
||||
} else {
|
||||
requireContext().settings().shouldShowSearchSuggestions
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
@ -85,21 +93,13 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||
|
||||
requireComponents.analytics.metrics.track(Event.InteractWithSearchURLArea)
|
||||
|
||||
val showSearchSuggestions =
|
||||
if (isPrivate) {
|
||||
requireContext().settings().shouldShowSearchSuggestions &&
|
||||
requireContext().settings().shouldShowSearchSuggestionsInPrivate
|
||||
} else {
|
||||
requireContext().settings().shouldShowSearchSuggestions
|
||||
}
|
||||
|
||||
searchStore = StoreProvider.get(this) {
|
||||
SearchFragmentStore(
|
||||
SearchFragmentState(
|
||||
query = url,
|
||||
searchEngineSource = currentSearchEngine,
|
||||
defaultEngineSource = currentSearchEngine,
|
||||
showSearchSuggestions = showSearchSuggestions,
|
||||
showSearchSuggestions = shouldShowSearchSuggestions(isPrivate),
|
||||
showSearchSuggestionsHint = false,
|
||||
showSearchShortcuts = requireContext().settings().shouldShowSearchShortcuts && url.isEmpty(),
|
||||
showClipboardSuggestions = requireContext().settings().shouldShowClipboardSuggestions,
|
||||
|
@ -142,6 +142,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
|
|||
listener = ::launchVoiceSearch
|
||||
)
|
||||
)
|
||||
|
||||
val urlView = toolbarView.view
|
||||
.findViewById<InlineAutocompleteEditText>(R.id.mozac_browser_toolbar_edit_url_view)
|
||||
urlView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||
|
|
Loading…
Reference in New Issue