コード例 #1
0
  @Override
  protected void onDestroy() {
    activityPresenter.dropView(this);

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

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

    super.onDestroy();
  }
コード例 #2
0
  @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);
  }
コード例 #3
0
 @Override
 public void onLowMemory() {
   super.onLowMemory();
   activityPresenter.onLowMemory();
 }
コード例 #4
0
 @Override
 protected void onPause() {
   activityPresenter.onPause();
   super.onPause();
 }
コード例 #5
0
 @Override
 protected void onResume() {
   super.onResume();
   activityPresenter.onResume();
 }