0

Right now I have two separate fragments with a RecyclerView inside them. My first RecyclerView adapter is called MainRestaurantCardAdapter and the second is called ListRestaurantCardAdapter.

MainRestaurantCardAdapter handles (and displays) only one item (a Restaurant object) at a time.

ListRestaurantCardAdapter handles an entire list of Restaurants, like a typical RecyclerView adapter.

The list gets added to whenever the user clicks the "save" button on the from the MainRestaurantCardAdapter.

Whenever the button (ImageButton) is clicked, the button changes to indicate it has been saved. What I want is if the user deletes the item from the list, the button is returned to the original (so it can be clicked again).

My problem is I'm not sure where to store the Observable which is essentially watching a boolean value. And also, how to have both RecyclerView adapters subscribe to the Observable.

I hope this makes sense, I'll be glad to clear up anything.

ctzdev
  • 646
  • 2
  • 9
  • 24
  • Before I start trying to answer your question, few questions of mine: Are those both `Fragments` inside a single `Activity`? Why do you need a `RecyclerView` with a `MainRestaurantCardAdapter` if it's displaying only a single item? Can you provide some sort of a visual interpretation of your layout? Because maybe there could be a significant simplification in your layout which could lead to a simplification of your issue? – Bartek Lipinski Feb 02 '16 at 10:16
  • @BartoszLipinski No both fragments are in their own Activity. Sorry I should have cleared that up earlier. The reason for the RecyclerView to display one item is because I wanted swipe functionality on the CardView. [See my previous question for more about that.](http://stackoverflow.com/questions/34620840/how-to-add-swipe-functionality-on-android-cardview) – ctzdev Feb 02 '16 at 21:00

0 Answers0