Skip to content

Habitap-Pte-Ltd/PinEntryView

 
 

Repository files navigation

PinEntryView

Maven Central

About

A PIN entry view widget for Android. This is a fork of Philio/PinEntryView, refactored to Kotlin, updated to use the latest Android libraries and added some new features.

Uses a hidden EditText to handle input, hence behaves much in the same was as an EditText on the screen and supports similar features.

Change log

Download

Gradle

Add the following to your build.gradle:

implementation "app.habitap:pinentryview:0.0.1"

Styling

Attributes

  • numDigits - The number of digits in the PIN, default 4.
  • digitWidth - The width of the digit view, default 50dp.
  • digitHeight - The heigh of the digit view, default 50dp.
  • digitSpacing - The distance between the digit views, default 20dp.
  • digitBackground - A resource to use for the digit views, supports drawables or colours and can be used with a custom selector as an alternative to using the built in accent support (by setting the accentColor as transparent). Defaults to android:windowBackground from the current theme.
  • digitTextSize - The size of the text in the digit view, default 15sp.
  • digitTextColor - The colour of the text in the digit view, defaults to android:textColorPrimary from the current theme.
  • digitElevation - Set the elevation of the digit views, API 21+ only, default 0dp.
  • mask - A character to use as a mask for the entered PIN value, can be set to an empty string to show typed numbers, default *.
  • pinAccentColor - The colour of the accent to use to highlight the view when it's in focus, defaults to android:colorAccent from the current theme.
  • accentWidth - The width of the accent highlight, default 3dp.
  • accentType - Defines the behaviour of the accent, default none, options:
    • none - disabled
    • all - highlights each separate digit view
    • character - highlights a single digit view to represent the position of the cursor
  • accentRequiresFocus - show accent only when focused, default true
  • pinInputType - Set the input type, default number, options:
    • text - full keyboard, any available character allowed
    • number - numeric keyboard, only numbers allowed

License

Copyright 2022 Habitap Pte. Ltd.

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.

About

A pin entry view widget for Android.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%