private Observer<Timed<Long>> getObserver() { return new Observer<Timed<Long>>() { @Override public void onSubscribe(Disposable d) { Log.d(TAG, " onSubscribe : " + d.isDisposed()); } @Override public void onNext(Timed<Long> value) { textView.append(" onNext : value : " + value); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onNext : value : " + value); } @Override public void onError(Throwable e) { textView.append(" onError : " + e.getMessage()); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onError : " + e.getMessage()); } @Override public void onComplete() { textView.append(" onComplete"); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onComplete"); } }; }
private Observer<Timed<String>> getObserver() { return new Observer<Timed<String>>() { @Override public void onSubscribe(Disposable d) { Log.d(TAG, " onSubscribe : " + d.isDisposed()); } @Override public void onNext(Timed<String> value) { textView.append(" onNext : value : " + value.value() + ", time:" + value.time()); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onNext : value : " + value); } @Override public void onError(Throwable e) { textView.append(" onError : " + e.getMessage()); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onError : " + e.getMessage()); } @Override public void onComplete() { textView.append(" onComplete"); textView.append(AppConstant.LINE_SEPARATOR); Log.d(TAG, " onComplete"); } }; }
@VisibleForTesting static Flowable<Integer> detect(Flowable<Integer> clicks, final long maxIntervalMillis, final int minComboTimesCared) { return clicks.timestamp() .scan((lastOne, thisOne) -> { if (thisOne.time() - lastOne.time() <= maxIntervalMillis) { return new Timed<>(lastOne.value() + 1, thisOne.time(), thisOne.unit()); } else { return new Timed<>(1, thisOne.time(), thisOne.unit()); } }) .map(Timed::value) .filter(combo -> combo >= minComboTimesCared); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timeInterval() { return boxed.timeInterval(); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timeInterval(Scheduler scheduler) { return boxed.timeInterval(scheduler); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timeInterval(TimeUnit unit) { return boxed.timeInterval(unit); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timeInterval(TimeUnit unit, Scheduler scheduler) { return boxed.timeInterval(unit, scheduler); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timestamp() { return boxed.timestamp(); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timestamp(Scheduler scheduler) { return boxed.timestamp(scheduler); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timestamp(TimeUnit unit) { return boxed.timestamp(unit); }
@CheckReturnValue @SchedulerSupport("none") public Observable<Timed<T>> timestamp(TimeUnit unit, Scheduler scheduler) { return boxed.timestamp(unit, scheduler); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timeInterval() { return boxed.timeInterval(); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timeInterval(io.reactivex.Scheduler scheduler) { return boxed.timeInterval(scheduler); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timeInterval(TimeUnit unit) { return boxed.timeInterval(unit); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timeInterval(TimeUnit unit, io.reactivex.Scheduler scheduler) { return boxed.timeInterval(unit, scheduler); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timestamp() { return boxed.timestamp(); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timestamp(io.reactivex.Scheduler scheduler) { return boxed.timestamp(scheduler); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timestamp(TimeUnit unit) { return boxed.timestamp(unit); }
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport("none") public Flowable<Timed<T>> timestamp(TimeUnit unit, io.reactivex.Scheduler scheduler) { return boxed.timestamp(unit, scheduler); }