Skip to content
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

Various improvements #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Various improvements #1

wants to merge 4 commits into from

Conversation

roptat
Copy link

@roptat roptat commented Jul 31, 2021

Hi!

I've started using your RubyTextView recently and found a few issues that I fixed in this PR. First, my app used to target API 15 and above, but your library targets 21 or above. There's really no reason why it can't target 16, and the first commit ensures it can even target 15 like my app (lineSpacingExtra was added in 16).

Then, I set the text programmatically, not statically in the XML, which lead to a crash which I fixed in the second commit.

I also use a dark theme, so the hard-coded black color for the ruby text was almost not visible. Instead, the third patch replaces it to default to the default text color, just like the rest of the text.

Finally, I had a few issues with measurement and the way the text was painted. First, I needed to use the widget with width="wrapContent", but the measurement always returns the parent size, so the widget took all the space, leaving no space for the rest of my layout on the right. I fixed that by returning instead the width of the largest line. I also have some furigana that exceeds the size of the kanji it is related to, and this presents two issues: it can overflow on the left and be hidden, and it can be overwritten by the next furigana block. I fixed that by creating additional spacing between text blocks when the ruby text is longer than the text it is related to.

Julien Lepiller added 4 commits July 31, 2021 15:15
This ensures the right color is used by default even with dark theme.
This makes the widget respect `width=wrapContent` and prevents ruby text
from overflowing on the left.
spacing = ta.getDimension(R.styleable.RubyTextView_spacing, 0);
lineSpacingExtra = ta.getDimension(R.styleable.RubyTextView_lineSpacingExtra, 0);
Copy link
Owner

Choose a reason for hiding this comment

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

Please define lineSpacingExtra in attrs.xml

Copy link
Owner

@b84330808 b84330808 left a comment

Choose a reason for hiding this comment

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

There is a missing value. I will approve the PR after updating, Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants