feature: ablity to disable switch to tab suggestion, fix #726

feature: ablity to disable successful download diaglog box, fix #730
pull/745/head
akliuxingyuan 4 months ago
parent 4d13610668
commit a4b6a3d413

@ -122,6 +122,10 @@ class DynamicDownloadDialog(
(binding.root.layoutParams as CoordinatorLayout.LayoutParams).apply {
(behavior as DynamicDownloadDialogBehavior).forceExpand(binding.root)
}
if(!settings.shouldShowSuccessDownloadDialog && !didFail) {
dismiss()
}
}
private fun dismiss() {

@ -183,7 +183,7 @@ fun createInitialSearchFragmentState(
showSyncedTabsSuggestionsForCurrentEngine = false,
showAllSyncedTabsSuggestions = settings.shouldShowSyncedTabsSuggestions,
showSessionSuggestionsForCurrentEngine = false,
showAllSessionSuggestions = true,
showAllSessionSuggestions = settings.shouldShowSessionSuggestions,
showSponsoredSuggestions = activity.browsingModeManager.mode == BrowsingMode.Normal &&
settings.enableFxSuggest && settings.showSponsoredSuggestions,
showNonSponsoredSuggestions = activity.browsingModeManager.mode == BrowsingMode.Normal &&
@ -284,7 +284,7 @@ private fun searchStateReducer(state: SearchFragmentState, action: SearchFragmen
action.settings.enableFxSuggest && action.settings.showSponsoredSuggestions,
showNonSponsoredSuggestions = action.browsingMode == BrowsingMode.Normal &&
action.settings.enableFxSuggest && action.settings.showNonSponsoredSuggestions,
showAllSessionSuggestions = true,
showAllSessionSuggestions = action.settings.shouldShowSessionSuggestions,
)
is SearchFragmentAction.SearchShortcutEngineSelected ->
state.copy(
@ -316,10 +316,10 @@ private fun searchStateReducer(state: SearchFragmentState, action: SearchFragmen
false -> action.settings.shouldShowSyncedTabsSuggestions
},
showSessionSuggestionsForCurrentEngine = action.settings.showUnifiedSearchFeature &&
!action.engine.isGeneral,
!action.engine.isGeneral && action.settings.shouldShowSessionSuggestions,
showAllSessionSuggestions = when (action.settings.showUnifiedSearchFeature) {
true -> false
false -> true
false -> action.settings.shouldShowSessionSuggestions
},
showSponsoredSuggestions = false,
showNonSponsoredSuggestions = false,

@ -54,6 +54,7 @@ class CustomizationFragment : PreferenceFragmentCompat() {
setupRadioGroups()
setupToolbarCategory()
setupGesturesCategory()
setupDownloadCustomizationCategory()
setupAddonsCustomizationCategory()
setupSystemBehaviorCategory()
requirePreference<SwitchPreference>(R.string.pref_key_strip_url).apply {
@ -189,6 +190,13 @@ class CustomizationFragment : PreferenceFragmentCompat() {
}
}
private fun setupDownloadCustomizationCategory() {
requirePreference<SwitchPreference>(R.string.pref_key_success_download_dialog).apply {
isChecked = requireContext().settings().shouldShowSuccessDownloadDialog
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
override fun onPreferenceTreeClick(preference: Preference): Boolean {
when (preference.key) {
resources.getString(R.string.pref_key_website_pull_to_refresh) -> {

@ -88,6 +88,11 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
isChecked = context.settings().shouldShowSyncedTabsSuggestions
}
val showSessionSuggestions =
requirePreference<SwitchPreference>(R.string.pref_key_search_opened_tabs).apply {
isChecked = context.settings().shouldShowSessionSuggestions
}
val showClipboardSuggestions =
requirePreference<SwitchPreference>(R.string.pref_key_show_clipboard_suggestions).apply {
isChecked = context.settings().shouldShowClipboardSuggestions
@ -120,6 +125,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
showHistorySuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
showBookmarkSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
showSyncedTabsSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
showSessionSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
showClipboardSuggestions.onPreferenceChangeListener = SharedPreferenceUpdater()
searchSuggestionsInPrivatePreference.onPreferenceChangeListener = SharedPreferenceUpdater()
showVoiceSearchPreference.onPreferenceChangeListener = object : Preference.OnPreferenceChangeListener {

@ -1964,4 +1964,20 @@ class Settings(private val appContext: Context) : PreferencesHolder {
appContext.getPreferenceKey(R.string.pref_key_show_top_recent_sites),
default = false,
)
/**
* Indicates if the user has chosen to show Switch to tab suggestion
*/
var shouldShowSessionSuggestions by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_search_opened_tabs),
default = true,
)
/**
* Indicates if the user has chosen to show success download dialog
*/
var shouldShowSuccessDownloadDialog by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_success_download_dialog),
default = true,
)
}

@ -2469,4 +2469,6 @@
<string name="confirm_addons_delete_cache_no">取消</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. -->
<string name="a11y_heading">%s标题</string>
<string name="preferences_search_opened_tabs" >搜索已打开的标签页</string>
<string name="preferences_show_success_download_dialog">完成时的对话框</string>
</resources>

@ -2443,4 +2443,6 @@
<string name="confirm_addons_delete_cache_no">取消</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. -->
<string name="a11y_heading">標題 %s</string>
<string name="preferences_search_opened_tabs">搜尋已開啟的標籤頁</string>
<string name="preferences_show_success_download_dialog">完成時的對話方塊</string>
</resources>

@ -379,6 +379,10 @@
<string name="pref_key_relinquish_memory_under_pressure" translatable="false">pref_key_relinquish_memory_under_pressure</string>
<!-- shortcut settings -->
<string name="pref_key_show_top_recent_sites" translatable="false">pref_key_show_top_recent_sites</string>
<!-- search opened tabs settings -->
<string name="pref_key_search_opened_tabs" translatable="false">pref_key_search_opened_tabs</string>
<!-- success download notification settings -->
<string name="pref_key_success_download_dialog" translatable="false">pref_key_success_download_dialog</string>
<!--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_product_recommendations_enabled">pref_key_is_review_quality_check_product_recommendations_enabled</string>

@ -2323,4 +2323,6 @@
<string name="confirm_addons_delete_cache">Are you sure to delete addons metadata cache file?</string>
<string name="confirm_addons_delete_cache_yes">OK</string>
<string name="confirm_addons_delete_cache_no">Cancel</string>
<string name="preferences_search_opened_tabs" >Search opened tabs</string>
<string name="preferences_show_success_download_dialog">Completion dialog box</string>
</resources>

@ -72,6 +72,15 @@
app:isPreferenceVisible="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:layout="@layout/preference_cat_style"
android:title="@string/library_downloads"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreference
android:key="@string/pref_key_success_download_dialog"
android:title="@string/preferences_show_success_download_dialog"/>
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:key="@string/pref_addons_settings_category"
android:layout="@layout/preference_cat_style"

@ -59,6 +59,11 @@
android:defaultValue="true"
android:key="@string/pref_key_search_synced_tabs"
android:title='@string/preferences_search_synced_tabs' />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:key="@string/pref_key_search_opened_tabs"
android:title="@string/preferences_search_opened_tabs" />
<SwitchPreference
app:iconSpaceReserved="false"
android:key="@string/pref_key_show_nonsponsored_suggestions"

Loading…
Cancel
Save