A simple implementation of a counter custom view with android
simple-counter
This a simple implementation of a counter custom view.
Usage
Add the counter view to your layout to get started.
<com.davidodari.simplecounter.SimpleCounter
android:id="@+id/simpleCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Then to get the current value implement the listener
simpleCounter.setListener { value ->
Toast.makeText(this,"$value",Toast.LENGTH_SHORT).show()
}
Download
Add jitpack to project level build.gradle
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
Then add the library to module level build.gradle.
implementation 'com.github.Davidodari:simple-counter:$latest_release'