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 #2093: [Mobile-Landscape] High-fi StoryActivity Updated UI #2685

Closed
wants to merge 11 commits into from

Conversation

anshbajpai
Copy link

@anshbajpai anshbajpai commented Feb 11, 2021

Explanation

Fixes #2093
Updated, landscape UI according to the given changes.
Updated Screenshots:
Incomplete1
Complete1

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@FareesHussain FareesHussain self-assigned this Feb 11, 2021
@anshbajpai
Copy link
Author

@FareesHussain are there any changes, I should make?

Copy link
Contributor

@FareesHussain FareesHussain left a comment

Choose a reason for hiding this comment

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

@anshbajpai Add few comments please check
Update the PR description add Fixes #2093

Comment on lines -61 to +67
android:fontFamily="sans-serif-medium"
android:fontFamily="sans-serif"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change according to the mock.

Copy link
Author

Choose a reason for hiding this comment

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

no, the mock uses Roboto font, but I used sans-serif as it was being used earlier. Can I change it to Roboto?

android:maxLines="2"
android:text="@{String.format(@string/chapter_name, (viewModel.index + 1), viewModel.name)}"
android:text="@{titleContent}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you updating the title here. The issue is only related to the borders right.

Copy link
Author

Choose a reason for hiding this comment

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

yeah, but also if some pre-requisites are not completed, the title has to be changed to - "to unlock this chapter, you have to finish this chapter", hence I used the title here

str,
binding.chapterTitle
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this extra line. This is causing the lint test error.
To avoid this I suggest to setup the ktlint pre-push for the project

Copy link
Author

Choose a reason for hiding this comment

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

sure

