Search in sources :

Example 1 with SeekBarStopChangeEvent

use of com.jakewharton.rxbinding.widget.SeekBarStopChangeEvent 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())));
}
Also used : R(com.simplecity.amp_library.R) ImageButton(android.widget.ImageButton) Bundle(android.os.Bundle) SizableSeekBar(com.simplecity.amp_library.ui.views.SizableSeekBar) DrawableUtils(com.simplecity.amp_library.utils.DrawableUtils) AndroidSchedulers(rx.android.schedulers.AndroidSchedulers) SeekBarStartChangeEvent(com.jakewharton.rxbinding.widget.SeekBarStartChangeEvent) Animator(android.animation.Animator) StringUtils(com.simplecity.amp_library.utils.StringUtils) Observable(rx.Observable) ColorStateList(android.content.res.ColorStateList) Song(com.simplecity.amp_library.model.Song) ThemeUtils(com.simplecity.amp_library.utils.ThemeUtils) ColorUtils(com.simplecity.amp_library.utils.ColorUtils) RepeatingImageButton(com.simplecity.amp_library.ui.views.RepeatingImageButton) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) PreferenceManager(android.preference.PreferenceManager) SeekBarChangeEvent(com.jakewharton.rxbinding.widget.SeekBarChangeEvent) SeekBarProgressChangeEvent(com.jakewharton.rxbinding.widget.SeekBarProgressChangeEvent) FloatingActionButton(android.support.design.widget.FloatingActionButton) LayoutInflater(android.view.LayoutInflater) MainActivity(com.simplecity.amp_library.ui.activities.MainActivity) ObjectAnimator(android.animation.ObjectAnimator) Fragment(android.support.v4.app.Fragment) PlayPauseView(com.simplecity.amp_library.ui.views.PlayPauseView) TextUtils(android.text.TextUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) RxSeekBar(com.jakewharton.rxbinding.widget.RxSeekBar) MusicUtils(com.simplecity.amp_library.utils.MusicUtils) TimeUnit(java.util.concurrent.TimeUnit) CompositeSubscription(rx.subscriptions.CompositeSubscription) PlayerView(com.simplecity.amp_library.ui.views.PlayerView) TextView(android.widget.TextView) SharedPreferences(android.content.SharedPreferences) SeekBarStopChangeEvent(com.jakewharton.rxbinding.widget.SeekBarStopChangeEvent) MusicService(com.simplecity.amp_library.playback.MusicService) PlayerPresenter(com.simplecity.amp_library.ui.presenters.PlayerPresenter) Nullable(android.support.annotation.Nullable) FragmentTransaction(android.support.v4.app.FragmentTransaction) SeekBarStopChangeEvent(com.jakewharton.rxbinding.widget.SeekBarStopChangeEvent) CompositeSubscription(rx.subscriptions.CompositeSubscription) SeekBarStartChangeEvent(com.jakewharton.rxbinding.widget.SeekBarStartChangeEvent) SeekBarChangeEvent(com.jakewharton.rxbinding.widget.SeekBarChangeEvent)

Aggregations

Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 AnimatorSet (android.animation.AnimatorSet)1 ObjectAnimator (android.animation.ObjectAnimator)1 SharedPreferences (android.content.SharedPreferences)1 ColorStateList (android.content.res.ColorStateList)1 Bundle (android.os.Bundle)1 PreferenceManager (android.preference.PreferenceManager)1 Nullable (android.support.annotation.Nullable)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 Fragment (android.support.v4.app.Fragment)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 TextUtils (android.text.TextUtils)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ImageButton (android.widget.ImageButton)1 TextView (android.widget.TextView)1 RxSeekBar (com.jakewharton.rxbinding.widget.RxSeekBar)1 SeekBarChangeEvent (com.jakewharton.rxbinding.widget.SeekBarChangeEvent)1