@@ -0,0 +1,1043 @@
+package com.davidstemmer.screenplay.component;%0A%0Aimport android.os.Parcelable;%0Aimport android.util.SparseArray;%0A%0Aimport com.davidstemmer.screenplay.scene.Scene;%0A%0Aimport javax.inject.Inject;%0A%0A/**%0A * Saves the instance state of a Scene's View when it is torn down and restores it when it%0A * is destroyed.%0A */%0Apublic class InstanceStateComponent implements Scene.Component %7B%0A%0A    private final SparseArray%3CParcelable%3E savedState = new SparseArray%3C%3E();%0A%0A    @Inject%0A    public InstanceStateComponent() %7B%7D%0A%0A    @Override%0A    public void afterSetUp(final Scene scene, boolean isStarting) %7B%0A        scene.getView().post(new Runnable() %7B%0A            @Override%0A            public void run() %7B%0A                if (scene.getView() != null) %7B%0A                    scene.getView().restoreHierarchyState(savedState);%0A                    savedState.clear();%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Override%0A    public void beforeTearDown(final Scene scene, boolean isFinishing) %7B%0A        scene.getView().saveHierarchyState(savedState);%0A    %7D%0A%7D%0A

Add InstanceStateComponent to library