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

io.nextop.v15.rx.RxFragment Maven / Gradle / Ivy

The newest version!
package io.nextop.v15.rx;

import android.app.Fragment;
import io.nextop.rx.RxLifecycleBinder;
import rx.Observable;
import rx.Subscription;

// connects to the fragment lifecycle (on resume, on pause)
public class RxFragment extends Fragment 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();
        liftedRxLifecycleBinder.connect(getView());
    }

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy