Use AppBarActions
This commit is contained in:
parent
7ea6f685bf
commit
190c87f7f3
@ -15,7 +15,6 @@ import androidx.compose.material.icons.outlined.CopyAll
|
||||
import androidx.compose.material.icons.outlined.Done
|
||||
import androidx.compose.material.icons.outlined.DoneAll
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
@ -28,6 +27,7 @@ import eu.kanade.presentation.browse.components.MigrationActionIcon
|
||||
import eu.kanade.presentation.browse.components.MigrationItem
|
||||
import eu.kanade.presentation.browse.components.MigrationItemResult
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.AppBarActions
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigratingManga
|
||||
import tachiyomi.core.util.lang.withIOContext
|
||||
@ -63,24 +63,22 @@ fun MigrationListScreen(
|
||||
AppBar(
|
||||
title = title,
|
||||
actions = {
|
||||
IconButton(
|
||||
onClick = { openMigrationDialog(true) },
|
||||
enabled = migrationDone,
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (items.size == 1) Icons.Outlined.ContentCopy else Icons.Outlined.CopyAll,
|
||||
contentDescription = stringResource(R.string.copy),
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = { openMigrationDialog(false) },
|
||||
enabled = migrationDone,
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (items.size == 1) Icons.Outlined.Done else Icons.Outlined.DoneAll,
|
||||
contentDescription = stringResource(R.string.migrate),
|
||||
)
|
||||
}
|
||||
AppBarActions(
|
||||
listOf(
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.copy),
|
||||
icon = if (items.size == 1) Icons.Outlined.ContentCopy else Icons.Outlined.CopyAll,
|
||||
onClick = { openMigrationDialog(false) },
|
||||
enabled = migrationDone,
|
||||
),
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.migrate),
|
||||
icon = if (items.size == 1) Icons.Outlined.Done else Icons.Outlined.DoneAll,
|
||||
onClick = { openMigrationDialog(false) },
|
||||
enabled = migrationDone,
|
||||
),
|
||||
),
|
||||
)
|
||||
},
|
||||
scrollBehavior = scrollBehavior,
|
||||
)
|
||||
|
@ -101,9 +101,9 @@ fun EhLoginWebViewScreen(
|
||||
|
||||
val webClient = remember {
|
||||
object : AccompanistWebViewClient() {
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
override fun onPageFinished(view: WebView, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
onPageFinished(view ?: return, url ?: return)
|
||||
onPageFinished(view, url ?: return)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import androidx.compose.material.icons.outlined.ArrowForward
|
||||
import androidx.compose.material.icons.outlined.Deselect
|
||||
import androidx.compose.material.icons.outlined.SelectAll
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.rememberTopAppBarState
|
||||
@ -40,7 +39,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.Navigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.OverflowMenu
|
||||
import eu.kanade.presentation.components.AppBarActions
|
||||
import eu.kanade.presentation.util.Screen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.PreMigrationListBinding
|
||||
@ -98,34 +97,28 @@ class PreMigrationScreen(val mangaIds: List<Long>) : Screen() {
|
||||
navigateUp = navigator::pop,
|
||||
scrollBehavior = scrollBehavior,
|
||||
actions = {
|
||||
IconButton(onClick = { screenModel.massSelect(false) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Deselect,
|
||||
contentDescription = stringResource(R.string.select_none),
|
||||
)
|
||||
}
|
||||
IconButton(onClick = { screenModel.massSelect(true) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.SelectAll,
|
||||
contentDescription = stringResource(R.string.action_select_all),
|
||||
)
|
||||
}
|
||||
OverflowMenu { closeMenu ->
|
||||
androidx.compose.material3.DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.match_enabled_sources)) },
|
||||
onClick = {
|
||||
screenModel.matchSelection(true)
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
androidx.compose.material3.DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.match_pinned_sources)) },
|
||||
onClick = {
|
||||
screenModel.matchSelection(false)
|
||||
closeMenu()
|
||||
},
|
||||
)
|
||||
}
|
||||
AppBarActions(
|
||||
listOf(
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.select_none),
|
||||
icon = Icons.Outlined.Deselect,
|
||||
onClick = { screenModel.massSelect(false) },
|
||||
),
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.action_select_all),
|
||||
icon = Icons.Outlined.SelectAll,
|
||||
onClick = { screenModel.massSelect(true) },
|
||||
),
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(R.string.match_enabled_sources),
|
||||
onClick = { screenModel.matchSelection(true) },
|
||||
),
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(R.string.match_pinned_sources),
|
||||
onClick = { screenModel.matchSelection(false) },
|
||||
),
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
@ -13,8 +13,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.UTurnRight
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Slider
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
@ -31,6 +29,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.AppBarActions
|
||||
import eu.kanade.presentation.components.AroundLayout
|
||||
import eu.kanade.presentation.manga.components.PagePreview
|
||||
import eu.kanade.tachiyomi.R
|
||||
@ -89,7 +88,9 @@ fun PagePreviewScreen(
|
||||
) {
|
||||
items(items) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
@ -183,14 +184,15 @@ fun PagePreviewTopAppBar(
|
||||
AppBar(
|
||||
title = title,
|
||||
actions = {
|
||||
if (showOpenPageDialog) {
|
||||
IconButton(onClick = onOpenPageDialog) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.UTurnRight,
|
||||
contentDescription = stringResource(R.string.page_preview_page_go_to),
|
||||
)
|
||||
}
|
||||
}
|
||||
AppBarActions(
|
||||
listOfNotNull(
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.page_preview_page_go_to),
|
||||
icon = Icons.Outlined.UTurnRight,
|
||||
onClick = onOpenPageDialog,
|
||||
).takeIf { showOpenPageDialog },
|
||||
),
|
||||
)
|
||||
},
|
||||
navigateUp = navigateUp,
|
||||
scrollBehavior = scrollBehavior,
|
||||
|
Loading…
x
Reference in New Issue
Block a user