Giter Site home page Giter Site logo

amitshekhariitbhu / rxjava2-android-samples Goto Github PK

View Code? Open in Web Editor NEW
5.0K 187.0 1.1K 494 KB

RxJava 2 Android Examples - How to use RxJava 2 in Android

Home Page: https://amitshekhar.me

License: Apache License 2.0

Java 100.00%
rxjava android rxjava2 rxandroid example sample tutorial tutorials examples samples

rxjava2-android-samples's Issues

Simple Real-world app example

Hi
Great work you have done here. If possible can you include a real-world app example for clearer picture of RXJava2 can do? News feed reader maybe?

Thanks

ThrottleFirstExampleActivity注释写错了

private Observable getObservable() {
return Observable.create(new ObservableOnSubscribe() {
@OverRide
public void subscribe(ObservableEmitter emitter) throws Exception {
// send events with simulated time wait
//下面的注释是作者原注释,我觉得不太对,因为这个运行的结果是1,3,7被发送出来了
Thread.sleep(0);
emitter.onNext(1); // skip
emitter.onNext(2); // deliver
Thread.sleep(505);
emitter.onNext(3); // skip
Thread.sleep(99);
emitter.onNext(4); // skip
Thread.sleep(100);
emitter.onNext(5); // skip
emitter.onNext(6); // deliver
Thread.sleep(305);
emitter.onNext(7); // deliver
Thread.sleep(510);
emitter.onComplete();
}
});
}
下面的注释应该是ThrottleLast的结果,和ThrottleFirst的不符

Thread Interrupted

Any idea how to handle "thread interrupted"?

This happens due to calling the instant search api!

Thank you.

In SearchActivity error?

When I click on keyboard button "actionSearch" observer call "onComplete" and observable do not react on text changed event.

In ReplayExampleActivity,the repaly error?

The log is :
First onSubscribe : false
First onNext value : 1
First onNext value : 2
First onNext value : 3
First onNext value : 4
First onComplete
Second onSubscribe : false
Second onNext value : 1
Second onNext value : 2
Second onNext value : 3
Second onNext value : 4
Second onComplete

It is different from the comment "it will emit 2, 3, 4 as (count = 3), retains the 3 values for replay"

flowable and singleobserver

Hello, thank you for your perfect repo, but I have a question about Flowable, why did you use SingleObserver with Flowable maybe there is no error but I think logically is not correct because Flowable introduced for supporting backpressure and singleObserver introduced for single observable.Do you agree?

pagination with Fast Networking

Hi @amitshekhariitbhu !
i want to use pagination example with Fast Networking. but it does not work.could you create an example for this demo.thanks
this is my code:
private void subscribeForData() {
Disposable disposable = paginator
.onBackpressureDrop()
.concatMap(new Function<Integer, Publisher<List>>() {
@OverRide
public Publisher<List> apply(@nonnull final Integer page) {
loading = true;
progressBar.setVisibility(View.VISIBLE);
return dataFromNetwork(page);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<List>() {
@OverRide
public void accept(@nonnull List items) {
paginationAdapter.addItems(items);
paginationAdapter.notifyDataSetChanged();
loading = false;
progressBar.setVisibility(View.GONE);
}
});
compositeDisposable.add(disposable);
paginator.onNext(pageNumber);
}
private Flowable<List> dataFromNetwork(int page) {
return Rx2AndroidNetworking.get("https://fierce-cove-29863.herokuapp.com/getAllUsers/{pageNumber}")
.addPathParameter("pageNumber", String.valueOf(page))
.addQueryParameter("limit", "10")
.build()
.getObjectListFlowable(User.class);
}

Could you please add a complicated event bus(rxbus/rxbroadcast) sample?

Like Music Player
steps:
step1(listen to audio headphone jack plug in/plug out by system broadcast receiver)
step2(open Music Player Activity/view when head jack plugged in)
step3.1(listen to Play Button to Play Music | change to play UI(set textview1 to "play music"))
step3.2(listen to Pause Button to Pause Music | change to pause UI (set textview2 to "pause music"))
step4(when headphone jack plug out to Stop Music | change to stop UI (set textview3 to "stop music"))

Course Typo

qq 20171011153408

I don't known whether it's a typo as the arrow I point ?
I think it is subscriber and not publisher need to be handled,it is right ?

thx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.