@ -47,6 +47,7 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
import org.mozilla.fenix.components.searchengine.FenixSearchEngineProvider
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getSpannable
import org.mozilla.fenix.ext.hideToolbar
@ -130,7 +131,8 @@ class SearchFragment : Fragment(), UserInteractionHandler {
awesomeBarView = AwesomeBarView ( view . scrollable _area , searchInteractor ,
view . findViewById ( R . id . awesomeBar ) )
setShortcutsChangedListener ( )
setShortcutsChangedListener ( CustomSearchEngineStore . PREF _FILE _SEARCH _ENGINES )
setShortcutsChangedListener ( FenixSearchEngineProvider . PREF _FILE _SEARCH _ENGINES )
view . scrollView . setOnScrollChangeListener {
_ : NestedScrollView , _ : Int , _ : Int , _ : Int , _ : Int ->
@ -168,14 +170,12 @@ class SearchFragment : Fragment(), UserInteractionHandler {
return ( speechIntent . resolveActivity ( requireContext ( ) . packageManager ) != null )
}
private fun setShortcutsChangedListener ( ) {
private fun setShortcutsChangedListener ( preferenceFileName : String ) {
requireContext ( ) . getSharedPreferences (
CustomSearchEngineStore . PREF _FILE _SEARCH _ENGINES ,
preferenceFileName ,
Context . MODE _PRIVATE
) . registerOnSharedPreferenceChangeListener ( viewLifecycleOwner ) { _ , key ->
if ( key == CustomSearchEngineStore . PREF _KEY _CUSTOM _SEARCH _ENGINES ) {
awesomeBarView . update ( searchStore . state )
}
) . registerOnSharedPreferenceChangeListener ( viewLifecycleOwner ) { _ , _ ->
awesomeBarView . update ( searchStore . state )
}
}