Fix Clear Database item trying to display language when empty (#7651)

This commit is contained in:
Andreas 2022-07-30 19:55:07 +02:00 committed by GitHub
parent 0c9c4c0347
commit 039fe4a618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -17,8 +17,11 @@ data class Source(
val isUsedLast: Boolean = false, val isUsedLast: Boolean = false,
) { ) {
val nameWithLanguage: String val visualName: String
get() = "$name (${lang.uppercase()})" get() = when {
lang.isEmpty() -> name
else -> "$name (${lang.uppercase()})"
}
val icon: ImageBitmap? val icon: ImageBitmap?
get() { get() {

View file

@ -20,8 +20,6 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.input.nestedscroll.nestedScroll
@ -218,7 +216,7 @@ fun SourceOptionsDialog(
) { ) {
AlertDialog( AlertDialog(
title = { title = {
Text(text = source.nameWithLanguage) Text(text = source.visualName)
}, },
text = { text = {
Column { Column {

View file

@ -40,7 +40,7 @@ fun ClearDatabaseItem(
.weight(1f), .weight(1f),
) { ) {
Text( Text(
text = source.nameWithLanguage, text = source.visualName,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
) )
Text(text = stringResource(id = R.string.clear_database_source_item_count, count)) Text(text = stringResource(id = R.string.clear_database_source_item_count, count))