New Credits item.

This commit is contained in:
acclorite 2024-07-10 19:37:19 +03:00
parent b4e058dd4d
commit eabd08affb
6 changed files with 36 additions and 21 deletions

View file

@ -6,7 +6,7 @@ import ua.acclorite.book_story.domain.util.UIText
@Immutable
data class Credit(
val name: String,
val source: String,
val source: String?,
val credits: List<UIText>,
val website: String
val website: String?
)

View file

@ -91,6 +91,15 @@ object Constants {
),
website = "https://github.com/Drumber/Kitsune"
),
Credit(
name = "Crocus",
source = null,
credits = listOf(
UIText.StringResource(R.string.credits_motivation),
UIText.StringValue("UwU")
),
website = null
),
Credit(
name = "Freepik",
source = "Flaticon",

View file

@ -80,9 +80,10 @@ private fun CreditsScreen(
) {
customItems(Constants.CREDITS, key = { it.name }) {
CreditItem(credit = it) {
it.website?.let { website ->
onAboutNavigateEvent(
AboutEvent.OnNavigateToBrowserPage(
page = it.website,
page = website,
context = context,
noAppsFound = {
Toast.makeText(
@ -98,6 +99,7 @@ private fun CreditsScreen(
}
}
}
}

View file

@ -40,7 +40,7 @@ fun CreditItem(
Column(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick.invoke() }
.clickable(enabled = credit.website != null) { onClick.invoke() }
.padding(vertical = verticalPadding, horizontal = horizontalPadding)
) {
Text(
@ -51,11 +51,13 @@ fun CreditItem(
overflow = TextOverflow.Ellipsis
)
credit.source?.let {
Text(
text = credit.source,
text = it,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
if (credit.credits.isNotEmpty()) {
Spacer(modifier = Modifier.height(6.dp))

View file

@ -99,7 +99,7 @@
Немає опису.
</string>
<string name="error_something_went_wrong">
Щось пішло не так.
Який жах! Щось пішло не так.
</string>
<string name="error_something_went_wrong_with_file">
Щось пішло не так. Будь ласка, перевірте чи файл цієї книги не пошкоджений.
@ -351,6 +351,7 @@
<string name="credits_design">Дизайн</string>
<string name="credits_icon">Іконки</string>
<string name="credits_updates">Керування новими оновленнями</string>
<string name="credits_motivation">Мотивація</string>
<!-- Help -->
<string name="help_clickable_note_1">Будь ласка, зверніть увагу, що на</string>

View file

@ -371,6 +371,7 @@
<string name="credits_design">Design</string>
<string name="credits_icon">Icons</string>
<string name="credits_updates">New updates managing</string>
<string name="credits_motivation">Motivation</string>
<!-- Help -->
<string name="help_clickable_note_1">Please note, that</string>