🛠️ More precise control over text entry visibility
This commit is contained in:
parent
092bbfd10b
commit
b1f7e6176f
2 changed files with 52 additions and 47 deletions
|
|
@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.displayCutout
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -150,13 +149,11 @@ fun ReaderLayout(
|
|||
.coerceAtLeast(18.dp),
|
||||
)
|
||||
) {
|
||||
itemsIndexed(
|
||||
text, key = { index, _ -> index }
|
||||
) { index, textEntry ->
|
||||
for (entry in text) {
|
||||
ReaderLayoutText(
|
||||
activity = activity,
|
||||
showMenu = showMenu,
|
||||
entry = textEntry,
|
||||
entry = entry,
|
||||
fontFamily = fontFamily,
|
||||
fontColor = fontColor,
|
||||
lineHeight = lineHeight,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
@file:Suppress("FunctionName")
|
||||
|
||||
package ua.acclorite.book_story.presentation.reader
|
||||
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.compose.foundation.lazy.LazyItemScope
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
|
|
@ -14,8 +15,7 @@ import ua.acclorite.book_story.domain.reader.ReaderText
|
|||
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||
import ua.acclorite.book_story.ui.reader.ReaderEvent
|
||||
|
||||
@Composable
|
||||
fun LazyItemScope.ReaderLayoutText(
|
||||
fun LazyListScope.ReaderLayoutText(
|
||||
activity: ComponentActivity,
|
||||
showMenu: Boolean,
|
||||
entry: ReaderText,
|
||||
|
|
@ -40,20 +40,25 @@ fun LazyItemScope.ReaderLayoutText(
|
|||
) {
|
||||
when (entry) {
|
||||
is ReaderText.Image -> {
|
||||
item {
|
||||
ReaderLayoutTextImage(
|
||||
entry = entry,
|
||||
sidePadding = sidePadding
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is ReaderText.Separator -> {
|
||||
item {
|
||||
ReaderLayoutTextSeparator(
|
||||
sidePadding = sidePadding,
|
||||
fontColor = fontColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is ReaderText.Chapter -> {
|
||||
item {
|
||||
ReaderLayoutTextChapter(
|
||||
chapter = entry,
|
||||
chapterTitleAlignment = chapterTitleAlignment,
|
||||
|
|
@ -63,8 +68,10 @@ fun LazyItemScope.ReaderLayoutText(
|
|||
highlightedReadingThickness = highlightedReadingThickness
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is ReaderText.Text -> {
|
||||
item {
|
||||
ReaderLayoutTextParagraph(
|
||||
paragraph = entry,
|
||||
activity = activity,
|
||||
|
|
@ -89,4 +96,5 @@ fun LazyItemScope.ReaderLayoutText(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue