Skip to content

Commit

Permalink
Fix comment indent. Fixes #211 (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines authored Oct 2, 2022
1 parent ec00dc9 commit 6c5cbcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/jerboa/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fun calculateCommentOffset(depth: Int?, multiplier: Int): Dp {
return if (depth == null) {
0.dp
} else {
((depth + 1) * multiplier).dp
((depth * multiplier).dp)
}
}

Expand Down
17 changes: 7 additions & 10 deletions app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.jerboa.*
import com.jerboa.datatypes.*
import com.jerboa.db.Account
Expand Down Expand Up @@ -124,10 +123,12 @@ fun CommentNode(
account: Account?
) {
val offset = calculateCommentOffset(node.depth, 4)

// The ones with a border on the left need a little extra padding
val offset2 = if (node.depth == null) {
0.dp
} else {
LARGE_PADDING
} else {
XXL_PADDING
}
val borderColor = calculateBorderColor(node.depth)
val commentView = node.commentView
Expand All @@ -150,16 +151,12 @@ fun CommentNode(
start = offset
)
) {
Divider(startIndent = offset2)
Divider()
Column(
modifier = Modifier
.padding(
horizontal = LARGE_PADDING
)
.border(start = border)
modifier = Modifier.border(start = border)
) {
Column(
modifier = Modifier.padding(start = offset2)
modifier = Modifier.padding(start = offset2, end = LARGE_PADDING)
) {
if (showPostAndCommunityContext) {
PostAndCommunityContextHeader(
Expand Down

0 comments on commit 6c5cbcd

Please sign in to comment.