Bunch of style updates
parent
680658fd86
commit
968691a8fe
|
@ -1,6 +1,7 @@
|
|||
package xyz.pixelatedw.recipe
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
|
@ -10,11 +11,14 @@ import androidx.activity.enableEdgeToEdge
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
|
@ -22,6 +26,7 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
|
@ -68,11 +73,15 @@ import xyz.pixelatedw.recipe.ui.theme.RecipeTheme
|
|||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Shadow
|
||||
import androidx.compose.ui.text.style.LineBreak
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private val recipeView: RecipesView by viewModels()
|
||||
|
||||
|
@ -240,9 +249,16 @@ fun RecipeList(padding: PaddingValues, view: RecipesView) {
|
|||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
val annotatedString =
|
||||
parseMarkdown(active.value!!.content, MaterialTheme.typography)
|
||||
Text(text = annotatedString)
|
||||
Text(
|
||||
text = annotatedString,
|
||||
modifier = Modifier.padding(16.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +273,7 @@ fun RecipePreview(recipe: Recipe, onClick: () -> Unit) {
|
|||
Image(
|
||||
painter = painterResource(R.drawable.ic_launcher_background),
|
||||
contentDescription = "Recipe image",
|
||||
modifier = Modifier.size(256.dp)
|
||||
modifier = Modifier.size(256.dp).padding(top = 16.dp, bottom = 16.dp)
|
||||
)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.Center, modifier = Modifier.fillMaxWidth()) {
|
||||
|
@ -270,15 +286,22 @@ fun RecipePreview(recipe: Recipe, onClick: () -> Unit) {
|
|||
)
|
||||
)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) {
|
||||
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)) {
|
||||
for (tag in recipe.tags) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(start = 8.dp)
|
||||
.clip(RoundedCornerShape(percent = 50))
|
||||
.background(androidx.compose.ui.graphics.Color(0, 153, 170))
|
||||
) {
|
||||
Text(
|
||||
text = tag,
|
||||
modifier = Modifier.padding(start = 8.dp)
|
||||
modifier = Modifier.padding(start = 8.dp, end = 8.dp),
|
||||
text = tag
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@Preview(
|
||||
|
@ -379,6 +402,7 @@ private fun AnnotatedString.Builder.visitMarkdownNode(
|
|||
}
|
||||
}
|
||||
is ListItem -> {
|
||||
withStyle(ParagraphStyle(lineHeight = 18.sp)) {
|
||||
if (node.parents.any { it is BulletList }) {
|
||||
append("• ")
|
||||
} else if (node.parents.any { it is OrderedList }) {
|
||||
|
@ -389,6 +413,7 @@ private fun AnnotatedString.Builder.visitMarkdownNode(
|
|||
visitChildren(node, typography)
|
||||
appendLine()
|
||||
}
|
||||
}
|
||||
is Document -> {
|
||||
visitChildren(node, typography)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue