1
0
Fork 0

For #12571: Rename shortcuts to search engine on search screen (#12839)

* Rename shortcuts to search engine on search screen

* Remove deprecated pref key

* Re-add deprecated string
master
Elise Richards 2020-07-27 17:19:31 -05:00 committed by GitHub
parent 5d772337a8
commit b7325a3833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 26 deletions

View File

@ -236,7 +236,7 @@ sealed class Event {
context.getString(R.string.pref_key_search_bookmarks),
context.getString(R.string.pref_key_search_browsing_history),
context.getString(R.string.pref_key_show_clipboard_suggestions),
context.getString(R.string.pref_key_show_search_shortcuts),
context.getString(R.string.pref_key_show_search_engine_shortcuts),
context.getString(R.string.pref_key_open_links_in_a_private_tab),
context.getString(R.string.pref_key_sync_logins),
context.getString(R.string.pref_key_sync_bookmarks),

View File

@ -268,7 +268,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
qrFeature.get()?.scan(R.id.container)
}
view.search_shortcuts_button.setOnClickListener {
view.search_engines_shortcut_button.setOnClickListener {
searchInteractor.onSearchShortcutsButtonClicked()
}
@ -400,7 +400,7 @@ class SearchFragment : Fragment(), UserInteractionHandler {
}
private fun updateSearchWithLabel(searchState: SearchFragmentState) {
search_with_shortcuts.visibility =
search_engine_shortcut.visibility =
if (searchState.showSearchShortcuts) View.VISIBLE else View.GONE
}
@ -450,19 +450,19 @@ class SearchFragment : Fragment(), UserInteractionHandler {
findViewById<View>(R.id.search_suggestions_onboarding)?.isVisible = state.showSearchSuggestionsHint
search_suggestions_onboarding_divider?.isVisible =
search_with_shortcuts.isVisible && state.showSearchSuggestionsHint
search_engine_shortcut.isVisible && state.showSearchSuggestionsHint
}
}
private fun updateSearchShortcutsIcon(searchState: SearchFragmentState) {
view?.apply {
search_shortcuts_button.isVisible = searchState.areShortcutsAvailable
search_engines_shortcut_button.isVisible = searchState.areShortcutsAvailable
val showShortcuts = searchState.showSearchShortcuts
search_shortcuts_button.isChecked = showShortcuts
search_engines_shortcut_button.isChecked = showShortcuts
val color = if (showShortcuts) R.attr.contrastText else R.attr.primaryText
search_shortcuts_button.compoundDrawables[0]?.setTint(
search_engines_shortcut_button.compoundDrawables[0]?.setTint(
requireContext().getColorFromAttr(color)
)
}

View File

@ -38,7 +38,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() {
}
val showSearchShortcuts =
requirePreference<SwitchPreference>(R.string.pref_key_show_search_shortcuts).apply {
requirePreference<SwitchPreference>(R.string.pref_key_show_search_engine_shortcuts).apply {
isChecked = context.settings().shouldShowSearchShortcuts
}

View File

@ -305,7 +305,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
)
val shouldShowSearchShortcuts by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_show_search_shortcuts),
appContext.getPreferenceKey(R.string.pref_key_show_search_engine_shortcuts),
default = false
)

View File

