Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #5371: Updates search engine settings string #5393

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SearchTest {
}.openSearch {
scrollToSearchEngineSettings()
clickSearchEngineSettings()
verifySearchEngineSettings()
verifySearchSettings()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SearchRobot {
fun verifySearchWithText() = assertSearchWithText()
fun verifyDuckDuckGoResults() = assertDuckDuckGoResults()
fun verifyDuckDuckGoURL() = assertDuckDuckGoURL()
fun verifySearchEngineSettings() = assertSearchEngineSettings()
fun verifySearchSettings() = assertSearchSettings()
fun verifySearchBarEmpty() = assertSearchBarEmpty()

fun clickScanButton() {
Expand Down Expand Up @@ -161,8 +161,8 @@ private fun assertSearchWithText() =
onView(allOf(withText("SEARCH WITH")))
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

private fun assertSearchEngineSettings() =
onView(allOf(withText("Search engine")))
private fun assertSearchSettings() =
onView(allOf(withText("Default search engine")))
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))

private fun assertSearchBarEmpty() = browserToolbarEditView().check(matches(withText("")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() {

override fun onResume() {
super.onResume()
(activity as AppCompatActivity).title = getString(R.string.preferences_search_engine)
(activity as AppCompatActivity).title = getString(R.string.preferences_search)
(activity as AppCompatActivity).supportActionBar?.show()

val searchSuggestionsPreference =
Expand Down
10 changes: 2 additions & 8 deletions app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import org.mozilla.fenix.R.string.pref_key_make_default_browser
import org.mozilla.fenix.R.string.pref_key_privacy_link
import org.mozilla.fenix.R.string.pref_key_rate
import org.mozilla.fenix.R.string.pref_key_remote_debugging
import org.mozilla.fenix.R.string.pref_key_search_engine_settings
import org.mozilla.fenix.R.string.pref_key_search_settings
import org.mozilla.fenix.R.string.pref_key_sign_in
import org.mozilla.fenix.R.string.pref_key_site_permissions
import org.mozilla.fenix.R.string.pref_key_theme
Expand Down Expand Up @@ -124,12 +124,6 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
findPreference<DefaultBrowserPreference>(getPreferenceKey(R.string.pref_key_make_default_browser))
defaultBrowserPreference?.updateSwitch()

val searchEnginePreference =
findPreference<Preference>(getPreferenceKey(R.string.pref_key_search_engine_settings))
searchEnginePreference?.summary = context?.let {
requireComponents.search.searchEngineManager.getDefaultSearchEngine(it).name
}

val trackingProtectionPreference =
findPreference<Preference>(getPreferenceKey(R.string.pref_key_tracking_protection_settings))
trackingProtectionPreference?.summary = context?.let {
Expand Down Expand Up @@ -158,7 +152,7 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
@Suppress("ComplexMethod", "LongMethod")
override fun onPreferenceTreeClick(preference: Preference): Boolean {
when (preference.key) {
resources.getString(pref_key_search_engine_settings) -> {
resources.getString(pref_key_search_settings) -> {
navigateToSearchEngineSettings()
}
resources.getString(pref_key_tracking_protection_settings) -> {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
<fragment
android:id="@+id/searchEngineFragment"
android:name="org.mozilla.fenix.settings.SearchEngineFragment"
android:label="@string/preferences_search_engine" />
android:label="@string/preferences_search" />

<fragment
android:id="@+id/turnOnSyncFragment"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/preference_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<string name="pref_key_make_default_browser" translatable="false">pref_key_make_default_browser</string>
<string name="pref_key_search_engine_settings" translatable="false">pref_key_search_engine_settings</string>
<string name="pref_key_search_settings" translatable="false">pref_key_search_settings</string>
<string name="pref_key_search_engine" translatable="false">pref_key_search_engine</string>
<string name="pref_key_passwords" translatable="false">pref_key_passwords</string>
<string name="pref_key_credit_cards_addresses" translatable="false">pref_key_credit_cards_addresses</string>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@
<!-- Preference category for all links about Fenix -->
<string name="preferences_category_about">About</string>
<!-- Preference for settings related to changing the default search engine -->
<string name="preferences_search_engine">Search engine</string>
<string name="preferences_default_search_engine">Default search engine</string>
<!-- Preference for settings related to Search -->
<string name="preferences_search">Search</string>
<!-- Preference linking to help about Fenix -->
<string name="preferences_help">Help</string>
<!-- Preference link to rating Fenix on the Play Store -->
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
app:iconSpaceReserved="false">
<androidx.preference.Preference
android:icon="@drawable/ic_search"
android:key="@string/pref_key_search_engine_settings"
android:title="@string/preferences_search_engine" />
android:key="@string/pref_key_search_settings"
android:title="@string/preferences_search" />

<androidx.preference.Preference
android:icon="@drawable/ic_customize"
Expand Down
49 changes: 28 additions & 21 deletions app/src/main/res/xml/search_engine_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,32 @@

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.mozilla.fenix.settings.RadioSearchEngineListPreference />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_show_search_suggestions"
android:title="@string/preferences_show_search_suggestions"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_show_clipboard_suggestions"
android:title="@string/preferences_show_clipboard_suggestions"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_search_browsing_history"
android:title='@string/preferences_search_browsing_history'
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_search_bookmarks"
android:title='@string/preferences_search_bookmarks'
app:iconSpaceReserved="false" />
<PreferenceCategory
android:title="@string/preferences_default_search_engine"
android:selectable="false"
app:iconSpaceReserved="false">
<org.mozilla.fenix.settings.RadioSearchEngineListPreference
android:selectable="false"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_show_search_suggestions"
android:title="@string/preferences_show_search_suggestions"
app:iconSpaceReserved="false"
app:allowDividerAbove="false"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_show_clipboard_suggestions"
android:title="@string/preferences_show_clipboard_suggestions"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_search_browsing_history"
android:title='@string/preferences_search_browsing_history'
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_search_bookmarks"
android:title='@string/preferences_search_bookmarks'
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>