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 #389: Low-fi Home fragment implementation 2 (Nested RecyclerView) #477

Merged
merged 10 commits into from
Dec 10, 2019

Conversation

rt4914
Copy link
Contributor

@rt4914 rt4914 commented Nov 26, 2019

Explanation

This PR implements nested recyclerview to create carousel in HomeFragment.

Mock: https://xd.adobe.com/spec/e2239cf4-9cde-4c08-5296-25316c1f0a14-9412/screen/d47aa8de-a7a8-4d25-b011-5baefc7b7098/HP-Home-Page-

home_fragment_2

For testing carousel follow these steps:

  1. Go to TopicListController.kt file in domain module.
  2. In createOngoingStoryList, just repeat ongoingStoryListBuilder.addRecentStory twice, or something similar to that, check screenshot.

Screenshot 2019-11-27 at 2 25 35 PM

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.

Copy link
Contributor

@veena14cs veena14cs left a comment

Choose a reason for hiding this comment

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

It works smoothly. LGTM

@veena14cs veena14cs assigned rt4914 and unassigned veena14cs Nov 27, 2019
@rt4914 rt4914 removed their assignment Nov 27, 2019
Copy link
Contributor

@nikitamarysolomanpvt nikitamarysolomanpvt left a comment

Choose a reason for hiding this comment

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

LGTM

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 @rt4914. I have some concerns about the manual margin/padding computations happening. Other than that the changes LGTM.

app/src/main/java/org/oppia/app/home/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/org/oppia/app/home/HomeFragment.kt Outdated Show resolved Hide resolved

val padding48 = dipToPixels(48)
val padding16 = dipToPixels(16)
if (promotedStoryList.size > 1) {
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit hacky and won't work correctly for RTL layouts. Why do we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually as per @mschanteltc suggestions the implementation should be like this,
If there are more than 1 items, then the left and right margin are uneven, so as to make visual room for next item
Screenshot_1575270381

But if there is only one item, it will become an issue, so in that case, left/right margin should be same on both sides
Screenshot_1575270405

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, that makes sense to me. Could we also solve this by setting end padding on each individual item, but set the start padding on the whole recycler view? My thinking is that the padding/margin probably should be the same for each item, and in the case when there is only one item then ensuring the spacing is correct falls on the container itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot change the padding/margin of recyclerview because all the items in HomeFragment are at a particular margin/padding on left and right but as the promoted story is a carousel, it will use the entire width of screen when learner scrolls, therefore the recyclerview needs to have padding and margin as 0. And the padding/margin should be controlled on items(promoted story) only.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Hmm. I’ll need to think on this to see if there’s a cleaner way to do it. Let’s go with this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Dec 2, 2019
@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Dec 2, 2019
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!

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Dec 10, 2019
@rt4914 rt4914 merged commit c113c97 into develop Dec 10, 2019
@rt4914 rt4914 deleted the home-low-fi-part-2 branch December 10, 2019 07:30
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.

4 participants