PinView


Source link: https://github.com/DavidPizarro/PinView

PinView

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.

Try out the sample application on Google Play.

Demo

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])

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. 

Resources

Sick of writing ViewHolder classes, inflate xml and distinguish ViewTypes in your adapters?

Write less code with AnnotatedAdapter, an annotation processor for generating RecyclerView and AbsListView adapters.

Make Android screenshots of scrollable screen content.

This tool makes a number of screenshots, scrolling screen content by half height each time. Status bar and navigation bar are included only once.

A beautiful Android custom View that works similar to a range or seek bar. Selection by gesture. With animations. Supporting API level 11+.

Useful logger for Android based on standard android.util.Log class. Simple lightweight (< 50 Kb) implementation of SLF4J API. Easy but powerful configuration via properties file and some additional helpful logging methods. Easy analogue of popular log4j library.

This is a simple, straightforward, clean and organic python script to convert iOS images into Android compatible ones.

Did you ever got 273 [email protected] images? Did you rename those files manually? Fear not, ios2android is here!

This is an Android networking library for wrapping some complicated functionality and consisting of a combination of Volley, OkHttp and GSON.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes