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

Backstack entry's view state is never saved on rotation #67

Closed
almozavr opened this issue Mar 31, 2015 · 8 comments
Closed

Backstack entry's view state is never saved on rotation #67

almozavr opened this issue Mar 31, 2015 · 8 comments

Comments

@almozavr
Copy link

Precondition

According so sample, in case of screen rotation NonConfigurationInstance is used to save backstack

Problem

Backstack entry's viewState is not saved on ration, so when recreating flow with backstack, topmost entry doesn't have what to restore and views data (such as text for EditText) is lost.

almozavr pushed a commit to almozavr/flow that referenced this issue Mar 31, 2015
Entry's viewstate should be persisted not only when path is replaced with another path,
but also when on-save-instance is occurred, so topmost backstack entry has it's own viewstate
identical to underlying view has. (partly fixes square#67)
@almozavr
Copy link
Author

↑ Here is an example of solving issue for rotation only situation (when backstack stays the same instance).

@almozavr
Copy link
Author

Please, could someone tell me why ActivityFlowSupport#getBackstackToSave(Backstack backstack) creates a copy of backstack with dropped viewstates? This is key to problem of overall persistance (e.g. activity was destroyed and user goes back to app again)

almozavr pushed a commit to almozavr/flow that referenced this issue Mar 31, 2015
When saving getBackstackToSave filters backstack entries without path's NotPersist annotation,
but also should not ignore current entries viewstates and copy 'em gracefully.
Fully fixes square#67
@almozavr
Copy link
Author

↑ Fix for graceful backstack's viewstates persistance. Don't know if it's dirty for current code model, so punish hard, ready to take it further

@rjrjr
Copy link
Collaborator

rjrjr commented Apr 2, 2015

@almozavr
Copy link
Author

almozavr commented Apr 2, 2015

@rjrjr Sorry, I found no solution of this problem in #72, because:

  • ActivityFlowSupport#getBackstackToSave still ignores current viewstates of backstack entries;
  • flow support doesn't do snapshot of viewstate of current path before getBackstackToSave called, so I suppose e.g. EditText text will still be lost on rotation.

@rjrjr
Copy link
Collaborator

rjrjr commented Apr 2, 2015

Yup, rotation is definitely broken. Still not sure that this is the way to fix it though, looking.

@loganj
Copy link
Collaborator

loganj commented Apr 2, 2015

Yep. Thanks for the catch, and for the patches. I've made some slightly different fixes in #75.

@loganj loganj closed this as completed Apr 2, 2015
@almozavr
Copy link
Author

almozavr commented Apr 2, 2015

Thanks, looks great.

On Fri, Apr 3, 2015 at 12:24 AM Logan Johnson notifications@github.com
wrote:

Closed #67 #67.


Reply to this email directly or view it on GitHub
#67 (comment).

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

No branches or pull requests

3 participants