Skip to content
A minimal Android library to handle heavy works in worker threads
Kotlin Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
peanut
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

peanut

Android Arsenal
A minimal Android library to handle heavy works in worker threads easily.

How to use?

It's really easy to use.

Create your peanut.

val peanut = object : Peanut<String>() {
            override fun call() {
                var count = 0
                for (i in 0 until 100000) {
                    count += count
                }
                onSuccess(count.toString())
            }
}

and Schedule it

peanut.runOn(Schedulers.io())
                .receiveOn(Schedulers.main())
                .run(object : Peanut.Subscriber<String> {

                    override fun onComplete(data: String) {
                        count.text = data
                    }

                    override fun onError(e: Error) {
                        e.printStackTrace()
                    }
})

Dependency

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency

dependencies {
	 implementation 'com.github.savepopulation:peanut:v1.0.0'
}
You can’t perform that action at this time.