mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Add back action mode title (#1633)
Co-authored-by: fanchao <git@fanchao.dev>
This commit is contained in:
parent
ab2e3744a9
commit
eea54d1a17
@ -144,6 +144,7 @@ fun MediaOverviewScreen(
|
|||||||
onSaveClicked = { showingSaveAttachmentWarning = true },
|
onSaveClicked = { showingSaveAttachmentWarning = true },
|
||||||
onDeleteClicked = { showingDeleteConfirmation = true },
|
onDeleteClicked = { showingDeleteConfirmation = true },
|
||||||
onSelectAllClicked = viewModel::onSelectAllClicked,
|
onSelectAllClicked = viewModel::onSelectAllClicked,
|
||||||
|
numSelected = selectedItems.size,
|
||||||
appBarScrollBehavior = appBarScrollBehavior
|
appBarScrollBehavior = appBarScrollBehavior
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.ui.theme.LocalColors
|
|||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
fun MediaOverviewTopAppBar(
|
fun MediaOverviewTopAppBar(
|
||||||
selectionMode: Boolean,
|
selectionMode: Boolean,
|
||||||
|
numSelected: Int,
|
||||||
title: String,
|
title: String,
|
||||||
onBackClicked: () -> Unit,
|
onBackClicked: () -> Unit,
|
||||||
onSaveClicked: () -> Unit,
|
onSaveClicked: () -> Unit,
|
||||||
@ -25,7 +26,8 @@ fun MediaOverviewTopAppBar(
|
|||||||
) {
|
) {
|
||||||
ActionAppBar(
|
ActionAppBar(
|
||||||
title = title,
|
title = title,
|
||||||
navigationIcon = {AppBarBackIcon(onBack = onBackClicked)},
|
actionModeTitle = numSelected.toString(),
|
||||||
|
navigationIcon = { AppBarBackIcon(onBack = onBackClicked) },
|
||||||
scrollBehavior = appBarScrollBehavior,
|
scrollBehavior = appBarScrollBehavior,
|
||||||
actionMode = selectionMode,
|
actionMode = selectionMode,
|
||||||
actionModeActions = {
|
actionModeActions = {
|
||||||
|
@ -2,26 +2,27 @@ package org.thoughtcrime.securesms.ui.components
|
|||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBarColors
|
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.ui.Divider
|
import org.thoughtcrime.securesms.ui.Divider
|
||||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||||
|
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||||
@ -37,7 +38,10 @@ fun AppBarPreview(
|
|||||||
Column() {
|
Column() {
|
||||||
BasicAppBar(title = "Basic App Bar")
|
BasicAppBar(title = "Basic App Bar")
|
||||||
Divider()
|
Divider()
|
||||||
BasicAppBar(title = "Basic App Bar With Color", backgroundColor = LocalColors.current.backgroundSecondary)
|
BasicAppBar(
|
||||||
|
title = "Basic App Bar With Color",
|
||||||
|
backgroundColor = LocalColors.current.backgroundSecondary
|
||||||
|
)
|
||||||
Divider()
|
Divider()
|
||||||
BackAppBar(title = "Back Bar", onBack = {})
|
BackAppBar(title = "Back Bar", onBack = {})
|
||||||
Divider()
|
Divider()
|
||||||
@ -69,7 +73,7 @@ fun BasicAppBar(
|
|||||||
backgroundColor: Color = LocalColors.current.background,
|
backgroundColor: Color = LocalColors.current.background,
|
||||||
navigationIcon: @Composable () -> Unit = {},
|
navigationIcon: @Composable () -> Unit = {},
|
||||||
actions: @Composable RowScope.() -> Unit = {},
|
actions: @Composable RowScope.() -> Unit = {},
|
||||||
){
|
) {
|
||||||
CenterAlignedTopAppBar(
|
CenterAlignedTopAppBar(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
title = {
|
title = {
|
||||||
@ -94,7 +98,7 @@ fun BackAppBar(
|
|||||||
scrollBehavior: TopAppBarScrollBehavior? = null,
|
scrollBehavior: TopAppBarScrollBehavior? = null,
|
||||||
backgroundColor: Color = LocalColors.current.background,
|
backgroundColor: Color = LocalColors.current.background,
|
||||||
actions: @Composable RowScope.() -> Unit = {},
|
actions: @Composable RowScope.() -> Unit = {},
|
||||||
){
|
) {
|
||||||
BasicAppBar(
|
BasicAppBar(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
title = title,
|
title = title,
|
||||||
@ -115,6 +119,7 @@ fun ActionAppBar(
|
|||||||
scrollBehavior: TopAppBarScrollBehavior? = null,
|
scrollBehavior: TopAppBarScrollBehavior? = null,
|
||||||
backgroundColor: Color = LocalColors.current.background,
|
backgroundColor: Color = LocalColors.current.background,
|
||||||
actionMode: Boolean = false,
|
actionMode: Boolean = false,
|
||||||
|
actionModeTitle: String = "",
|
||||||
navigationIcon: @Composable () -> Unit = {},
|
navigationIcon: @Composable () -> Unit = {},
|
||||||
actions: @Composable RowScope.() -> Unit = {},
|
actions: @Composable RowScope.() -> Unit = {},
|
||||||
actionModeActions: @Composable (RowScope.() -> Unit) = {},
|
actionModeActions: @Composable (RowScope.() -> Unit) = {},
|
||||||
@ -126,7 +131,19 @@ fun ActionAppBar(
|
|||||||
AppBarText(title = title)
|
AppBarText(title = title)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigationIcon =navigationIcon,
|
navigationIcon = {
|
||||||
|
if (actionMode) {
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.xxxsSpacing),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
navigationIcon()
|
||||||
|
AppBarText(title = actionModeTitle)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navigationIcon()
|
||||||
|
}
|
||||||
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
colors = appBarColors(backgroundColor),
|
colors = appBarColors(backgroundColor),
|
||||||
actions = {
|
actions = {
|
||||||
|
Loading…
Reference in New Issue
Block a user