morgan pushed to branch tor-browser-128.3.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits: 1affb9d1 by cypherpunks1 at 2024-10-21T19:51:41+00:00 fixup! [android] Modify UI/UX
Bug 43225: Hide non-private tab settings and history search on Android
- - - - -
5 changed files:
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/HttpsOnlyFragment.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TabsSettingsFragment.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/search/SearchEngineFragment.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
Changes:
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt ===================================== @@ -242,7 +242,7 @@ class Core( }
val applicationSearchEngines: List<SearchEngine> by lazyMonitored { - listOf( + listOfNotNull( createApplicationSearchEngine( id = BOOKMARKS_SEARCH_ENGINE_ID, name = context.getString(R.string.library_bookmarks), @@ -255,12 +255,16 @@ class Core( url = "", icon = getDrawable(context, R.drawable.ic_tabs_search)?.toBitmap()!!, ), - createApplicationSearchEngine( - id = HISTORY_SEARCH_ENGINE_ID, - name = context.getString(R.string.library_history), - url = "", - icon = getDrawable(context, R.drawable.ic_history_search)?.toBitmap()!!, - ), + if (!context.settings().shouldDisableNormalMode) { + createApplicationSearchEngine( + id = HISTORY_SEARCH_ENGINE_ID, + name = context.getString(R.string.library_history), + url = "", + icon = getDrawable(context, R.drawable.ic_history_search)?.toBitmap()!!, + ) + } else { + null + }, ) }
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/HttpsOnlyFragment.kt ===================================== @@ -15,6 +15,7 @@ import android.view.ViewGroup import androidx.core.text.HtmlCompat import androidx.core.text.getSpans import androidx.core.view.children +import androidx.core.view.isGone import androidx.fragment.app.Fragment import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.HomeActivity @@ -60,6 +61,8 @@ class HttpsOnlyFragment : Fragment() { updateEngineHttpsOnlyMode() }
+ binding.httpsOnlyModes.isGone = requireContext().settings().shouldDisableNormalMode + return binding.root }
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TabsSettingsFragment.kt ===================================== @@ -32,6 +32,14 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.tabs_preferences, rootKey) + + findPreference<RadioButtonPreference>(getString(R.string.pref_key_close_tabs_manually))?.parent?.apply { + isVisible = !context.settings().shouldDisableNormalMode + } + + findPreference<PreferenceCategory>(getString(R.string.pref_key_inactive_tabs_category))?.apply { + isVisible = !context.settings().shouldDisableNormalMode + } }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/search/SearchEngineFragment.kt ===================================== @@ -34,6 +34,14 @@ class SearchEngineFragment : PreferenceFragmentCompat() { rootKey, )
+ findPreference<CheckBoxPreference>(getString(R.string.pref_key_show_search_suggestions_in_private))?.apply { + isVisible = !context.settings().shouldDisableNormalMode + } + + findPreference<SwitchPreference>(getString(R.string.pref_key_search_browsing_history))?.apply { + isVisible = !context.settings().shouldDisableNormalMode + } + // requirePreference<SwitchPreference>(R.string.pref_key_show_sponsored_suggestions).apply { // isVisible = context.settings().enableFxSuggest // } @@ -135,7 +143,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() { autocompleteURLsPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
searchSuggestionsPreference.setOnPreferenceClickListener { - if (!searchSuggestionsPreference.isChecked) { + if (!requireContext().settings().shouldDisableNormalMode && !searchSuggestionsPreference.isChecked) { searchSuggestionsInPrivatePreference.isChecked = false searchSuggestionsInPrivatePreference.callChangeListener(false) }
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt ===================================== @@ -421,9 +421,14 @@ class Settings(private val appContext: Context) : PreferencesHolder { default = 1f, )
+ val shouldDisableNormalMode by booleanPreference( + appContext.getPreferenceKey(R.string.pref_key_disable_normal_mode), + true + ) + val shouldShowHistorySuggestions by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_search_browsing_history), - default = true, + default = !shouldDisableNormalMode, )
val shouldShowBookmarkSuggestions by booleanPreference( @@ -903,11 +908,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { return touchExplorationIsEnabled || switchServiceIsEnabled }
- val shouldDisableNormalMode by booleanPreference( - appContext.getPreferenceKey(R.string.pref_key_disable_normal_mode), - true - ) - var lastKnownMode: BrowsingMode = BrowsingMode.Private get() { val lastKnownModeWasPrivate = preferences.getBoolean( @@ -1066,7 +1066,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
val shouldShowSearchSuggestions by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions), - default = true, + default = false, )
val shouldAutocompleteInAwesomebar by booleanPreference( @@ -1081,7 +1081,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var shouldShowSearchSuggestionsInPrivate by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private), - default = false, + default = shouldDisableNormalMode, )
var showSearchSuggestionsInPrivateOnboardingFinished by booleanPreference(
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1affb9d1...
tor-commits@lists.torproject.org