0

UI Description

I am working on a social media app like facebook for professionals. In which at the home page there are multiple feeds(Posts) like Facebook. These feeds are consist of Nested recyclerViews - where one is the Main recyclerview (Vertical) and another one (Horizonal)is the child of Main recyclerview.

User Click Event

Now when the user clicks on any row of the child recyclerview then the user will be redirected to the detail page of that post. There is LIKE button on the feed page(Horizontal recyclerview row) as well as on the detail page to like that post.

Where the problem is ?

Now when the user clicks on that Like button on the detail page I need to update the same post on the Feed screen.

For example

The below image demonstrates the whole UI scenario.
Now when I click on post with position 1 (Parent), 1 (Child) it will open the detail screen with the corresponding data. And when I click on the like button on the detail screen it must update the LIKE button at the post with position 1 (Parent), 1 (Child). So, when the user presses the button and comes on the feed screen he is able to see that post(1,1) liked without doing any API call or refreshing the UI. enter image description here

What I tried ?

On clicking the post I am getting both the positions (1,1) and passing those positions on the detail screen. Now when the user clicks the like button I am passing those positions on the feed activity using Interface.


I hope I have provided enough details about the question.
I am not providing any code snippet else the question will get more lengthy & complex.

1 Answers1

0

there are two options 1.using interface pub sub structure 2.using static variable using static variable its easy to do. but it is not recommended so use first one. create an interface and then subscribe it from adapter class and then fire data from details page and on adapter class update the row using fired data.