-
Notifications
You must be signed in to change notification settings - Fork 165
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
support text wrapping and centering #146
base: main
Are you sure you want to change the base?
Conversation
Prevent long texts to be covered by the slide icon button as well as gets cut off by supporting text-wrapping.
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.
Thanks for you change @JeppeLeth and sorry for the late review but I was taking some time for Xmas 🎅
Overall the change looks good, but there are a couple of things to address:
-
With this change the text is now not centered anymore. This is a pretty significant behavioural change that I'd rather avoid. I believe we should apply the canvas translation only if the number of lines is above 1.
-
I believe we should increase the left margin as the text is bleeding below the slider.
-
The text is having a funny yet weird animation when resetting the slides. This goes along the way that the
StaticLayout.Builder.build()
method should be invoked only once and not on everyonDraw
:
-
Examples should be added, ideally here: https://github.com/cortinico/slidetoact/blob/master/example/src/main/res/layout/content_text_size.xml
val leftOffset = | ||
(mAreaHeight - 2 * mActualAreaMargin).toFloat() / mAreaHeight.toFloat() * | ||
mBorderRadius.toFloat() * 2 |
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 you move this inside the else branch?
val mTextTop = 0 + dY | ||
val mTextRight = mAreaWidth - mActualAreaWidth - dX | ||
|
||
canvas.translate(mTextLeft.toFloat(), mTextTop.toFloat()) |
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.
canvas.translate(mTextLeft.toFloat(), mTextTop.toFloat()) | |
canvas.translate(mTextLeft, mTextTop.toFloat()) |
val mTextRight = mAreaWidth - mActualAreaWidth - dX | ||
|
||
canvas.translate(mTextLeft.toFloat(), mTextTop.toFloat()) | ||
canvas.translate(((mTextRight - mTextLeft) / 2).toFloat(), 0f) |
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.
canvas.translate(((mTextRight - mTextLeft) / 2).toFloat(), 0f) | |
canvas.translate(((mTextRight - mTextLeft) / 2), 0f) |
Please let me know if you need some support going forward 🙏 |
Description
Prevent long texts to be covered by the slide icon button as well as gets cut off by supporting text-wrapping.
Used solution proposed by @Nealsoni00 and added ellipsis and dynamic max lines.
Related PRs/Issues
mText cutoff and wrapping issue #140
Screenshot
Used string
Sample SlideToActView veeeeeeeeeeeeeeeeeery looooong long loooooong looooooong looooooooong looooong text