Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kojofosu/Quantitizer
:sparkles: A quantity stepper for android projects
https://github.com/kojofosu/Quantitizer
android ecommerce kotlin library number open-source opensource shop stepper
Last synced: 9 days ago
JSON representation
:sparkles: A quantity stepper for android projects
- Host: GitHub
- URL: https://github.com/kojofosu/Quantitizer
- Owner: kojofosu
- License: mit
- Created: 2021-07-17T12:49:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-12T09:45:36.000Z (about 1 month ago)
- Last Synced: 2024-10-28T14:46:13.243Z (19 days ago)
- Topics: android, ecommerce, kotlin, library, number, open-source, opensource, shop, stepper
- Language: Kotlin
- Homepage:
- Size: 1.3 MB
- Stars: 188
- Watchers: 1
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - kojofosu/Quantitizer - :sparkles: A quantity stepper for android projects (Kotlin)
README
# Quantitizer
![Jit](https://img.shields.io/jitpack/v/github/kojofosu/Quantitizer?style=for-the-badge&color=2F9319)[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Quantitizer-green.svg?style=for-the-badge&color=D35400)]( https://android-arsenal.com/details/1/8257 )
[![Android Weekly](https://img.shields.io/badge/Featured%20in%20androidweekly.net%20-Issue%23479-blue?color=D35400&style=for-the-badge)]( https://androidweekly.net/issues/issue-479)
[![Kotlin Weekly](https://img.shields.io/badge/Featured%20in%20kotlinweekly.net.net%20-Issue%23265-blue?color=D35400&style=for-the-badge)](https://mailchi.mp/kotlinweekly/kotlin-weekly-265):sparkles: A highly customizable quantity stepper for android projects
## Demo
## Setup
Add it in your root `build.gradle` at the end of repositories:
```groovy
allprojects {
repositories {
//...omitted for brevity
maven { url 'https://jitpack.io' }
}
}
```Add the dependency
```groovy
dependencies {
implementation "com.github.kojofosu:Quantitizer:$latest_release"
}
```## Usage
Sample implementation [here](app/)### Horizontal Quantitizer
- Add `HorizontalQuantitizer` in your layout xml file
```xml
```### Vertical Quantitizer
- Add `VerticalQuantitizer` in your layout xml file
```xml
```### No Value Quantitizer
- Add `NoValueQuantitizer` in your layout xml file
```xml
```#### Get quantity value
```kotlin
var hQ: HorizontalQuantitizer = findViewById(R.id.h_q)
var selectedValue = hQ.value //get current value
```#### Listener
```kotlin
hQ.setQuantitizerListener(object: QuantitizerListener{
override fun onIncrease() {
Toast.makeText(this@MainActivity, "inc", Toast.LENGTH_SHORT).show()
}override fun onDecrease() {
Toast.makeText(this@MainActivity, "dec", Toast.LENGTH_SHORT).show()
}override fun onValueChanged(value: Int) {
Toast.makeText(this@ButtonsOnlyActivity, "value changed to : $value", Toast.LENGTH_SHORT).show()
}
})
```
### Customize Quantitizer#### Change text/value animation style
```kotlin
hQ.textAnimationStyle = AnimationStyle.SLIDE_IN
```#### List of current animations
| ANIMATION | DEMO |
| ------------------ | ------------------------------------------------------------ |
| `FALL_IN` | |
| `SLIDE_IN` | |
| `SLIDE_IN_REVERSE` | |
| `SWING` | |#### Disable button animations
```kotlin
hQ.isReadOnly = false // Disable value input from keyboard. Default false
``````kotlin
hQ.buttonAnimationEnabled = false //Default true
```
#### Change animation duration
```kotlin
hQ.animationDuration = 400L //Default 300L
```#### Change icons
```kotlin
hQ.setPlusIcon(R.drawable.ic_angle_double_small_right)
hQ.setMinusIcon(R.drawable.ic_angle_double_small_left)
```#### Change icon backgrounds
```kotlin
hQ.setPlusIconBackgroundColor(android.R.color.holo_red_dark)
hQ.setMinusIconBackgroundColor(android.R.color.holo_red_dark)
```#### Change value text and background color
```kotlin
hQ.setValueBackgroundColor(android.R.color.holo_red_dark)
hQ.setValueTextColor("#FFFF00")
```#### Change icon colors
```kotlin
hQ.setMinusIconColor("#FFFF00")
hQ.setPlusIconColor("#FFFF00")
```#### Changing the Icon and it's color.
```kotlin
changeShapeAndColorDecrease(Color.parseColor("#FF4500"), R.drawable.heart_shape)
changeShapeAndColorIncrease(Color.parseColor("#1E90FF"), R.drawable.shape_x)
```
using these mthods inside the required component you will be able to change and customize the shape of the button according to you use
```kotlin
hq.apply {}
```#### Use these below methods to change the font size of the Quantizer
for horizontal
```
changeTextSizeHorizontal(10f)
```
for vertical
```
changeTextSizeVertical(50f)
```### Licensed under the [MIT License](LICENSE)
```
MIT LicenseCopyright (c) 2021 Kojo Fosu Bempa Edue
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```