package com.kickstarter.libs;

import android.support.annotation.NonNull;
import android.support.v4.widget.SwipeRefreshLayout;

import com.jakewharton.rxbinding.support.v4.widget.RxSwipeRefreshLayout;
import com.kickstarter.R;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action0;
import rx.functions.Func0;

public final class SwipeRefresher {
  public SwipeRefresher(@NonNull final BaseActivity<? extends Presenter> activity,
    @NonNull final SwipeRefreshLayout layout,
    @NonNull final Action0 refreshAction,
    @NonNull final Func0<Observable<Boolean>> isRefreshing) {

    // Iterate through colors in loading spinner while waiting for refresh
    layout.setColorSchemeResources(R.color.green, R.color.green_darken_10, R.color.green_darken_20, R.color.green_darken_10);

    // Emits when user has signaled to refresh layout
    RxSwipeRefreshLayout.refreshes(layout)
      .compose(activity.bindToLifecycle())
      .subscribe(__ -> refreshAction.call());

    // Emits when the refreshing status changes. Hides loading spinner when feed is no longer refreshing.
    isRefreshing.call()
      .filter(fetching -> !fetching)
      .compose(activity.bindToLifecycle())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(layout::setRefreshing);
  }
}

@@ -384,16 +384,385 @@
 esher %7B%0A
+  /**%0A   *%0A   * @param activity Activity to bind lifecycle events for.%0A   * @param layout Layout to subscribe to for refresh events, send signals when no longer refreshing.%0A   * @param refreshAction Action to call when a refresh event is emitted, likely a presenter input.%0A   * @param isRefreshing Observable that emits events when the refreshing status changes.%0A   */%0A
   public
@@ -1520,20 +1520,22 @@
 .filter(
-fetc
+refres
 hing -%3E 
@@ -1539,12 +1539,14 @@
 -%3E !
-fetc
+refres
 hing

Add javadoc for params