示例#1
0
  /**
   * calls either #connect or #disconnect on the binder, depending on the view state. Call this
   * after a change to the view state.
   */
  private void evalBinder() {
    if (liftedRxLifecycleBinder.isClosed()) {
      // abort; already done
      return;
    }

    boolean connect;
    if (View.VISIBLE == getWindowVisibility()) {
      if (View.VISIBLE == getVisibility()) {
        boolean visible = true;
        for (ViewParent p = getParent(); visible && p instanceof View; p = p.getParent()) {
          visible &= View.VISIBLE == ((View) p).getVisibility();
        }
        connect = visible;
      } else {
        connect = false;
      }
    } else {
      connect = false;
    }
    if (connect) {
      liftedRxLifecycleBinder.connect(this);
    } else {
      liftedRxLifecycleBinder.disconnect();
    }
  }
示例#2
0
 public void cascadeDispose(@Nullable RxLifecycleBinder parent) {
   liftedRxLifecycleBinder.cascadeUnsubscribe(parent);
 }
示例#3
0
 public void onDispose() {
   liftedRxLifecycleBinder.close();
 }
示例#4
0
 @Override
 public boolean isUnsubscribed() {
   return liftedRxLifecycleBinder.isUnsubscribed();
 }
示例#5
0
 @Override
 public void unsubscribe() {
   liftedRxLifecycleBinder.unsubscribe();
 }
示例#6
0
 @Override
 public void bind(Subscription sub) {
   liftedRxLifecycleBinder.bind(sub);
 }
示例#7
0
 @Override
 public <T> Observable<T> bind(Observable<T> source) {
   return liftedRxLifecycleBinder.bind(source);
 }
示例#8
0
 @Override
 public boolean reset(Object id) {
   return liftedRxLifecycleBinder.reset(id);
 }
示例#9
0
 @Override
 public void reset() {
   liftedRxLifecycleBinder.reset();
 }