ValueCounter
Android Value Counter Library.
Usage
For a working implementation of this project see the app/
folder.
Step 1
Add this in your root build.gradle at the end of repositories
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2
Include the library as a local library project or add the dependency in your build.gradle.
dependencies {
implementation 'com.github.Mohammed-Alaa:ValueCounter:1.0.0'
}
Step 3
Add the following xml to your layout file.
<com.mohammedalaa.valuecounterlib.ValueCounterView
app:valueColor="@color/black"
app:defaultValue="5"
app:addButton="@drawable/ic_add_24dp"
app:subButton="@drawable/ic_sub_24dp"
app:stepValue="1"
app:minValue="1"
app:maxValue="10"
app:labelColor="@color/colorPrimary"
app:labelText="EGP"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/valueCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.mohammedalaa.valuecounterlib.ValueCounterView>
Step 4
Reference the View in Java code.
ValueCounterView valueCounter= (ValueCounterView) findViewById(R.id.valueCounter);
getValue
valueCounter.getValue();