package com.davidstemmer.screenplay.scene;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.davidstemmer.screenplay.SceneCut;
import com.davidstemmer.screenplay.flow.Screenplay;

/**
 * Created by weefbellington on 10/2/14.
 */

/**
 * @author  David Stemmer
 * @version 1.0.0
 * @since   1.0.0
 */
public interface Scene {

    /**
     * Create the View, using the layout parameters of the Parent. After this method is called,
     * getView() should return non-null value. The View should not be attached to the parent; that is the
     * responsibility of the Scene.Rigger.
     * @param context current context
     * @param parent the container view
     * @return the created view
     */
    public View setUp(Context context, ViewGroup parent);

    /**
     * Destroy the View. After this method is called, getView() should return null. The View should
     * not be detached from its parent; that is the responsibility of the Scene.Rigger.
     * @param context the current context
     * @param parent the container view
     * @return the destroyed view
     */
    public View tearDown(Context context, ViewGroup parent);

    /**
     * Get the View associated with the Scene
     * @return the view, or null of {@link #setUp setUp} has not yet been called
     */
    public View getView();

    /**
     * @return a non-null {@link com.davidstemmer.screenplay.scene.Scene.Rigger}
     */
    public Rigger getRigger();

    /**
     * @return a non-null {@link com.davidstemmer.screenplay.scene.Scene.Transformer}
     */
    public Transformer getTransformer();

    /**
     * @author  David Stemmer
     * @version 1.0.0
     * @since   1.0.0
     */
    public static interface Component {
        /**
         * Called after {@link Scene#setUp(android.content.Context, android.view.ViewGroup)}
         * @param context the current context
         * @param scene the current scene
         * @param view the view that was set up
         */
        public void afterSetUp(Context context, Scene scene, View view);
        /**
         * Called before {@link Scene#tearDown(android.content.Context, android.view.ViewGroup)}
         * @param context the current context
         * @param scene the current scene
         * @param view the view that will be torn down
         */
        public void beforeTearDown(Context context, Scene scene, View view);
    }

    /**
     * @author  David Stemmer
     * @version 1.0.0
     * @since   1.0.0
     */
    public static interface Rigger {
        /**
         * Layout the next (incoming) scene. When this method returns, the next scene should be
         * attached to the parent.
         * @param context the current context
         * @param parent the parent that the view should be attached to
         * @param cut contains the next and previous scene, and the flow direction
         */
        public void layoutNext(Context context, ViewGroup parent, SceneCut cut);

        /**
         * Layout the previous (outgoing) scene. When this method returns, the previous scene may
         * (but is not necessarily) detached from the parent.
         * @param context the current context
         * @param parent the parent that the view should be detached from
         * @param cut contains the next and previous scene, and the flow direction
         */
        public void layoutPrevious(Context context, ViewGroup parent, SceneCut cut);
    }

    /**
     * @author  David Stemmer
     * @version 1.0.0
     * @since   1.0.0
     */
    public static interface Transformer {
        /**
         * Apply the animation based on the Flow.Direction. When the animation completes, it is the
         * responsibility of the Transformer to call {@link Screenplay#endCut(com.davidstemmer.screenplay.SceneCut)}
         * @param cut
         * @param listener
         */
        public void applyAnimations(SceneCut cut, Screenplay listener);
    }

}

@@ -225,16 +225,35 @@
 nplay;%0A%0A
+import flow.Flow;%0A%0A
 /**%0A * C
@@ -2603,42 +2603,8 @@
    *
- Layout the next (incoming) scene.
  Whe
@@ -2630,20 +2630,24 @@
 ns, the 
-next
+incoming
  scene s
@@ -2654,27 +2654,16 @@
 hould be
-%0A         *
  attache
@@ -2701,345 +2701,318 @@
 ram 
-contex
+paren
 t the 
-cur
+pa
 rent 
-context%0A         * @param parent the parent that the view should be attached to%0A         * @param cut contains the next and previous scene, and the flow direction%0A         */%0A        public void layoutNext(Context context, ViewGroup parent, SceneCut cut);%0A%0A        /**%0A         * Layout the previous (outgoing) scene.
+that the view should be attached to%0A         * @param nextView the view to attach to the parent%0A         * @param direction the direction of the scene transition%0A         */%0A        public void layoutIncoming(ViewGroup parent, View nextView, Flow.Direction direction);%0A%0A        /**%0A         *
  Whe
@@ -3038,24 +3038,24 @@
 ns, the 
-previous
+outgoing
  scene m
@@ -3060,44 +3060,24 @@
  may
-%0A         * (but is not necessarily)
+ (optionally) be
  det
@@ -3121,35 +3121,61 @@
 ram 
-contex
+paren
 t the 
-cur
+pa
 rent 
-context
+that the view should be attached to
 %0A   
@@ -3190,37 +3190,27 @@
 @param p
-a
 re
-nt the parent that
+viousView
  the vie
@@ -3215,31 +3215,33 @@
 iew 
-should be
+to
  detach
-ed
  from
+ the parent
 %0A   
@@ -3259,167 +3259,164 @@
 ram 
-cut contains the next and previous scene, and the flow direction%0A         */%0A        public void layoutPrevious(Context context, ViewGroup parent, SceneCut cut
+direction the direction of the scene transition%0A         */%0A        public void layoutOutgoing(ViewGroup parent, View previousView, Flow.Direction direction
 );%0A 

Simplify the Rigger. It no longer requires a SceneCut or a Context, just a parent, a child and a flow direction.