mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1816558 - Add functionality for the three-dot button in the multi selection banner
This commit is contained in:
parent
c93819b91c
commit
15e5d8a82c
@ -81,6 +81,9 @@ import mozilla.components.browser.storage.sync.Tab as SyncTab
|
||||
* @param onRecentlyClosedClick Invoked when the user clicks on the recently closed banner menu item.
|
||||
* @param onAccountSettingsClick Invoked when the user clicks on the account settings banner menu item.
|
||||
* @param onDeleteAllTabsClick Invoked when the user clicks on the close all tabs banner menu item.
|
||||
* @param onBookmarkSelectedTabsClick Invoked when the user clicks on the bookmark banner menu item.
|
||||
* @param onDeleteSelectedTabsClick Invoked when the user clicks on the close selected tabs banner menu item.
|
||||
* @param onForceSelectedTabsAsInactiveClick Invoked when the user clicks on the make inactive banner menu item.
|
||||
*/
|
||||
@OptIn(ExperimentalPagerApi::class)
|
||||
@Suppress("LongMethod", "LongParameterList", "ComplexMethod")
|
||||
@ -113,6 +116,9 @@ fun TabsTray(
|
||||
onRecentlyClosedClick: () -> Unit,
|
||||
onAccountSettingsClick: () -> Unit,
|
||||
onDeleteAllTabsClick: () -> Unit,
|
||||
onBookmarkSelectedTabsClick: () -> Unit,
|
||||
onDeleteSelectedTabsClick: () -> Unit,
|
||||
onForceSelectedTabsAsInactiveClick: () -> Unit,
|
||||
) {
|
||||
val normalTabCount = browserStore
|
||||
.observeAsComposableState { state -> state.normalTabs.size }.value ?: 0
|
||||
@ -166,6 +172,9 @@ fun TabsTray(
|
||||
onRecentlyClosedClick = onRecentlyClosedClick,
|
||||
onAccountSettingsClick = onAccountSettingsClick,
|
||||
onDeleteAllTabsClick = onDeleteAllTabsClick,
|
||||
onBookmarkSelectedTabsClick = onBookmarkSelectedTabsClick,
|
||||
onDeleteSelectedTabsClick = onDeleteSelectedTabsClick,
|
||||
onForceSelectedTabsAsInactiveClick = onForceSelectedTabsAsInactiveClick,
|
||||
)
|
||||
}
|
||||
|
||||
@ -525,6 +534,9 @@ private fun TabsTrayPreviewRoot(
|
||||
onRecentlyClosedClick = {},
|
||||
onAccountSettingsClick = {},
|
||||
onDeleteAllTabsClick = {},
|
||||
onDeleteSelectedTabsClick = {},
|
||||
onBookmarkSelectedTabsClick = {},
|
||||
onForceSelectedTabsAsInactiveClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ private val ICON_SIZE = 24.dp
|
||||
* @param onRecentlyClosedClick Invoked when the user clicks on the recently closed tabs menu item.
|
||||
* @param onAccountSettingsClick Invoked when the user clicks on the account settings menu item.
|
||||
* @param onDeleteAllTabsClick Invoked when user interacts with the close all tabs menu item.
|
||||
* @param onDeleteSelectedTabsClick Invoked when user interacts with the close menu item.
|
||||
* @param onBookmarkSelectedTabsClick Invoked when user interacts with the bookmark menu item.
|
||||
* @param onForceSelectedTabsAsInactiveClick Invoked when user interacts with the make inactive menu item.
|
||||
*/
|
||||
@Suppress("LongParameterList")
|
||||
@Composable
|
||||
@ -93,6 +96,9 @@ fun TabsTrayBanner(
|
||||
onRecentlyClosedClick: () -> Unit,
|
||||
onAccountSettingsClick: () -> Unit,
|
||||
onDeleteAllTabsClick: () -> Unit,
|
||||
onDeleteSelectedTabsClick: () -> Unit,
|
||||
onBookmarkSelectedTabsClick: () -> Unit,
|
||||
onForceSelectedTabsAsInactiveClick: () -> Unit,
|
||||
) {
|
||||
if (selectMode is TabsTrayState.Mode.Select) {
|
||||
MultiSelectBanner(
|
||||
@ -101,6 +107,9 @@ fun TabsTrayBanner(
|
||||
onExitSelectModeClick = onExitSelectModeClick,
|
||||
onSaveToCollectionsClick = onSaveToCollectionClick,
|
||||
onShareSelectedTabs = onShareSelectedTabsClick,
|
||||
onBookmarkSelectedTabsClick = onBookmarkSelectedTabsClick,
|
||||
onCloseSelectedTabsClick = onDeleteSelectedTabsClick,
|
||||
onMakeSelectedTabsInactive = onForceSelectedTabsAsInactiveClick,
|
||||
)
|
||||
} else {
|
||||
SingleSelectBanner(
|
||||
@ -350,8 +359,11 @@ private fun NormalTabsTabIcon(normalTabCount: Int) {
|
||||
* @param onExitSelectModeClick Invoked when the user clicks on exit select mode button.
|
||||
* @param onSaveToCollectionsClick Invoked when the user clicks on the save to collection button.
|
||||
* @param onShareSelectedTabs Invoked when the user clicks on the share button.
|
||||
* @param onBookmarkSelectedTabsClick Invoked when user interacts with the bookmark menu item.
|
||||
* @param onCloseSelectedTabsClick Invoked when user interacts with the close menu item.
|
||||
* @param onMakeSelectedTabsInactive Invoked when user interacts with the make inactive menu item.
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
@Suppress("LongMethod", "LongParameterList")
|
||||
@Composable
|
||||
private fun MultiSelectBanner(
|
||||
selectedTabCount: Int,
|
||||
@ -359,21 +371,27 @@ private fun MultiSelectBanner(
|
||||
onExitSelectModeClick: () -> Unit,
|
||||
onSaveToCollectionsClick: () -> Unit,
|
||||
onShareSelectedTabs: () -> Unit,
|
||||
onBookmarkSelectedTabsClick: () -> Unit,
|
||||
onCloseSelectedTabsClick: () -> Unit,
|
||||
onMakeSelectedTabsInactive: () -> Unit,
|
||||
) {
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
val menuItems = mutableListOf(
|
||||
MenuItem(
|
||||
title = stringResource(R.string.tab_tray_multiselect_menu_item_bookmark),
|
||||
) {},
|
||||
onClick = onBookmarkSelectedTabsClick,
|
||||
),
|
||||
MenuItem(
|
||||
title = stringResource(R.string.tab_tray_multiselect_menu_item_close),
|
||||
) {},
|
||||
onClick = onCloseSelectedTabsClick,
|
||||
),
|
||||
)
|
||||
if (shouldShowInactiveButton) {
|
||||
menuItems.add(
|
||||
MenuItem(
|
||||
title = stringResource(R.string.inactive_tabs_menu_item),
|
||||
) {},
|
||||
onClick = onMakeSelectedTabsInactive,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@ -508,6 +526,9 @@ private fun TabsTrayBannerPreviewRoot(
|
||||
onRecentlyClosedClick = {},
|
||||
onAccountSettingsClick = {},
|
||||
onDeleteAllTabsClick = {},
|
||||
onBookmarkSelectedTabsClick = {},
|
||||
onDeleteSelectedTabsClick = {},
|
||||
onForceSelectedTabsAsInactiveClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -275,6 +275,9 @@ class TabsTrayFragment : AppCompatDialogFragment() {
|
||||
private = tabsTrayStore.state.selectedPage == Page.PrivateTabs,
|
||||
)
|
||||
},
|
||||
onDeleteSelectedTabsClick = tabsTrayInteractor::onDeleteSelectedTabsClicked,
|
||||
onBookmarkSelectedTabsClick = tabsTrayInteractor::onBookmarkSelectedTabsClicked,
|
||||
onForceSelectedTabsAsInactiveClick = tabsTrayInteractor::onForceSelectedTabsAsInactiveClicked,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user