diff --git a/app/src/main/java/org/mozilla/fenix/components/Search.kt b/app/src/main/java/org/mozilla/fenix/components/Search.kt index cf31a6ba0b..7746b1db2f 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Search.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Search.kt @@ -8,6 +8,7 @@ import android.content.Context import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import mozilla.components.browser.search.SearchEngineManager +import org.mozilla.fenix.utils.Settings /** * Component group for all search engine integration related functionality. @@ -23,6 +24,10 @@ class Search(private val context: Context) { GlobalScope.launch { load(context).await() } + defaultSearchEngine = getDefaultSearchEngine( + context, + Settings.getInstance(context).defaultSearchEngineName + ) } } } diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index d4c97d1be0..d871b09143 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -112,8 +112,7 @@ class HomeFragment : Fragment() { }) val searchIcon = requireComponents.search.searchEngineManager.getDefaultSearchEngine( - requireContext(), - Settings.getInstance(requireContext()).defaultSearchEngineName + requireContext() ).let { BitmapDrawable(resources, it.icon) } diff --git a/app/src/main/java/org/mozilla/fenix/settings/RadioSearchEngineListPreference.kt b/app/src/main/java/org/mozilla/fenix/settings/RadioSearchEngineListPreference.kt index cc1ccd96ce..928cd7915a 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/RadioSearchEngineListPreference.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/RadioSearchEngineListPreference.kt @@ -10,6 +10,7 @@ import android.widget.CompoundButton import android.widget.RadioGroup import androidx.preference.PreferenceViewHolder import org.mozilla.fenix.R +import org.mozilla.fenix.ext.components import org.mozilla.fenix.utils.Settings class RadioSearchEngineListPreference : SearchEngineListPreference, @@ -45,6 +46,7 @@ class RadioSearchEngineListPreference : SearchEngineListPreference, } val newDefaultEngine = searchEngines[checkedId] + context.components.search.searchEngineManager.defaultSearchEngine = newDefaultEngine Settings.getInstance(group.context).setDefaultSearchEngineByName(newDefaultEngine.name) } }