-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
5074: Fix cropped numbers in Leaderboard #5143
5074: Fix cropped numbers in Leaderboard #5143
Conversation
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.
Much easier now to read the diff, thanks a lot!
I think the unit tests need to be updated too. Figured out from the failed check on GitHub. Will check and commit if there's any relevant change. |
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, the screenshot looks great!
Looking forward to the unit tests :-)
Did you get a chance to check the unit tests? :-)
|
I am sorry for the delay; wasn't anticipating any interviews before my continuous exams when I had taken this issue up. Now that my exams have ended today, I will update you soon. Thank you for waiting for me to make the changes :) |
…ion in AchievementsFragmentUnitTests
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.
Working fine, unit tests passing. Thanks!
Thank you for reviewing and approving the changes :) |
Description (required)
Fixes #5074
What changes did you make and why?
Fix without indentation changes:
Enabled auto-scaling of text
The numbers in the Achievements fragment are getting cropped as the app is currently using a hard-coded text size value of
9dp
and the text is of the form "xxx/xxx", that is, the circular progress bar can accommodate at most 6 digits and one '/' as of now. Increasing the size of the progress bar might disturb the nearby elements and so, I enabled auto-scaling of the text.For defining the UI, Commons makes use of the dependency: com.dinuscxj:circleprogressbar:1.1.1 (Available here).
Since this library does not handle larger numbers even in the latest version, they get cropped in the Achievements fragment. Even though we can programatically scale the text size, a more reliable method is to make use of the official Android UI guide for autoscaling text. Modifying the library might introduce an additional maintenance overhead for the app and so, I added a frame layout to make use of the official auto-sizeable TextView. Since the circular progress bar takes up a very small portion of the activity, the GPU considerations are negligible here.
I also changed the unit for progress bar text size from
dp
tosp
(for text scaling) in thedimens
file as this dimension would not impact any other component except the fix.Tests performed (required)
Tested ProdDebug on Redmi 5A with API level 26.
Screenshots (for UI changes only)
Since I haven't uploaded many pictures on the Commons app, I cannot reproduce the issue directly. However, this is how the XML design shows changes in Android Studio on adding large numbers: