El Arsenal de Android – Selectores de números

? Un paso a paso de cantidad altamente personalizable para proyectos de Android

Demostración

Configurar

Agrégalo en tu raíz build.gradle al final de los repositorios:

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

Agrega la adicción

dependencies {
   implementation "com.github.kojofosu:Quantitizer:$latest_release"
}

Uso

Ejemplo de implementación aquí

Cuantizador horizontal

  • Para agregar HorizontalQuantitizer en su archivo xml de diseño
    <com.mcdev.quantitizerlibrary.HorizontalQuantitizer
        android:id="@+id/h_q"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

Cuantificador vertical

  • Para agregar VerticalQuantitizer en su archivo xml de diseño
    <com.mcdev.quantitizerlibrary.VerticalQuantitizer
        android:id="@+id/v_q"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

Sin cuantificador de valor

  • Para agregar NoValueQuantitizer en su archivo xml de diseño
    <com.mcdev.quantitizerlibrary.NoValueQuantitizer
        android:id="@+id/n_q"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

Obtenga el valor de la cantidad

    var hQ: HorizontalQuantitizer = findViewById(R.id.h_q)
    var selectedValue = hQ.value    //get current value

Oyente

        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()
            }
        })

Personaliza el cuantificador

Cambiar el estilo de animación del texto / valor

    hQ.textAnimationStyle = AnimationStyle.SLIDE_IN

Lista de animaciones actuales

ANIMACIÓN MANIFESTACIÓN
FALL_IN
SLIDE_IN
SLIDE_IN_REVERSE
SWING

Desactivar animaciones de botones

    hQ.buttonAnimationEnabled = false //Default true

Cambiar la duración de la animación

    hQ.animationDuration = 400L //Default 300L

Cambiar iconos

    hQ.setPlusIcon(R.drawable.ic_angle_double_small_right)
    hQ.setMinusIcon(R.drawable.ic_angle_double_small_left)

Cambiar los fondos de los iconos

    hQ.setPlusIconBackgroundColor(android.R.color.holo_red_dark)
    hQ.setMinusIconBackgroundColor(android.R.color.holo_red_dark)

Cambiar el texto del valor y el color de fondo

    hQ.setValueBackgroundColor(android.R.color.holo_red_dark)
    hQ.setValueTextColor("#FFFF00")

Cambiar los colores de los iconos

    hQ.setMinusIconColor("#FFFF00")
    hQ.setPlusIconColor("#FFFF00")

Licenciado bajo el Licencia MIT

MIT License

Copyright (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.

.

Compruebe también

Blog para desarrolladores de Android: Lucha contra las estafas de robo de identidad: el enfoque innovador de Monzo

Publicado por Todd Burner, ingeniero de relaciones con desarrolladores Los ciberdelincuentes continúan invirtiendo en estafas …

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *