// Path: sample/src/main/java/mortar/lib/sample/activity/MainActivity.java
// public class MainActivity extends MortarActivity {
// 
//   @Override protected void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     setContentView(R.layout.activity_main);
//   }
// 
//   @Override protected Blueprint getNewActivityScreen() {
//     return new ActivityScreen();
//   }
// 
// }
// 
// Path: sample/src/main/java/mortar/lib/sample/application/SampleModule.java
// @Module(
//     injects = {
//         MainActivity.class
//     },
//     library = true
// )
// public class SampleModule {
//   
//   private SampleApplication mApplication;
//   
//   public SampleModule(SampleApplication application) {
//     mApplication = application;
//   }
//   
//   @Provides @Singleton Gson provideGson() {
//     return new GsonBuilder()
//         .create();
//   }
// 
//   @Provides @Singleton Parcer<Object> provideParcer(Gson gson) {
//     return new GsonParcer<Object>(gson);
//   }
// }
// 
// Path: lib/src/main/java/mortar/lib/screen/FlowOwner.java
// public abstract class FlowOwner<S extends Blueprint, V extends View & CanShowScreen<S>>
//     extends ViewPresenter<V> implements Flow.Listener {
// 
//   private static final String FLOW_KEY = "FLOW_KEY";
// 
//   private final Parcer<Object> parcer;
// 
//   private Flow flow;
// 
//   protected FlowOwner(Parcer<Object> parcer) {
//     this.parcer = parcer;
//   }
// 
//   @Override public void onLoad(Bundle savedInstanceState) {
//     super.onLoad(savedInstanceState);
//     if (flow == null) {
//       Backstack backstack;
// 
//       if (savedInstanceState != null) {
//         backstack = Backstack.from(savedInstanceState.getParcelable(FLOW_KEY), parcer);
//       } else {
//         backstack = Backstack.fromUpChain(getFirstScreen());
//       }
// 
//       flow = new Flow(backstack, this);
//     }
// 
//     //noinspection unchecked
//     showScreen((S) flow.getBackstack().current().getScreen(), null);
//   }
// 
//   @Override public void onSave(Bundle outState) {
//     super.onSave(outState);
//     outState.putParcelable(FLOW_KEY, flow.getBackstack().getParcelable(parcer));
//   }
// 
//   @Override public void go(Backstack backstack, Flow.Direction flowDirection) {
//     //noinspection unchecked
//     S newScreen = (S) backstack.current().getScreen();
//     showScreen(newScreen, flowDirection);
//   }
// 
//   public boolean onRetreatSelected() {
//     return getFlow().goBack();
//   }
// 
//   public boolean onUpSelected() {
//     return getFlow().goUp();
//   }
// 
//   protected void showScreen(S newScreen, Flow.Direction flowDirection) {
//     V view = getView();
//     if (view == null) return;
// 
//     view.showScreen(newScreen, flowDirection);
//   }
// 
//   public final Flow getFlow() {
//     return flow;
//   }
// 
//   /** Returns the first screen shown by this presenter. */
//   protected abstract S getFirstScreen();
// 
// }
// 
// Path: sample/src/main/java/view/ActivityView.java
// public class ActivityView extends FlowOwnerView implements CanShowScreen<Blueprint> {
// 
//   @Inject ActivityScreen.Presenter mPresenter;
// 
//   public ActivityView(Context context, AttributeSet attrs) {
//     super(context, attrs);
//   }
// 
//   @Override protected FlowOwner getPresenter() {
//     return mPresenter;
//   }
// 
//   @Override public void showScreen(Blueprint screen, Flow.Direction direction) {
//     super.showScreen(screen, direction);
//   }
// 
//   @Override protected AbstractScreenConductor createScreenConductor(Context context) {
//     return new AnimatedScreenConductor(context, ActivityView.this);
//   }
// 
// }


import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.Provides;
import flow.Flow;
import flow.Parcer;
import mortar.Blueprint;
import mortar.lib.sample.activity.MainActivity;
import mortar.lib.sample.application.SampleModule;
import mortar.lib.screen.FlowOwner;
import view.ActivityView;
package mortar.lib.sample.screen;



public class ActivityScreen implements Blueprint {

  public ActivityScreen() {
  }

  @Override public String getMortarScopeName() {
    return ActivityScreen.class.getName();
  }

  @Override public Object getDaggerModule() {
    return new Module();
  }

