Closed alexei-28 closed 6 years ago
So basically, whenever you call a method of your View Interface like view.showTopAndBottomContainer()
, the implementation of that method has to set the view state accordingly.
For example:
class OfferDetailsViewPdfActivity ... {
@Override
public void hideTopAndBottomContainer() {
getViewState(). setIsshowTopAndBottomContainer(false);
offerDetailsToolBarMainContainer.setVisibility(View.GONE);
offerBottomContainer.setVisibility(View.GONE);
}
}
Also, in your ViewState you have to read the data from your bundle. I assume isshowTopAndBottomContainer = bundle.getBoolean(iS_SHOW_TOP_AND_BOTTOM_CONTAINER)
Hope that helps. For more information take a look at the documentation: http://hannesdorfmann.com/mosby
app/build.gradle:
I have activity that show pdf file. Also on top and bottom show 2 containers with icons. When click on pdf then both containers are hide. When click again then both containers show again. And so on.
When containers are not visible and I rotate phone than containers show. But they MUST be hide. So to solve this problem I must use
ViewState
. Method that show/hide container in activity are:showTopAndBottomContainer()/hideTopAndBottomContainer()
Here code:Here my custom activity:
Here my presenter: (I show only method that call when click on pdf)
Here my custom ViewState:
OK. Method
apply()
is success call. The question is : How I need restore state in the Activity when rotate phone? What I need to edit in my activity?