A PIN entry view widget for Android with support for Android 5 Material Theme features via the AppCompat v7 support library.
Uses a hidden EditText
to handle input, hence behaves much in the same was as an EditText
on the
screen and supports similar features.
The demo app running the latest release build is also available on Google Play:
pinInputType
attribute to allow changing the input type, fixed #7setText
and clearText
methods, updated build to API 22accentColor
to pinAccentColor
to avoid conflicts with other
librariesAdd the following to your build.gradle
:
compile 'me.philio:pinentryview:1.0.6'
Or for latest snapshot:
compile 'me.philio:pinentryview:1.1.0-SNAPSHOT'
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
- disabledall
- highlights each separate digit viewcharacter
- highlights a single digit view to represent the position of the cursoraccentRequiresFocus
- show accent only when focused, default truepinInputType
- Set the input type, default number, options:
text
- full keyboard, any available character allowednumber
- numeric keyboard, only numbers allowedCopyright 2014-2015 Phil Bayfield
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.