improvement: Show 'Empty' in place of an empty title text
This commit is contained in:
parent
3fc4ec3f03
commit
b8cd84a7f4
@ -302,11 +302,23 @@ fun VaultListItemText(
|
|||||||
content = {
|
content = {
|
||||||
FlatItemTextContent(
|
FlatItemTextContent(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
val title = item.title
|
||||||
text = item.title,
|
.takeUnless { it.isEmpty() }
|
||||||
overflow = TextOverflow.Ellipsis,
|
if (title != null) {
|
||||||
maxLines = 1,
|
Text(
|
||||||
)
|
text = title,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
text = stringResource(Res.strings.empty_value),
|
||||||
|
color = LocalContentColor.current
|
||||||
|
.combineAlpha(DisabledEmphasisAlpha),
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
text = item.text
|
text = item.text
|
||||||
?.takeIf { it.isNotEmpty() }
|
?.takeIf { it.isNotEmpty() }
|
||||||
|
@ -47,6 +47,7 @@ import com.artemchep.keyguard.feature.home.vault.component.rememberSecretAccentC
|
|||||||
import com.artemchep.keyguard.feature.home.vault.component.surfaceColorAtElevationSemi
|
import com.artemchep.keyguard.feature.home.vault.component.surfaceColorAtElevationSemi
|
||||||
import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon
|
import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon
|
||||||
import com.artemchep.keyguard.feature.navigation.NavigationIcon
|
import com.artemchep.keyguard.feature.navigation.NavigationIcon
|
||||||
|
import com.artemchep.keyguard.res.Res
|
||||||
import com.artemchep.keyguard.ui.Avatar
|
import com.artemchep.keyguard.ui.Avatar
|
||||||
import com.artemchep.keyguard.ui.DefaultFab
|
import com.artemchep.keyguard.ui.DefaultFab
|
||||||
import com.artemchep.keyguard.ui.DisabledEmphasisAlpha
|
import com.artemchep.keyguard.ui.DisabledEmphasisAlpha
|
||||||
@ -63,6 +64,7 @@ import com.artemchep.keyguard.ui.shimmer.shimmer
|
|||||||
import com.artemchep.keyguard.ui.skeleton.SkeletonText
|
import com.artemchep.keyguard.ui.skeleton.SkeletonText
|
||||||
import com.artemchep.keyguard.ui.theme.combineAlpha
|
import com.artemchep.keyguard.ui.theme.combineAlpha
|
||||||
import com.artemchep.keyguard.ui.toolbar.LargeToolbar
|
import com.artemchep.keyguard.ui.toolbar.LargeToolbar
|
||||||
|
import dev.icerock.moko.resources.compose.stringResource
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun VaultViewScreen(
|
fun VaultViewScreen(
|
||||||
@ -312,12 +314,23 @@ private fun VaultViewTitle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is VaultViewState.Content.Cipher -> {
|
is VaultViewState.Content.Cipher -> {
|
||||||
val name = state.content.data.name
|
val title = state.content.data.name
|
||||||
Text(
|
.takeUnless { it.isEmpty() }
|
||||||
text = name,
|
if (title != null) {
|
||||||
maxLines = 2,
|
Text(
|
||||||
overflow = TextOverflow.Ellipsis,
|
text = title,
|
||||||
)
|
maxLines = 2,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
text = stringResource(Res.strings.empty_value),
|
||||||
|
color = LocalContentColor.current
|
||||||
|
.combineAlpha(DisabledEmphasisAlpha),
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is VaultViewState.Content.NotFound -> {
|
is VaultViewState.Content.NotFound -> {
|
||||||
|
@ -29,6 +29,7 @@ import androidx.compose.material3.DropdownMenu
|
|||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.LocalAbsoluteTonalElevation
|
import androidx.compose.material3.LocalAbsoluteTonalElevation
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
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
|
||||||
@ -82,6 +83,7 @@ import com.artemchep.keyguard.ui.CollectedEffect
|
|||||||
import com.artemchep.keyguard.ui.Compose
|
import com.artemchep.keyguard.ui.Compose
|
||||||
import com.artemchep.keyguard.ui.DefaultFab
|
import com.artemchep.keyguard.ui.DefaultFab
|
||||||
import com.artemchep.keyguard.ui.DefaultSelection
|
import com.artemchep.keyguard.ui.DefaultSelection
|
||||||
|
import com.artemchep.keyguard.ui.DisabledEmphasisAlpha
|
||||||
import com.artemchep.keyguard.ui.DropdownMenuItemFlat
|
import com.artemchep.keyguard.ui.DropdownMenuItemFlat
|
||||||
import com.artemchep.keyguard.ui.DropdownMinWidth
|
import com.artemchep.keyguard.ui.DropdownMinWidth
|
||||||
import com.artemchep.keyguard.ui.DropdownScopeImpl
|
import com.artemchep.keyguard.ui.DropdownScopeImpl
|
||||||
@ -101,6 +103,7 @@ import com.artemchep.keyguard.ui.icons.KeyguardNote
|
|||||||
import com.artemchep.keyguard.ui.icons.KeyguardView
|
import com.artemchep.keyguard.ui.icons.KeyguardView
|
||||||
import com.artemchep.keyguard.ui.pulltosearch.PullToSearch
|
import com.artemchep.keyguard.ui.pulltosearch.PullToSearch
|
||||||
import com.artemchep.keyguard.ui.skeleton.SkeletonItem
|
import com.artemchep.keyguard.ui.skeleton.SkeletonItem
|
||||||
|
import com.artemchep.keyguard.ui.theme.combineAlpha
|
||||||
import com.artemchep.keyguard.ui.theme.selectedContainer
|
import com.artemchep.keyguard.ui.theme.selectedContainer
|
||||||
import com.artemchep.keyguard.ui.toolbar.CustomToolbar
|
import com.artemchep.keyguard.ui.toolbar.CustomToolbar
|
||||||
import com.artemchep.keyguard.ui.toolbar.content.CustomSearchbarContent
|
import com.artemchep.keyguard.ui.toolbar.content.CustomSearchbarContent
|
||||||
@ -512,11 +515,23 @@ fun VaultSendItemText(
|
|||||||
content = {
|
content = {
|
||||||
FlatItemTextContent(
|
FlatItemTextContent(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
val title = item.title
|
||||||
text = item.title,
|
.takeUnless { it.isEmpty() }
|
||||||
overflow = TextOverflow.Ellipsis,
|
if (title != null) {
|
||||||
maxLines = 1,
|
Text(
|
||||||
)
|
text = title,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
text = stringResource(Res.strings.empty_value),
|
||||||
|
color = LocalContentColor.current
|
||||||
|
.combineAlpha(DisabledEmphasisAlpha),
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
text = item.text
|
text = item.text
|
||||||
?.takeIf { it.isNotEmpty() }
|
?.takeIf { it.isNotEmpty() }
|
||||||
|
@ -311,12 +311,23 @@ private fun VaultViewTitle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is SendViewState.Content.Cipher -> {
|
is SendViewState.Content.Cipher -> {
|
||||||
val name = state.content.data.name
|
val title = state.content.data.name
|
||||||
Text(
|
.takeUnless { it.isEmpty() }
|
||||||
text = name,
|
if (title != null) {
|
||||||
maxLines = 2,
|
Text(
|
||||||
overflow = TextOverflow.Ellipsis,
|
text = title,
|
||||||
)
|
maxLines = 2,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
text = stringResource(Res.strings.empty_value),
|
||||||
|
color = LocalContentColor.current
|
||||||
|
.combineAlpha(DisabledEmphasisAlpha),
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is SendViewState.Content.NotFound -> {
|
is SendViewState.Content.NotFound -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user