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