Skip to content

Commit c07833b

Browse files
committed
Hide open url button in ItemScreenBottomBar when no url is available
1 parent c3d1e3a commit c07833b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

app/src/main/java/com/readrops/app/item/ItemScreenPage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ fun ItemScreenPage(
7272
ItemScreenBottomBar(
7373
state = BottomBarState(
7474
isRead = itemWithFeed.item.isRead,
75-
isStarred = itemWithFeed.item.isStarred
75+
isStarred = itemWithFeed.item.isStarred,
76+
isOpenUrlVisible = !item.link.isNullOrEmpty()
7677
),
7778
accentColor = accentColor,
7879
modifier = Modifier

app/src/main/java/com/readrops/app/item/components/ItemScreenBottomBar.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import com.readrops.app.util.theme.spacing
2323

2424
data class BottomBarState(
2525
val isRead: Boolean = false,
26-
val isStarred: Boolean = false
26+
val isStarred: Boolean = false,
27+
val isOpenUrlVisible: Boolean = true
2728
)
2829

2930
@Composable
@@ -87,14 +88,16 @@ fun ItemScreenBottomBar(
8788
)
8889
}
8990

90-
IconButton(
91-
onClick = onOpenUrl
92-
) {
93-
Icon(
94-
painter = painterResource(id = R.drawable.ic_open_in_browser),
95-
tint = tint,
96-
contentDescription = null
97-
)
91+
if (state.isOpenUrlVisible) {
92+
IconButton(
93+
onClick = onOpenUrl
94+
) {
95+
Icon(
96+
painter = painterResource(id = R.drawable.ic_open_in_browser),
97+
tint = tint,
98+
contentDescription = null
99+
)
100+
}
98101
}
99102
}
100103
}

0 commit comments

Comments
 (0)