final class StateSaverImpl extends Object
| Constructor and Description |
|---|
StateSaverImpl(Map<Class<?>,Injector> injectors) |
| Modifier and Type | Method and Description |
|---|---|
(package private) <T> void |
restoreInstanceState(T target,
Bundle state)
Restore the given
target from the passed in Bundle. |
(package private) <T extends View> |
restoreInstanceState(T target,
Parcelable state)
Restore the sate of the given view and return the super state of the parent class.
|
(package private) <T> void |
saveInstanceState(T target,
Bundle state)
Save the given
target in the passed in Bundle. |
(package private) <T extends View> |
saveInstanceState(T target,
Parcelable state)
Save the state of the given view and the other state inside of the returned
Parcelable. |
(package private) void |
setEnabledForAllActivitiesAndSupportFragments(Application application,
boolean enabled)
Turns automatic instance saving on or off for all activities and fragments from the support library.
|
<T> void saveInstanceState(T target,
Bundle state)
target in the passed in Bundle.target - The object containing fields annotated with State.state - The object is saved into this bundle.<T> void restoreInstanceState(T target,
Bundle state)
target from the passed in Bundle.target - The object containing fields annotated with State.state - The object is being restored from this bundle. Nothing is restored if the argument is null.<T extends View> Parcelable saveInstanceState(T target,
Parcelable state)
Parcelable.target - The view containing fields annotated with State.state - The super state of the parent class of the view. Usually it isn't null.<T extends View> Parcelable restoreInstanceState(T target,
Parcelable state)
target - The view containing fields annotated with State.state - The parcelable containing the view's state and its super sate.null.void setEnabledForAllActivitiesAndSupportFragments(Application application,
boolean enabled)
saveInstanceState(Object, Bundle) and restoreInstanceState(Object, Bundle), instead
the library is doing this automatically for you. It's still necessary to annotate fields with State, though.
Application#onCreate() method.application - Your application instance.enabled - Whether this feature should be enabled.