RxBattery
Android library monitoring battery state of the device with RxJava and RxKotlin.
Usage
In the Kotlin application, you can use library as follows:
In the Java application, you can use library as follows:
BatteryState
data class looks as follows:
All Integer
values returned by BatteryState
object are reflected in constants of BatteryManager
class from the Android SDK. Enums Status
, Plugged
and Health
represents battery state translated from integer codes from BatteryManager
class.
Examples
Exemplary Kotlin application is located in app-kotlin
directory.
Download
You can depend on the library through Gradle:
Tests
Tests are available in library/src/test/kotlin/
directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:
./gradlew test
Code style
Code style used in the project is called SquareAndroid
from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.
Static code analysis
Static code analysis runs Checkstyle, FindBugs, PMD, Lint, KtLint and Detekt. It can be executed with command:
./gradlew check
Reports from analysis are generated in library/build/reports/
directory.
JavaDoc
Documentation can be generated as follows:
./gradlew dokka
Output will be generated in library/build/javadoc
JavaDoc can be viewed on-line at https://pwittchen.github.io/RxBattery/library/