diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/components/LicenseItem.kt b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/components/LicenseItem.kt index d62603b3..e6833260 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/components/LicenseItem.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/components/LicenseItem.kt @@ -16,14 +16,17 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.aboutlibraries.ui.compose.m3.util.author +import ua.acclorite.book_story.R /** * License Item. @@ -53,18 +56,33 @@ fun LicenseItem( text = library.name, modifier = Modifier.weight(1f), style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onSurface, + color = if (library.openSource) MaterialTheme.colorScheme.onSurface + else MaterialTheme.colorScheme.error, maxLines = 2, overflow = TextOverflow.Ellipsis ) - library.artifactVersion?.let { + + if (library.artifactVersion != null || !library.openSource) { Spacer(modifier = Modifier.width(8.dp)) - Text( - it, - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, - textAlign = TextAlign.Center - ) + Column(horizontalAlignment = Alignment.End) { + library.artifactVersion?.let { + Text( + it, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center + ) + } + + if (!library.openSource) { + Text( + stringResource(id = R.string.error_closed_source), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center + ) + } + } } } diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/data/LicensesViewModel.kt b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/data/LicensesViewModel.kt index af3e799f..7c458821 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/data/LicensesViewModel.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/screens/about/nested/licenses/data/LicensesViewModel.kt @@ -36,7 +36,7 @@ class LicensesViewModel @Inject constructor( _state.update { it.copy( - licenses = licenses + licenses = licenses.sortedBy { library -> library.openSource } ) } } diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 6ac4e264..2f752898 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -123,6 +123,7 @@ Не вдалося завантажити мову. Не вдалося завантажити мови. Не вдалося скинути обкладинку. + Закритий код diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cccb5345..cfb70d8b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -142,6 +142,7 @@ Could not download language. Could not download languages. Could not reset cover image. + Closed source