diff --git a/app/src/main/java/com/pixelized/biblib/repository/search/SearchRepository.kt b/app/src/main/java/com/pixelized/biblib/repository/search/SearchRepository.kt index c3c90b5..7112649 100644 --- a/app/src/main/java/com/pixelized/biblib/repository/search/SearchRepository.kt +++ b/app/src/main/java/com/pixelized/biblib/repository/search/SearchRepository.kt @@ -54,7 +54,7 @@ class SearchRepository constructor( when (type) { SortType.New -> BookDbo.run { "$TABLE.$NEW_ORDER" } SortType.Title -> BookDbo.run { "$TABLE.$SORT" } - SortType.Series -> BookDbo.run { "$TABLE.$SERIES_INDEX" } + SortType.Series -> BookDbo.run { "$TABLE.$SERIES_ID DESC, $TABLE.$SERIES_INDEX" } } } } diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreen.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreen.kt index c2f3035..75aaa32 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreen.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreen.kt @@ -156,7 +156,7 @@ fun AuthenticationProgress( contentAlignment = Alignment.Center, ) { CircularProgressIndicator( - modifier = Modifier.size(MaterialTheme.bibLib.dimen.dialog.iconSize), + modifier = Modifier.size(MaterialTheme.bibLib.dimen.progress.iconSize), ) } } diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreenContent.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreenContent.kt index 79cd73d..5ee926f 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreenContent.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/authentication/AuthenticationScreenContent.kt @@ -28,13 +28,13 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import com.pixelized.biblib.R import com.pixelized.biblib.ui.composable.animation.AnimatedDelayer import com.pixelized.biblib.ui.composable.animation.AnimatedOffset import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.ui.theme.color.GoogleColorPalette import com.pixelized.biblib.utils.extention.autofill -import com.pixelized.biblib.utils.extention.bibLib @Composable fun AuthenticationScreenContent( @@ -62,7 +62,7 @@ fun AuthenticationScreenContent( AnimatedOffset( modifier = Modifier - .padding(all = MaterialTheme.bibLib.dimen.dp16) + .padding(all = 16.dp) .align(alignment = Alignment.CenterHorizontally), ) { Text( @@ -75,7 +75,7 @@ fun AuthenticationScreenContent( Spacer(modifier = Modifier.weight(1f)) AnimatedOffset( - modifier = Modifier.padding(horizontal = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(horizontal = 16.dp), ) { LoginField( modifier = Modifier.fillMaxWidth(), @@ -85,10 +85,10 @@ fun AuthenticationScreenContent( ) } - Spacer(modifier = Modifier.height(MaterialTheme.bibLib.dimen.dp8)) + Spacer(modifier = Modifier.height(8.dp)) AnimatedOffset( - modifier = Modifier.padding(horizontal = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(horizontal = 16.dp), ) { PasswordField( modifier = Modifier.fillMaxWidth(), @@ -99,10 +99,10 @@ fun AuthenticationScreenContent( ) } - Spacer(modifier = Modifier.height(MaterialTheme.bibLib.dimen.dp16)) + Spacer(modifier = Modifier.height(16.dp)) AnimatedOffset( - modifier = Modifier.padding(horizontal = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(horizontal = 16.dp), ) { CredentialRemember( value = rememberPassword, @@ -110,11 +110,11 @@ fun AuthenticationScreenContent( ) } - Spacer(modifier = Modifier.height(MaterialTheme.bibLib.dimen.dp16)) + Spacer(modifier = Modifier.height(16.dp)) AnimatedOffset( modifier = Modifier - .padding(horizontal = MaterialTheme.bibLib.dimen.dp16) + .padding(horizontal = 16.dp) .align(Alignment.End), ) { Row { @@ -125,7 +125,7 @@ fun AuthenticationScreenContent( Text(text = stringResource(id = R.string.action_register)) } - Spacer(modifier = Modifier.width(MaterialTheme.bibLib.dimen.dp8)) + Spacer(modifier = Modifier.width(8.dp)) Button( colors = ButtonDefaults.buttonColors(), @@ -141,7 +141,7 @@ fun AuthenticationScreenContent( AnimatedOffset { Button( modifier = Modifier - .padding(all = MaterialTheme.bibLib.dimen.dp16) + .padding(all = 16.dp) .fillMaxWidth(), colors = ButtonDefaults.outlinedButtonColors(), onClick = onGoogleSignIn, @@ -235,7 +235,7 @@ private fun CredentialRemember( onCheckedChange = null ) - Spacer(modifier = Modifier.width(MaterialTheme.bibLib.dimen.dp8)) + Spacer(modifier = Modifier.width(8.dp)) Text( modifier = Modifier.align(Alignment.CenterVertically), diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt index cfed385..37fa6a5 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt @@ -444,6 +444,7 @@ private fun HomeScreenLayout( ) { Surface( modifier = modifier, + color = MaterialTheme.bibLib.colors.base.background, ) { Column( modifier = Modifier.fillMaxSize() diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/connectivity/ConnectivityHeader.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/connectivity/ConnectivityHeader.kt index 83c285c..2e7ea19 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/connectivity/ConnectivityHeader.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/connectivity/ConnectivityHeader.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import com.pixelized.biblib.R import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.utils.extention.bibLib @@ -38,19 +39,19 @@ fun ConnectivityHeader( .sizeIn(minHeight = ButtonDefaults.MinHeight) .padding( horizontal = MaterialTheme.bibLib.dimen.thumbnail.padding, - vertical = MaterialTheme.bibLib.dimen.dp8, + vertical = 8.dp, ), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, ) { Icon( - modifier = Modifier.size(MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.size(16.dp), imageVector = Icons.Default.CloudOff, tint = MaterialTheme.colors.onError, contentDescription = null ) Text( - modifier = Modifier.padding(start = MaterialTheme.bibLib.dimen.dp8), + modifier = Modifier.padding(start = 8.dp), style = MaterialTheme.typography.caption, color = MaterialTheme.colors.onError, text = stringResource(id = R.string.error_offline), diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/LargeBookThumbnail.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/LargeBookThumbnail.kt index 25496e2..45a7e45 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/LargeBookThumbnail.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/LargeBookThumbnail.kt @@ -22,6 +22,7 @@ import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.utils.extention.bibLib import com.pixelized.biblib.utils.extention.default import com.pixelized.biblib.utils.extention.modifier.drawDiagonalLabel +import com.pixelized.biblib.utils.extention.placeholder import com.skydoves.landscapist.glide.GlideImage @Stable @@ -83,10 +84,10 @@ private fun LargeBookThumbnailPlaceHolder( modifier = Modifier .fillMaxWidth() .aspectRatio(64f / 102f) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, + .placeholder( shape = MaterialTheme.bibLib.shapes.bookThumbnailCoverLarge, - ), + visible = { true } + ) ) } diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/MicroBookThumbnail.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/MicroBookThumbnail.kt index a28e9bb..7258ad9 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/MicroBookThumbnail.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/MicroBookThumbnail.kt @@ -2,13 +2,11 @@ package com.pixelized.biblib.ui.screen.home.common.item import android.annotation.SuppressLint import android.content.res.Configuration -import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.Card import androidx.compose.material.MaterialTheme import androidx.compose.material.Text @@ -29,8 +27,8 @@ import androidx.constraintlayout.compose.Dimension import com.pixelized.biblib.R import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.utils.extention.bibLib -import com.pixelized.biblib.utils.extention.default import com.pixelized.biblib.utils.extention.modifier.drawDiagonalLabel +import com.pixelized.biblib.utils.extention.placeholder import com.skydoves.landscapist.glide.GlideImage @Stable @@ -47,7 +45,7 @@ data class MicroBookThumbnailUio( fun MicroBookThumbnail( modifier: Modifier = Modifier, thumbnail: MicroBookThumbnailUio?, - onClick: (MicroBookThumbnailUio) -> Unit = default(), + onClick: (MicroBookThumbnailUio) -> Unit, ) { if (thumbnail != null) { MicroBookThumbnailContent( @@ -66,9 +64,8 @@ fun MicroBookThumbnail( private fun MicroBookThumbnailContent( modifier: Modifier = Modifier, thumbnail: MicroBookThumbnailUio, - onClick: (MicroBookThumbnailUio) -> Unit = default(), + onClick: (MicroBookThumbnailUio) -> Unit, ) { - val dimen = MaterialTheme.bibLib.dimen Card( modifier = modifier .clickable { onClick(thumbnail) } @@ -97,9 +94,9 @@ private fun MicroBookThumbnailContent( Text( modifier = Modifier.constrainAs(title) { - top.linkTo(parent.top, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + top.linkTo(parent.top, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) width = Dimension.fillToConstraints }, style = MaterialTheme.typography.body1, @@ -111,13 +108,13 @@ private fun MicroBookThumbnailContent( Text( modifier = Modifier.constrainAs(author) { - top.linkTo(title.bottom, margin = dimen.dp4) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + top.linkTo(title.bottom, margin = 4.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) width = Dimension.fillToConstraints }, style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, overflow = TextOverflow.Ellipsis, maxLines = 1, text = thumbnail.author, @@ -125,13 +122,13 @@ private fun MicroBookThumbnailContent( Text( modifier = Modifier.constrainAs(series) { - top.linkTo(author.bottom, margin = dimen.dp4) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + top.linkTo(author.bottom, margin = 4.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) width = Dimension.fillToConstraints }, style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, overflow = TextOverflow.Ellipsis, maxLines = 1, text = thumbnail.series, @@ -144,7 +141,6 @@ private fun MicroBookThumbnailContent( private fun MicroBookThumbnailPlaceHolder( modifier: Modifier = Modifier, ) { - val dimen = MaterialTheme.bibLib.dimen Card( modifier = modifier .fillMaxWidth() @@ -164,36 +160,30 @@ private fun MicroBookThumbnailPlaceHolder( start.linkTo(parent.start) } .size(size = MaterialTheme.bibLib.dimen.thumbnail.micro) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, + .placeholder( shape = MaterialTheme.bibLib.shapes.bookThumbnailCoverSmall, + visible = { true }, ), ) Box( modifier = Modifier .constrainAs(title) { - top.linkTo(parent.top, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) + top.linkTo(parent.top, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) } .size(width = 120.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) Box( modifier = Modifier .constrainAs(author) { - top.linkTo(title.bottom, margin = dimen.dp4) - start.linkTo(cover.end, margin = dimen.dp8) + top.linkTo(title.bottom, margin = 4.dp) + start.linkTo(cover.end, margin = 8.dp) } .size(width = 100.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) } } @@ -236,7 +226,8 @@ private fun MicroBookThumbnailPreview() { author = "Asimov", series = "Foundation - 1", isNew = true, - ) + ), + onClick = { }, ) } } @@ -248,6 +239,7 @@ private fun MicroBookThumbnailEmptyPreview() { BibLibTheme { MicroBookThumbnail( thumbnail = null, + onClick = { }, ) } } \ No newline at end of file diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/SmallBookThumbnail.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/SmallBookThumbnail.kt index 2cb93ea..f03e692 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/SmallBookThumbnail.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/common/item/SmallBookThumbnail.kt @@ -2,17 +2,14 @@ package com.pixelized.biblib.ui.screen.home.common.item import android.annotation.SuppressLint import android.content.res.Configuration -import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* -import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.Card import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color @@ -28,6 +25,7 @@ import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.utils.extention.bibLib import com.pixelized.biblib.utils.extention.default import com.pixelized.biblib.utils.extention.modifier.drawDiagonalLabel +import com.pixelized.biblib.utils.extention.placeholder import com.skydoves.landscapist.glide.GlideImage @Stable @@ -66,7 +64,6 @@ private fun SmallBookThumbnailContent( thumbnail: SmallBookThumbnailUio, onClick: (SmallBookThumbnailUio) -> Unit = default(), ) { - val dimen = MaterialTheme.bibLib.dimen Card( modifier = modifier .clickable { onClick(thumbnail) } @@ -95,9 +92,9 @@ private fun SmallBookThumbnailContent( Text( modifier = Modifier.constrainAs(title) { - top.linkTo(parent.top, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + top.linkTo(parent.top, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) width = Dimension.fillToConstraints }, style = MaterialTheme.typography.h6, @@ -109,15 +106,15 @@ private fun SmallBookThumbnailContent( Text( modifier = Modifier.constrainAs(author) { - top.linkTo(title.bottom, margin = dimen.dp4) - bottom.linkTo(genre.top, margin = dimen.dp4) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + top.linkTo(title.bottom, margin = 4.dp) + bottom.linkTo(genre.top, margin = 4.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) width = Dimension.fillToConstraints height = Dimension.fillToConstraints }, style = MaterialTheme.typography.body1, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, maxLines = 1, overflow = TextOverflow.Ellipsis, text = thumbnail.author @@ -125,25 +122,25 @@ private fun SmallBookThumbnailContent( Text( modifier = Modifier.constrainAs(genre) { - bottom.linkTo(parent.bottom, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) - end.linkTo(date.start, margin = dimen.dp8) + bottom.linkTo(parent.bottom, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) + end.linkTo(date.start, margin = 8.dp) width = Dimension.fillToConstraints }, maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, text = thumbnail.genre ) Text( modifier = Modifier.constrainAs(date) { - bottom.linkTo(parent.bottom, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + bottom.linkTo(parent.bottom, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) }, style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, text = thumbnail.date ?: "" ) } @@ -154,7 +151,6 @@ private fun SmallBookThumbnailContent( private fun SmallBookThumbnailPlaceHolder( modifier: Modifier = Modifier, ) { - val dimen = MaterialTheme.bibLib.dimen Card( modifier = modifier .fillMaxWidth() @@ -174,62 +170,50 @@ private fun SmallBookThumbnailPlaceHolder( start.linkTo(parent.start) } .size(size = MaterialTheme.bibLib.dimen.thumbnail.cover) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, + .placeholder( shape = MaterialTheme.bibLib.shapes.bookThumbnailCoverSmall, + visible = { true }, ), ) Box( modifier = Modifier .constrainAs(title) { - top.linkTo(parent.top, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) + top.linkTo(parent.top, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) } .size(width = 120.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) Box( modifier = Modifier .constrainAs(author) { - top.linkTo(title.bottom, margin = dimen.dp4) - start.linkTo(cover.end, margin = dimen.dp8) + top.linkTo(title.bottom, margin = 4.dp) + start.linkTo(cover.end, margin = 8.dp) } .size(width = 100.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) Box( modifier = Modifier .constrainAs(genre) { - bottom.linkTo(parent.bottom, margin = dimen.dp8) - start.linkTo(cover.end, margin = dimen.dp8) + bottom.linkTo(parent.bottom, margin = 8.dp) + start.linkTo(cover.end, margin = 8.dp) } .size(width = 80.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) Box( modifier = Modifier .constrainAs(date) { - bottom.linkTo(parent.bottom, margin = dimen.dp8) - end.linkTo(parent.end, margin = dimen.dp8) + bottom.linkTo(parent.bottom, margin = 8.dp) + end.linkTo(parent.end, margin = 8.dp) } .size(width = 40.dp, height = 16.dp) - .background( - color = MaterialTheme.bibLib.colors.placeHolder, - shape = CircleShape, - ), + .placeholder { true }, ) } } diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreen.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreen.kt index d6c2126..b049ead 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreen.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.pixelized.biblib.R import com.pixelized.biblib.ui.LocalSnackHostState @@ -75,7 +76,7 @@ fun DetailScreen( DetailScreenSendOption( modifier = Modifier .navigationBarsPadding() - .padding(bottom = MaterialTheme.bibLib.dimen.dp16), + .padding(bottom = 16.dp), emails = profileViewModel.mails, onHelp = { uri -> uriHandler.openUri(uri) @@ -92,7 +93,7 @@ fun DetailScreen( modifier = Modifier .fillMaxSize() .verticalScroll(rememberScrollState()) - .padding(all = MaterialTheme.bibLib.dimen.dp16) + .padding(all = 16.dp) .systemBarsPadding(), book = detail, onSend = { diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenContent.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenContent.kt index 2fc22e1..cb58bdc 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenContent.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenContent.kt @@ -36,6 +36,7 @@ import com.pixelized.biblib.ui.composable.animation.AnimatedOffset import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.utils.extention.bibLib import com.pixelized.biblib.utils.extention.default +import com.pixelized.biblib.utils.extention.placeholder import com.skydoves.landscapist.CircularReveal import com.skydoves.landscapist.glide.GlideImage import kotlinx.coroutines.launch @@ -90,7 +91,7 @@ fun DetailScreenContent( GlideImage( modifier = Modifier .fillMaxWidth() - .padding(vertical = MaterialTheme.bibLib.dimen.dp16) + .padding(vertical = 16.dp) .height(MaterialTheme.bibLib.dimen.detail.cover), previewPlaceholder = R.drawable.ic_fondatoin_cover, circularReveal = CircularReveal(duration = 1000), @@ -98,7 +99,7 @@ fun DetailScreenContent( imageModel = book.cover, ) - Row(modifier = Modifier.padding(vertical = MaterialTheme.bibLib.dimen.dp16)) { + Row(modifier = Modifier.padding(vertical = 16.dp)) { AnimatedOffset( modifier = Modifier.weight(1f), ) { @@ -107,12 +108,12 @@ fun DetailScreenContent( onClick = onMobi, ) { Icon(imageVector = Icons.Default.Download, contentDescription = null) - Spacer(modifier = Modifier.width(MaterialTheme.bibLib.dimen.dp4)) + Spacer(modifier = Modifier.width(4.dp)) Text(text = stringResource(id = R.string.action_mobi)) } } - Spacer(modifier = Modifier.padding(all = MaterialTheme.bibLib.dimen.dp4)) + Spacer(modifier = Modifier.padding(all = 4.dp)) AnimatedOffset( modifier = Modifier.weight(1f), @@ -122,12 +123,12 @@ fun DetailScreenContent( onClick = onEpub, ) { Icon(imageVector = Icons.Default.Download, contentDescription = null) - Spacer(modifier = Modifier.width(MaterialTheme.bibLib.dimen.dp4)) + Spacer(modifier = Modifier.width(4.dp)) Text(text = stringResource(id = R.string.action_epub)) } } - Spacer(modifier = Modifier.padding(all = MaterialTheme.bibLib.dimen.dp4)) + Spacer(modifier = Modifier.padding(all = 4.dp)) AnimatedOffset( modifier = Modifier.weight(1f), @@ -137,7 +138,7 @@ fun DetailScreenContent( onClick = { scope.launch { onSend() } }, ) { Icon(imageVector = Icons.Default.Send, contentDescription = "") - Spacer(modifier = Modifier.width(MaterialTheme.bibLib.dimen.dp4)) + Spacer(modifier = Modifier.width(4.dp)) Text(text = stringResource(id = R.string.action_send)) } } @@ -158,7 +159,7 @@ fun DetailScreenContent( AnimatedOffset( modifier = Modifier .align(alignment = Alignment.CenterHorizontally) - .padding(bottom = MaterialTheme.bibLib.dimen.dp16), + .padding(bottom = 16.dp), ) { Text( fontWeight = FontWeight.Bold, @@ -169,7 +170,7 @@ fun DetailScreenContent( } Row( - modifier = Modifier.padding(bottom = MaterialTheme.bibLib.dimen.dp8), + modifier = Modifier.padding(bottom = 8.dp), ) { AnimatedOffset(modifier = Modifier.weight(1f)) { TitleLabel( @@ -197,7 +198,7 @@ fun DetailScreenContent( } AnimatedOffset( - modifier = Modifier.padding(bottom = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(bottom = 16.dp), ) { TitleLabel( modifier = Modifier.fillMaxWidth(), @@ -211,12 +212,8 @@ fun DetailScreenContent( modifier = Modifier .fillMaxWidth() .placeholder( - visible = book.placeHolder, shape = MaterialTheme.bibLib.shapes.base.medium, - color = MaterialTheme.bibLib.colors.placeHolder, - highlight = PlaceholderHighlight.shimmer( - highlightColor = MaterialTheme.bibLib.colors.shimmer, - ), + visible = { book.placeHolder }, ), style = MaterialTheme.typography.body1, color = MaterialTheme.colors.onSurface, @@ -263,7 +260,7 @@ private fun DetailScreenContentPreview() { DetailScreenContent( modifier = Modifier .verticalScroll(state = rememberScrollState()) - .padding(all = MaterialTheme.bibLib.dimen.dp16), + .padding(all = 16.dp), book = BookDetailUio.preview(), ) } diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendLoader.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendLoader.kt index 5f5af79..84c1e78 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendLoader.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendLoader.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import com.pixelized.biblib.R import com.pixelized.biblib.ui.theme.BibLibTheme import com.pixelized.biblib.ui.theme.color.BibLibColorPalette @@ -55,7 +56,7 @@ fun DetailScreenSendLoaderContent( modifier = Modifier .fillMaxSize() .background(color = ShadowPalette.scrim) - .padding(all = MaterialTheme.bibLib.dimen.dp16), + .padding(all = 16.dp), ) } @@ -66,7 +67,7 @@ fun DetailScreenSendLoaderContent( exit = fadeOut() + slideOutVertically { it }, ) { CircularProgressIndicator( - modifier = Modifier.size(MaterialTheme.bibLib.dimen.dialog.iconSize), + modifier = Modifier.size(MaterialTheme.bibLib.dimen.progress.iconSize), ) } @@ -80,16 +81,16 @@ fun DetailScreenSendLoaderContent( modifier = Modifier .fillMaxWidth() .navigationBarsPadding() - .padding(all = MaterialTheme.bibLib.dimen.dp16) + .padding(all = 16.dp) .background( color = BibLibColorPalette.LightGreen, shape = MaterialTheme.shapes.small, ) .padding( - vertical = MaterialTheme.bibLib.dimen.dp16, - horizontal = MaterialTheme.bibLib.dimen.dp24, + vertical = 16.dp, + horizontal = 24.dp, ), - horizontalArrangement = Arrangement.spacedBy(MaterialTheme.bibLib.dimen.dp16) + horizontalArrangement = Arrangement.spacedBy(16.dp) ) { Icon( painter = painterResource(id = R.drawable.ic_baseline_auto_stories_24), diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendOption.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendOption.kt index 2865a2a..f4ec30b 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendOption.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/detail/DetailScreenSendOption.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.pixelized.biblib.R import com.pixelized.biblib.ui.theme.BibLibTheme @@ -86,30 +87,30 @@ fun DetailScreenSendOption( item { Column( modifier = Modifier - .padding(top = MaterialTheme.bibLib.dimen.dp16) - .padding(horizontal = MaterialTheme.bibLib.dimen.dp16), + .padding(top = 16.dp) + .padding(horizontal = 16.dp), ) { Text( - modifier = Modifier.padding(bottom = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(bottom = 16.dp), style = MaterialTheme.typography.h6, color = MaterialTheme.bibLib.colors.typography.medium, text = stringResource(R.string.detail_send_confirm_title) ) Text( - modifier = Modifier.padding(bottom = MaterialTheme.bibLib.dimen.dp8), + modifier = Modifier.padding(bottom = 8.dp), style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.easy, + color = MaterialTheme.bibLib.colors.typography.light, text = rememberDescription() ) Text( modifier = Modifier .clickable(onClick = { onHelp(amazonHelpUri) }) - .padding(vertical = MaterialTheme.bibLib.dimen.dp8), + .padding(vertical = 8.dp), textAlign = TextAlign.Center, style = MaterialTheme.typography.caption, - color = MaterialTheme.bibLib.colors.typography.strong, + color = MaterialTheme.bibLib.colors.typography.dark, overflow = TextOverflow.Ellipsis, maxLines = 1, text = stringResource(R.string.detail_send_confirm_help), @@ -120,9 +121,9 @@ fun DetailScreenSendOption( item { Text( modifier = Modifier - .padding(vertical = MaterialTheme.bibLib.dimen.dp8) - .padding(horizontal = MaterialTheme.bibLib.dimen.dp16), - color = MaterialTheme.bibLib.colors.typography.easy, + .padding(vertical = 8.dp) + .padding(horizontal = 16.dp), + color = MaterialTheme.bibLib.colors.typography.light, style = MaterialTheme.typography.caption, text = stringResource(id = R.string.detail_option_mail), ) @@ -132,16 +133,16 @@ fun DetailScreenSendOption( modifier = Modifier .clickable { onEmail(email) } .fillMaxWidth() - .padding(all = MaterialTheme.bibLib.dimen.dp16), + .padding(all = 16.dp), uio = email, ) } item { Text( modifier = Modifier - .padding(vertical = MaterialTheme.bibLib.dimen.dp8) - .padding(horizontal = MaterialTheme.bibLib.dimen.dp16), - color = MaterialTheme.bibLib.colors.typography.easy, + .padding(vertical = 8.dp) + .padding(horizontal = 16.dp), + color = MaterialTheme.bibLib.colors.typography.light, style = MaterialTheme.typography.caption, text = stringResource(id = R.string.detail_option_format), ) @@ -151,7 +152,7 @@ fun DetailScreenSendOption( modifier = Modifier .clickable { onFormat(format) } .fillMaxWidth() - .padding(all = MaterialTheme.bibLib.dimen.dp16), + .padding(all = 16.dp), uio = format, ) } @@ -159,7 +160,7 @@ fun DetailScreenSendOption( Button( modifier = Modifier .fillMaxWidth() - .padding(horizontal = MaterialTheme.bibLib.dimen.dp16), + .padding(horizontal = 16.dp), onClick = { val format = formats.first { it.selected } val email = emails.first { it.selected } @@ -190,8 +191,8 @@ private fun OptionItem( Text( modifier = Modifier .padding( - start = MaterialTheme.bibLib.dimen.dp16, - end = MaterialTheme.bibLib.dimen.dp8, + start = 16.dp, + end = 8.dp, ) .weight(1f), style = MaterialTheme.typography.body1, diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/header/LazyGridCollapsingHeaderLayout.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/header/LazyGridCollapsingHeaderLayout.kt index 611794d..6d250be 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/header/LazyGridCollapsingHeaderLayout.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/header/LazyGridCollapsingHeaderLayout.kt @@ -1,6 +1,7 @@ package com.pixelized.biblib.ui.screen.home.header import androidx.compose.foundation.layout.Box +import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import androidx.compose.runtime.* import androidx.compose.runtime.saveable.rememberSaveable @@ -39,7 +40,9 @@ fun LazyGridCollapsingHeaderLayout( } } - Surface { + Surface( + color = MaterialTheme.colors.background, + ) { Layout( modifier = modifier.nestedScroll(nestedScrollConnection), content = { diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/profile/ProfilePage.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/profile/ProfilePage.kt index 8f5eaa0..48f8ec1 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/profile/ProfilePage.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/profile/ProfilePage.kt @@ -46,7 +46,7 @@ fun ProfilePage( ProfileScreenContent( modifier = Modifier .fillMaxWidth() - .padding(MaterialTheme.bibLib.dimen.dp16), + .padding(16.dp), user = viewModel.user, onEditClick = { val intent = Intent(Intent.ACTION_VIEW, Uri.parse(IBibLibClient.EDIT_PROFILE)) @@ -107,7 +107,7 @@ private fun ProfileScreenContent( } Text( - modifier = Modifier.padding(top = MaterialTheme.bibLib.dimen.dp16), + modifier = Modifier.padding(top = 16.dp), style = MaterialTheme.typography.body1, color = MaterialTheme.colors.onSurface, text = stringResource(id = R.string.profile_emails) @@ -138,7 +138,7 @@ private fun ProfileScreenContent( Row( modifier = Modifier - .padding(top = MaterialTheme.bibLib.dimen.dp16) + .padding(top = 16.dp) .align(Alignment.End), horizontalArrangement = Arrangement.spacedBy(4.dp), ) { @@ -174,7 +174,7 @@ private fun ProfileScreenContentPreview( ProfileScreenContent( modifier = Modifier .fillMaxWidth() - .padding(all = MaterialTheme.bibLib.dimen.dp16), + .padding(all = 16.dp), user = preview, onEditClick = { }, onLogoutClick = { }, diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/sort/BookSortPage.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/sort/BookSortPage.kt index bcc3190..06a7b26 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/sort/BookSortPage.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/sort/BookSortPage.kt @@ -77,7 +77,7 @@ private fun BookSortPageContent( modifier = Modifier.padding(horizontal = 16.dp), style = MaterialTheme.typography.h6, color = MaterialTheme.bibLib.colors.typography.medium, - text = "Sort by:" + text = stringResource(id = R.string.search_sort_by) ) LazyColumn( @@ -114,7 +114,7 @@ private fun BookSortPageContent( .padding(horizontal = 16.dp), onClick = onConfirm ) { - Text(text = "Sort") + Text(text = stringResource(id = R.string.search_sort_action)) } } } diff --git a/app/src/main/java/com/pixelized/biblib/ui/theme/color/BibLibColor.kt b/app/src/main/java/com/pixelized/biblib/ui/theme/color/BibLibColor.kt index d9fb623..cf54274 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/theme/color/BibLibColor.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/theme/color/BibLibColor.kt @@ -13,17 +13,21 @@ import javax.annotation.concurrent.Immutable data class BibLibColor( val base: Colors, val typography: Typography, - val placeHolder: Color, - val shimmer: Color, - val dialogBackground: Color, + val placeHolder: PlaceHolder, ) { - @Stable @Immutable data class Typography( - val easy: Color, + val light: Color, val medium: Color, - val strong: Color, + val dark: Color, + ) + + @Stable + @Immutable + data class PlaceHolder( + val color: Color, + val shimmer: Color, ) } @@ -37,19 +41,18 @@ fun bibLibDarkColors( onError = Color.White, ), typography: BibLibColor.Typography = BibLibColor.Typography( - easy = base.onSurface.copy(alpha = 0.67f), + light = base.onSurface.copy(alpha = 0.67f), medium = base.onSurface, - strong = base.primary, + dark = base.primary, + ), + placeHolder: BibLibColor.PlaceHolder = BibLibColor.PlaceHolder( + color = BibLibColorPalette.DarkGrey, + shimmer = BibLibColorPalette.Grey, ), - placeHolder: Color = BibLibColorPalette.DarkGrey, - shimmer: Color = BibLibColorPalette.Grey, - dialogBackground: Color = BibLibColorPalette.VeryDarkGrey, ) = BibLibColor( base = base, typography = typography, placeHolder = placeHolder, - shimmer = shimmer, - dialogBackground = dialogBackground, ) fun bibLibLightColors( @@ -60,19 +63,22 @@ fun bibLibLightColors( onSecondary = Color.White, error = BibLibColorPalette.Red, onError = Color.White, + background = BibLibColorPalette.VeryLightGrey, + onBackground = BibLibColorPalette.VeryDarkGrey, + surface = Color.White, + onSurface = BibLibColorPalette.VeryDarkGrey, ), typography: BibLibColor.Typography = BibLibColor.Typography( - easy = base.onSurface.copy(alpha = 0.67f), + light = base.onSurface.copy(alpha = 0.67f), medium = base.onSurface, - strong = base.primary, + dark = base.primary, + ), + placeHolder: BibLibColor.PlaceHolder = BibLibColor.PlaceHolder( + color = BibLibColorPalette.LightGrey, + shimmer = BibLibColorPalette.Grey, ), - placeHolder: Color = BibLibColorPalette.LightGrey, - shimmer: Color = BibLibColorPalette.Grey, - dialogBackground: Color = Color.White, ) = BibLibColor( base = base, typography = typography, placeHolder = placeHolder, - shimmer = shimmer, - dialogBackground = dialogBackground, ) \ No newline at end of file diff --git a/app/src/main/java/com/pixelized/biblib/ui/theme/dimen/BibLibDimen.kt b/app/src/main/java/com/pixelized/biblib/ui/theme/dimen/BibLibDimen.kt index 0a4b3b4..57ba712 100644 --- a/app/src/main/java/com/pixelized/biblib/ui/theme/dimen/BibLibDimen.kt +++ b/app/src/main/java/com/pixelized/biblib/ui/theme/dimen/BibLibDimen.kt @@ -9,44 +9,28 @@ import androidx.compose.ui.unit.dp @Stable @Immutable data class BibLibDimen( - @Deprecated("") - val default: Dp = 0.dp, - @Deprecated("") - val dp2: Dp = 2.dp, - @Deprecated("") - val dp4: Dp = 4.dp, - @Deprecated("") - val dp8: Dp = 8.dp, - @Deprecated("") - val dp12: Dp = 12.dp, - @Deprecated("") - val dp16: Dp = 16.dp, - @Deprecated("") - val dp24: Dp = 24.dp, - @Deprecated("") - val dp32: Dp = 32.dp, - @Deprecated("") - val dp48: Dp = 48.dp, - @Deprecated("") - val dp52: Dp = 52.dp, - @Deprecated("") - val dp64: Dp = 64.dp, - @Deprecated("") - val dialog: Dialog = Dialog(), val avatar: Avatar = Avatar(), - val thumbnail: BookThumbnail = BookThumbnail(), + val progress: Progress = Progress(), val detail: BookDetail = BookDetail(), + val thumbnail: BookThumbnail = BookThumbnail(), ) { @Stable @Immutable - data class Dialog( + data class Avatar( + val medium: Dp = 32.dp, + ) + + @Stable + @Immutable + data class Progress( val iconSize: Dp = 52.dp, ) @Stable @Immutable - data class Avatar( - val medium: Dp = 32.dp, + data class BookDetail( + val placeHolder: Dp = 64.dp, + val cover: Dp = 384.dp, ) @Stable @@ -58,11 +42,4 @@ data class BibLibDimen( val cover: DpSize = 72.dp.let { DpSize(width = it, height = it * ratio) }, val micro: DpSize = 50.dp.let { DpSize(width = it, height = it * ratio) }, ) - - @Stable - @Immutable - data class BookDetail( - val placeHolder: Dp = 64.dp, - val cover: Dp = 384.dp, - ) } \ No newline at end of file diff --git a/app/src/main/java/com/pixelized/biblib/utils/extention/ModifierEx.kt b/app/src/main/java/com/pixelized/biblib/utils/extention/ModifierEx.kt index 215a04e..14308e0 100644 --- a/app/src/main/java/com/pixelized/biblib/utils/extention/ModifierEx.kt +++ b/app/src/main/java/com/pixelized/biblib/utils/extention/ModifierEx.kt @@ -47,8 +47,8 @@ fun Modifier.autofill( @SuppressLint("ComposableModifierFactory") @Composable fun Modifier.placeholder( - color: Color = MaterialTheme.bibLib.colors.placeHolder, - shimmer: Color = MaterialTheme.bibLib.colors.shimmer, + color: Color = MaterialTheme.bibLib.colors.placeHolder.color, + shimmer: Color = MaterialTheme.bibLib.colors.placeHolder.shimmer, shape: Shape = CircleShape, visible: () -> Boolean, ) = this.placeholder( diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 54ca573..e79d661 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -69,7 +69,11 @@ Genre Langue - Trié par : %1$s + Trier par : + Trier + Dernier ajout + Titre des livres + Ordre dans la série Bonjour Emails associés : diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 035edf5..f51a826 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -84,7 +84,8 @@ Genres Languages - Sort by: %1$s + Sort by + Sort Last addition Book title Series order diff --git a/gradle.properties b/gradle.properties index 98bed16..dbc9506 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true +android.enableJetifier=false # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official \ No newline at end of file