mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/1205: Adds search term to EditToolbar
This commit is contained in:
parent
aff56b9e38
commit
e04a7b05a7
@ -117,7 +117,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
||||
view.browserLayout,
|
||||
ActionBusFactory.get(this), sessionId,
|
||||
(activity as HomeActivity).browsingModeManager.isPrivate,
|
||||
SearchState("", isEditing = false),
|
||||
SearchState("", getSessionByIdOrUseSelectedSession().searchTerms, isEditing = false),
|
||||
search_engine_icon
|
||||
)
|
||||
|
||||
|
@ -24,7 +24,7 @@ class ToolbarComponent(
|
||||
bus: ActionBusFactory,
|
||||
private val sessionId: String?,
|
||||
private val isPrivate: Boolean,
|
||||
override var initialState: SearchState = SearchState("", false),
|
||||
override var initialState: SearchState = SearchState("", "", false),
|
||||
private val engineIconView: ImageView? = null
|
||||
) :
|
||||
UIComponent<SearchState, SearchAction, SearchChange>(
|
||||
@ -73,6 +73,7 @@ class ToolbarComponent(
|
||||
|
||||
data class SearchState(
|
||||
val query: String,
|
||||
val searchTerm: String,
|
||||
val isEditing: Boolean,
|
||||
val engine: SearchEngine? = null
|
||||
) : ViewState
|
||||
|
@ -52,19 +52,17 @@ class SearchFragment : Fragment() {
|
||||
): View? {
|
||||
sessionId = SearchFragmentArgs.fromBundle(arguments!!).sessionId
|
||||
isPrivate = (activity as HomeActivity).browsingModeManager.isPrivate
|
||||
|
||||
val session = sessionId?.let { requireComponents.core.sessionManager.findSessionById(it) }
|
||||
val view = inflater.inflate(R.layout.fragment_search, container, false)
|
||||
val url = sessionId?.let {
|
||||
requireComponents.core.sessionManager.findSessionById(it)?.let { session ->
|
||||
session.url
|
||||
}
|
||||
} ?: ""
|
||||
val url = session?.url ?: ""
|
||||
|
||||
toolbarComponent = ToolbarComponent(
|
||||
view.toolbar_component_wrapper,
|
||||
ActionBusFactory.get(this),
|
||||
sessionId,
|
||||
isPrivate,
|
||||
SearchState(url, isEditing = true),
|
||||
SearchState(url, session?.searchTerms ?: "", isEditing = true),
|
||||
view.search_engine_icon
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user