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 #4362, #1491: When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size #5290

Draft
wants to merge 55 commits into
base: develop
Choose a base branch
from

Conversation

Vishwajith-Shettigar
Copy link
Collaborator

@Vishwajith-Shettigar Vishwajith-Shettigar commented Dec 25, 2023

Explanation

Fixes #4362
Fixes #1491

Support resizable reading text in resume lesson, question player and revision card.

Before After
before.webm device-2024-01-02-150914.webm
tablet_before.webm tablet_after.webm

Question Player

questionPLayer.webm

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)
  • For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

@Vishwajith-Shettigar
Copy link
Collaborator Author

@adhiamboperes, PTAL.

@Vishwajith-Shettigar Vishwajith-Shettigar requested a review from a team as a code owner December 28, 2023 03:45
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

Thanks @Vishwajith-Shettigar!!

Please update the PR description and add before/after screenshots for mobile and tablets so that I can verify that the solution works.

Copy link

oppiabot bot commented Jan 2, 2024

Unassigning @adhiamboperes since the review is done.

Copy link

oppiabot bot commented Jan 2, 2024

Hi @Vishwajith-Shettigar, it looks like some changes were requested on this pull request by @adhiamboperes. PTAL. Thanks!

Copy link

oppiabot bot commented Jan 2, 2024

Unassigning @Vishwajith-Shettigar since a re-review was requested. @Vishwajith-Shettigar, please make sure you have addressed all review comments. Thanks!

@Vishwajith-Shettigar
Copy link
Collaborator Author

@adhiamboperes, PTAL.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

Thanks @Vishwajith-Shettigar! This is an intyeresting solution.

I have some thoughts:

  • When thinking about possible User journey, it seems less likely that a user may want to change the text size on the resume lesson page, and more that they would expect it to show the same as the text size they selected the last time they were in a lesson.
  • As such, we would want to not add the option to change the text sie in the toolbar, but to retrieve the saved exploration reading text size, and apply it to this activity as well.

Please let me know if you have questions on how to go about this.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

Thanks @Vishwajith-Shettigar!

I have taken another full pass at this and left some comments. Most of them revolve around removing changes that do not contribute to the feature.

@@ -110,7 +110,6 @@ class ResumeLessonActivity :
}

override fun onBackPressed() {
super.onBackPressed()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is needed for this lifecycle method

}

/** Action for onOptionsItemSelected. */
fun handleOnOptionsItemSelected(itemId: Int): Boolean {
setReadingTextSizeMedium()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should remain the same as the current selected font size, for consistency purposes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are only scaling content of the app, i don't think scaling option or help activity is necessary.
Would like to hear your opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't really understand your comment in response to mine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we remove setReadingTextSizeMedium() from line no 135, option activity and help activity font size will also scale.
Below i have attached screen recording, PTAL.

OptionActivity.webm

@@ -87,6 +90,7 @@ class ResumeLessonActivity :
parentScreen: ExplorationActivityParams.ParentScreen,
isCheckpointingEnabled: Boolean
) {
resumeLessonActivityPresenter.setReadingTextSizeNormal()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe there is no need to reset the size here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we don't set text size medium it will affect the exploration tool bar title text size.

Resume.webm

@Vishwajith-Shettigar Vishwajith-Shettigar marked this pull request as draft April 27, 2024 10:31
@Vishwajith-Shettigar Vishwajith-Shettigar changed the title Fix #4362: When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size Fix #4362, #1491: When reading text size is extra large, resume lesson page and revision tabs content is seen in normal size Apr 27, 2024
Comment on lines 250 to 262
onView(withId(R.id.revision_card_explanation_text)).check(
matches(
withFontSize(
round(
context.resources.getDimension(
R.dimen.revision_card_fragment_font_scale_content_extra_large_text_size
)
)
)
)
)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

In our discussion we had agreed to hardcode the values, e.g below.

Suggested change
onView(withId(R.id.revision_card_explanation_text)).check(
matches(
withFontSize(
round(
context.resources.getDimension(
R.dimen.revision_card_fragment_font_scale_content_extra_large_text_size
)
)
)
)
)
}
}
onView(withId(R.id.revision_card_explanation_text)).check(
matches(
withFontSize(
62.0F
)
)
)

I came up with 62F by logging the calculated value in the FontSizeMatcher.kt util class and checking logcat:

class FontSizeMatcher(private val expectedSize: Float) :
  TypeSafeMatcher<View?>(View::class.java) {
  override fun matchesSafely(target: View?): Boolean {
    if (target !is TextView) {
      return false
    }
    println("Textsize ${target.textSize}")
    return target.textSize.equals(expectedSize)
  }

You'll be able to find the appropriate values for other scale sizes too. Hope this helps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

I resolved some comments after verifying, and left some that I believe are still valid. PTAL.

Copy link

oppiabot bot commented May 7, 2024

Hi @Vishwajith-Shettigar, 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 May 7, 2024
@Vishwajith-Shettigar Vishwajith-Shettigar removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label May 8, 2024
Copy link

oppiabot bot commented May 21, 2024

Hi @Vishwajith-Shettigar, 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 May 21, 2024
@adhiamboperes adhiamboperes removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants