-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapse comments by tapping directly on the comment body #398
Collapse comments by tapping directly on the comment body #398
Conversation
…dy or header, and expand comments by tapping on the comment header. This replaces the old behaviour (tap and hold on comment headers), which wasn't as intuitive for new users. Tested on comment markdown text as well as "View source" text. Tested clickable links and usernames are still clickable.
@@ -86,7 +86,7 @@ fun CommentNodeHeader( | |||
score: Int, | |||
myVote: Int?, | |||
isModerator: Boolean, | |||
onLongClick: () -> Unit = {} | |||
onClick: () -> Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the convention on these components, which is to make sure there's no default. IE
onClick: () -> Unit
@@ -118,7 +118,8 @@ fun CommentNodeHeaderPreview() { | |||
@Composable | |||
fun CommentBody( | |||
comment: Comment, | |||
viewSource: Boolean | |||
viewSource: Boolean, | |||
onClick: () -> Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -56,7 +56,7 @@ fun CommentMentionNodeHeader( | |||
onPersonClick: (personId: Int) -> Unit, | |||
score: Int, | |||
myVote: Int?, | |||
onLongClick: () -> Unit = {} | |||
onClick: () -> Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -56,7 +56,7 @@ fun CommentReplyNodeHeader( | |||
onPersonClick: (personId: Int) -> Unit, | |||
score: Int, | |||
myVote: Int?, | |||
onLongClick: () -> Unit = {} | |||
onClick: () -> Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -215,8 +215,8 @@ fun CommentOrPostNodeHeader( | |||
bottom = MEDIUM_PADDING | |||
) | |||
.combinedClickable( | |||
onLongClick = onLongClick, | |||
onClick = {} | |||
onLongClick = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you create a github issue for long-click voting? I think that'd be really nice to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -674,11 +674,13 @@ fun PreviewLines( | |||
@Composable | |||
fun MyMarkdownText( | |||
markdown: String, | |||
color: Color = MaterialTheme.colorScheme.onSurface | |||
color: Color = MaterialTheme.colorScheme.onSurface, | |||
onClick: () -> Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Once you get around to this, don't worry about the merge conflicts, I'll handle those. |
Had to touch a few more files for this due to not providing a default implementation for onClick parameters, let me know if the merge is a pain and I can rebase on head. |
I got it, it'll be merged shortly after the CI passes. Thanks! |
Users can now collapse comments by tapping anywhere on the comment body or header, and expand comments again by tapping on the comment header. This replaces the old behaviour (tap and hold on comment headers), which wasn't as intuitive for new users.
Tested on comment markdown text as well as "View source" comment text. Tested clickable links in the comment body and usernames in the comment header are still clickable.