A custom OTP view to enter a code usually used in authentication

Overview

SSComposeOTPPinView

Android-Studio Kotlin Version Platform

A custom view to enter a code usually used in authentication. Different types of OTPViews. Easy to use and configure your own view and character of OTP using all the attributes.

Features

  • Simple OTPView
  • Box OTPView
  • Underline OTPView
  • We can manage our own OTPCount
  • We can manage the OTP character color
  • We can manage OTP character size
  • We can manage the border color of OTPView as well
  • We can enabled and disabled the visibility of OTP characters
  • We can customize your OTP characters using attributes
  • If we entered the incorrect length of OTP then button will not be clickable

🎬 Preview

Simple OTPView with dot character Box OTPView with dot character
Underline OTPView with dot character Simple OTPView with star character
Box OTPView with star character Underline OTPView with star character

How to use the library?

  • Using Compose Just use the OtpView composable function where you need to display the view
 OtpView(
    otpText = otpValue,
    onOtpTextChange = {
    otpValue = it
    },
    type = OTP_VIEW_TYPE_NONE,
    password = true,
    containerSize = 48.dp,
    passwordChar = "",
    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
    charColor = Color.White
)

Next in your code create OtpView composable function like below:

Unit )">
fun OtpView(
    modifier: Modifier = Modifier,
    otpText: String = "",
    charColor: Color = Color.Black,
    charBackground: Color = Color.Transparent,
    charSize: TextUnit = 16.sp,
    strokeColor: Color = Color.Black,
    containerSize: Dp = charSize.value.dp * 2,
    otpCount: Int = 4,
    type: Int = OTP_VIEW_TYPE_UNDERLINE,
    enabled: Boolean = true,
    password: Boolean = false,
    passwordChar: String = "",
    keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
    onOtpTextChange: (String) -> Unit
)

All Attributes


Attribute Description
charColor To change otp character color.
charSize Set custom character size.
containerSize To change the size of otp character container.
otpCount Set the custom range of otp characters.
password Show/hide the otp characters.
passwordChar Set the custom character for otp password.
strokecolor Set the custom color to container border.
type For customization we have created three types:
1. OTP_VIEW_TYPE_NONE
2. OTP_VIEW_TYPE_UNDERLINE
3. OTP_VIEW_TYPE_BOX
keyboardOptions Set the custom keyboard which you need.

Official Documentations

Find this samples useful? ❤️

Support it by joining stargazers for this repository.

How to Contribute 🤝

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 Check out our Contributing Guide for ideas on contributing.

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Awesome Mobile Libraries

License

Copyright 2022 Simform Solutions

   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.
You might also like...
Android Custom View Accessibility

CustomFanController - Solution Code Creates a circular fan control dial that offers multiple selections marked by numeric indicators: 0 for off, 1 for

A custom view for rating which easy to make and use, but function is excellent
A custom view for rating which easy to make and use, but function is excellent

QRatingView A custom view for rating which easy to make and use, but function is excellent Effect Picture Properties declare-styleable name="QRat

Advent of Code 2021 in Kotlin, solved by myself. Focus on code readability. With GitHub Actions all puzzles are executed and their solutions printed

Advent of Code 2021 in Kotlin Focus on Code Readability. With CI Solution Printing. Welcome to the Advent of Code1 Kotlin project created by michaeltr

Team management service is a production ready and fully tested service that can be used as a template for a microservices development.
Team management service is a production ready and fully tested service that can be used as a template for a microservices development.

team-mgmt-service Description Team management service is a production ready and fully tested service that can be used as a template for a microservice

A Kotlin library used to analyse discrete Markov chains, in order to generate plausible sequences

Markov Markov is a Kotlin library used to analyse discrete Markov chains, in order to generate plausible sequences. Using This project is still under

An application that allows the user to update variety of smartphones that are used such as iPhone and Android
An application that allows the user to update variety of smartphones that are used such as iPhone and Android

PhoneApplication An application that allows the user to update variety of smartphones such as iPhone and Android. This application allows users to add

An open source app which can be used to do basic surveys
An open source app which can be used to do basic surveys

SurveyApp This is an open source app which can be used to do basic surveys. It supports multiple question types. For demo please check the releases pa

Text-array-process - A home assignment used during the recruitment process at Lumera

Rules to implement class={isogram|palindrome|semordnilap} maxlength=INT minl

This application is used to adjust the scaling of kubernetes deployments depending on the message-count of given RabbitMQ queues.

PodAutoScaler This application is used to adjust the scaling of kubernetes deployments depending on the message-count of given RabbitMQ queues. It use

Releases(1.0)
  • 1.0(Jul 25, 2022)

    A custom view to enter a code usually used in authentication. Easy to use and configure your own view and character of OTP using all the attributes.

    What's Changed

    • OTPView implemented with three types by @priyal-p-simformsolutions in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/1
    • Develop by @yashwantgowla-simform in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/2
    • Updated CODE_OF_CONDUCT.md and CONTRIBUTING.md by @yashwantgowla-simform in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/3
    • Develop by @yashwantgowla-simform in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/4

    New Contributors

    • @priyal-p-simformsolutions made their first contribution in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/1
    • @yashwantgowla-simform made their first contribution in https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/pull/2

    Full Changelog: https://github.com/SimformSolutionsPvtLtd/SSComposeOTPPinView/commits/1.0

    Source code(tar.gz)
    Source code(zip)
Owner
Simform Solutions
Simform Solutions
Android library to help enter, and more importantly, leave, android "Immersive Mode".

Immersive Lock Android has various ways to full screen an application including locking the screen to prevent accidentally leaving the app. This is pa

Baby Apps 2 May 20, 2022
A learning project which focuses on designing an OTP flow and use of various components of Android efficiently

Otp Demo A learning project which focuses on designing an OTP flow using Firebase. Article: https://saurabhpant.medium.com/otp-login-using-firebase-hi

Saurabh Pant 27 Dec 22, 2022
Implementing JWT token authentication on Android with Clean Architecture

Implementando autenticação com token JWT no Android com Clean Architecture Implementar autenticação com Token JWT no Android não é uma tarefa fácil. É

Rocketseat Experts Club 4 Jun 18, 2022
Firebase Authentication plugin for Ktor framework.

Firebase Authentication is a Ktor plugin which verifies requests authorized by a Firebase Auth Id Token.

Manav Tamboli 2 Jul 16, 2022
Login-and-Signup - Simple Login-and-Signup with authentication using Firebase API

Simple Login-and-Signup with authentication using Firebase API. Log in Sign Up

Indresh Goswami 0 Mar 25, 2022
Simple authentication provider for Ktor that verifies presence of the API key in the header

Ktor API Key Authentication Provider Simple authentication provider for Ktor that verifies presence of the API key in the header. Useful if you want t

Lukas Forst 6 Oct 28, 2022
User Authentication ( Compose Ktor Server MongoDB)

Utilising Security in android for Authentication and Authorization for Android I would be using mongo db to perform all basic operations no need for f

Michael Enoma 0 May 2, 2022
Used to generate the template code of GetX framework

Language: English | 中文简体 statement some fast code snippet prompt come from getx-snippets-intelliJ Description install Plugin effect Take a look at the

小呆呆666 242 Dec 30, 2022
Tweaks - A customizable debug screen to view and edit flags that can be used for development

A customizable debug screen to view and edit flags that can be used for developm

Telefónica 10 Jun 28, 2022