All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nextop.rx.RxActivity Maven / Gradle / Ivy

The newest version!
package io.nextop.rx;

import android.app.Activity;
import android.view.View;
import rx.Observable;
import rx.Subscription;

public class RxActivity extends Activity implements RxLifecycleBinder {


    private final RxLifecycleBinder.Lifted liftedRxLifecycleBinder = new RxLifecycleBinder.Lifted();






    @Override
    public void reset() {
        liftedRxLifecycleBinder.reset();
    }

    @Override
    public boolean reset(Object id) {
        return liftedRxLifecycleBinder.reset(id);
    }

    @Override
    public  Observable bind(Observable source) {
        return liftedRxLifecycleBinder.bind(source);
    }

    @Override
    public void bind(Subscription sub) {
        liftedRxLifecycleBinder.bind(sub);
    }

    @Override
    public void unsubscribe() {
        liftedRxLifecycleBinder.unsubscribe();
    }

    @Override
    public boolean isUnsubscribed() {
        return liftedRxLifecycleBinder.isUnsubscribed();
    }

    @Override
    public void onResume() {
        super.onResume();

        View contentView = findViewById(android.R.id.content);
        liftedRxLifecycleBinder.connect(contentView);
    }

    @Override
    public void onPause() {
        super.onPause();
        liftedRxLifecycleBinder.disconnect();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        liftedRxLifecycleBinder.close();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy