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

Fix issue with resume buttons not scaling as expected #4899

Conversation

KevinGitonga
Copy link
Contributor

@KevinGitonga KevinGitonga commented Mar 13, 2023

Explanation

Fixes #4710 and #3833. The second issue was closed as it is possibly a duplicate of #4710

Updating width on both the buttons width 0dp actually gives them equal width enabling the button text and child drawables to scale as expected on max display and font config. Main issue is that the currently used width "144dp" doesn't work when the device's display and font config is set to max. This update works better and is per @adhiamboperes comments on previous PR submitted, The previous fix involved using a LinearLayout which had other caveats.

Essential Checklist

  • 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: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

Before and after screenshots demo

Nexus 5x API 29

Before Portrait After Portrait

Google Pixel 3xl

Before Portrait After Portrait

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @KevinGitonga.

Two things:

  1. Does this actually fix When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size #4362? It seems that issue is tied to also scaling the "resume lesson" screen and isn't particularly tied to the buttons.
  2. Won't this '0dp' fix only work if the button is used in a constraint layout (since 0dp means 'match constraint')? I'm concerned with defaulting it at such a high level in styles since other uses of the button (both now and in the future) could lead to the button not displaying at all. Similarly, we need to make sure the min size of buttons is always at least 48dp per accessibility requirements, so you may need to add a minWidth to the styles as well.

@KevinGitonga
Copy link
Contributor Author

Thanks @KevinGitonga.

Two things:

  1. Does this actually fix When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size #4362? It seems that issue is tied to also scaling the "resume lesson" screen and isn't particularly tied to the buttons.
  2. Won't this '0dp' fix only work if the button is used in a constraint layout (since 0dp means 'match constraint')? I'm concerned with defaulting it at such a high level in styles since other uses of the button (both now and in the future) could lead to the button not displaying at all. Similarly, we need to make sure the min size of buttons is always at least 48dp per accessibility requirements, so you may need to add a minWidth to the styles as well.

Thanks @BenHenning they seem related basing on the screenshots on the PR will double check on the revision tab which is mentioned on issue #4362 and provide update on this.

@KevinGitonga
Copy link
Contributor Author

KevinGitonga commented Mar 21, 2023

Thanks @KevinGitonga.

Two things:

  1. Does this actually fix When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size #4362? It seems that issue is tied to also scaling the "resume lesson" screen and isn't particularly tied to the buttons.
  2. Won't this '0dp' fix only work if the button is used in a constraint layout (since 0dp means 'match constraint')? I'm concerned with defaulting it at such a high level in styles since other uses of the button (both now and in the future) could lead to the button not displaying at all. Similarly, we need to make sure the min size of buttons is always at least 48dp per accessibility requirements, so you may need to add a minWidth to the styles as well.

Hey @BenHenning
RE 1. they are not related so i have removed reference to #4362 from this fix as the other is related to local inapp changes in text size not working although the image demonstration convey's a different message that shows relation to #4710.
RE 2. The buttons already have a minimum width set per this file https://github.com/oppia/oppia-android/blob/develop/app/src/main/res/values/styles.xml. The buttons are also currently referenced only from constraintlayout.

@BenHenning
Copy link
Member

I'm not sure that fully addresses point (2) actually. Defaulting to using constraint layout is problematic since it won't be clear to users of this style in the future that the button must be in a constraint layout, leading to a potentially brittle style.

It also occurs to me that the current style very much wants the button to be the size it's set to (as the minimum is set to the same size). Perhaps we should be considering alternatives to resizing such as wrapping the buttons. Per https://m2.material.io/components/buttons#anatomy button text shouldn't ever wrap in Material design as it can hurt text legibility, so wrapping would probably be more in-line with Material as well.

@oppiabot
Copy link

oppiabot bot commented Mar 29, 2023

Hi @KevinGitonga, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 29, 2023
@oppiabot oppiabot bot closed this Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Corresponds to items that haven't seen a recent update and may be automatically closed.
Development

Successfully merging this pull request may close these issues.

Improve support for scaling in resume lesson screen
2 participants