Skip to content

Conversation

@baillyjamy
Copy link
Contributor

image

@baillyjamy baillyjamy requested a review from LunarX November 28, 2025 14:53
@baillyjamy baillyjamy added the enhancement Improve or expand upon an existing feature label Nov 28, 2025
@sonarqubecloud
Copy link

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have an unused hasCollapsibleFolder: Boolean in the setFolderUi() method


// If the item view has a collapse button, remove end margin. The margin is already present inside the button
fun adaptMarginAfterCollapsingButton() {
val endMargin = if (binding.collapseCustomFolderButton.isVisible) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this condition be if (canBeCollapsed)?

Comment on lines +123 to +130
fun adaptMarginAfterCollapsingButton() {
val endMargin = if (binding.collapseCustomFolderButton.isVisible) {
0
} else {
context.resources.getDimensionPixelSize(RLegacy.dimen.marginStandardMedium)
}
binding.constraintLayout.setMarginsRelative(end = endMargin)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the margin be automatically computed and adapted when the canBeCollapsed boolean is changed without needing to remember to call some adaptMarginAfterCollapsingButton() method?

Comment on lines +36 to +37
private fun updateConstraintLayoutMarginStart() = with(binding) {
val marginStart = context.resources.getDimension(R.dimen.decoratedItemConstraintMarginStart).toInt()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be defined at the xml level only? Does it bring something by being called here in the code? Like will it change or something and we need to reset it to 8dp here?

Comment on lines +41 to 44
private fun updateItemNameMarginStart(indent: Int) {
val totalMarginStart = binding.context.resources.getDimension(R.dimen.decoratedItemTextMarginStart).toInt() + computeIndent(indent)
binding.itemName.apply { setMarginsRelative(start = totalMarginStart, end = marginEnd) }
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set the marginEnd here?

Comment on lines +49 to +56
binding.endIconLayout.isVisible = isPastilleDisplayed || unreadCount > 0
}

var isPastilleDisplayed = false
set(isDisplayed) {
field = isDisplayed
setEndIcon(if (isDisplayed) pastille else null, R.string.contentDescriptionUnreadPastille)
binding.endIconLayout.isVisible = isPastilleDisplayed || unreadCount > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need this two new visibility lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve or expand upon an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants