mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 03:17:03 +05:30
Rename LobstersItemRedux to LobstersItem
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
974076c5f1
commit
5acab43669
3 changed files with 4 additions and 10 deletions
|
@ -30,7 +30,7 @@ fun HottestPosts(
|
||||||
if (posts.lastIndex == index) {
|
if (posts.lastIndex == index) {
|
||||||
overscrollAction.invoke()
|
overscrollAction.invoke()
|
||||||
}
|
}
|
||||||
LobstersItemRedux(
|
LobstersItem(
|
||||||
post = item,
|
post = item,
|
||||||
onClick = { post -> urlLauncher.launch(post.url.ifEmpty { post.commentsUrl }) },
|
onClick = { post -> urlLauncher.launch(post.url.ifEmpty { post.commentsUrl }) },
|
||||||
onLongClick = { post -> urlLauncher.launch(post.commentsUrl) },
|
onLongClick = { post -> urlLauncher.launch(post.commentsUrl) },
|
||||||
|
|
|
@ -55,14 +55,8 @@ val TEST_POST = LobstersPost(
|
||||||
listOf("openbsd", "linux", "containers", "hack the planet", "no thanks"),
|
listOf("openbsd", "linux", "containers", "hack the planet", "no thanks"),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* A temporary replacement for [LobstersItem] that implements the same functionality backed by
|
|
||||||
* a UI that's built upon [ConstraintLayout] rather than Column and Row. This allows us to add a
|
|
||||||
* dedicated save button without needing to add swipe actions, which have been hard to get right
|
|
||||||
* and thus resulted in a variety of bugs (see https://msfjarvis.dev/g/compose-lobsters/issues/65).
|
|
||||||
*/
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LobstersItemRedux(
|
fun LobstersItem(
|
||||||
post: LobstersPost,
|
post: LobstersPost,
|
||||||
onClick: (LobstersPost) -> Unit = {},
|
onClick: (LobstersPost) -> Unit = {},
|
||||||
onLongClick: (LobstersPost) -> Unit = {},
|
onLongClick: (LobstersPost) -> Unit = {},
|
||||||
|
@ -157,7 +151,7 @@ fun TagRow(
|
||||||
fun Preview() {
|
fun Preview() {
|
||||||
LobstersTheme {
|
LobstersTheme {
|
||||||
LazyColumnFor(items = listOf(TEST_POST, TEST_POST, TEST_POST, TEST_POST, TEST_POST)) { item ->
|
LazyColumnFor(items = listOf(TEST_POST, TEST_POST, TEST_POST, TEST_POST, TEST_POST)) { item ->
|
||||||
LobstersItemRedux(
|
LobstersItem(
|
||||||
post = item,
|
post = item,
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ fun SavedPosts(
|
||||||
state = listState,
|
state = listState,
|
||||||
modifier = Modifier.padding(horizontal = 8.dp).then(modifier)
|
modifier = Modifier.padding(horizontal = 8.dp).then(modifier)
|
||||||
) { item ->
|
) { item ->
|
||||||
LobstersItemRedux(
|
LobstersItem(
|
||||||
post = item,
|
post = item,
|
||||||
onClick = { post -> urlLauncher.launch(post.url.ifEmpty { post.commentsUrl }) },
|
onClick = { post -> urlLauncher.launch(post.url.ifEmpty { post.commentsUrl }) },
|
||||||
onLongClick = { post -> urlLauncher.launch(post.commentsUrl) },
|
onLongClick = { post -> urlLauncher.launch(post.commentsUrl) },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue