@Override
  protected void onDestroy() {
    activityPresenter.dropView(this);

    navigator.delegate().onDestroy();
    navigator = null;

    if (isFinishing() && scope != null) {
      scope.destroy();
      scope = null;
    }

    super.onDestroy();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    scope =
        ActivityArchitector.onCreateScope(
            this,
            savedInstanceState,
            new Architected() {
              @Override
              public Navigator createNavigator(MortarScope scope) {
                Navigator navigator = Navigator.create(scope, new Parceler());
                navigator
                    .transitions()
                    .register(
                        new TransitionsMapping()
                            .byDefault(new LateralViewTransition(new Config().duration(300))));
                return navigator;
              }

              @Override
              public void configureScope(MortarScope.Builder builder, MortarScope parentScope) {
                DemoActivityComponent component =
                    DaggerDemoActivityComponent.builder()
                        .demoAppComponent(
                            parentScope.<DemoAppComponent>getService(DaggerService.SERVICE_NAME))
                        .build();
                builder.withService(DaggerService.SERVICE_NAME, component);
              }
            });

    DaggerService.<DemoActivityComponent>get(this).inject(this);

    setContentView(R.layout.activity_root);
    ButterKnife.inject(this);

    navigator =
        ActivityArchitector.onCreateNavigator(
            this, savedInstanceState, containerView, new HomeStackable());

    activityPresenter.takeView(this);
  }
 @Override
 public void onLowMemory() {
   super.onLowMemory();
   activityPresenter.onLowMemory();
 }
 @Override
 protected void onPause() {
   activityPresenter.onPause();
   super.onPause();
 }
 @Override
 protected void onResume() {
   super.onResume();
   activityPresenter.onResume();
 }