Search in sources :

Example 31 with CompositeSubscription

use of rx.subscriptions.CompositeSubscription in project ListenerMusicPlayer by hefuyicoder.

the class FolderPresenter method attachView.

@Override
public void attachView(FoldersContract.View view) {
    this.mView = view;
    mCompositeSubscription = new CompositeSubscription();
}
Also used : CompositeSubscription(rx.subscriptions.CompositeSubscription)

Example 32 with CompositeSubscription

use of rx.subscriptions.CompositeSubscription in project ListenerMusicPlayer by hefuyicoder.

the class SongsPresenter method attachView.

@Override
public void attachView(SongsContract.View view) {
    mView = view;
    mCompositeSubscription = new CompositeSubscription();
}
Also used : CompositeSubscription(rx.subscriptions.CompositeSubscription)

Example 33 with CompositeSubscription

use of rx.subscriptions.CompositeSubscription in project realm-rxjava-example by kboyarshinov.

the class MainActivity method addNewIssue.

private void addNewIssue() {
    if (compositeSubscription == null) {
        return;
    }
    String title = "Feature request: removing issues";
    String body = "Add function to remove issues";
    User user = new User("kboyarshinov");
    List<Label> labels = new ArrayList<>();
    labels.add(new Label("feature", "FF5722"));
    Subscription subscription = dataService.newIssue(title, body, user, labels).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Action1<Issue>() {

        @Override
        public void call(Issue issue) {
            Log.d(TAG, "Issue with title " + issue.getTitle() + " successfully saved");
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            Log.e(TAG, "Add new issue error", throwable);
        }
    });
    compositeSubscription.add(subscription);
}
Also used : User(com.kboyarshinov.realmrxjavaexample.model.User) Issue(com.kboyarshinov.realmrxjavaexample.model.Issue) ArrayList(java.util.ArrayList) Label(com.kboyarshinov.realmrxjavaexample.model.Label) CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription)

Example 34 with CompositeSubscription

use of rx.subscriptions.CompositeSubscription in project realm-rxjava-example by kboyarshinov.

the class MainActivity method requestAllIssues.

private void requestAllIssues() {
    if (compositeSubscription == null) {
        return;
    }
    Subscription subscription = dataService.issuesList().observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Action1<List<Issue>>() {

        @Override
        public void call(List<Issue> issues) {
            Log.d(TAG, "Issues received with size " + issues.size());
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            Log.e(TAG, "Request all issues error", throwable);
        }
    });
    compositeSubscription.add(subscription);
}
Also used : Issue(com.kboyarshinov.realmrxjavaexample.model.Issue) ArrayList(java.util.ArrayList) List(java.util.List) CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription)

Example 35 with CompositeSubscription

use of rx.subscriptions.CompositeSubscription in project Shuttle by timusus.

the class SearchActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    if (subscriptions == null || subscriptions.isUnsubscribed()) {
        subscriptions = new CompositeSubscription();
    }
    refreshAdapterItems();
    if (searchView != null) {
        subscriptions.add(getSearchViewSubscription());
    }
}
Also used : CompositeSubscription(rx.subscriptions.CompositeSubscription)

Aggregations

CompositeSubscription (rx.subscriptions.CompositeSubscription)49 ArrayList (java.util.ArrayList)9 View (android.view.View)7 Subscription (rx.Subscription)7 Context (android.content.Context)6 Bundle (android.os.Bundle)6 AndroidSchedulers (rx.android.schedulers.AndroidSchedulers)6 Intent (android.content.Intent)5 AppCompatActivity (android.support.v7.app.AppCompatActivity)5 RecyclerView (android.support.v7.widget.RecyclerView)5 ViewGroup (android.view.ViewGroup)5 List (java.util.List)5 Schedulers (rx.schedulers.Schedulers)5 MenuItem (android.view.MenuItem)4 Issue (com.kboyarshinov.realmrxjavaexample.model.Issue)4 ActionBar (android.support.v7.app.ActionBar)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 Menu (android.view.Menu)3 TextView (android.widget.TextView)3 TwitterStringUtils (com.github.moko256.twicalico.text.TwitterStringUtils)3