Search in sources :

Example 6 with MetaChangedEvent

use of io.hefuyi.listener.event.MetaChangedEvent in project ListenerMusicPlayer by hefuyicoder.

the class SongsFragment method subscribeMetaChangedEvent.

private void subscribeMetaChangedEvent() {
    Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {

        @Override
        public void call(MetaChangedEvent event) {
            mAdapter.notifyDataSetChanged();
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
        }
    });
    RxBus.getInstance().addSubscription(this, subscription);
}
Also used : MetaChangedEvent(io.hefuyi.listener.event.MetaChangedEvent) Subscription(rx.Subscription)

Example 7 with MetaChangedEvent

use of io.hefuyi.listener.event.MetaChangedEvent in project ListenerMusicPlayer by hefuyicoder.

the class FolderSongsFragment method subscribeMetaChangedEvent.

private void subscribeMetaChangedEvent() {
    Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {

        @Override
        public void call(MetaChangedEvent event) {
            mAdapter.notifyDataSetChanged();
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
        }
    });
    RxBus.getInstance().addSubscription(this, subscription);
}
Also used : MetaChangedEvent(io.hefuyi.listener.event.MetaChangedEvent) Subscription(rx.Subscription)

Example 8 with MetaChangedEvent

use of io.hefuyi.listener.event.MetaChangedEvent in project ListenerMusicPlayer by hefuyicoder.

the class PanelSlideListener method subscribeMetaChangedEvent.

private void subscribeMetaChangedEvent() {
    Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {

        @Override
        public void call(MetaChangedEvent event) {
            caculateTitleAndArtist();
            if (TextUtils.isEmpty(MusicPlayer.getTrackName()) || TextUtils.isEmpty(MusicPlayer.getArtistName())) {
                if (mStatus == Status.EXPANDED || mStatus == Status.FULLSCREEN) {
                    mPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
                }
                mPanelLayout.setTouchEnabled(false);
            } else {
                mPanelLayout.setTouchEnabled(true);
            }
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
        }
    });
    RxBus.getInstance().addSubscription(this, subscription);
}
Also used : MetaChangedEvent(io.hefuyi.listener.event.MetaChangedEvent) Subscription(rx.Subscription)

Example 9 with MetaChangedEvent

use of io.hefuyi.listener.event.MetaChangedEvent in project ListenerMusicPlayer by hefuyicoder.

the class AlbumDetailFragment method subscribeMetaChangedEvent.

private void subscribeMetaChangedEvent() {
    Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {

        @Override
        public void call(MetaChangedEvent event) {
            mAdapter.notifyDataSetChanged();
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
        }
    });
    RxBus.getInstance().addSubscription(this, subscription);
}
Also used : MetaChangedEvent(io.hefuyi.listener.event.MetaChangedEvent) Subscription(rx.Subscription)

Example 10 with MetaChangedEvent

use of io.hefuyi.listener.event.MetaChangedEvent in project ListenerMusicPlayer by hefuyicoder.

the class MainActivity method subscribeMetaChangedEvent.

private void subscribeMetaChangedEvent() {
    Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {

        @Override
        public void call(MetaChangedEvent event) {
            setDetailsToHeader();
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
        }
    });
    RxBus.getInstance().addSubscription(this, subscription);
}
Also used : MetaChangedEvent(io.hefuyi.listener.event.MetaChangedEvent) Subscription(rx.Subscription)

Aggregations

MetaChangedEvent (io.hefuyi.listener.event.MetaChangedEvent)10 Subscription (rx.Subscription)10