mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Improve Direction enum
This commit is contained in:
@@ -471,7 +471,7 @@ fun ReaderLayout(
|
||||
currentPageOffset = currentPageOffset,
|
||||
loadingModifier = loadingModifier,
|
||||
pageContentScale = if (fitSize) {
|
||||
if (direction == Direction.Up || direction == Direction.Down) {
|
||||
if (direction.isVertical) {
|
||||
ContentScale.FillWidth
|
||||
} else {
|
||||
ContentScale.FillHeight
|
||||
|
||||
@@ -110,9 +110,9 @@ fun ContinuousReader(
|
||||
}
|
||||
|
||||
val imageModifier = if (maxSize != 0) {
|
||||
when (direction) {
|
||||
Direction.Up, Direction.Down -> Modifier.width(maxSize.dp)
|
||||
Direction.Left, Direction.Right -> Modifier.height(maxSize.dp)
|
||||
when (direction.isVertical) {
|
||||
true -> Modifier.width(maxSize.dp)
|
||||
false -> Modifier.height(maxSize.dp)
|
||||
}
|
||||
} else {
|
||||
Modifier
|
||||
@@ -125,8 +125,8 @@ fun ContinuousReader(
|
||||
}
|
||||
fun retry(index: Int) { pages.find { it is ReaderPage && it.index == index }?.let { retry(it as ReaderPage) } }
|
||||
|
||||
when (direction) {
|
||||
Direction.Down, Direction.Up -> {
|
||||
when (direction.isVertical) {
|
||||
true -> {
|
||||
LazyColumn(
|
||||
state = state,
|
||||
reverseLayout = direction == Direction.Up,
|
||||
@@ -151,7 +151,7 @@ fun ContinuousReader(
|
||||
reverseLayout = direction == Direction.Up
|
||||
)
|
||||
}
|
||||
Direction.Left, Direction.Right -> {
|
||||
false -> {
|
||||
LazyRow(
|
||||
state = state,
|
||||
reverseLayout = direction == Direction.Left,
|
||||
|
||||
@@ -81,7 +81,7 @@ fun PagerReader(
|
||||
val modifier = parentModifier then Modifier.fillMaxSize()
|
||||
fun retry(index: Int) { pages.find { it is ReaderPage && it.index == index }?.let { retry(it as ReaderPage) } }
|
||||
|
||||
if (direction == Direction.Down || direction == Direction.Up) {
|
||||
if (direction.isVertical) {
|
||||
VerticalPager(
|
||||
count = pages.size,
|
||||
state = state,
|
||||
|
||||
@@ -242,7 +242,7 @@ fun SettingsReaderScreenContent(
|
||||
stringResource(MR.strings.page_padding)
|
||||
)
|
||||
val direction by it.direction.collectAsState()
|
||||
val (title, subtitle) = if (direction == Direction.Up || direction == Direction.Down) {
|
||||
val (title, subtitle) = if (direction.isVertical) {
|
||||
stringResource(MR.strings.force_fit_width) to stringResource(MR.strings.force_fit_width_sub)
|
||||
} else {
|
||||
stringResource(MR.strings.force_fit_height) to stringResource(MR.strings.force_fit_height_sub)
|
||||
@@ -253,7 +253,7 @@ fun SettingsReaderScreenContent(
|
||||
subtitle
|
||||
)
|
||||
val maxSize by it.maxSize.collectAsState()
|
||||
val (maxSizeTitle, maxSizeSubtitle) = if (direction == Direction.Up || direction == Direction.Down) {
|
||||
val (maxSizeTitle, maxSizeSubtitle) = if (direction.isVertical) {
|
||||
stringResource(MR.strings.max_width) to stringResource(
|
||||
MR.strings.max_width_sub,
|
||||
maxSize
|
||||
|
||||
Reference in New Issue
Block a user