use of com.jakewharton.rxbinding.widget.SeekBarStartChangeEvent in project Shuttle by timusus.
the class PlayerFragment method onResume.
@Override
public void onResume() {
super.onResume();
subscriptions = new CompositeSubscription();
Observable<SeekBarChangeEvent> sharedSeekBarEvents = RxSeekBar.changeEvents(seekBar).onBackpressureLatest().ofType(SeekBarChangeEvent.class).observeOn(AndroidSchedulers.mainThread()).share();
subscriptions.add(sharedSeekBarEvents.subscribe(seekBarChangeEvent -> {
if (seekBarChangeEvent instanceof SeekBarStartChangeEvent) {
isSeeking = true;
} else if (seekBarChangeEvent instanceof SeekBarStopChangeEvent) {
isSeeking = false;
}
}));
subscriptions.add(sharedSeekBarEvents.ofType(SeekBarProgressChangeEvent.class).filter(SeekBarProgressChangeEvent::fromUser).debounce(15, TimeUnit.MILLISECONDS).subscribe(seekBarChangeEvent -> presenter.seekTo(seekBarChangeEvent.progress())));
}
Aggregations