@ -52,7 +52,7 @@
android:fadingEdgeLength="40dp"
android:nestedScrollingEnabled="false"
android:requiresFadingEdge="vertical"
app:layout_constraintTop_toBottomOf="@id/search_with_shortcuts"
app:layout_constraintTop_toBottomOf="@id/search_engine_shortcut"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
mozac:awesomeBarDescriptionTextColor="?secondaryText"
@ -139,8 +139,8 @@
app:layout_constraintTop_toBottomOf="@id/fill_link_from_clipboard" />
<TextView
android:id="@+id/search_with_shortcuts"
style="@style/SearchShortcutsLabelStyle"
android:id="@+id/search_engine_shortcut"
style="@style/SearchEngineShortcutsLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/search_fragment_shortcuts_label_margin_horizontal"
@ -150,14 +150,14 @@
android:text="@string/search_engines_search_with"
app:layout_constraintStart_toStartOf="@id/scrollable_area"
app:layout_constraintTop_toBottomOf="@id/awesomeBar_barrier"
tools:text="This time, search with:" />
tools:text="@string/search_engines_search_with" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/awesomeBar_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="fill_link_from_clipboard,search_with_shortcuts,search_suggestions_onboarding" />
app:constraint_referenced_ids="fill_link_from_clipboard,search_engine_shortcut,search_suggestions_onboarding" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -195,10 +195,10 @@
app:drawableStartCompat="@drawable/ic_qr" />
<ToggleButton
android:id="@+id/search_shortcuts_button"
android:id="@+id/search_engines_shortcut_button"
style="@style/search_pill"
android:textOff="@string/search_engines_shortcut_button"
android:textOn="@string/search_engines_shortcut_button"
android:textOff="@string/search_engine_button"
android:textOn="@string/search_engine_button"
app:drawableStartCompat="@drawable/ic_search" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -86,7 +86,7 @@
<!-- Search Settings -->
<string name="pref_key_search_engine_list" translatable="false">pref_key_search_engine_list</string>
<string name="pref_key_show_search_shortcuts" translatable="false">pref_key_show_search_shortcuts</string>
<string name="pref_key_show_search_engine_shortcuts" translatable="false">pref_key_show_search_engine_shortcuts</string>
<string name="pref_key_show_search_suggestions" translatable="false">pref_key_show_search_suggestions</string>
<string name="pref_key_show_clipboard_suggestions" translatable="false">pref_key_show_clipboard_suggestions</string>
<string name="pref_key_search_browsing_history" translatable="false">pref_key_search_browsing_history</string>
@ -95,7 +95,6 @@
<string name="pref_key_show_search_suggestions_in_private_onboarding" translatable="false">pref_key_show_search_suggestions_in_privateonboarding</string>
<string name="pref_key_show_voice_search" translatable="false">pref_key_show_voice_search</string>
<!-- Site Permissions Settings -->
<string name="pref_key_optimize" translatable="false">pref_key_optimize</string>
<string name="pref_key_show_site_exceptions" translatable="false">pref_key_show_site_exceptions</string>

View File

@ -167,8 +167,8 @@
<!-- Search Fragment -->
<!-- Button in the search view that lets a user search by scanning a QR code -->
<string name="search_scan_button">Scan</string>
<!-- Button in the search view that lets a user search by using a shortcut -->
<string name="search_engines_shortcut_button">Search Engine</string>
<!-- Button in the search view that lets a user change their search engine -->
<string name="search_engine_button">Search engine</string>
<!-- Button in the search view when shortcuts are displayed that takes a user to the search engine settings -->
<string name="search_shortcuts_engine_settings">Search engine settings</string>
<!-- Header displayed when selecting a shortcut search engine -->
@ -1456,12 +1456,14 @@
<string name="top_sites_max_limit_confirmation_button">OK, Got It</string>
<!-- DEPRECATED STRINGS -->
<!-- Button in the search view that lets a user search by using a shortcut -->
<!-- DEPRECATED: Button in the search view that lets a user search by using a shortcut -->
<string name="search_shortcuts_button">Shortcuts</string>
<!-- DEPRECATED: Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with">Search with</string>
<!-- Header displayed when selecting a shortcut search engine -->
<!-- DEPRECATED: Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with_2">This time, search with:</string>
<!-- Preference title for switch preference to show search shortcuts -->
<!-- DEPRECATED: Preference title for switch preference to show search shortcuts -->
<string name="preferences_show_search_shortcuts">Show search shortcuts</string>
<!-- DEPRECATED: Button in the search view that lets a user search by using a shortcut -->
<string name="search_engines_shortcut_button">Search Engine</string>
</resources>

View File

@ -455,7 +455,7 @@
<item name="android:elevation">0dp</item>
</style>
<style name="SearchShortcutsLabelStyle">
<style name="SearchEngineShortcutsLabelStyle">
<item name="android:fontFamily">@font/metropolis_semibold</item>
<item name="android:letterSpacing">0.15</item>
<item name="android:textAllCaps">true</item>

View File

@ -26,7 +26,7 @@
android:layout="@layout/preference_cat_style">
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_show_search_shortcuts"
android:key="@string/pref_key_show_search_engine_shortcuts"
android:title="@string/preferences_show_search_engines" />
<SwitchPreference
android:defaultValue="true"