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
[TIMOB-6392] Android fix: Ti.UI.Button text values with too many dis… #9299
Conversation
…playable characters draw improperly [TIMOB-6392]- Android fix: Ti.UI.Button text values with too many displayable characters draw improperly
@maggieaxway, I did a quick test on iOS and it turn out we don't support multiline buttons on that platform. That is, there is no line wrapping and it ignores newline '\n' characters. It's always forced to be single-line. iOS also always applies ellipsis in the middle of the text as well. So, for parity with iOS, let's do the following in the TiUIButton constructor:
This also means you don't need to do the above dynamically anymore. So, you can get rid of the |
For parity with iOS: Force to set single line Use TextUtils.TruncateAt.MIDDLE ellipsis mode
} | ||
}); | ||
btn.setEllipsize(TextUtils.TruncateAt.MIDDLE); | ||
btn.setMaxLines(1); |
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 these 2 lines into the TiUIButton constructor please?
(Before the setNativeView(btn)
call.)
This way these setting will always be applied. This is in case the "title" property is not set upon button creation and is set afterwards instead.
Other than that, yeah, it should be this simple. :)
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.
Yes you're right! I didn't notice it. Appreciate your caution!
Move changes to constructor to make sure always applied
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.
CR: Pass
FR Passed. For longer button text on android the text are shortened using ellipses like IOS. Studio Ver: 4.10.0.201709271713 |
Generated by 🚫 dangerJS |
@maggieaxway , Jenkins is asking for unit tests before merge. Can you please add it. |
I don't think there is a good way to automate testing of this particular case. You have to eyeball the text and make sure it's showing ellipsis. |
@lokeshchdhry There's no crash before or after the changes, it just meant to display properly. So I agree with Josh it doesn't make sense to make auto test. |
@sgtcoolguy , Can you please merge this as according to @maggieaxway no unit tests can't be added. Thanks! |
…playable characters draw improperly
[TIMOB-6392]- Android fix: Ti.UI.Button text values with too many
displayable characters draw improperly
JIRA: https://jira.appcelerator.org/browse/TIMOB-6392
Test case: