mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #3544 - Set SearchSuggestions preference value from settings
This commit is contained in:
parent
ab6101b0f4
commit
b1102c2e76
@ -128,7 +128,7 @@ class AwesomeBarUIView(
|
||||
components.core.icons
|
||||
)
|
||||
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions()) {
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions) {
|
||||
val searchDrawable = getDrawable(R.drawable.ic_search)
|
||||
searchDrawable?.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
@ -171,7 +171,7 @@ class AwesomeBarUIView(
|
||||
}
|
||||
|
||||
private fun showSuggestionProviders() {
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions()) {
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions) {
|
||||
view.addProviders(searchSuggestionProvider!!)
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ class AwesomeBarUIView(
|
||||
}
|
||||
|
||||
private fun showSearchSuggestionProvider() {
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions()) {
|
||||
if (Settings.getInstance(container.context).showSearchSuggestions) {
|
||||
view.addProviders(searchSuggestionProvider!!)
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ package org.mozilla.fenix.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SwitchPreference
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
@ -23,7 +23,10 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
|
||||
(activity as AppCompatActivity).supportActionBar?.show()
|
||||
|
||||
val searchSuggestionsPreference =
|
||||
findPreference<Preference>(getString(R.string.pref_key_show_search_suggestions))
|
||||
findPreference<SwitchPreference>(getString(R.string.pref_key_show_search_suggestions))?.apply {
|
||||
isChecked = Settings.getInstance(context).showSearchSuggestions
|
||||
}
|
||||
|
||||
searchSuggestionsPreference?.setOnPreferenceChangeListener { preference, newValue ->
|
||||
Settings.getInstance(preference.context).preferences.edit().putBoolean(preference.key, newValue as Boolean)
|
||||
.apply()
|
||||
@ -31,7 +34,10 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
|
||||
val showVisitedSitesBookmarks =
|
||||
findPreference<Preference>(getString(R.string.pref_key_show_visited_sites_bookmarks))
|
||||
findPreference<SwitchPreference>(getString(R.string.pref_key_show_visited_sites_bookmarks))?.apply {
|
||||
isChecked = Settings.getInstance(context).shouldShowVisitedSitesBookmarks
|
||||
}
|
||||
|
||||
showVisitedSitesBookmarks?.setOnPreferenceChangeListener { preference, newValue ->
|
||||
Settings.getInstance(preference.context).preferences.edit().putBoolean(preference.key, newValue as Boolean)
|
||||
.apply()
|
||||
|
@ -168,10 +168,10 @@ class Settings private constructor(context: Context) {
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun showSearchSuggestions(): Boolean = preferences.getBoolean(
|
||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
|
||||
true
|
||||
)
|
||||
val showSearchSuggestions: Boolean
|
||||
get() = preferences.getBoolean(
|
||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions), true
|
||||
)
|
||||
|
||||
fun setSitePermissionsPhoneFeatureCameraAction(action: SitePermissionsRules.Action) {
|
||||
preferences.edit()
|
||||
|
Loading…
Reference in New Issue
Block a user