-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Move CollapsingButton to the right and adapt marging #2732
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
base: main
Are you sure you want to change the base?
Conversation
baillyjamy
commented
Nov 28, 2025
|
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.
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) { |
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.
Shouldn't this condition be if (canBeCollapsed)?
| fun adaptMarginAfterCollapsingButton() { | ||
| val endMargin = if (binding.collapseCustomFolderButton.isVisible) { | ||
| 0 | ||
| } else { | ||
| context.resources.getDimensionPixelSize(RLegacy.dimen.marginStandardMedium) | ||
| } | ||
| binding.constraintLayout.setMarginsRelative(end = endMargin) | ||
| } |
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.
Can the margin be automatically computed and adapted when the canBeCollapsed boolean is changed without needing to remember to call some adaptMarginAfterCollapsingButton() method?
| private fun updateConstraintLayoutMarginStart() = with(binding) { | ||
| val marginStart = context.resources.getDimension(R.dimen.decoratedItemConstraintMarginStart).toInt() |
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.
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?
| 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) } | ||
| } |
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.
Why do we set the marginEnd here?
| 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 |
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.
Why did you need this two new visibility lines?