@rt4914 rt4914 self-assigned this Feb 11, 2021
@FareesHussain FareesHussain removed their assignment Feb 11, 2021
Comment on lines 150 to 191
val str = if (storyItemViewModel.chapterSummary.chapterPlayState ==
ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES
) {
String.format(
HtmlCompat.toHtml(
SpannedString
.valueOf(view.context.getText(R.string.unlock_chapter)),
HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE
),
storyItemViewModel.index,
storyItemViewModel.missingPrerequisiteChapter.name
)
} else {
String.format(
HtmlCompat.toHtml(
SpannedString.valueOf(
view.context
.getText(R.string.chapter_name)
),
HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE
),
storyItemViewModel.index + 1,
storyItemViewModel.name
)
}
binding.storyChapterCard.strokeWidth =
when (storyItemViewModel.chapterSummary.chapterPlayState) {
ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ->
view.context.resources.getDimension(R.dimen.space_0dp).toInt()
else ->
view.context.resources.getDimension(R.dimen.story_chapter_stroke_width).toInt()
}
binding.titleContent =
htmlParserFactory.create(
resourceBucketName,
entityType,
storyItemViewModel.storyId,
imageCenterAlign = true
).parseOppiaHtml(
str,
binding.chapterTitle
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this can be done with Data binding only, we want to abstract away this as much as possible, so try doing it with data binding only.

Copy link
Author

Choose a reason for hiding this comment

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

Sure.

@anshbajpai
Copy link
Author

@prayutsu I have updated the code and now it's only using data binding

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

There are some issues with the mocks. Adding @mschanteltc for clarifications:

Portrait
Landscape

  1. In the locked chapter the portrait mock contains Chapter name and landscape mode does not which is inconsistent especially for A11y cases. So I think we should add Chapter name title in both cases.
  2. In the statement "Complete Chapter 2: The Meaning of “Equal Parts” to unlock this chapter." we are using two types of fonts: Regular and Medium. Is this possible to update this to Regular and Bold so that it because easy on android side to implement this.

@mschanteltc WDYT about above points?

<!-- android:layout_marginBottom="8dp"-->
<!-- android:background="@color/chapterCardShadow"-->
<!-- android:padding="8dp"-->
<!-- android:visibility="@{viewModel.chapterSummary.chapterPlayState == ChapterPlayState.NOT_PLAYABLE_MISSING_PREREQUISITES ? View.VISIBLE : View.INVISIBLE}" />-->
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove these comments.

@@ -64,6 +64,7 @@
<string name="chapter_name">Chapter %s: %s</string>
<string name="chapter_completed">Chapter %s: %s is completed.</string>
<string name="chapter_prerequisite_title_label">Complete Chapter %s: %s to unlock this chapter.</string>
<string name="empty_string"> </string>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct. We should not use empty_strings.

@@ -422,4 +423,6 @@
</string>
<string name="smallest_text_size_content_description">Smallest text size</string>
<string name="largest_text_size_content_description">Largest text size</string>
<string name="unlock_chapter">"Complete <![CDATA[<b>Chapter %s: %s</b>]]> to unlock this chapter."</string>
<string name="chapter_land_name"><![CDATA[<b>Chapter %s: %s</b>]]></string>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect. Making the text bold is not same as Roboto-Medium.

Copy link
Author

Choose a reason for hiding this comment

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

@rt4914 I agree, but I was not sure whether I can use Roboto-Medium or not, as it's an external font

Copy link
Contributor

Choose a reason for hiding this comment

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

This solution will work for now.

@rt4914 rt4914 assigned mschanteltc and unassigned rt4914 Feb 11, 2021
@mschanteltc
Copy link

There are some issues with the mocks. Adding @mschanteltc for clarifications:

Portrait
Landscape

  1. In the locked chapter the portrait mock contains Chapter name and landscape mode does not which is inconsistent especially for A11y cases. So I think we should add Chapter name title in both cases.
  2. In the statement "Complete Chapter 2: The Meaning of “Equal Parts” to unlock this chapter." we are using two types of fonts: Regular and Medium. Is this possible to update this to Regular and Bold so that it because easy on android side to implement this.

@mschanteltc WDYT about above points?

  1. Yes, I updated the mobile and tablet mocks for both portrait and landscape orientations so that each one includes the Chapter name.
  2. If we bold the name, can we add a feature where if the user taps on the prerequisite Chapter Name, the page auto scrolls to that respective Chapter card? If so, can we also make the Chapter Name a different color so that it's distinguishable and can be recognized as a button? I edited the mobile portrait mock so you can see how the feature works. (Scroll to 'Chapter 3: Fractions of a Group' card and tap 'Chapter 2: The Meaning of "Equal Parts"')

@anshbajpai
Copy link
Author

@mschanteltc @rt4914 should I change the font to Roboto for the landscape version according to the mock, if yes - should I add the font as a downloadable font or simply add it in the project ?

@rt4914
Copy link
Contributor

rt4914 commented Feb 15, 2021

There are some issues with the mocks. Adding @mschanteltc for clarifications:
Portrait
Landscape

  1. In the locked chapter the portrait mock contains Chapter name and landscape mode does not which is inconsistent especially for A11y cases. So I think we should add Chapter name title in both cases.
  2. In the statement "Complete Chapter 2: The Meaning of “Equal Parts” to unlock this chapter." we are using two types of fonts: Regular and Medium. Is this possible to update this to Regular and Bold so that it because easy on android side to implement this.

@mschanteltc WDYT about above points?

  1. Yes, I updated the mobile and tablet mocks for both portrait and landscape orientations so that each one includes the Chapter name.
  2. If we bold the name, can we add a feature where if the user taps on the prerequisite Chapter Name, the page auto scrolls to that respective Chapter card? If so, can we also make the Chapter Name a different color so that it's distinguishable and can be recognized as a button? I edited the mobile portrait mock so you can see how the feature works. (Scroll to 'Chapter 3: Fractions of a Group' card and tap 'Chapter 2: The Meaning of "Equal Parts"')

@mschanteltc We can do that but the technical cost might be too much which might not be needed for this feature. Adding @BenHenning for his input. @BenHenning Do you think we should apply what Chantel has suggested?

@BenHenning
Copy link
Sponsor Member

BenHenning commented Feb 17, 2021

@rt4914 I think that might be a nice stretch project, but shouldn't be a hard blocker. It can be implemented similarly to how we implement non-interactive links elsewhere in the app (e.g. using a custom tag). It seems like a nice improvement.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Feb 17, 2021
@rt4914
Copy link
Contributor

rt4914 commented Feb 23, 2021

@anshbajpai Have a look at this mock: https://xd.adobe.com/view/e8aa4198-3940-47f9-514a-f41cc54457f6-9e9b/screen/5abb0ace-19ee-48b8-8154-919154f924d2/

As per the third card in this. The Chapter-2 should be clickable. For now we can keep it non-clickable and lets use regular and bold so that it looks like this but in black color. Similar to what you did in current solution.

@rt4914 rt4914 assigned anshbajpai and unassigned rt4914 and mschanteltc Feb 23, 2021
@BenHenning BenHenning added the PR don't merge - NEEDS UPDATE Corresponds to PRs that need to be updated with the latest develop changes before they can be merged label Feb 24, 2021
@BenHenning BenHenning removed the PR don't merge - NEEDS UPDATE Corresponds to PRs that need to be updated with the latest develop changes before they can be merged label Feb 24, 2021
@FareesHussain
Copy link
Contributor

@anshbajpai any updates on this?

@anshbajpai
Copy link
Author

@anshbajpai any updates on this?

yeah , i am working on it, will update the pr in 1 - 2 days probably

@FareesHussain
Copy link
Contributor

@anshbajpai Any updates on this?

@rt4914
Copy link
Contributor

rt4914 commented Mar 15, 2021

Closing this because of no updates in 2 weeks.

@rt4914 rt4914 closed this Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mobile-Landscape] High-fi StoryActivity Updated UI
6 participants