diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt index 9251a5752c2a..f9b74a43239c 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt @@ -76,7 +76,6 @@ class BrowserToolbar @JvmOverloads constructor( @VisibleForTesting internal var searchTerms: String = "" private var urlCommitListener: ((String) -> Boolean)? = null - var isNavBarEnabled: Boolean = false /** * Toolbar in "display mode". @@ -357,22 +356,6 @@ class BrowserToolbar @JvmOverloads constructor( display.setHorizontalPadding(horizontalPadding) } - /** - * Hides the page action separator in display/edit mode. - */ - override fun hidePageActionSeparator() { - display.hidePageActionSeparator() - edit.hidePageActionSeparator() - } - - /** - * Shows the page action separator in display/edit mode. - */ - override fun showPageActionSeparator() { - display.showPageActionSeparator() - edit.showPageActionSeparator() - } - /** * Switches to URL editing mode. * diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt index 2029d17ca080..ccc444127153 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt @@ -95,7 +95,6 @@ class DisplayToolbar internal constructor( * @property text Text color of the URL. * @property trackingProtection Color tint for the tracking protection icons. * @property separator Color tint for the separator shown between indicators. - * @property pageActionSeparator Color tint of separator dividing url and page actions. * @property highlight Color tint for the highlight icon. * * Set/Get the site security icon colours. It uses a pair of color integers which represent the @@ -111,7 +110,6 @@ class DisplayToolbar internal constructor( @ColorInt val text: Int, @ColorInt val trackingProtection: Int?, @ColorInt val separator: Int, - @ColorInt val pageActionSeparator: Int, @ColorInt val highlight: Int?, ) @@ -150,7 +148,6 @@ class DisplayToolbar internal constructor( navigationActions = rootView.findViewById(R.id.mozac_browser_toolbar_navigation_actions), background = rootView.findViewById(R.id.mozac_browser_toolbar_background), separator = rootView.findViewById(R.id.mozac_browser_toolbar_separator), - pageActionSeparator = rootView.findViewById(R.id.mozac_browser_toolbar_action_separator), emptyIndicator = rootView.findViewById(R.id.mozac_browser_toolbar_empty_indicator), menu = MenuButton(rootView.findViewById(R.id.mozac_browser_toolbar_menu)), securityIndicator = rootView.findViewById(R.id.mozac_browser_toolbar_security_indicator), @@ -177,7 +174,6 @@ class DisplayToolbar internal constructor( text = views.origin.textColor, trackingProtection = null, separator = ContextCompat.getColor(context, photonColors.photonGrey80), - pageActionSeparator = ContextCompat.getColor(context, photonColors.photonGrey80), highlight = null, ) set(value) { @@ -190,7 +186,6 @@ class DisplayToolbar internal constructor( views.origin.titleColor = value.title views.origin.textColor = value.text views.separator.setColorFilter(value.separator) - views.pageActionSeparator.setBackgroundColor(value.pageActionSeparator) if (value.trackingProtection != null) { views.trackingProtectionIndicator.setTint(value.trackingProtection) @@ -679,20 +674,6 @@ class DisplayToolbar internal constructor( background.layoutParams = this } } - - /** - * Hides the page action separator in display mode. - */ - fun hidePageActionSeparator() { - views.pageActionSeparator.isVisible = false - } - - /** - * Shows the page action separator in display mode. - */ - internal fun showPageActionSeparator() { - views.pageActionSeparator.isVisible = true - } } /** @@ -705,7 +686,6 @@ internal class DisplayToolbarViews( val navigationActions: ActionContainer, val background: ImageView, val separator: ImageView, - val pageActionSeparator: View, val emptyIndicator: ImageView, val menu: MenuButton, val securityIndicator: SiteSecurityIconView, diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/edit/EditToolbar.kt b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/edit/EditToolbar.kt index ae1be8e84407..00f1e3dd5ca2 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/edit/EditToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/edit/EditToolbar.kt @@ -71,17 +71,14 @@ class EditToolbar internal constructor( * @property text Text color of the URL. * @property suggestionBackground The background color used for autocomplete suggestions. * @property suggestionForeground The foreground color used for autocomplete suggestions. - * @property pageActionSeparator Color tint of separator dividing page actions. */ data class Colors( @ColorInt val clear: Int, - @ColorInt val erase: Int, @ColorInt val icon: Int?, @ColorInt val hint: Int, @ColorInt val text: Int, @ColorInt val suggestionBackground: Int, @ColorInt val suggestionForeground: Int?, - @ColorInt val pageActionSeparator: Int, ) private val autocompleteDispatcher = SupervisorJob() + @@ -104,11 +101,6 @@ class EditToolbar internal constructor( onClear() } }, - erase = rootView.findViewById(R.id.mozac_browser_toolbar_erase_view).apply { - setOnClickListener { - onClear() - } - }, url = rootView.findViewById( R.id.mozac_browser_toolbar_edit_url_view, ).apply { @@ -136,7 +128,6 @@ class EditToolbar internal constructor( false } }, - pageActionSeparator = rootView.findViewById(R.id.mozac_browser_action_separator), ) /** @@ -144,21 +135,17 @@ class EditToolbar internal constructor( */ var colors: Colors = Colors( clear = ContextCompat.getColor(context, colorsR.color.photonWhite), - erase = ContextCompat.getColor(context, colorsR.color.photonWhite), icon = null, hint = views.url.currentHintTextColor, text = views.url.currentTextColor, suggestionBackground = views.url.autoCompleteBackgroundColor, suggestionForeground = views.url.autoCompleteForegroundColor, - pageActionSeparator = ContextCompat.getColor(context, colorsR.color.photonGrey80), ) set(value) { field = value views.clear.setColorFilter(value.clear) - views.erase.setColorFilter(value.erase) - if (value.icon != null) { views.icon.setColorFilter(value.icon) } @@ -167,7 +154,6 @@ class EditToolbar internal constructor( views.url.setTextColor(value.text) views.url.autoCompleteBackgroundColor = value.suggestionBackground views.url.autoCompleteForegroundColor = value.suggestionForeground - views.pageActionSeparator.setBackgroundColor(value.pageActionSeparator) } /** @@ -296,8 +282,7 @@ class EditToolbar internal constructor( } else { views.url.setText(url, shouldAutoComplete) } - views.clear.isVisible = url.isNotBlank() && !toolbar.isNavBarEnabled - views.erase.isVisible = url.isNotBlank() && toolbar.isNavBarEnabled + views.clear.isVisible = url.isNotBlank() if (shouldHighlight) { views.url.setSelection(views.url.text.length - url.length, views.url.text.length) @@ -363,8 +348,7 @@ class EditToolbar internal constructor( } private fun onTextChanged(text: String) { - views.clear.isVisible = text.isNotBlank() && !toolbar.isNavBarEnabled - views.erase.isVisible = text.isNotBlank() && toolbar.isNavBarEnabled + views.clear.isVisible = text.isNotBlank() views.editActionsEnd.autoHideAction(text.isEmpty()) /* @@ -383,33 +367,16 @@ class EditToolbar internal constructor( } editListener?.onTextChanged(text) } - - /** - * Hides the page action separator in edit mode. - */ - fun hidePageActionSeparator() { - views.pageActionSeparator.isVisible = false - } - - /** - * Shows the page action separator in edit mode. - */ - fun showPageActionSeparator() { - views.pageActionSeparator.isVisible = true - } } /** * Internal holder for view references. */ -@Suppress("LongParameterList") internal class EditToolbarViews( val background: ImageView, val icon: ImageView, val editActionsStart: ActionContainer, val editActionsEnd: ActionContainer, val clear: ImageView, - val erase: ImageView, val url: InlineAutocompleteEditText, - val pageActionSeparator: View, ) diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/res/layout/mozac_browser_toolbar_displaytoolbar.xml b/mobile/android/android-components/components/browser/toolbar/src/main/res/layout/mozac_browser_toolbar_displaytoolbar.xml index bee60ae7a9b6..21ca7a1c9eb4 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/main/res/layout/mozac_browser_toolbar_displaytoolbar.xml +++ b/mobile/android/android-components/components/browser/toolbar/src/main/res/layout/mozac_browser_toolbar_displaytoolbar.xml @@ -106,25 +106,12 @@ android:layout_height="40dp" android:layout_marginTop="8dp" android:paddingEnd="@dimen/mozac_browser_toolbar_origin_padding_end" - app:layout_constraintEnd_toStartOf="@+id/mozac_browser_toolbar_action_separator" + app:layout_constraintEnd_toStartOf="@+id/mozac_browser_toolbar_page_actions" app:layout_constraintStart_toEndOf="@+id/mozac_browser_toolbar_security_indicator" app:layout_constraintTop_toTopOf="parent" app:layout_goneMarginStart="8dp" app:layout_goneMarginTop="8dp" /> - - - - - - diff --git a/mobile/android/android-components/components/browser/toolbar/src/main/res/values/dimens.xml b/mobile/android/android-components/components/browser/toolbar/src/main/res/values/dimens.xml index 23fd755686ad..84086e40dd20 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/main/res/values/dimens.xml +++ b/mobile/android/android-components/components/browser/toolbar/src/main/res/values/dimens.xml @@ -9,7 +9,6 @@ 3dp 24dp 1dp - 4dp 24dp 12dp 24dp diff --git a/mobile/android/android-components/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/BrowserToolbarTest.kt b/mobile/android/android-components/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/BrowserToolbarTest.kt index 3e535faa9603..f2e80700e76d 100644 --- a/mobile/android/android-components/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/BrowserToolbarTest.kt +++ b/mobile/android/android-components/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/BrowserToolbarTest.kt @@ -566,36 +566,6 @@ class BrowserToolbarTest { verify(display).showMenuButton() } - @Test - fun `WHEN showPageActionSeparator is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar and EditToolbar`() { - val toolbar = BrowserToolbar(testContext) - - val display: DisplayToolbar = mock() - val edit: EditToolbar = mock() - toolbar.display = display - toolbar.edit = edit - - toolbar.showPageActionSeparator() - - verify(display).showPageActionSeparator() - verify(edit).showPageActionSeparator() - } - - @Test - fun `WHEN hidePageActionSeparator is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar and EditToolbar`() { - val toolbar = BrowserToolbar(testContext) - - val display: DisplayToolbar = mock() - val edit: EditToolbar = mock() - toolbar.display = display - toolbar.edit = edit - - toolbar.hidePageActionSeparator() - - verify(display).hidePageActionSeparator() - verify(edit).hidePageActionSeparator() - } - @Test fun `WHEN setDisplayHorizontalPadding is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar`() { val toolbar = BrowserToolbar(testContext) diff --git a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/BrowserToolbar.kt b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/BrowserToolbar.kt index e74045538567..fe9c3052f670 100644 --- a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/BrowserToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/BrowserToolbar.kt @@ -357,22 +357,6 @@ class BrowserToolbar @JvmOverloads constructor( display.setHorizontalPadding(horizontalPadding) } - /** - * Hides the page action separator in display/edit mode. - */ - override fun hidePageActionSeparator() { - display.hidePageActionSeparator() - edit.hidePageActionSeparator() - } - - /** - * Shows the page action separator in display/edit mode. - */ - override fun showPageActionSeparator() { - display.showPageActionSeparator() - edit.showPageActionSeparator() - } - /** * Switches to URL editing mode. * diff --git a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/display/DisplayToolbar.kt b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/display/DisplayToolbar.kt index 0ed03923cba2..655e22d9f4d4 100644 --- a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/display/DisplayToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/display/DisplayToolbar.kt @@ -679,20 +679,6 @@ class DisplayToolbar internal constructor( background.layoutParams = this } } - - /** - * Hides the page action separator in display mode. - */ - fun hidePageActionSeparator() { - views.pageActionSeparator.isVisible = false - } - - /** - * Shows the page action separator in display mode. - */ - internal fun showPageActionSeparator() { - views.pageActionSeparator.isVisible = true - } } /** diff --git a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/edit/EditToolbar.kt b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/edit/EditToolbar.kt index 2595ab66e2a7..3939c316581f 100644 --- a/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/edit/EditToolbar.kt +++ b/mobile/android/android-components/components/browser/toolbar2/src/main/java/mozilla/components/browser/toolbar2/edit/EditToolbar.kt @@ -383,20 +383,6 @@ class EditToolbar internal constructor( } editListener?.onTextChanged(text) } - - /** - * Hides the page action separator in edit mode. - */ - fun hidePageActionSeparator() { - views.pageActionSeparator.isVisible = false - } - - /** - * Shows the page action separator in edit mode. - */ - fun showPageActionSeparator() { - views.pageActionSeparator.isVisible = true - } } /** diff --git a/mobile/android/android-components/components/browser/toolbar2/src/test/java/mozilla/components/browser/toolbar2/BrowserToolbarTest.kt b/mobile/android/android-components/components/browser/toolbar2/src/test/java/mozilla/components/browser/toolbar2/BrowserToolbarTest.kt index d1a499e30c82..06faab952df3 100644 --- a/mobile/android/android-components/components/browser/toolbar2/src/test/java/mozilla/components/browser/toolbar2/BrowserToolbarTest.kt +++ b/mobile/android/android-components/components/browser/toolbar2/src/test/java/mozilla/components/browser/toolbar2/BrowserToolbarTest.kt @@ -566,36 +566,6 @@ class BrowserToolbarTest { verify(display).showMenuButton() } - @Test - fun `WHEN showPageActionSeparator is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar and EditToolbar`() { - val toolbar = BrowserToolbar(testContext) - - val display: DisplayToolbar = mock() - val edit: EditToolbar = mock() - toolbar.display = display - toolbar.edit = edit - - toolbar.showPageActionSeparator() - - verify(display).showPageActionSeparator() - verify(edit).showPageActionSeparator() - } - - @Test - fun `WHEN hidePageActionSeparator is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar and EditToolbar`() { - val toolbar = BrowserToolbar(testContext) - - val display: DisplayToolbar = mock() - val edit: EditToolbar = mock() - toolbar.display = display - toolbar.edit = edit - - toolbar.hidePageActionSeparator() - - verify(display).hidePageActionSeparator() - verify(edit).hidePageActionSeparator() - } - @Test fun `WHEN setDisplayHorizontalPadding is sent to BrowserToolbar THEN it will be forwarded to the DisplayToolbar`() { val toolbar = BrowserToolbar(testContext) diff --git a/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt b/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt index 55244b4f6bc6..506921d19424 100644 --- a/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt +++ b/mobile/android/android-components/components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt @@ -188,16 +188,6 @@ interface Toolbar : ScrollableToolbar { */ fun setDisplayHorizontalPadding(horizontalPadding: Int) - /** - * Hides the page action separator in display mode. - */ - fun hidePageActionSeparator() - - /** - * Shows the page action separator in display mode. - */ - fun showPageActionSeparator() - /** * Casts this toolbar to an Android View object. */ diff --git a/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt b/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt index 2190e6a42e53..163da5fa905f 100644 --- a/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt +++ b/mobile/android/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt @@ -132,7 +132,6 @@ class CustomTabsToolbarFeature( internal fun init(config: CustomTabConfig) { // Don't allow clickable toolbar so a custom tab can't switch to edit mode. toolbar.display.onUrlClicked = { false } - toolbar.display.hidePageActionSeparator() // Use the intent provided color scheme or fallback to the app night mode preference. val nightMode = config.colorScheme?.toNightMode() ?: appNightMode diff --git a/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/feature/CustomTabSessionTitleObserverTest.kt b/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/feature/CustomTabSessionTitleObserverTest.kt index c91844259353..01f2a52c2539 100644 --- a/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/feature/CustomTabSessionTitleObserverTest.kt +++ b/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/feature/CustomTabSessionTitleObserverTest.kt @@ -91,8 +91,6 @@ class CustomTabSessionTitleObserverTest { override fun hideMenuButton() = Unit override fun showMenuButton() = Unit override fun setDisplayHorizontalPadding(horizontalPadding: Int) = Unit - override fun hidePageActionSeparator() = Unit - override fun showPageActionSeparator() = Unit override fun setOnEditListener(listener: Toolbar.OnEditListener) = Unit override fun displayMode() = Unit override fun editMode(cursorPlacement: Toolbar.CursorPlacement) = Unit diff --git a/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarAutocompleteFeatureTest.kt b/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarAutocompleteFeatureTest.kt index 3a5dbc1cfe5e..a38e3f242d4e 100644 --- a/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarAutocompleteFeatureTest.kt +++ b/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarAutocompleteFeatureTest.kt @@ -127,14 +127,6 @@ class ToolbarAutocompleteFeatureTest { fail() } - override fun hidePageActionSeparator() { - fail() - } - - override fun showPageActionSeparator() { - fail() - } - override fun invalidateActions() { fail() } diff --git a/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarInteractorTest.kt b/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarInteractorTest.kt index 3dcee39e7b89..2054cae26b36 100644 --- a/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarInteractorTest.kt +++ b/mobile/android/android-components/components/feature/toolbar/src/test/java/mozilla/components/feature/toolbar/ToolbarInteractorTest.kt @@ -110,14 +110,6 @@ class ToolbarInteractorTest { fail() } - override fun hidePageActionSeparator() { - fail() - } - - override fun showPageActionSeparator() { - fail() - } - override fun invalidateActions() { fail() } diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml index 504803ee73d6..63fcf54678f5 100644 --- a/mobile/android/fenix/app/metrics.yaml +++ b/mobile/android/fenix/app/metrics.yaml @@ -45,7 +45,7 @@ events: source: description: | The view the user was on when they initiated the search (For example: - `HOME`, `HOME_QR`, `HOME_VOICE` or `BROWSER`) + `Home` or `Browser`) type: string bugs: - https://github.com/mozilla-mobile/fenix/issues/959 diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 7fa390843990..eae0ff6999dd 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -512,8 +512,6 @@ abstract class BaseBrowserFragment : context = context, activity = activity, ) - } else { - browserToolbarView.view.hidePageActionSeparator() } if (!shouldAddNavigationBar && shouldShowMicrosurveyPrompt()) { @@ -1303,7 +1301,6 @@ abstract class BaseBrowserFragment : context: Context, activity: HomeActivity, ) { - browserToolbar.showPageActionSeparator() val isToolbarAtBottom = isToolbarAtBottom(context) // The toolbar view has already been added directly to the container. diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt index d00d40e6184f..a30d0b55f976 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt @@ -13,7 +13,6 @@ import android.view.View import android.view.ViewGroup import androidx.annotation.LayoutRes import androidx.annotation.VisibleForTesting -import androidx.appcompat.content.res.AppCompatResources import androidx.compose.runtime.Composable import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy @@ -103,28 +102,15 @@ class BrowserToolbarView( true } - view.isNavBarEnabled = isNavBarEnabled - with(context) { val isPinningSupported = components.useCases.webAppUseCases.isPinningSupported() - val searchUrlBackground = if (isNavBarEnabled) { - R.drawable.search_url_background - } else { - R.drawable.search_old_url_background - } - layout.elevation = resources.getDimension(R.dimen.browser_fragment_toolbar_elevation) view.apply { setToolbarBehavior() if (!isCustomTabSession) { - display.setUrlBackground( - AppCompatResources.getDrawable( - context, - searchUrlBackground, - ), - ) + display.setUrlBackground(getDrawable(R.drawable.search_url_background)) } display.onUrlClicked = { @@ -149,10 +135,6 @@ class BrowserToolbarView( context, ThemeManager.resolveAttribute(R.attr.borderPrimary, context), ) - val pageActionSeparatorColor = ContextCompat.getColor( - context, - ThemeManager.resolveAttribute(R.attr.borderToolbarDivider, context), - ) display.urlFormatter = { url -> if (isNavBarEnabled) { @@ -174,7 +156,6 @@ class BrowserToolbarView( context, R.color.fx_mobile_icon_color_information, ), - pageActionSeparator = pageActionSeparatorColor, ) display.hint = context.getString(R.string.search_hint) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 310f3b44bcd9..ca267fea162a 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -466,7 +466,6 @@ class HomeFragment : Fragment() { binding = binding, context = requireContext(), interactor = sessionControlInteractor, - searchEngine = components.core.store.state.search.selectedOrDefaultSearchEngine, ) val shouldAddNavigationBar = shouldAddNavigationBar(requireContext()) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/ToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/ToolbarView.kt index c8802868e874..222f0a65fb6b 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/ToolbarView.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/ToolbarView.kt @@ -5,8 +5,6 @@ package org.mozilla.fenix.home import android.content.Context -import android.content.Intent -import android.speech.RecognizerIntent import android.view.Gravity import android.view.View import android.view.ViewGroup @@ -16,7 +14,6 @@ import androidx.constraintlayout.widget.ConstraintSet import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams -import mozilla.components.browser.state.search.SearchEngine import mozilla.components.support.ktx.android.content.res.resolveAttribute import org.mozilla.fenix.R import org.mozilla.fenix.browser.tabstrip.isTabStripEnabled @@ -25,7 +22,6 @@ import org.mozilla.fenix.components.toolbar.ToolbarPosition import org.mozilla.fenix.databinding.FragmentHomeBinding import org.mozilla.fenix.ext.settings import org.mozilla.fenix.home.toolbar.ToolbarInteractor -import org.mozilla.fenix.search.ExtraAction import org.mozilla.fenix.utils.ToolbarPopupWindow import java.lang.ref.WeakReference @@ -36,7 +32,6 @@ class ToolbarView( private val binding: FragmentHomeBinding, private val context: Context, private val interactor: ToolbarInteractor, - private val searchEngine: SearchEngine?, ) { init { updateLayout(binding.root) @@ -53,14 +48,6 @@ class ToolbarView( interactor.onNavigateSearch() } - binding.qrActionImage.setOnClickListener { - interactor.onNavigateSearch(ExtraAction.QR_READER) - } - - binding.microphoneActionImage.setOnClickListener { - interactor.onNavigateSearch(ExtraAction.VOICE_SEARCH) - } - binding.toolbarWrapper.setOnLongClickListener { ToolbarPopupWindow.show( WeakReference(it), @@ -72,31 +59,10 @@ class ToolbarView( } } - @Suppress("LongMethod") private fun updateLayout(view: View) { - val speechIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) - - when (IncompleteRedesignToolbarFeature(context.settings()).isEnabled) { - true -> { - binding.menuButton.isVisible = false - binding.tabButton.isVisible = false - binding.qrActionImage.isVisible = - searchEngine?.isGeneral == true || searchEngine?.type == SearchEngine.Type.CUSTOM - binding.microphoneActionImage.isVisible = - speechIntent.resolveActivity(context.packageManager) != null && - context.settings().shouldShowVoiceSearch - binding.browserActionSeparator.isVisible = - binding.qrActionImage.isVisible || binding.microphoneActionImage.isVisible - } - - false -> { - binding.menuButton.isVisible = true - binding.tabButton.isVisible = true - binding.browserActionSeparator.isVisible = false - binding.qrActionImage.isVisible = false - binding.microphoneActionImage.isVisible = false - } - } + val redesignEnabled = IncompleteRedesignToolbarFeature(context.settings()).isEnabled + binding.menuButton.isVisible = !redesignEnabled + binding.tabButton.isVisible = !redesignEnabled when (context.settings().toolbarPosition) { ToolbarPosition.TOP -> { @@ -161,13 +127,5 @@ class ToolbarView( ToolbarPosition.BOTTOM -> {} } - - binding.toolbarWrapper.updateLayoutParams { - rightMargin = if (IncompleteRedesignToolbarFeature(context.settings()).isEnabled) { - context.resources.getDimensionPixelSize(R.dimen.home_fragment_toolbar_margin) - } else { - 0 - } - } } } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt index f5d214fd92df..1bdcfbd893a8 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlInteractor.kt @@ -31,7 +31,6 @@ import org.mozilla.fenix.home.recentvisits.controller.RecentVisitsController import org.mozilla.fenix.home.recentvisits.interactor.RecentVisitsInteractor import org.mozilla.fenix.home.toolbar.ToolbarController import org.mozilla.fenix.home.toolbar.ToolbarInteractor -import org.mozilla.fenix.search.ExtraAction import org.mozilla.fenix.search.toolbar.SearchSelectorController import org.mozilla.fenix.search.toolbar.SearchSelectorInteractor import org.mozilla.fenix.search.toolbar.SearchSelectorMenu @@ -334,8 +333,8 @@ class SessionControlInteractor( toolbarController.handlePaste(clipboardText) } - override fun onNavigateSearch(extraAction: ExtraAction) { - toolbarController.handleNavigateSearch(extraAction) + override fun onNavigateSearch() { + toolbarController.handleNavigateSearch() } override fun onRemoveCollectionsPlaceholder() { diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarController.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarController.kt index da8cdb0d3014..ca2a7ce39894 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarController.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarController.kt @@ -15,7 +15,6 @@ import org.mozilla.fenix.NavGraphDirections import org.mozilla.fenix.browser.BrowserAnimator import org.mozilla.fenix.components.metrics.MetricsUtils import org.mozilla.fenix.ext.nav -import org.mozilla.fenix.search.ExtraAction /** * An interface that handles the view manipulation of the home screen toolbar. @@ -34,7 +33,7 @@ interface ToolbarController { /** * @see [ToolbarInteractor.onNavigateSearch] */ - fun handleNavigateSearch(extraAction: ExtraAction = ExtraAction.NONE) + fun handleNavigateSearch() } /** @@ -74,11 +73,10 @@ class DefaultToolbarController( navController.nav(navController.currentDestination?.id, directions) } - override fun handleNavigateSearch(extraAction: ExtraAction) { + override fun handleNavigateSearch() { val directions = NavGraphDirections.actionGlobalSearchDialog( sessionId = null, - extraAction = extraAction, ) navController.nav( @@ -87,13 +85,6 @@ class DefaultToolbarController( BrowserAnimator.getToolbarNavOptions(activity), ) - when (extraAction) { - ExtraAction.QR_READER -> - Events.searchBarTapped.record(Events.SearchBarTappedExtra("HOME_QR")) - ExtraAction.VOICE_SEARCH -> - Events.searchBarTapped.record(Events.SearchBarTappedExtra("HOME_VOICE")) - ExtraAction.NONE -> - Events.searchBarTapped.record(Events.SearchBarTappedExtra("HOME")) - } + Events.searchBarTapped.record(Events.SearchBarTappedExtra("HOME")) } } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarInteractor.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarInteractor.kt index e4139665d6ea..155aed5e5f13 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarInteractor.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/home/toolbar/ToolbarInteractor.kt @@ -4,8 +4,6 @@ package org.mozilla.fenix.home.toolbar -import org.mozilla.fenix.search.ExtraAction - /** * Interface for toolbar related actions. */ @@ -26,8 +24,6 @@ interface ToolbarInteractor { /** * Navigates to the search dialog. - * - * @param extraAction specify [ExtraAction] that needs to be performed in the search dialog. */ - fun onNavigateSearch(extraAction: ExtraAction = ExtraAction.NONE) + fun onNavigateSearch() } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt index 685956b2cdc9..aa07bb96e20e 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt @@ -83,7 +83,6 @@ import org.mozilla.fenix.components.Core.Companion.BOOKMARKS_SEARCH_ENGINE_ID import org.mozilla.fenix.components.Core.Companion.HISTORY_SEARCH_ENGINE_ID import org.mozilla.fenix.components.Core.Companion.TABS_SEARCH_ENGINE_ID import org.mozilla.fenix.components.appstate.AppAction -import org.mozilla.fenix.components.toolbar.IncompleteRedesignToolbarFeature import org.mozilla.fenix.components.toolbar.ToolbarPosition import org.mozilla.fenix.databinding.FragmentSearchDialogBinding import org.mozilla.fenix.databinding.SearchSuggestionsHintBinding @@ -105,13 +104,6 @@ import org.mozilla.fenix.settings.SupportUtils typealias SearchDialogFragmentStore = SearchFragmentStore -/** - * Possible extra actions when opening search dialog fragment. - */ -enum class ExtraAction { - QR_READER, VOICE_SEARCH, NONE, -} - @SuppressWarnings("LargeClass", "TooManyFunctions") class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler { private var _binding: FragmentSearchDialogBinding? = null @@ -260,12 +252,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler { binding.toolbar, fromHomeFragment, ).also { - if (!IncompleteRedesignToolbarFeature(requireContext().settings()).isEnabled) { - it.view.hidePageActionSeparator() - } else { - it.view.showPageActionSeparator() - it.view.isNavBarEnabled = true - } inlineAutocompleteEditText = it.view.findViewById(R.id.mozac_browser_toolbar_edit_url_view) inlineAutocompleteEditText.increaseTapArea(TAP_INCREASE_DPS_4) } @@ -482,13 +468,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler { updateQrButton(it) updateVoiceSearchButton() } - - val args by navArgs() - when (args.extraAction) { - ExtraAction.QR_READER -> launchQr() - ExtraAction.VOICE_SEARCH -> launchVoiceSearch() - ExtraAction.NONE -> {} - } } /** diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt index def5cd4999f9..841e00839deb 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt @@ -19,8 +19,6 @@ import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.R import org.mozilla.fenix.browser.tabstrip.isTabStripEnabled import org.mozilla.fenix.components.Components -import org.mozilla.fenix.components.toolbar.IncompleteRedesignToolbarFeature -import org.mozilla.fenix.ext.settings import org.mozilla.fenix.search.SearchEngineSource import org.mozilla.fenix.search.SearchFragmentState import org.mozilla.fenix.utils.Settings @@ -102,21 +100,10 @@ class ToolbarView( R.color.suggestion_highlight_color, ), clear = context.getColorFromAttr(R.attr.textPrimary), - erase = context.getColorFromAttr(R.attr.textPrimary), - pageActionSeparator = context.getColorFromAttr(R.attr.borderToolbarDivider), ) - val searchUrlBackground = if (IncompleteRedesignToolbarFeature(context.settings()).isEnabled) { - R.drawable.search_url_background - } else { - R.drawable.search_old_url_background - } - edit.setUrlBackground( - AppCompatResources.getDrawable( - context, - searchUrlBackground, - ), + AppCompatResources.getDrawable(context, R.drawable.search_url_background), ) private = isPrivate diff --git a/mobile/android/fenix/app/src/main/res/drawable/search_old_url_background.xml b/mobile/android/fenix/app/src/main/res/drawable/search_old_url_background.xml deleted file mode 100644 index 6c71fe948536..000000000000 --- a/mobile/android/fenix/app/src/main/res/drawable/search_old_url_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/mobile/android/fenix/app/src/main/res/drawable/search_url_background.xml b/mobile/android/fenix/app/src/main/res/drawable/search_url_background.xml index c64970c69516..6c71fe948536 100644 --- a/mobile/android/fenix/app/src/main/res/drawable/search_url_background.xml +++ b/mobile/android/fenix/app/src/main/res/drawable/search_url_background.xml @@ -3,10 +3,10 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + + android:bottomLeftRadius="8dp" + android:topLeftRadius="8dp" + android:topRightRadius="8dp"/> diff --git a/mobile/android/fenix/app/src/main/res/layout/fragment_home.xml b/mobile/android/fenix/app/src/main/res/layout/fragment_home.xml index 3988f6dca97c..9d18c4db5c55 100644 --- a/mobile/android/fenix/app/src/main/res/layout/fragment_home.xml +++ b/mobile/android/fenix/app/src/main/res/layout/fragment_home.xml @@ -151,7 +151,7 @@ - - - - - - - + android:textSize="15sp" /> - 60dp - 4dp 16dp 8dp 18dp diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/SessionControlInteractorTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/SessionControlInteractorTest.kt index 2020c894c009..97ad080013b7 100644 --- a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/SessionControlInteractorTest.kt +++ b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/SessionControlInteractorTest.kt @@ -27,7 +27,6 @@ import org.mozilla.fenix.home.recentvisits.controller.RecentVisitsController import org.mozilla.fenix.home.sessioncontrol.DefaultSessionControlController import org.mozilla.fenix.home.sessioncontrol.SessionControlInteractor import org.mozilla.fenix.home.toolbar.ToolbarController -import org.mozilla.fenix.search.ExtraAction import org.mozilla.fenix.search.toolbar.SearchSelectorController class SessionControlInteractorTest { @@ -148,18 +147,6 @@ class SessionControlInteractorTest { verify { toolbarController.handleNavigateSearch() } } - @Test - fun onNavigateSearchWithQr() { - interactor.onNavigateSearch(ExtraAction.QR_READER) - verify { toolbarController.handleNavigateSearch(ExtraAction.QR_READER) } - } - - @Test - fun onNavigateSearchWithVoice() { - interactor.onNavigateSearch(ExtraAction.VOICE_SEARCH) - verify { toolbarController.handleNavigateSearch(ExtraAction.VOICE_SEARCH) } - } - @Test fun onRemoveCollectionsPlaceholder() { interactor.onRemoveCollectionsPlaceholder() diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/toolbar/DefaultToolbarControllerTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/toolbar/DefaultToolbarControllerTest.kt index 40b35e652a8e..191be907102b 100644 --- a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/toolbar/DefaultToolbarControllerTest.kt +++ b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/home/toolbar/DefaultToolbarControllerTest.kt @@ -29,7 +29,6 @@ import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.ext.settings import org.mozilla.fenix.helpers.FenixRobolectricTestRunner -import org.mozilla.fenix.search.ExtraAction import org.mozilla.fenix.utils.Settings @RunWith(FenixRobolectricTestRunner::class) // For gleanTestRule @@ -134,54 +133,6 @@ class DefaultToolbarControllerTest { } } - @Test - @Suppress("Deprecation") - fun `WHEN the toolbar QR button is tapped THEN navigate to the search dialog with QR reader activated`() { - assertNull(Events.searchBarTapped.testGetValue()) - - createController().handleNavigateSearch(ExtraAction.QR_READER) - - assertNotNull(Events.searchBarTapped.testGetValue()) - - val recordedEvents = Events.searchBarTapped.testGetValue()!! - assertEquals(1, recordedEvents.size) - assertEquals("HOME_QR", recordedEvents.single().extra?.getValue("source")) - - verify { - navController.navigate( - match { - it.actionId == R.id.action_global_search_dialog && - it.arguments.get("extra_action") as ExtraAction == ExtraAction.QR_READER - }, - any(), - ) - } - } - - @Test - @Suppress("Deprecation") - fun `WHEN the toolbar VOICE button is tapped THEN navigate to the search dialog with voice search activated`() { - assertNull(Events.searchBarTapped.testGetValue()) - - createController().handleNavigateSearch(ExtraAction.VOICE_SEARCH) - - assertNotNull(Events.searchBarTapped.testGetValue()) - - val recordedEvents = Events.searchBarTapped.testGetValue()!! - assertEquals(1, recordedEvents.size) - assertEquals("HOME_VOICE", recordedEvents.single().extra?.getValue("source")) - - verify { - navController.navigate( - match { - it.actionId == R.id.action_global_search_dialog && - it.arguments.get("extra_action") as ExtraAction == ExtraAction.VOICE_SEARCH - }, - any(), - ) - } - } - private fun createController() = DefaultToolbarController( activity = activity, store = store,