  @dagger.Module(
      addsTo = SampleModule.class,
      injects = {
          MainActivity.class,
          ActivityView.class,
      },
      library = true
  )
  public class Module {
    @Provides @Singleton Flow provideFlow(Presenter presenter) {
      return presenter.getFlow();
    }
  }

// Path: sample/src/main/java/mortar/lib/sample/activity/MainActivity.java
// public class MainActivity extends MortarActivity {
// 
//   @Override protected void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     setContentView(R.layout.activity_main);
//   }
// 
//   @Override protected Blueprint getNewActivityScreen() {
//     return new ActivityScreen();
//   }
// 
// }
// 
// Path: sample/src/main/java/mortar/lib/sample/application/SampleModule.java
// @Module(
//     injects = {
//         MainActivity.class
//     },
//     library = true
// )
// public class SampleModule {
//   
//   private SampleApplication mApplication;
//   
//   public SampleModule(SampleApplication application) {
//     mApplication = application;
//   }
//   
//   @Provides @Singleton Gson provideGson() {
//     return new GsonBuilder()
//         .create();
//   }
// 
//   @Provides @Singleton Parcer<Object> provideParcer(Gson gson) {
//     return new GsonParcer<Object>(gson);
//   }
// }
// 
// Path: lib/src/main/java/mortar/lib/screen/FlowOwner.java
// public abstract class FlowOwner<S extends Blueprint, V extends View & CanShowScreen<S>>
//     extends ViewPresenter<V> implements Flow.Listener {
// 
//   private static final String FLOW_KEY = "FLOW_KEY";
// 
//   private final Parcer<Object> parcer;
// 
//   private Flow flow;
// 
//   protected FlowOwner(Parcer<Object> parcer) {
//     this.parcer = parcer;
//   }
// 
//   @Override public void onLoad(Bundle savedInstanceState) {
//     super.onLoad(savedInstanceState);
//     if (flow == null) {
//       Backstack backstack;
// 
//       if (savedInstanceState != null) {
//         backstack = Backstack.from(savedInstanceState.getParcelable(FLOW_KEY), parcer);
//       } else {
//         backstack = Backstack.fromUpChain(getFirstScreen());
//       }
// 
//       flow = new Flow(backstack, this);
//     }
// 
//     //noinspection unchecked
//     showScreen((S) flow.getBackstack().current().getScreen(), null);
//   }
// 
//   @Override public void onSave(Bundle outState) {
//     super.onSave(outState);
//     outState.putParcelable(FLOW_KEY, flow.getBackstack().getParcelable(parcer));
//   }
// 
//   @Override public void go(Backstack backstack, Flow.Direction flowDirection) {
//     //noinspection unchecked
//     S newScreen = (S) backstack.current().getScreen();
//     showScreen(newScreen, flowDirection);
//   }
// 
//   public boolean onRetreatSelected() {
//     return getFlow().goBack();
//   }
// 
//   public boolean onUpSelected() {
//     return getFlow().goUp();
//   }
// 
//   protected void showScreen(S newScreen, Flow.Direction flowDirection) {
//     V view = getView();
//     if (view == null) return;
// 
//     view.showScreen(newScreen, flowDirection);
//   }
// 
//   public final Flow getFlow() {
//     return flow;
//   }
// 
//   /** Returns the first screen shown by this presenter. */
//   protected abstract S getFirstScreen();
// 
// }
// 
// Path: sample/src/main/java/view/ActivityView.java
// public class ActivityView extends FlowOwnerView implements CanShowScreen<Blueprint> {
// 
//   @Inject ActivityScreen.Presenter mPresenter;
// 
//   public ActivityView(Context context, AttributeSet attrs) {
//     super(context, attrs);
//   }
// 
//   @Override protected FlowOwner getPresenter() {
//     return mPresenter;
//   }
// 
//   @Override public void showScreen(Blueprint screen, Flow.Direction direction) {
//     super.showScreen(screen, direction);
//   }
// 
//   @Override protected AbstractScreenConductor createScreenConductor(Context context) {
//     return new AnimatedScreenConductor(context, ActivityView.this);
//   }
// 
// }


// Path: sample/src/main/java/mortar/lib/sample/screen/ActivityScreen.java
import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.Provides;
import flow.Flow;
import flow.Parcer;
import mortar.Blueprint;
import mortar.lib.sample.activity.MainActivity;
import mortar.lib.sample.application.SampleModule;
import mortar.lib.screen.FlowOwner;
import view.ActivityView;

package mortar.lib.sample.screen;



public class ActivityScreen implements Blueprint {

  public ActivityScreen() {
  }

  @Override public String getMortarScopeName() {
    return ActivityScreen.class.getName();
  }

  @Override public Object getDaggerModule() {
    return new Module();
  }

  @dagger.Module(
      addsTo = SampleModule.class,
      injects = {
          MainActivity.class,
          ActivityView.class,
      },
      library = true
  )
  public class Module {
    @Provides @Singleton Flow provideFlow(Presenter presenter) {
      return presenter.getFlow();
    }
  }

  @Singleton public static class Presenter extends FlowOwner<Blueprint, ActivityView> {