PinView

PinView Library

License

License

GroupId

GroupId

com.github.davidpizarro
ArtifactId

ArtifactId

pinview
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

PinView
PinView Library
Project URL

Project URL

https://github.com/DavidPizarro/PinView
Source Code Management

Source Code Management

https://github.com/DavidPizarro/PinView

Download pinview

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.davidpizarro/pinview/ -->
<dependency>
    <groupId>com.github.davidpizarro</groupId>
    <artifactId>pinview</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.davidpizarro/pinview/
implementation 'com.github.davidpizarro:pinview:1.0.0'
// https://jarcasting.com/artifacts/com.github.davidpizarro/pinview/
implementation ("com.github.davidpizarro:pinview:1.0.0")
'com.github.davidpizarro:pinview:aar:1.0.0'
<dependency org="com.github.davidpizarro" name="pinview" rev="1.0.0">
  <artifact name="pinview" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.davidpizarro', module='pinview', version='1.0.0')
)
libraryDependencies += "com.github.davidpizarro" % "pinview" % "1.0.0"
[com.github.davidpizarro/pinview "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.android.support » appcompat-v7 jar 23.0.0

Project Modules

There are no modules declared in this project.

PinView

Android Arsenal Maven Central Android Gems

A Pin view widget for Android. PinView has a feature that allows you to find out when they have completed all parameters. Support for Android 3.0 and up. It supports portrait and landscape mode, saving the state.

Example screenshot

Try out the sample application on Google Play.

PinView Sample on Google Play

Demo

Example gif

Including in Your Project

Last version is 1.0.0

Just add the following statement in your build.gradle

compile 'com.github.davidpizarro:pinview:VERSION'

You may also add the library as an Android Library to your project. All the library files live in library.

Usage

To add the PinView to your layout, add this to your xml

<com.dpizarro.pinview.library.PinView
        android:id="@+id/pinView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

You can add custom attributes in your xml to customize: pin boxes number, splits, number of characters in pin boxes, styles, mask password, titles, drawables, sizes, colors, behaviors...

<com.dpizarro.pinview.library.PinView
            android:id="@+id/pinView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            pinview:titles="@array/small_titles"
            pinview:password="true"
            pinview:numberPinBoxes="4"
            pinview:split="-"
            pinview:numberCharacters="2"
            pinview:deleteOnClick="false"
            pinview:keyboardMandatory="false"
            pinview:nativePinBox="false"
            pinview:textSizePinBox="@dimen/size_text_pinbox"
            pinview:textSizeTitles="@dimen/size_titles"
            pinview:drawablePinBox="@drawable/custom_pinbox"
            pinview:sizeSplit="@dimen/size_split"
            pinview:colorSplit="@color/color_splits"
            pinview:colorTextPinBox="@android:color/black"
            pinview:colorTextTitles="@color/color_title"/>
        

Review attrs.xml file to know the list of shapes ready to be used in the library.

This configuration can be also provided programmatically. You can use PinView programatically, using the Builder class to set the settings and the desired functionalities to make easy:

PinView pinView = (PinView) view.findViewById(R.id.pinView);

PinViewSettings pinViewSettings = new PinViewSettings.Builder()
                                                     .withPinTitles(titlesAux)
                                                     .withMaskPassword(true)
                                                     .withDeleteOnClick(true)
                                                     .withKeyboardMandatory(false)
                                                     .withSplit("-")
                                                     .withNumberPinBoxes(5)
                                                     .withNativePinBox(false)
                                                     .build();

pinView.setSettings(pinViewSettings);

You can set/get values programatically:

mPinView.setPin(5);
mPinView.setTitles(getResources().getStringArray(R.array.titles));
mPinView.setMaskPassword(true);
mPinView.setDeleteOnClick(true);
mPinView.setNativePinBox(true);
mPinView.setCustomDrawablePinBox(R.drawable.pin_box);
mPinView.setKeyboardMandatory(false);
mPinView.setSplit("**");
mPinView.setColorTitles(Color.rgb(255, 0, 128));
mPinView.setColorTextPinBoxes(Color.rgb(200, 57, 222));
mPinView.setColorSplit(Color.rgb(0, 0, 0));
mPinView.setSizeSplit(getResources().getDimension(R.dimen.size_split));
mPinView.setTextSizePinBoxes(getResources().getDimension(R.dimen.size_pinboxes));
mPinView.setTextSizeTitles(getResources().getDimension(R.dimen.size_titles));

We can use a Listener to notify us when we could do Login and the returned value. You will need to implement OnCompleteListener interface.

pinView.setOnCompleteListener(new PinView.OnCompleteListener() {
            @Override
            public void onComplete(boolean completed, final String pinResults) {
                //Do what you want
                if (completed) {
                    doLogin(pinResults);
                }
            }
        });

Or browse the source code of the sample application for a complete example of use.

Contribution

Pull requests are welcome!

I'd like to improve this library with your help! If you've fixed a bug or have a feature you've added, just create a pull request. Issues can be reported on the github issue tracker.

Author

David Pizarro ([email protected])

Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2015 David Pizarro

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.

Versions

Version
1.0.0