Skip to content

Recreate views on config changes#189

Open
hansonchris wants to merge 1 commit into
bluelinelabs:developfrom
hansonchris:configChanges
Open

Recreate views on config changes#189
hansonchris wants to merge 1 commit into
bluelinelabs:developfrom
hansonchris:configChanges

Conversation

@hansonchris

Copy link
Copy Markdown

This is typically necessary when the Activity has specified in the manifest that it will handle configuration changes such as an orientation change.

If the top Controller.setRecreateViewOnConfigChange(true) has been called before a configuration change happens, that Controller's current view will be removed and a recreated view will be added to the parent.

For Controllers that are lower in the stack, those Controllers' view will only be recreated if the Controller also has a RetainViewMode of RetainViewMode#RETAIN_DETACH.

@hansonchris

Copy link
Copy Markdown
Author

@EricKuck would you mind taking a look at this when you have a chance?

@hansonchris

Copy link
Copy Markdown
Author

Rebased, resolved conflicts, was bee8128

This is typically necessary when the Activity has specified in the manifest that it will handle configuration changes such as an orientation change.

If the top Controller.setRecreateViewOnConfigChange(true) has been called before a configuration change happens, that Controller's current view will be removed and a recreated view will be added to the parent.

For Controllers that are lower in the stack, those Controllers' view will only be recreated if the Controller also has a RetainViewMode of RetainViewMode#RETAIN_DETACH.
@hansonchris

Copy link
Copy Markdown
Author

Rebased, resolved conflicts, was 90b7add

@EricKuck

EricKuck commented Feb 6, 2017

Copy link
Copy Markdown
Member

Recreating views on all config changes seems a little heavy-handed, doesn't it? I can see people potentially wanting to do this for landscape -> portrait, but what if they don't want to recreate views for keyboard availability events or multi-window changes?

@Tagakov

Tagakov commented Apr 22, 2017

Copy link
Copy Markdown

Maybe it is reasonable to allow user to pass predicate which would filter appropriate configchanges for view hierarchy recreation? Approach with view hierarchy recreation without destroying activity seems very usable

@Tagakov

Tagakov commented May 1, 2017

Copy link
Copy Markdown

Or maybe it would be better to just add recreateViews() method to router allowing users to invoke it in Activity::onConfigurationChanged?

@Tagakov

Tagakov commented May 31, 2017

Copy link
Copy Markdown

ping?

@CebotariM

Copy link
Copy Markdown

Any updates on this?

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

Successfully merging this pull request may close these issues.

4 participants