commit ac3ffc445a42d75601461a1e02750f8d354ab440
parent 63d57d3ed6531365c4c335bcc38e9d4ee5eef9a1
Author: clairehurst <clairehurst@torproject.org>
Date: Wed, 21 Jan 2026 18:08:45 -0700
TB 44581 [android]: Cleanup new android compose tab-strip feature
Diffstat:
5 files changed, 16 insertions(+), 184 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/MenuDialogFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/MenuDialogFragment.kt
@@ -118,6 +118,7 @@ import com.google.android.material.R as materialR
import mozilla.components.browser.engine.gecko.GeckoEngineSession
import android.util.Log
+import org.mozilla.fenix.HomeActivity
// EXPANDED_MIN_RATIO is used for BottomSheetBehavior.halfExpandedRatio().
// That value needs to be less than the PEEK_HEIGHT.
@@ -321,7 +322,7 @@ class MenuDialogFragment : BottomSheetDialogFragment() {
activity?.let { activity ->
activity.lifecycleScope.launch {
deleteBrowsingDataController.clearBrowsingDataOnQuit {
- activity.finishAndRemoveTask()
+ (activity as HomeActivity).shutDown()
}
}
}
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/CustomTabMenu.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/CustomTabMenu.kt
@@ -222,20 +222,6 @@ internal fun CustomTabMenu(
badgeBackgroundColor = badgeBackgroundColor,
)
}
-
- if (shouldShowExtensionsMenu) {
- ExtensionsMenuItem(
- inCustomTab = true,
- isPrivate = isPrivate,
- isExtensionsProcessDisabled = isExtensionsProcessDisabled,
- isExtensionsExpanded = isExtensionsExpanded,
- isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
- webExtensionMenuCount = webExtensionMenuCount,
- extensionsMenuItemDescription = extensionsMenuDescription,
- onExtensionsMenuClick = onExtensionsMenuClick,
- extensionSubmenu = extensionSubmenu,
- )
- }
}
if (!customTabMenuItems.isNullOrEmpty()) {
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MainMenu.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MainMenu.kt
@@ -243,33 +243,6 @@ fun MainMenu(
}
}
- if (accessPoint == MenuAccessPoint.Home && showBanner) {
- MenuBanner(
- onDismiss = {
- onBannerDismiss()
- },
- onClick = {
- onBannerClick()
- },
- )
- }
-
- if (accessPoint == MenuAccessPoint.Home) {
- MenuGroup {
- ExtensionsMenuItem(
- inCustomTab = false,
- isPrivate = isPrivate,
- isExtensionsProcessDisabled = isExtensionsProcessDisabled,
- isExtensionsExpanded = isExtensionsExpanded,
- isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
- webExtensionMenuCount = webExtensionMenuCount,
- extensionsMenuItemDescription = extensionsMenuItemDescription,
- onExtensionsMenuClick = onExtensionsMenuClick,
- extensionSubmenu = extensionSubmenu,
- )
- }
- }
-
if (accessPoint == MenuAccessPoint.Browser) {
ToolsAndActionsMenuGroup(
isBookmarked = isBookmarked,
@@ -304,45 +277,24 @@ fun MainMenu(
)
MenuGroup {
- MozillaAccountMenuItem(
- account = account,
- accountState = accountState,
- isPrivate = isPrivate,
- onClick = onMozillaAccountButtonClick,
- )
-
MenuItem(
label = stringResource(id = R.string.browser_menu_settings),
beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_settings_24),
onClick = onSettingsButtonClick,
)
- }
-
- if (showQuitMenu) {
- QuitMenuGroup(
- onQuitMenuClick = onQuitMenuClick,
+ MenuItem(
+ label = stringResource(
+ id = R.string.browser_menu_delete_browsing_data_on_quit,
+ stringResource(id = R.string.app_name),
+ ),
+ beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_cross_circle_24),
+ state = MenuItemState.WARNING,
+ onClick = onQuitMenuClick,
)
}
}
}
-@Composable
-private fun QuitMenuGroup(
- onQuitMenuClick: () -> Unit,
-) {
- MenuGroup {
- MenuItem(
- label = stringResource(
- id = R.string.browser_menu_delete_browsing_data_on_quit,
- stringResource(id = R.string.app_name),
- ),
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_cross_circle_fill_24),
- state = MenuItemState.WARNING,
- onClick = onQuitMenuClick,
- )
- }
-}
-
@Suppress("LongParameterList", "LongMethod", "CognitiveComplexMethod")
@Composable
private fun ToolsAndActionsMenuGroup(
@@ -435,21 +387,9 @@ private fun ToolsAndActionsMenuGroup(
)
}
- ExtensionsMenuItem(
- inCustomTab = false,
- isPrivate = isPrivate,
- isExtensionsProcessDisabled = isExtensionsProcessDisabled,
- isExtensionsExpanded = isExtensionsExpanded,
- isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
- webExtensionMenuCount = webExtensionMenuCount,
- extensionsMenuItemDescription = extensionsMenuItemDescription,
- onExtensionsMenuClick = onExtensionsMenuClick,
- extensionSubmenu = extensionSubmenu,
- )
-
if (!moreMenuExpanded) {
MoreMenuButtonGroup(
- isMoreMenuHighlighted = isMoreMenuHighlighted,
+ isMoreMenuHighlighted = false, // This prevents a dot from incorrectly showing e.g. "open in app" is available, even though we disable it.
onMoreMenuClick = onMoreMenuClick,
)
}
@@ -530,7 +470,7 @@ private fun LibraryMenuGroup(
.semantics {
this.collectionInfo = CollectionInfo(
rowCount = 1,
- columnCount = 4,
+ columnCount = 2,
)
},
horizontalArrangement = Arrangement.SpaceEvenly,
@@ -540,23 +480,10 @@ private fun LibraryMenuGroup(
modifier = Modifier
.weight(1f)
.fillMaxHeight(),
- iconRes = iconsR.drawable.mozac_ic_history_24,
- labelRes = R.string.library_history,
- shape = leftShape,
- index = 0,
- onClick = onHistoryMenuClick,
- )
-
- Spacer(Modifier.width(spacerWidth))
-
- LibraryMenuItem(
- modifier = Modifier
- .weight(1f)
- .fillMaxHeight(),
iconRes = iconsR.drawable.mozac_ic_bookmark_tray_fill_24,
labelRes = R.string.library_bookmarks,
- shape = middleShape,
- index = 1,
+ shape = leftShape,
+ index = 0,
onClick = onBookmarksMenuClick,
)
@@ -569,22 +496,9 @@ private fun LibraryMenuGroup(
isHighlighted = isDownloadHighlighted,
iconRes = iconsR.drawable.mozac_ic_download_24,
labelRes = R.string.library_downloads,
- shape = middleShape,
- index = 2,
- onClick = onDownloadsMenuClick,
- )
-
- Spacer(Modifier.width(spacerWidth))
-
- LibraryMenuItem(
- modifier = Modifier
- .weight(1f)
- .fillMaxHeight(),
- iconRes = iconsR.drawable.mozac_ic_login_24,
- labelRes = R.string.browser_menu_passwords,
shape = rightShape,
- index = 3,
- onClick = onPasswordsMenuClick,
+ index = 1,
+ onClick = onDownloadsMenuClick,
)
}
}
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MenuNavigation.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MenuNavigation.kt
@@ -95,14 +95,6 @@ internal fun MenuNavigation(
onLongClick = { onForwardButtonClick(true) },
)
- MenuNavItem(
- modifier = Modifier.weight(1f),
- state = state,
- painter = painterResource(id = iconsR.drawable.mozac_ic_share_android_24),
- label = stringResource(id = R.string.browser_menu_share),
- onClick = onShareButtonClick,
- )
-
if (isSiteLoading) {
MenuNavItem(
modifier = Modifier.weight(1f),
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MoreSettingsSubmenu.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MoreSettingsSubmenu.kt
@@ -49,67 +49,6 @@ internal fun MoreSettingsSubmenu(
Column(
verticalArrangement = Arrangement.spacedBy(2.dp),
) {
- if (translationInfo.isTranslationSupported) {
- TranslationMenuItem(
- translationInfo = translationInfo,
- isReaderViewActive = isReaderViewActive,
- )
- }
-
- if (isWebCompatReporterSupported) {
- MenuItem(
- label = stringResource(id = R.string.browser_menu_webcompat_reporter_2),
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_lightbulb_24),
- state = if (isWebCompatEnabled) MenuItemState.ENABLED else MenuItemState.DISABLED,
- onClick = onWebCompatReporterClick,
- )
- }
-
- if (showShortcuts) {
- ShortcutsMenuItem(
- isPinned = isPinned,
- onShortcutsMenuClick = onShortcutsMenuClick,
- )
- }
-
- if (isAddToHomeScreenSupported) {
- MenuItem(
- label = if (isInstallable) {
- stringResource(id = R.string.browser_menu_add_app_to_homescreen)
- } else {
- stringResource(id = R.string.browser_menu_add_to_homescreen)
- },
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_add_to_homescreen_24),
- onClick = onAddToHomeScreenMenuClick,
- )
- }
-
- MenuItem(
- label = stringResource(id = R.string.browser_menu_save_to_collection_2),
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_collection_24),
- onClick = onSaveToCollectionMenuClick,
- )
-
- if (hasExternalApp) {
- MenuItem(
- label = if (externalAppName != "") {
- stringResource(id = R.string.browser_menu_open_in_fenix, externalAppName)
- } else {
- stringResource(id = R.string.browser_menu_open_app_link)
- },
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_more_grid_24),
- isBeforeIconHighlighted = isOpenInAppMenuHighlighted,
- state = MenuItemState.ENABLED,
- onClick = onOpenInAppMenuClick,
- )
- } else {
- MenuItem(
- label = stringResource(id = R.string.browser_menu_open_app_link),
- beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_more_grid_24),
- state = MenuItemState.DISABLED,
- )
- }
-
MenuItem(
label = stringResource(id = R.string.browser_menu_save_as_pdf_2),
beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_save_file_24),