[Proof of concept] Added autosizing of text and updated the project #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've implemented a form of text autosizing (#29) and customizable text padding, as well as updated the target sdk to api 28 and necessarily migrated the project to AndroidX. I also updated the min sdk to api 23, which was necessary in order to check if the screen was round easily (there are of course other methods to do so which do not necessitate raising the min sdk, but none as straightforward). I might give updating the project even further a try, assuming that I do not hit a brick wall in the process ;/
The method is imperfect and as such this is merely a proof of concept. It should however work well in most cases.
I used a dummy TextView to get the correct text size, as Autosizing does not work well inside a ScrollView. Even though this isn't an ideal solution, it is not the main reason for the messy code, but rather the fact that Autosizing prioritizes increasing font size over not splitting words in the middle, something which can result in very unsightly text. The code to fix this issue is also imperfect, among other things I had to change the word break strategy.
Some identified problems:
Occurrences of the character " " at the end of the text will shift the text leftwards, which can sometimes cause the text to be cut off for some reason. A simple fix would be to simply remove any whitespace characters at the end of the text, since they serve no use anyways and only takes up the limited screen space.EDIT: fixed.Some things that needs to be done:
As a side note, is there a particular reason as to why the rect. wear activity TextView has clickable and focusable set to true, whereas the round wear activity does not?