RxLifecycleMoxy

Additional

Language
Java
Version
N/A
Created
Feb 21, 2017
Updated
Feb 22, 2017
Owner
Denis Nikiforov (Popalay)
Contributor
Denis Nikiforov (Popalay)
1
Activity
Badge
Generate
Download
Source code
APK file

Announcement

Rx Realm

The utility for automatic completion of sequences based on Moxy Presenter lifecycle events

Getting Started

compile 'com.github.popalay:rx-lifecycle-moxy:latest-version'

Usage

@InjectViewState
public class ChatPresenter extends RxPresenter<ChatView> {

    @Inject ChatInteractor mChatInteractor;

    public ChatPresenter() {
        App.get().getSessionComponent().inject(this);
    }

    @Override
    protected void onFirstViewAttach() {
        super.onFirstViewAttach();

        mChatInteractor.listenMessages()
                .compose(bindToLifecycle())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(getViewState::setMessages, this::handleBaseError);
    }
}

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.