{"id":18660396,"url":"https://github.com/patrick-doyle/android-rx-schedulers","last_synced_at":"2025-07-11T08:41:42.531Z","repository":{"id":152359162,"uuid":"65680515","full_name":"patrick-doyle/android-rx-schedulers","owner":"patrick-doyle","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-13T23:40:11.000Z","size":330,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-27T16:09:39.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrick-doyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-14T18:26:50.000Z","updated_at":"2017-04-14T10:32:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"2819f36b-80da-4cef-a726-09cab1d863c1","html_url":"https://github.com/patrick-doyle/android-rx-schedulers","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick-doyle%2Fandroid-rx-schedulers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick-doyle%2Fandroid-rx-schedulers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick-doyle%2Fandroid-rx-schedulers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick-doyle%2Fandroid-rx-schedulers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrick-doyle","download_url":"https://codeload.github.com/patrick-doyle/android-rx-schedulers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239478770,"owners_count":19645601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:43:33.602Z","updated_at":"2025-02-18T13:28:18.075Z","avatar_url":"https://github.com/patrick-doyle.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android Rx Android Schedulers\r\n\r\n```groovy\r\n    compile 'com.twistedequations.rx:rx-android-schedulers:1.1.0'\r\n```\r\n\r\nWrapper class around the RxSchedulers that can be used to make then injectable and thus can be swapped out for testing.\r\n\r\nThe `DefaultAndroidRxSchedulers` implementation is optimised for android by having the thread priority set to background to reduce interference with the main thread. \r\nThe threads are also named according to the thread pool.\r\n\r\nA network thread pool was added with a limit of 6 threads t0 prevent \r\n\r\n#### Usage\r\n\r\nCreate a single instance of `AndroidRxSchedulers` using one of the implementations, the Application subclass would be a good place to create it. This can be injected \r\ninto your presenter via a constructor. This allows you you swap out for the `TestAndroidRxSchedulers` version for unit tests which forces everything onto the main thread.\r\n\r\n```java\r\n\r\n    private final HomeView homeView;\r\n    private final HomeModel homeModel;\r\n    private final AndroidRxSchedulers androidRxSchedulers;\r\n\r\n    public HomePresenter(HomeView homeView, HomeModel homeModel, AndroidRxSchedulers androidRxSchedulers) {\r\n        this.homeView = homeView;\r\n        this.homeModel = homeModel;\r\n        this.androidRxSchedulers = androidRxSchedulers;\r\n    }\r\n    \r\n    ...//More code\r\n    \r\n    private Observable\u003cList\u003cRedditItem\u003e\u003e loadPostsObservable() {\r\n    return homeModel.postsForAll()\r\n        .subscribeOn(androidRxSchedulers.network())\r\n        .observeOn(androidRxSchedulers.mainThread());\r\n    }\r\n```\r\n\r\nIF you are already using the default schedulers you can use the `AndroidRxPlugin.applyRxJavaPlugins()` methods to set the default RxJava (eg `Schedulers.io()`)schedulers.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick-doyle%2Fandroid-rx-schedulers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrick-doyle%2Fandroid-rx-schedulers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick-doyle%2Fandroid-rx-schedulers/lists"}