From 8c88b8e6da61f74ef9c87a40cad8891e9ecd0e18 Mon Sep 17 00:00:00 2001 From: Saul Henriquez Date: Sat, 9 Jul 2022 12:08:30 -0500 Subject: [PATCH] Hide Author's website when it isn't available --- .../pages/app_detail/components/LinkItem.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/LinkItem.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/LinkItem.kt index 5ac45681..d9da564a 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/LinkItem.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/LinkItem.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -58,13 +59,15 @@ fun LinkItem( maxLines = 1, style = MaterialTheme.typography.titleMedium ) - Text( - text = linkType.link.toString(), - style = MaterialTheme.typography.bodySmall, - overflow = TextOverflow.Ellipsis, - maxLines = 2, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) + if(linkType.link!=null){ + Text( + text = linkType.link.toString(), + style = MaterialTheme.typography.bodySmall, + overflow = TextOverflow.Ellipsis, + maxLines = 2, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } } } } @@ -74,7 +77,10 @@ fun LinkItem( fun LinkItemPreview() { AppTheme(blackTheme = false) { LinkItem( - linkType = LinkType(R.drawable.ic_email, "R.string.author_email") + linkType = LinkType( + R.drawable.ic_email, + stringResource(id = R.string.author_email), + Uri.parse("neostore@neoapps.com")) ) } } \ No newline at end of file