Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create_post_activity); ButterKnife.inject(this); final CreatePostPresenter createPostPresenter = new CreatePostPresenter(AndroidSchedulers.mainThread(), FakeDagger.getPostsDaoInstance(getApplicationContext())); MoreViewObservables.navigationClick(toolbar) .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(createPostPresenter.navigationClickObserver()); createPostPresenter.closeActivityObservable() .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(new Action1<Object>() { @Override public void call(Object o) { finish(); } }); ViewObservable.clicks(acceptButton) .map(new Func1<OnClickEvent, Object>() { @Override public Object call(OnClickEvent onClickEvent) { return new Object(); } }) .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(createPostPresenter.sendObservable()); WidgetObservable.text(bodyText) .map(new OnTextChangeAction()) .compose(lifecycleMainObservable.<String>bindLifecycle()) .subscribe(createPostPresenter.bodyObservable()); WidgetObservable.text(nameText) .map(new OnTextChangeAction()) .compose(lifecycleMainObservable.<String>bindLifecycle()) .subscribe(createPostPresenter.nameObservable()); createPostPresenter.finishActivityObservable() .compose(lifecycleMainObservable.<Response>bindLifecycle()) .subscribe(new Action1<Response>() { @Override public void call(Response response) { finish(); } }); createPostPresenter.postErrorObservable() .compose(lifecycleMainObservable.<Throwable>bindLifecycle()) .subscribe(new Action1<Throwable>() { @Override public void call(Throwable throwable) { Toast.makeText(getApplicationContext(), R.string.create_post_error_message, Toast.LENGTH_SHORT).show(); } }); createPostPresenter.errorObservable() .map(ErrorHelper.mapThrowableToStringError()) .compose(lifecycleMainObservable.<String>bindLifecycle()) .subscribe(ViewActions.setText(error)); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create_post_activity); ButterKnife.inject(this); toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); final CreatePostPresenter presenter = new CreatePostPresenter( FakeDagger.getPostsDaoInstance(getApplicationContext())); MoreViewObservables.navigationClick(toolbar) .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(presenter.navigationClickObserver()); ViewObservable.clicks(acceptButton) .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(presenter.sendObservable()); WidgetObservable.text(bodyText) .map(new OnTextChangeAction()) .compose(lifecycleMainObservable.<String>bindLifecycle()) .subscribe(presenter.bodyObservable()); WidgetObservable.text(nameText) .map(new OnTextChangeAction()) .compose(lifecycleMainObservable.<String>bindLifecycle()) .subscribe(presenter.nameObservable()); presenter.finishActivityObservable() .compose(lifecycleMainObservable.bindLifecycle()) .subscribe(new Action1<Object>() { @Override public void call(Object response) { finish(); } }); presenter.postErrorObservable() .compose(lifecycleMainObservable.<Throwable>bindLifecycle()) .subscribe(new Action1<Throwable>() { @Override public void call(Throwable throwable) { Toast.makeText(getApplicationContext(), R.string.create_post_error_message, Toast.LENGTH_SHORT).show(); } }); presenter.progressObservable() .compose(lifecycleMainObservable.<Boolean>bindLifecycle()) .subscribe(ViewActions.setVisibility(progress, View.INVISIBLE)); presenter.showBodyIsEmptyErrorObservable() .compose(lifecycleMainObservable.bindLifecycle()) .map(Functions1.returnJust(getString(R.string.create_post_empty_body_error))) .subscribe(MoreViewActions.showError(bodyText)); presenter.showNameIsEmptyErrorObservable() .compose(lifecycleMainObservable.bindLifecycle()) .map(Functions1.returnJust(getString(R.string.create_post_empty_name_error))) .subscribe(MoreViewActions.showError(nameText)); }