From 4cd0d464a7d5e15cc85f29e0dc14fcd127cca4ea Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Fri, 26 Apr 2019 13:54:38 -0700 Subject: [PATCH] For #1092: Fixes ordering of custom tab menu items (#2072) --- .../fenix/customtabs/CustomTabToolbarMenu.kt | 32 ++++++++++--------- .../fenix/customtabs/CustomTabsIntegration.kt | 5 +++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabToolbarMenu.kt b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabToolbarMenu.kt index e9da576100..e2352595d3 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabToolbarMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabToolbarMenu.kt @@ -91,17 +91,17 @@ class CustomTabToolbarMenu( private val menuItems by lazy { listOf( - SimpleBrowserMenuItem( - { - val appName = context.getString(R.string.app_name) - context.getString(R.string.browser_menu_powered_by, appName).toUpperCase() - }(), - ToolbarMenu.CAPTION_TEXT_SIZE, - DefaultThemeManager.resolveAttribute(R.attr.primaryText, context) - ), + menuToolbar, BrowserMenuDivider(), + BrowserMenuImageText( + context.getString(R.string.browser_menu_share), + R.drawable.mozac_ic_share + ) { + onItemTapped.invoke(ToolbarMenu.Item.Share) + }, + SimpleBrowserMenuItem( { val appName = context.getString(R.string.app_name) @@ -115,14 +115,16 @@ class CustomTabToolbarMenu( onItemTapped.invoke(ToolbarMenu.Item.OpenInFenix) }, - BrowserMenuImageText( - context.getString(R.string.browser_menu_share), - R.drawable.mozac_ic_share, + BrowserMenuDivider(), + + SimpleBrowserMenuItem( + { + val appName = context.getString(R.string.app_name) + context.getString(R.string.browser_menu_powered_by, appName).toUpperCase() + }(), + ToolbarMenu.CAPTION_TEXT_SIZE, DefaultThemeManager.resolveAttribute(R.attr.primaryText, context) - ) { - onItemTapped.invoke(ToolbarMenu.Item.Share) - }, - menuToolbar + ) ) } } diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt index db85396e24..dce5df37a0 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt @@ -34,6 +34,7 @@ class CustomTabsIntegration( toolbar, sessionId, customTabToolbarMenu.menuBuilder, + START_OF_MENU_ITEMS_INDEX, closeListener = { activity?.finish() }) override fun start() { @@ -47,4 +48,8 @@ class CustomTabsIntegration( override fun onBackPressed(): Boolean { return feature.onBackPressed() } + + companion object { + const val START_OF_MENU_ITEMS_INDEX = 2 + } }