MaterialCounterView

Additional

Language
Java
Version
0.1.2 (Nov 5, 2018)
Created
Nov 5, 2018
Updated
Nov 5, 2018 (Retired)
Owner
Baset Esmaeili (BasetEsmaeili)
Contributor
Baset Esmaeili (BasetEsmaeili)
1
Activity
Badge
Generate
Download
Source code

MaterialCounterView

a Android Library for counting anything

How to Download

Gradle

Step 1: add below code in your root build.gradle at the end of repositories:

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

Step 2: add below code in build.gradle dependency of app module

dependencies {
   implementation 'com.github.BasetEsmaeili:MaterialCounterView:0.1.2'

 }

How use this library

XML

<com.baset.mcounterview.MaterialCounterView
    android:id="@+id/myCounterView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

1- change add Button Icon

app:addButtonDrawable="@drawable/ic_arrow_forward_black_24dp"

2- change remove Button Icon

app:removeButtonDrawable="@drawable/ic_arrow_back_black_24dp"

3- change Buttons Icon Color

app:buttonsDrawableColor="@color/colorPrimary"

4- change count value Color

app:countTextColor="@color/colorAccent"

5- change background stroke color

app:roundBtnBackgroundColor="@color/colorPrimaryDark"

Java or Kotlin

Step 1: findViewById

val myCounterView:MaterialCounterView=findViewById(R.id.myCounterView)

Step 2:

Customization

1-this method return count

myCounterView.count

2-this method setFont on View

myCounterView.setTypeface(typeface)

3- this methods change Buttons Icon

myCounterView.setAddButtonDrawable(ContextCompat.getDrawable(baseContext,R.drawable.ic_arrow_forward_black_24dp))
myCounterView.setRemoveButtonDrawable(ContextCompat.getDrawable(baseContext,R.drawable.ic_arrow_back_black_24dp))

4- this method change Buttons Icon Color

myCounterView.setButtonsDrawableColor(ContextCompat.getColor(baseContext,R.color.colorPrimaryDark))

5- this method change Count Value Color

myCounterView.setCountTextColor(ContextCompat.getColor(baseContext,R.color.colorAccent))

6- this method set limit for counting

myCounterView.setMaxCount(10)

7- this method change background stroke color

myCounterView.setRoundBtnsBackgroundColor(ContextCompat.getColor(baseContext,android.R.color.white))

Licence

Copyright 2018 Baset Esmaeili

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author

Baset Esmaeili

email: baset.esmaili0@gmail.com

telegram: https://telegram.me/ikurdish