parent
22afae4449
commit
bcd90be525
5 changed files with 83 additions and 53 deletions
|
@ -5,8 +5,6 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.DeleteSweep
|
import androidx.compose.material.icons.outlined.DeleteSweep
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -14,6 +12,8 @@ import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import eu.kanade.domain.ui.UiPreferences
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.components.AppBarTitle
|
import eu.kanade.presentation.components.AppBarTitle
|
||||||
import eu.kanade.presentation.components.RelativeDateHeader
|
import eu.kanade.presentation.components.RelativeDateHeader
|
||||||
import eu.kanade.presentation.components.SearchToolbar
|
import eu.kanade.presentation.components.SearchToolbar
|
||||||
|
@ -47,12 +47,17 @@ fun HistoryScreen(
|
||||||
searchQuery = state.searchQuery,
|
searchQuery = state.searchQuery,
|
||||||
onChangeSearchQuery = onSearchQueryChange,
|
onChangeSearchQuery = onSearchQueryChange,
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = { onDialogChange(HistoryScreenModel.Dialog.DeleteAll) }) {
|
AppBarActions(
|
||||||
Icon(
|
listOf(
|
||||||
Icons.Outlined.DeleteSweep,
|
AppBar.Action(
|
||||||
contentDescription = stringResource(R.string.pref_clear_history),
|
title = stringResource(R.string.pref_clear_history),
|
||||||
|
icon = Icons.Outlined.DeleteSweep,
|
||||||
|
onClick = {
|
||||||
|
onDialogChange(HistoryScreenModel.Dialog.DeleteAll)
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.components.OverflowMenu
|
import eu.kanade.presentation.components.OverflowMenu
|
||||||
import eu.kanade.presentation.components.SearchToolbar
|
import eu.kanade.presentation.components.SearchToolbar
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
@ -139,12 +140,20 @@ private fun LibrarySelectionToolbar(
|
||||||
AppBar(
|
AppBar(
|
||||||
titleContent = { Text(text = "$selectedCount") },
|
titleContent = { Text(text = "$selectedCount") },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = onClickSelectAll) {
|
AppBarActions(
|
||||||
Icon(Icons.Outlined.SelectAll, contentDescription = stringResource(R.string.action_select_all))
|
listOf(
|
||||||
}
|
AppBar.Action(
|
||||||
IconButton(onClick = onClickInvertSelection) {
|
title = stringResource(R.string.action_select_all),
|
||||||
Icon(Icons.Outlined.FlipToBack, contentDescription = stringResource(R.string.action_select_inverse))
|
icon = Icons.Outlined.SelectAll,
|
||||||
}
|
onClick = onClickSelectAll,
|
||||||
|
),
|
||||||
|
AppBar.Action(
|
||||||
|
title = stringResource(R.string.action_select_inverse),
|
||||||
|
icon = Icons.Outlined.FlipToBack,
|
||||||
|
onClick = onClickInvertSelection,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
},
|
},
|
||||||
isActionMode = true,
|
isActionMode = true,
|
||||||
onCancelActionMode = onClickUnselectAll,
|
onCancelActionMode = onClickUnselectAll,
|
||||||
|
|
|
@ -26,6 +26,8 @@ import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.components.DownloadDropdownMenu
|
import eu.kanade.presentation.components.DownloadDropdownMenu
|
||||||
import eu.kanade.presentation.components.OverflowMenu
|
import eu.kanade.presentation.components.OverflowMenu
|
||||||
import eu.kanade.presentation.manga.DownloadAction
|
import eu.kanade.presentation.manga.DownloadAction
|
||||||
|
@ -74,18 +76,20 @@ fun MangaToolbar(
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
if (isActionMode) {
|
if (isActionMode) {
|
||||||
IconButton(onClick = onSelectAll) {
|
AppBarActions(
|
||||||
Icon(
|
listOf(
|
||||||
imageVector = Icons.Outlined.SelectAll,
|
AppBar.Action(
|
||||||
contentDescription = stringResource(R.string.action_select_all),
|
title = stringResource(R.string.action_select_all),
|
||||||
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
onClick = onSelectAll,
|
||||||
|
),
|
||||||
|
AppBar.Action(
|
||||||
|
title = stringResource(R.string.action_select_inverse),
|
||||||
|
icon = Icons.Outlined.FlipToBack,
|
||||||
|
onClick = onInvertSelection,
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
IconButton(onClick = onInvertSelection) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Outlined.FlipToBack,
|
|
||||||
contentDescription = stringResource(R.string.action_select_inverse),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (onClickDownload != null) {
|
if (onClickDownload != null) {
|
||||||
val (downloadExpanded, onDownloadExpanded) = remember { mutableStateOf(false) }
|
val (downloadExpanded, onDownloadExpanded) = remember { mutableStateOf(false) }
|
||||||
|
|
|
@ -18,6 +18,7 @@ import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.fastForEach
|
import androidx.compose.ui.util.fastForEach
|
||||||
|
@ -29,7 +30,10 @@ import cafe.adriel.voyager.core.model.rememberScreenModel
|
||||||
import cafe.adriel.voyager.core.screen.Screen
|
import cafe.adriel.voyager.core.screen.Screen
|
||||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.util.ioCoroutineScope
|
import eu.kanade.presentation.util.ioCoroutineScope
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import eu.kanade.tachiyomi.util.system.workManager
|
import eu.kanade.tachiyomi.util.system.workManager
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
|
@ -63,13 +67,17 @@ object WorkerInfoScreen : Screen {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(
|
AppBarActions(
|
||||||
|
listOf(
|
||||||
|
AppBar.Action(
|
||||||
|
title = stringResource(R.string.action_copy_to_clipboard),
|
||||||
|
icon = Icons.Default.ContentCopy,
|
||||||
onClick = {
|
onClick = {
|
||||||
context.copyToClipboard(title, enqueued + finished + running)
|
context.copyToClipboard(title, enqueued + finished + running)
|
||||||
},
|
},
|
||||||
) {
|
),
|
||||||
Icon(imageVector = Icons.Default.ContentCopy, contentDescription = null)
|
),
|
||||||
}
|
)
|
||||||
},
|
},
|
||||||
scrollBehavior = it,
|
scrollBehavior = it,
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,8 +7,6 @@ import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.FlipToBack
|
import androidx.compose.material.icons.outlined.FlipToBack
|
||||||
import androidx.compose.material.icons.outlined.Refresh
|
import androidx.compose.material.icons.outlined.Refresh
|
||||||
import androidx.compose.material.icons.outlined.SelectAll
|
import androidx.compose.material.icons.outlined.SelectAll
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
|
@ -24,6 +22,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.util.fastAll
|
import androidx.compose.ui.util.fastAll
|
||||||
import androidx.compose.ui.util.fastAny
|
import androidx.compose.ui.util.fastAny
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.manga.components.ChapterDownloadAction
|
import eu.kanade.presentation.manga.components.ChapterDownloadAction
|
||||||
import eu.kanade.presentation.manga.components.MangaBottomActionMenu
|
import eu.kanade.presentation.manga.components.MangaBottomActionMenu
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
@ -144,28 +143,33 @@ private fun UpdatesAppBar(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
title = stringResource(R.string.label_recent_updates),
|
title = stringResource(R.string.label_recent_updates),
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = onUpdateLibrary) {
|
AppBarActions(
|
||||||
Icon(
|
listOf(
|
||||||
imageVector = Icons.Outlined.Refresh,
|
AppBar.Action(
|
||||||
contentDescription = stringResource(R.string.action_update_library),
|
title = stringResource(R.string.action_update_library),
|
||||||
|
icon = Icons.Outlined.Refresh,
|
||||||
|
onClick = onUpdateLibrary,
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
actionModeCounter = actionModeCounter,
|
actionModeCounter = actionModeCounter,
|
||||||
onCancelActionMode = onCancelActionMode,
|
onCancelActionMode = onCancelActionMode,
|
||||||
actionModeActions = {
|
actionModeActions = {
|
||||||
IconButton(onClick = onSelectAll) {
|
AppBarActions(
|
||||||
Icon(
|
listOf(
|
||||||
imageVector = Icons.Outlined.SelectAll,
|
AppBar.Action(
|
||||||
contentDescription = stringResource(R.string.action_select_all),
|
title = stringResource(R.string.action_select_all),
|
||||||
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
onClick = onSelectAll,
|
||||||
|
),
|
||||||
|
AppBar.Action(
|
||||||
|
title = stringResource(R.string.action_select_inverse),
|
||||||
|
icon = Icons.Outlined.FlipToBack,
|
||||||
|
onClick = onInvertSelection,
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
IconButton(onClick = onInvertSelection) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Outlined.FlipToBack,
|
|
||||||
contentDescription = stringResource(R.string.action_select_inverse),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue