io.nextop.v15.rx.RxFragment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-v15 Show documentation
Show all versions of android-v15 Show documentation
Nextop client for Android 15+
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();
}
}