Ability to disable QR scan search in urlbar

iceraven iceraven-2.18.4
akliuxingyuan 1 month ago
parent 01ca30e900
commit f4eedc368a

@ -850,7 +850,8 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
private fun updateQrButton(searchFragmentState: SearchFragmentState) { private fun updateQrButton(searchFragmentState: SearchFragmentState) {
val searchEngine = searchFragmentState.searchEngineSource.searchEngine val searchEngine = searchFragmentState.searchEngineSource.searchEngine
when ( when (
searchEngine?.isGeneral == true || searchEngine?.type == SearchEngine.Type.CUSTOM requireContext().settings().shouldShowQRScanSearch &&
(searchEngine?.isGeneral == true || searchEngine?.type == SearchEngine.Type.CUSTOM)
) { ) {
true -> { true -> {
if (qrButtonAction == null) { if (qrButtonAction == null) {

@ -103,6 +103,11 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
isChecked = context.settings().shouldShowVoiceSearch isChecked = context.settings().shouldShowVoiceSearch
} }
val showQRScanSearchPreference =
requirePreference<SwitchPreference>(R.string.pref_key_show_qr_scan_search).apply {
isChecked = context.settings().shouldShowQRScanSearch
}
val showSponsoredSuggestionsPreference = val showSponsoredSuggestionsPreference =
requirePreference<SwitchPreference>(R.string.pref_key_show_sponsored_suggestions).apply { requirePreference<SwitchPreference>(R.string.pref_key_show_sponsored_suggestions).apply {
isChecked = context.settings().showSponsoredSuggestions isChecked = context.settings().showSponsoredSuggestions
@ -138,6 +143,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
return true return true
} }
} }
showQRScanSearchPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
autocompleteURLsPreference.onPreferenceChangeListener = SharedPreferenceUpdater() autocompleteURLsPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
searchSuggestionsPreference.setOnPreferenceClickListener { searchSuggestionsPreference.setOnPreferenceClickListener {

@ -1238,6 +1238,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = true, default = true,
) )
var shouldShowQRScanSearch by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_show_qr_scan_search),
default = true,
)
/** /**
* Used in [SearchDialogFragment.kt], [SearchFragment.kt] (deprecated), and [PairFragment.kt] * Used in [SearchDialogFragment.kt], [SearchFragment.kt] (deprecated), and [PairFragment.kt]
* to see if we need to check for camera permissions before using the QR code scanner. * to see if we need to check for camera permissions before using the QR code scanner.

@ -2534,6 +2534,8 @@
<string name="confirm_addons_delete_cache_no">取消</string> <string name="confirm_addons_delete_cache_no">取消</string>
<string name="preferences_search_opened_tabs" >搜索已打开的标签页</string> <string name="preferences_search_opened_tabs" >搜索已打开的标签页</string>
<string name="preferences_show_success_download_dialog">完成时的对话框</string> <string name="preferences_show_success_download_dialog">完成时的对话框</string>
<string name="preferences_show_qr_scan_search">显示二维码扫描搜索</string>
<!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. --> <!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. -->
<string name="a11y_heading">%s标题</string> <string name="a11y_heading">%s标题</string>

@ -2480,6 +2480,8 @@
<string name="confirm_addons_delete_cache_no">取消</string> <string name="confirm_addons_delete_cache_no">取消</string>
<string name="preferences_search_opened_tabs">搜尋已開啟的標籤頁</string> <string name="preferences_search_opened_tabs">搜尋已開啟的標籤頁</string>
<string name="preferences_show_success_download_dialog">完成時的對話方塊</string> <string name="preferences_show_success_download_dialog">完成時的對話方塊</string>
<string name="preferences_show_qr_scan_search">顯示 QR 掃描搜尋</string>
<!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. --> <!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. -->
<string name="a11y_heading">標題 %s</string> <string name="a11y_heading">標題 %s</string>

@ -398,6 +398,8 @@
<string name="pref_key_search_opened_tabs" translatable="false">pref_key_search_opened_tabs</string> <string name="pref_key_search_opened_tabs" translatable="false">pref_key_search_opened_tabs</string>
<!-- success download notification settings --> <!-- success download notification settings -->
<string name="pref_key_success_download_dialog" translatable="false">pref_key_success_download_dialog</string> <string name="pref_key_success_download_dialog" translatable="false">pref_key_success_download_dialog</string>
<string name="pref_key_show_qr_scan_search" translatable="false">pref_key_show_qr_scan_search</string>
<!--Shopping --> <!--Shopping -->
<string name="pref_key_is_review_quality_check_enabled">pref_key_is_review_quality_check_enabled</string> <string name="pref_key_is_review_quality_check_enabled">pref_key_is_review_quality_check_enabled</string>
<string name="pref_key_is_review_quality_check_product_recommendations_enabled">pref_key_is_review_quality_check_product_recommendations_enabled</string> <string name="pref_key_is_review_quality_check_product_recommendations_enabled">pref_key_is_review_quality_check_product_recommendations_enabled</string>

@ -2361,6 +2361,8 @@
<string name="confirm_addons_delete_cache_no">Cancel</string> <string name="confirm_addons_delete_cache_no">Cancel</string>
<string name="preferences_search_opened_tabs" >Search opened tabs</string> <string name="preferences_search_opened_tabs" >Search opened tabs</string>
<string name="preferences_show_success_download_dialog">Completion dialog box</string> <string name="preferences_show_success_download_dialog">Completion dialog box</string>
<string name="preferences_show_qr_scan_search">Show QR scan search</string>
<!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. --> <!-- Content description for headings announced by accessibility service. The first parameter is the text of the heading. Talkback will announce the first parameter and then speak the word "Heading" indicating to the user that this text is a heading for a section. -->
<string name="a11y_heading">%s, Heading</string> <string name="a11y_heading">%s, Heading</string>
<!-- Title for dialog displayed when trying to access links present in a text. --> <!-- Title for dialog displayed when trying to access links present in a text. -->

@ -95,6 +95,11 @@
android:defaultValue="true" android:defaultValue="true"
android:key="@string/pref_key_show_voice_search" android:key="@string/pref_key_show_voice_search"
android:title="@string/preferences_show_voice_search" /> android:title="@string/preferences_show_voice_search" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_show_qr_scan_search"
android:title="@string/preferences_show_qr_scan_search" />
<SwitchPreference <SwitchPreference
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
android:defaultValue="true" android:defaultValue="true"

Loading…
Cancel
Save