-
Notifications
You must be signed in to change notification settings - Fork 531
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
Improve text scaling according to accessibility scanner #4586
Comments
…4587) * Fixed text-scaling issue by setting min Height and width * Navigation drawer scaling fixed * text-scaling fixed in promoted-story-card * Removed minHeight=48dp * Fixed more text scaling issues * Optimized code resume lesson * layout_height set to 0dp * Updated promoted_story_card
@BenHenning @rt4914 for this particular issue only in promotes story card we are getting text scaling issues, other than that almost all of the issues are already solved in this #4686 PR. For promoted story card I get following suggestion from accessibility scanner. The suggestion shows that ViewGroup has a fixed width and contains a TextView with scalable text. Here, to solve this issue we need to set width as wrap content. As per the #4684 we can't set the width as wrap content, we need to give fixed width such that all promoted story cards have same width. I think that here we need to compromise with the text scaling issue as we can't fix it for promoted story card. |
@BenHenning @vrajdesai78 I have tried solving this issue and so far using Other solution attempts were:
|
@rt4914 I agree with your solution, but if we make the fontsize in dp then accessibility scanner will give another suggestion that fontsize should in sp instead of dp. So any approach we take, we have to compromise to atleast one problem either accessibility or inconsistent size of card. I think we can't keep the size of card inconsistent and also doing dp will give another suggestion of changing it back to sp. So, I think that even if we go with the current implementation it's fine. @BenHenning WDYT |
Just to be clear I have not used dp for font size. Instead I have used sp for the card width. Also, notice that the width/height of card is different in above screenshots that's because of using sp, if it was dp then it would have been fixed width/height. |
## Explanation Fixes #4586: Changed layout_width to sp instead of dp as per this [comment](#4586 (comment)). This actually solves the problem of text scaling. Improved text scaling by setting layout_height and layout_width to wrap_content and setting min_height = 48dp and min_width = 48dp (may vary in some cases). Introduced a tests which will make sure that width is set in SP not in DP. Note: In accessibility scanner it still shows to improve text scaling but visually or practically this solution looks accurate. ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## Screenshots For Mobile (Promoted Story Card) Default Fonts | Large Fonts :-------------------------:|:-------------------------: ![Screenshot from 2022-11-05 01-27-47](https://user-images.githubusercontent.com/43074241/200065857-3408aca5-7cac-484b-bef8-91aac6a35047.png) | ![Screenshot from 2022-11-05 01-28-36](https://user-images.githubusercontent.com/43074241/200065890-89013801-4b13-4fec-a53c-e77b802eedde.png) ![Screenshot from 2022-11-05 01-30-00](https://user-images.githubusercontent.com/43074241/200066086-30a9b533-5a29-4f86-919d-a0fdc3ab8e9b.png) | ![Screenshot from 2022-11-05 01-29-23](https://user-images.githubusercontent.com/43074241/200066127-8718ce6c-d22f-4d7d-96b4-9f2698bc3185.png) ## Screenshots for Tablet (Promoted Story Card) Default Fonts | Large Fonts :-------------------------:|:-------------------------: ![Screenshot from 2022-11-05 01-31-14](https://user-images.githubusercontent.com/43074241/200066306-d0ebedeb-af87-43e4-9509-a7a50e95d77e.png) | ![Screenshot from 2022-11-05 01-31-36](https://user-images.githubusercontent.com/43074241/200066339-6f52bd98-012a-42c7-ab44-ea6ca1593554.png) ![Screenshot from 2022-11-05 01-24-34](https://user-images.githubusercontent.com/43074241/200066489-10dcf823-b6bd-4704-9dba-9bdc6d0cf44e.png) | ![Screenshot from 2022-11-05 01-25-16](https://user-images.githubusercontent.com/43074241/200066530-6c43a78e-8465-4693-8cdf-7438b23e8b3a.png) Failing robolectric tests when we change the width in dp. ![Screenshot from 2022-11-07 14-39-57](https://user-images.githubusercontent.com/43074241/200274329-2040e1bc-ae14-465f-a0a2-3c562e53fb66.png)
Describe the bug
In Android 12, accessibility scanner is showing suggestion to improve text scaling for cases in which we have set fixed width or height of view group which will create a problem in scaling test.
Expected behavior
Accessibility scanner should not show any improvements for text scaling
Demonstration
Environment
The text was updated successfully, but these errors were encountered: