An open API service indexing awesome lists of open source software.

https://github.com/hichamboushaba/reactivecompass

A small library that wraps orientation sensors listeners into RxJava2
https://github.com/hichamboushaba/reactivecompass

android rxjava2 sensors

Last synced: about 1 month ago
JSON representation

A small library that wraps orientation sensors listeners into RxJava2

Awesome Lists containing this project

README

          

# ReactiveCompass
A small library that wraps orientation sensors listeners into [RxJava2](https://github.com/ReactiveX/RxJava) observables

To use:
```kotlin
val compass = Compass(this)
compass.observeAzimuth()
.distinctUntilChanged({ i1, i2 -> Math.abs(i1 - i2) < 1 })
.subscribe { println("Azimuth: ${it.toInt()}") }
compass.observeAccuracy()
.distinctUntilChanged()
.map {
when (it) {
ICompass.Accuracy.ACCURATE -> "Accurate"
ICompass.Accuracy.MEDIUM -> "Medium"
ICompass.Accuracy.NOT_ACCURATE -> "Inaccurate"
}
}
.subscribe { println("Accuracy: $it") }
```