Use MaterialTheme.shapes in more places

This commit is contained in:
arkon 2022-10-28 16:18:05 -04:00
parent 87391832ba
commit 401134fa8e
10 changed files with 13 additions and 21 deletions

View File

@ -6,7 +6,6 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Dangerous import androidx.compose.material.icons.filled.Dangerous
import androidx.compose.material.icons.filled.Warning import androidx.compose.material.icons.filled.Warning
@ -85,7 +84,7 @@ fun ExtensionIcon(
placeholder = ColorPainter(Color(0x1F888888)), placeholder = ColorPainter(Color(0x1F888888)),
error = rememberResourceBitmapPainter(id = R.drawable.cover_error), error = rememberResourceBitmapPainter(id = R.drawable.cover_error),
modifier = modifier modifier = modifier
.clip(RoundedCornerShape(4.dp)), .clip(MaterialTheme.shapes.extraSmall),
) )
} }
is Extension.Installed -> { is Extension.Installed -> {

View File

@ -4,7 +4,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -19,7 +18,7 @@ import androidx.compose.ui.unit.dp
@Composable @Composable
fun BadgeGroup( fun BadgeGroup(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
shape: Shape = RoundedCornerShape(4.dp), shape: Shape = MaterialTheme.shapes.extraSmall,
content: @Composable RowScope.() -> Unit, content: @Composable RowScope.() -> Unit,
) { ) {
Row(modifier = modifier.clip(shape)) { Row(modifier = modifier.clip(shape)) {

View File

@ -225,7 +225,7 @@ private fun GridItemSelectable(
) { ) {
Box( Box(
modifier = modifier modifier = modifier
.clip(RoundedCornerShape(8.dp)) .clip(MaterialTheme.shapes.small)
.combinedClickable( .combinedClickable(
onClick = onClick, onClick = onClick,
onLongClick = onLongClick, onLongClick = onLongClick,

View File

@ -2,7 +2,7 @@ package eu.kanade.presentation.components
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
@ -11,7 +11,6 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.painter.ColorPainter import androidx.compose.ui.graphics.painter.ColorPainter
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage import coil.compose.AsyncImage
import eu.kanade.presentation.util.rememberResourceBitmapPainter import eu.kanade.presentation.util.rememberResourceBitmapPainter
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -26,7 +25,7 @@ enum class MangaCover(val ratio: Float) {
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
data: Any?, data: Any?,
contentDescription: String = "", contentDescription: String = "",
shape: Shape = RoundedCornerShape(4.dp), shape: Shape = MaterialTheme.shapes.extraSmall,
onClick: (() -> Unit)? = null, onClick: (() -> Unit)? = null,
) { ) {
AsyncImage( AsyncImage(

View File

@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -28,7 +27,7 @@ fun Pill(
androidx.compose.material3.Surface( androidx.compose.material3.Surface(
modifier = modifier modifier = modifier
.padding(start = 4.dp), .padding(start = 4.dp),
shape = RoundedCornerShape(100), shape = MaterialTheme.shapes.extraLarge,
color = color, color = color,
contentColor = contentColor, contentColor = contentColor,
tonalElevation = elevation, tonalElevation = elevation,

View File

@ -158,7 +158,7 @@ fun AppThemePreviewItem(
.padding(end = 4.dp) .padding(end = 4.dp)
.background( .background(
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
shape = RoundedCornerShape(9.dp), shape = MaterialTheme.shapes.small,
), ),
) )
@ -182,7 +182,7 @@ fun AppThemePreviewItem(
.padding(start = 8.dp, top = 2.dp) .padding(start = 8.dp, top = 2.dp)
.background( .background(
color = dividerColor, color = dividerColor,
shape = RoundedCornerShape(9.dp), shape = MaterialTheme.shapes.small,
) )
.fillMaxWidth(0.5f) .fillMaxWidth(0.5f)
.aspectRatio(MangaCover.Book.ratio), .aspectRatio(MangaCover.Book.ratio),
@ -242,7 +242,7 @@ fun AppThemePreviewItem(
.weight(1f) .weight(1f)
.background( .background(
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
shape = RoundedCornerShape(9.dp), shape = MaterialTheme.shapes.small,
), ),
) )
} }

View File

@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.RadioButton import androidx.compose.material3.RadioButton
@ -89,7 +88,7 @@ private fun DialogRow(
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(8.dp)) .clip(MaterialTheme.shapes.small)
.selectable( .selectable(
selected = isSelected, selected = isSelected,
onClick = { if (!isSelected) onSelected() }, onClick = { if (!isSelected) onSelected() },

View File

@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Checkbox import androidx.compose.material3.Checkbox
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -62,7 +61,7 @@ fun MultiSelectListPreferenceWidget(
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(8.dp)) .clip(MaterialTheme.shapes.small)
.selectable( .selectable(
selected = isSelected, selected = isSelected,
onClick = { onSelectionChanged() }, onClick = { onSelectionChanged() },

View File

@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Check
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@ -45,7 +44,7 @@ fun TrackingPreferenceWidget(
Box( Box(
modifier = Modifier modifier = Modifier
.size(48.dp) .size(48.dp)
.background(color = Color(logoColor), shape = RoundedCornerShape(8.dp)) .background(color = Color(logoColor), shape = MaterialTheme.shapes.small)
.padding(4.dp), .padding(4.dp),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {

View File

@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.CheckBox import androidx.compose.material.icons.rounded.CheckBox
import androidx.compose.material.icons.rounded.CheckBoxOutlineBlank import androidx.compose.material.icons.rounded.CheckBoxOutlineBlank
@ -79,7 +78,7 @@ fun <T> TriStateListDialog(
val state = selected[index] val state = selected[index]
Row( Row(
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(8.dp)) .clip(MaterialTheme.shapes.small)
.clickable { .clickable {
selected[index] = when (state) { selected[index] = when (state) {
State.UNCHECKED -> State.CHECKED State.UNCHECKED -> State.CHECKED