Extremely useful library to validate EditText inputs whether by using just the validator for your custom view or using library's extremely resizable & customisable dialog

Overview

GitHub release (latest by date) GitHub top language GitHub all releases Twitter Follow

OtpinVerification

OtpinVerification & Dialog

Description:

Extremely useful library for validating EditText inputs whether by using just the validator (OtpinVerification) for your custom view or using library's extremely resizable & customisable dialog (OtpinDialogCreator)


Features:

  • OtpinVerification for validating your EditTexts from your own layout view
  • OtpinDialogCreator (library's customisable dialog)

Setup.

To get a Git project into your build:

  1. Add the JitPack repository to you root build.gradle at the end of repositories:
allprojects {
    repositories {
	...
	maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency
dependencies {
    implementation 'com.github.EhmaUgbogo:OtpinVerification:1.0.3'
}

Usage

1. OtpinVerification (Use to power your own custom layout view)

  
  val yourEditTexts = listOf(yourEditText1, yourEditText2, yourEditText3,...)
  val inputType = OtpInputType.DIGIT // Library default. if used can be ommited
  
  otpin = OtpinVerification(yourEditTexts, inputType) { validated, percent, otp ->
      // Your code here
  }//.startCountDown(5, countDownListener)
  
  
  otpin.setOtpInputsText(yourOtpText) //SetText at runtime
  
  otpin.clearInputs() //Clear edittexts at runtime
  

Add CountDown

 otpin.startCountDown(minutes, object :OtpCountDownListener{
      override fun onCountDown(sec: Int, minutes: Int, timeFormat: String, onFinish: Boolean) {
            // your code here
            if(onFinish){
                // your code here
            }
      }
 })
 

2. OtpinDialogCreator

Sample1 Sample2 Sample3 Sample4 Sample5 Sample6 Sample7 Sample8

continueClicked(otpDialog, otp) } .setResendListener {resendClicked(it)} .setCancelListener { showToast("Task Cancelled") } //.displayMode(OtpDisplay.FullScreen(showToolbar = true)) //.autoSubmitOnComplete(hideContinueBtn = false) //.excludeResend() //.displayOnlyInputFields() //.theme(R.style.myOtpDialogTheme) //.windowAnimation(R.style.yourWindowStyle) //.disableWindowAnimation() //.boxShape() // Use styles instead // Not available via runtime now .start() otpDialog.setOtpInputsText(yourOtpText) //SetText at runtime otpDialog.dismissDialog() //Dismiss OtpinDialog otpDialog.showMessage(msg, useSnackInsteadOfToast = true) //Show message via SnackBar or Toast otpDialog.hideProgress() // Hide otpDialog progressBar ">
  
  // All operations that can be done on the dialog
  
  otpDialog = OtpinDialogCreator.with(this)
            //.title(title)
            //.customSubtitle("Please provide your card cvv")
            //.customBtnText("Submit")
            //.logo(R.drawable.ic_logo)
            //.cancelable(false)
            //.otpFields(OtpFields.THREE)
            //.inputType(OtpInputType.DIGIT)
            .countDown(5)
            .setCountDownFinishListener { showToast("Count Down completed") }
            .setContinueListener { otpDialog, otp -> continueClicked(otpDialog, otp) }
            .setResendListener {resendClicked(it)}
            .setCancelListener { showToast("Task Cancelled") }
            //.displayMode(OtpDisplay.FullScreen(showToolbar = true))
	    //.autoSubmitOnComplete(hideContinueBtn = false)
            //.excludeResend()
            //.displayOnlyInputFields()
            //.theme(R.style.myOtpDialogTheme)
            //.windowAnimation(R.style.yourWindowStyle)
            //.disableWindowAnimation()
            //.boxShape() // Use styles instead // Not available via runtime now
            .start()
	    
	    
	   otpDialog.setOtpInputsText(yourOtpText) //SetText at runtime
	   
	   otpDialog.dismissDialog() //Dismiss OtpinDialog
	   
	   otpDialog.showMessage(msg, useSnackInsteadOfToast = true) //Show message via SnackBar or Toast
	   
	   otpDialog.hideProgress() // Hide otpDialog progressBar
 
  

Styling Used Underneath

OtpinDialogCreator uses the following attr and styles under the hood with values that you can easily adjust to suit your brand

@style/OtpDialogTitleAppearance @style/OtpDialogSubTitleAppearance @style/OtpDialogCounterTextAppearance @style/OtpDialogResendTextAppearance 4dp 16dp 48dp 48dp 1dp 2dp 8dp @style/BoxStyle.Outline @style/OtpBoxShape.Normal @style/BoxEditTextStyle @style/OtpDialogButtonStyle.Rounded @color/otp_color_toolbar @color/otp_color_toolbar_icon 4dp 16dp false ">
    
    <item name="otpDialogTitleTextAppearance">@style/OtpDialogTitleAppearanceitem>
    <item name="otpDialogSubtitleTextAppearance">@style/OtpDialogSubTitleAppearanceitem>
    <item name="otpDialogCounterTextAppearance">@style/OtpDialogCounterTextAppearanceitem>
    <item name="otpDialogResendTextAppearance">@style/OtpDialogResendTextAppearanceitem>
    
    <item name="otpDialogLayoutPadding">4dpitem>
    <item name="otpDialogLayoutCornerRadius">16dpitem>
    
    <item name="otpDialogBoxWidth">48dpitem>
    <item name="otpDialogBoxHeight">48dpitem>
    <item name="otpDialogBoxStrokeWidth">1dpitem>
    <item name="otpDialogBoxStrokeWidthFocused">2dpitem>
    <item name="otpDialogBoxSpacing">8dpitem>
    <item name="otpDialogBoxStyle">@style/BoxStyle.Outlineitem> 
    
    <item name="otpDialogBoxShape">@style/OtpBoxShape.Normalitem> 
    
    <item name="otpDialogBoxEditTextStyle">@style/BoxEditTextStyleitem>
    
    <item name="otpDialogButtonStyle">@style/OtpDialogButtonStyle.Roundeditem> 
    
    <item name="otpDialogToolbarColor">@color/otp_color_toolbaritem>
    <item name="otpDialogToolbarIconColor">@color/otp_color_toolbar_iconitem>
    
    <item name="otpDialogLayoutPadding">4dpitem>
    <item name="otpDialogLayoutCornerRadius">16dpitem>
    
    <item name="otpDialogIsFloating">falseitem>
  

Styling Yours

So to style yours simply create a theme that extends otpDialogTheme then use any precreated styles or extend them for further customization. for example to change the title font & size, see titleAppearance and buttonStyle below.

true ">
    
    <style name="myOtpDialogThemeFloating" parent="myOtpDialogTheme">
        <item name="otpDialogIsFloating">trueitem>
    style>

    
    <style name="myOtpDialogTheme" parent="OtpDialogTheme">
	 
        <item name="otpDialogBoxStyle">@style/BoxStyle.Underlineitem>
        <item name="otpDialogBoxShape">@style/OtpBoxShape.Roundeditem>
        <item name="otpDialogButtonStyle">@style/OtpDialogButtonStyleitem>
	<item name="otpDialogBoxSpacing">12dpitem>

	    
        <item name="otpDialogTitleTextAppearance">@style/titleAppearanceitem>
	<item name="otpDialogButtonStyle">@style/buttonStyleitem>

    style>

    <style name="titleAppearance" parent="OtpDialogTitleAppearance">
        <item name="fontFamily">@font/poppins_blackitem>
    style>

    <style name="buttonStyle" parent="OtpDialogButtonStyle">
        <item name="fontFamily">@font/poppins_mediumitem>
        <item name="cornerRadius">8dpitem>
    style>

    
  
  // Apply your fullscreen theme
  otpDialog = OtpinDialogCreator.with(this)
            .title(title)
            .theme(R.style.myOtpDialogTheme)
            .start()
	    
  // Apply your floating screen theme
  otpDialog = OtpinDialogCreator.with(this)
            .title(title)
	    .displayMode(OtpDisplay.Float)
            .theme(R.style.myOtpDialogThemeFloating)
            .start()
  

Color

For colors add these below to your color.xml

@color/your_color_here @color/your_color_here @color/your_color_here @color/your_color_here @color/your_color_here @color/your_color_here @color/your_color_here ">
    <color name="otp_color_status_bar">@color/your_color_herecolor>
    <color name="otp_color_toolbar">@color/your_color_herecolor>
    <color name="otp_color_toolbar_icon">@color/your_color_herecolor>
    <color name="otp_color_primary">@color/your_color_herecolor>
    <color name="otp_color_widget_active">@color/your_color_herecolor>
    <color name="otp_title_color">@color/your_color_herecolor>
    <color name="otp_subtitle_color">@color/your_color_herecolor>
  

Licence

MIT Licence

Copyright (c) [2021] Ehma Ugbogo

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.


Author Info

@EhmaUgbogo

Back To The Top

You might also like...
Android library that allows applications to add dialog-based slider widgets to their settings
Android library that allows applications to add dialog-based slider widgets to their settings

Android Slider Preference Library Overview Slider represents a float between 0.0 and 1.0 Access with SliderPreference.getValue() or SharedPreferences.

An Android library for displaying a dialog where it presents new features in the app.
An Android library for displaying a dialog where it presents new features in the app.

WhatIsNewDialog What is new dialog for Android is used for presenting new features in the the app. It can be used in the activity starts, from menu or

Android library to show
Android library to show "Rate this app" dialog

Android-RateThisApp Android-RateThisApp is an library to show "Rate this app" dialog. The library monitors the following status How many times is the

An beautiful and easy to use dialog library for Android
An beautiful and easy to use dialog library for Android

An beautiful and easy to use dialog library for Android

Advanced dialog solution for android
Advanced dialog solution for android

DialogPlus Simple and advanced dialog solution. Uses normal view as dialog Provides expandable option Multiple positioning Built-in options for easy i

SweetAlert for Android, a beautiful and clever alert dialog
SweetAlert for Android, a beautiful and clever alert dialog

Sweet Alert Dialog SweetAlert for Android, a beautiful and clever alert dialog 中文版 Inspired by JavaScript SweetAlert Demo Download ScreenShot Setup Th

An Android Dialog Lib simplify customization.
An Android Dialog Lib simplify customization.

FlycoDialog-Master 中文版 An Android Dialog Lib simplify customization. Supprot 2.2+. Features [Built-in Dialog, convenient to use](#Built-in Dialog) [Ab

A simple file/ directory picker dialog for android
A simple file/ directory picker dialog for android

FileListerDialog FileListerDialog helps you to list and pick file/directory. Library is built for Android Getting Started Installing To use this libra

An easy to use, yet very customizable search dialog
An easy to use, yet very customizable search dialog

search-dialog An awesome and customizable search dialog with built-in search options. Usage First add jitpack to your projects build.gradle file allpr

Releases(1.0.3)
Owner
Ehma Ugbogo
Experienced Android Java/Kotlin Programmer
Ehma Ugbogo
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
ionalert 1.3 1.6 Java Sweetalert, Dialog, Alert Dialog

ionalert - Android Alert Dialog A beautiful design Android Alert Dialog, alternative of Sweet Alert Dialog based on KAlertDialog using MaterialCompone

Excel Dwi Oktavianto 23 Sep 17, 2022
Alert Dialog - You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment.

We show a warning message (Alert Dialog) to the user in many parts of our applications. You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment. Thanks to this extension, you can create a Dialog and call it in the Activity or Fragment you want and customize the component you want.

Gökmen Bayram 0 Jan 9, 2022
A simple library to show custom dialog with animation in android

SmartDialog A simple library to show custom dialog in android Step 1. Add the JitPack repository to your build file allprojects { repositories {

claudysoft 9 Aug 18, 2022
CuteDialog- Android Custom Material Dialog Library

A Custom Material Design Dialog Library for Android Purpose CuteDialog is a Highly Customizable Material Design Android Library. CuteDialog allows dev

CuteLibs - Smart & Beautiful Android Libraries 7 Dec 7, 2022
[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.

Deprecated Please use android.support.v7.app.AlertDialog of support-v7. AlertDialogPro Why AlertDialogPro? Theming Android's AlertDialog is not an eas

Feng Dai 468 Nov 10, 2022
a quick custom android dialog project

QustomDialog Qustom helps you make quick custom dialogs for Android. All this is, for the time being, is a way to make it easy to achieve the Holo loo

Daniel Smith 183 Nov 20, 2022
Custom Dialog

Custom Dialog use Lottie Dialog How To Use? If yow want specific lottie file you must put your assets to under app → src → main → assets folder Add li

DevHoony 16 Oct 10, 2022
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.

AlertDialog for Android, a beautiful and material alert dialog to use in your android app. Older verion of this library has been removed

Akshay Masram 124 Dec 28, 2022
Android library to show "Rate this app" dialog

Android-RateThisApp Android-RateThisApp is an library to show "Rate this app" dialog. The library monitors the following status How many times is the

Keisuke Kobayashi 553 Nov 23, 2022