Optimize the content styles of articles
This commit is contained in:
parent
66094f8075
commit
5867186751
|
@ -238,7 +238,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ private fun TextComposer.appendTextChildren(
|
|||
withComposableStyle(
|
||||
style = { h5Style().toSpanStyle() }
|
||||
) {
|
||||
append(element.text())
|
||||
append("\n${element.text()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,6 +442,7 @@ private fun TextComposer.appendTextChildren(
|
|||
// .padding(horizontal = PADDING_HORIZONTAL.dp)
|
||||
.width(MAX_CONTENT_WIDTH.dp)
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(PADDING_HORIZONTAL.dp))
|
||||
DisableSelection {
|
||||
BoxWithConstraints(
|
||||
modifier = Modifier
|
||||
|
@ -466,7 +467,11 @@ private fun TextComposer.appendTextChildren(
|
|||
) {
|
||||
val imageSize = maxImageSize()
|
||||
RYAsyncImage(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = PADDING_HORIZONTAL.dp)
|
||||
.clip(IMAGE_SHAPE)
|
||||
.clickable { },
|
||||
data = imageCandidates.getBestImageForMaxSize(
|
||||
pixelDensity = pixelDensity(),
|
||||
maxSize = imageSize,
|
||||
|
@ -593,10 +598,12 @@ private fun TextComposer.appendTextChildren(
|
|||
) {
|
||||
RYAsyncImage(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = PADDING_HORIZONTAL.dp)
|
||||
.clip(IMAGE_SHAPE)
|
||||
.clickable {
|
||||
onLinkClick(video.link)
|
||||
}
|
||||
.fillMaxWidth(),
|
||||
},
|
||||
data = video.imageUrl,
|
||||
size = maxImageSize(),
|
||||
contentDescription = stringResource(R.string.touch_to_play_video),
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package me.ash.reader.ui.component.reader
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -27,12 +28,14 @@ import androidx.compose.ui.text.SpanStyle
|
|||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import me.ash.reader.ui.ext.alphaLN
|
||||
|
||||
const val PADDING_HORIZONTAL = 24.0
|
||||
const val MAX_CONTENT_WIDTH = 840.0
|
||||
val IMAGE_SHAPE = RoundedCornerShape(32.dp)
|
||||
|
||||
@Composable
|
||||
fun bodyForeground(): Color =
|
||||
|
@ -71,7 +74,7 @@ fun h4Style(): TextStyle =
|
|||
@Composable
|
||||
fun h5Style(): TextStyle =
|
||||
MaterialTheme.typography.headlineSmall.copy(
|
||||
color = bodyForeground()
|
||||
color = bodyForeground(),
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
@ -83,7 +86,8 @@ fun h6Style(): TextStyle =
|
|||
@Composable
|
||||
fun captionStyle(): TextStyle =
|
||||
MaterialTheme.typography.bodySmall.copy(
|
||||
color = bodyForeground().copy(alpha = 0.6f)
|
||||
color = bodyForeground().copy(alpha = 0.6f),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
|
|
@ -79,7 +79,7 @@ class TextComposer(
|
|||
) -> R
|
||||
): R {
|
||||
val url = link ?: findClosestLink()
|
||||
builder.ensureDoubleNewline()
|
||||
//builder.ensureDoubleNewline()
|
||||
terminateCurrentText()
|
||||
val onClick: (() -> Unit)? = if (url?.isNotBlank() == true) {
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user