-
Notifications
You must be signed in to change notification settings - Fork 521
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
Conversation
app/src/main/java/org/oppia/app/home/topiclist/TopicListAdapter.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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/topiclist/PromotedStoryListAdapter.kt
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/home/topiclist/PromotedStoryListViewModel.kt
Outdated
Show resolved
Hide resolved
|
||
val padding48 = dipToPixels(48) | ||
val padding16 = dipToPixels(16) | ||
if (promotedStoryList.size > 1) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay.
app/src/main/java/org/oppia/app/home/topiclist/TopicListAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/home/topiclist/TopicListAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/home/topiclist/TopicListAdapter.kt
Outdated
Show resolved
Hide resolved
domain/src/main/java/org/oppia/domain/topic/TopicListController.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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-
For testing carousel follow these steps:
createOngoingStoryList
, just repeatongoingStoryListBuilder.addRecentStory
twice, or something similar to that, check screenshot.Checklist