[go: up one dir, main page]

Skip to content

Android library that helps you with pin insertion screens. Fully animated and highly customizable using themes.

License

Notifications You must be signed in to change notification settings

Qusion/android-pin-dot-view

Repository files navigation

demo

Android-PinDotView

Set of views to speed up creating custom PIN screen in your app













Demo

NumberDialView & PinDotView

PinView

screen-1 screen-2

Features

  • Easy to implement
  • Exposing only necessary callbacks for ease of use
  • Customizable using themes

Usage

Implementation

Add jitpack to project-level build.gradle file

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

Add dependency to module-level build.gradle file

dependencies {
    implementation 'com.github.Qusion:android-pin-dot-view:0.1.0'
}

Layout

<com.qusion.lib_pindotview.PinDotView
    android:id="@+id/pinDotView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:pin_length="4"
    android:theme="@style/Widget.NumberDialView"
    app:layout_constraintTop_toBottomOf="@id/center_guideline"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent" />

supports biometrics_button_src, back_button_src, forgot_button_text, pin_length, has_grids, has_forget params

<com.qusion.lib_pindotview.PinView
    android:id="@+id/pinView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:pin_length="4"
    android:theme="@style/Widget.NumberDialView"
    app:layout_constraintTop_toBottomOf="@id/center_guideline"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent" />

supports biometrics_button_src, back_button_src, forgot_button_text, pin_length, has_grids, has_forget params

Activity | Fragment

pinDotView.setOnCompletedListener { pin ->
    // In case of incorrect pin we can show error animation when using PinDotView
    // clearPin gives you the option to reset on error
    // pinDotView.showErrorAnimation(clearPin = true)
}

pinDotView.setOnBiometricsButtonClickedListener {
    // Biometrics button clicked
}

pinDotView.setOnForgotButtonClickedListener {
    // Forgot button clicked
}

Styling

<style name="ThemeOverlay.PinDotView" parent="">
    <item name="colorPrimary">@color/color_aqua</item> // Tints biometric icon and active elements of pin input
    <item name="colorOnSurface">@color/color_white</item> // Changes color of idle elements of pin input and keyboard delimiters
    // + regular text styling
</style>

License

MIT License
Copyright (c) 2020 QusionDev

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.