Android Passcode Keypad View


Source link: https://github.com/Arjun-sna/android-passcodeview

Android Passcode Keypad View

A custom view with keyboard and character display to be used for authentication.

The view has a bunch customisation options to make to look and work the way whichever needed.

Demo

Installation

Add gradle dependency

repositories {

  jcenter() 
}
 dependencies {

  compile 'in.arjsna:passcodeview:1.2.1' 
}
  

Usage

Add the view in the layout file

<in.arjsna.lib.PassCodeView
 android:id="@+id/pass_code_view"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 app:digits="4"
 app:digit_size="30.0dp"
 app:key_text_size="30.0sp"
 android:padding="25.0dp"
 app:empty_drawable="@drawable/empty_dot"
 app:filled_drawable="@drawable/filled_dot"/> 

View attributes that can be included in xml are

digits - number of digits in passcode

filled_drawable - drawable to be show for filled digits

empty_drawable - drawable to be show for empty digits

key_text_size - size of text in keyboard's key

digit_spacing - horizontal space between each digit

digit_vertical_padding - vertical padding of digits

divider_visible - boolean to show or hide divider between digits and keyboard

Other customisations options available are

PassCodeView passCodeView = (PassCodeView) findViewById(R.id.pass_code_view);
 Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/Font-Bold.ttf");
  /**  *Set TypeFace for the font in keys of keypad  */ passCodeView.setTypeFace(typeFace);
  /**  * Set color for the keypad text  * @param color - Resource id of the color to be set  */ passCodeView.setKeyTextColor(getResources.getColor(R.color.black));
  /**  * Set size of keypad text  * @param size - Text size value to be set  */ passCodeView.setKeyTextSize(30);
  /**  * Set passcode digit lenght  * @param length - digit length to be set  */ passCodeView.setDigitLength(6);

/**  * Set current passcode text  * @param code - {
@code String
}
 passcode string to be set  */ public void setPassCode("8854")  /**  * Reset the code to empty  */ passCodeView.reset();
  /**  * Set drawable for empty digits programmatically  */  passCodeView.setEmptyDrawable(R.drawable.empty);
  /**  * Set drawable for filled digits programmatically  */  passCodeView.setFilledDrawable(R.drawable.filled);
  /**  * Attach {
@code TextChangeListener
}
 to get notified on text changes  * @param listener - {
@Code TextChangeListener
}
 object to be attached and notified  */ passCodeView.setOnTextChangeListener(new PassCodeView.TextChangeListener() {

 @Override

 public void onTextChanged(String text) {

  Log.i("Passcode", "text");

 
}

}
);
 

Resources

Low poly picture, Sandpainting for Android implemented by JNI.

Fresh Air is an application update library. It is designed to check a remote location for application updates and if updates are available, it prompts the user to upgrade the application. When the new version of the application is started, a dialog can be presented that showcases the new features to the user.

The set of handy classes.

InfinityMenu is an Android Library implementing an accordion style menu. You can place any view with any size in the menu. To close the menu you can drag to close or tap outside the menu.

The easiest Kotlin Library for Android Runtime Permissions & Device Info.

Android MediaPlayer/VideoView API-compatible media player library with exact seek, playback speed adjustment and DASH support.

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