mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
For #5745 - Create preference to disable domain autocompletion
This commit is contained in:
parent
8e7d10c33c
commit
f9b2d65993
@ -19,6 +19,7 @@ import mozilla.components.support.ktx.android.content.getColorFromAttr
|
|||||||
import mozilla.components.support.ktx.android.content.res.resolveAttribute
|
import mozilla.components.support.ktx.android.content.res.resolveAttribute
|
||||||
import mozilla.components.support.ktx.android.view.hideKeyboard
|
import mozilla.components.support.ktx.android.view.hideKeyboard
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.search.SearchFragmentState
|
import org.mozilla.fenix.search.SearchFragmentState
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,6 +111,8 @@ class ToolbarView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val engineForSpeculativeConnects = if (!isPrivate) engine else null
|
val engineForSpeculativeConnects = if (!isPrivate) engine else null
|
||||||
|
|
||||||
|
if (context.settings().shouldAutocompleteInAwesomebar) {
|
||||||
ToolbarAutocompleteFeature(
|
ToolbarAutocompleteFeature(
|
||||||
view,
|
view,
|
||||||
engineForSpeculativeConnects
|
engineForSpeculativeConnects
|
||||||
@ -118,6 +121,7 @@ class ToolbarView(
|
|||||||
historyStorage?.also(::addHistoryStorageProvider)
|
historyStorage?.also(::addHistoryStorageProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun update(searchState: SearchFragmentState) {
|
fun update(searchState: SearchFragmentState) {
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
|
@ -32,6 +32,11 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
|
|||||||
isChecked = context.settings().shouldShowSearchSuggestions
|
isChecked = context.settings().shouldShowSearchSuggestions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val autocompleteURLsPreference =
|
||||||
|
requirePreference<SwitchPreference>(R.string.pref_key_enable_autocomplete_urls).apply {
|
||||||
|
isChecked = context.settings().shouldAutocompleteInAwesomebar
|
||||||
|
}
|
||||||
|
|
||||||
val searchSuggestionsInPrivatePreference =
|
val searchSuggestionsInPrivatePreference =
|
||||||
requirePreference<CheckBoxPreference>(R.string.pref_key_show_search_suggestions_in_private).apply {
|
requirePreference<CheckBoxPreference>(R.string.pref_key_show_search_suggestions_in_private).apply {
|
||||||
isChecked = context.settings().shouldShowSearchSuggestionsInPrivate
|
isChecked = context.settings().shouldShowSearchSuggestionsInPrivate
|
||||||
@ -73,6 +78,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
|
|||||||
showClipboardSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
|
showClipboardSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
searchSuggestionsInPrivatePreference.onPreferenceChangeListener = SharedPreferenceUpdater()
|
searchSuggestionsInPrivatePreference.onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
showVoiceSearchPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
|
showVoiceSearchPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
|
autocompleteURLsPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||||
|
|
||||||
searchSuggestionsPreference.setOnPreferenceClickListener {
|
searchSuggestionsPreference.setOnPreferenceClickListener {
|
||||||
if (!searchSuggestionsPreference.isChecked) {
|
if (!searchSuggestionsPreference.isChecked) {
|
||||||
|
@ -615,6 +615,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||||||
default = true
|
default = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val shouldAutocompleteInAwesomebar by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_enable_autocomplete_urls),
|
||||||
|
default = true
|
||||||
|
)
|
||||||
|
|
||||||
var defaultTopSitesAdded by booleanPreference(
|
var defaultTopSitesAdded by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.default_top_sites_added),
|
appContext.getPreferenceKey(R.string.default_top_sites_added),
|
||||||
default = false
|
default = false
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
<string name="pref_key_show_search_suggestions_in_private" translatable="false">pref_key_show_search_suggestions_in_private</string>
|
<string name="pref_key_show_search_suggestions_in_private" translatable="false">pref_key_show_search_suggestions_in_private</string>
|
||||||
<string name="pref_key_show_search_suggestions_in_private_onboarding" translatable="false">pref_key_show_search_suggestions_in_privateonboarding</string>
|
<string name="pref_key_show_search_suggestions_in_private_onboarding" translatable="false">pref_key_show_search_suggestions_in_privateonboarding</string>
|
||||||
<string name="pref_key_show_voice_search" translatable="false">pref_key_show_voice_search</string>
|
<string name="pref_key_show_voice_search" translatable="false">pref_key_show_voice_search</string>
|
||||||
|
<string name="pref_key_enable_autocomplete_urls" translatable="false">pref_key_enable_domain_autocomplete</string>
|
||||||
|
|
||||||
<!-- Site Permissions Settings -->
|
<!-- Site Permissions Settings -->
|
||||||
<string name="pref_key_optimize" translatable="false">pref_key_optimize</string>
|
<string name="pref_key_optimize" translatable="false">pref_key_optimize</string>
|
||||||
|
@ -322,6 +322,8 @@
|
|||||||
<string name="preferences_search_bookmarks">Search bookmarks</string>
|
<string name="preferences_search_bookmarks">Search bookmarks</string>
|
||||||
<!-- Preference for account settings -->
|
<!-- Preference for account settings -->
|
||||||
<string name="preferences_account_settings">Account settings</string>
|
<string name="preferences_account_settings">Account settings</string>
|
||||||
|
<!-- Preference for enabling url autocomplete-->
|
||||||
|
<string name="preferences_enable_autocomplete_urls">Autocomplete URLs</string>
|
||||||
<!-- Preference for open links in third party apps -->
|
<!-- Preference for open links in third party apps -->
|
||||||
<string name="preferences_open_links_in_apps">Open links in apps</string>
|
<string name="preferences_open_links_in_apps">Open links in apps</string>
|
||||||
<!-- Preference for open download with an external download manager app -->
|
<!-- Preference for open download with an external download manager app -->
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="@string/pref_key_show_search_engine_shortcuts"
|
android:key="@string/pref_key_show_search_engine_shortcuts"
|
||||||
android:title="@string/preferences_show_search_engines" />
|
android:title="@string/preferences_show_search_engines" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/pref_key_enable_autocomplete_urls"
|
||||||
|
android:title="@string/preferences_enable_autocomplete_urls" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="@string/pref_key_show_clipboard_suggestions"
|
android:key="@string/pref_key_show_clipboard_suggestions"
|
||||||
|
Loading…
Reference in New Issue
Block a user