LockPattern


Source link: https://github.com/pro100svitlo/LockPattern

LockPattern

This library provides developer with possibility to easily integrate lock pattern protection into his android application. A lot of items are available for customization.

  1. Usage
  2. Callbacks
    1. Main Interface
    2. Dialog Interface
  3. Customization
  4. Password Managing
  5. License

Usage

Add the dependencies to your gradle file:

 dependencies {

compile 'com.github.pro100svitlo:lockpattern:0.9.3'
  
}
 
Also you need to add few lines to your manifest file:
  <uses-permission android:name="android.permission.VIBRATE" />
<application

...

tools:replace="label"

...

> 
In your layout xml you need to add following code:

Note: your activity must be without toolbar, etc.! Only LockPatternView should be used as main and single layout!

  <com.pro100svitlo.lockpattern.LockPatternView

android:id="@+id/lpv"

android:layout_width="match_parent"

android:layout_height="match_parent"

/> 
Inside your activity or fragment:
 LockPatternView lockPatternView = (LockPatternView) findViewById(R.id.lpv);
  lockPatternView.initLockPatternView(getActivity(), this, this);

  //second argument - main interface callback
  //second argument - dialogs interface callback

That's pretty much all what you need to start the work!


Callbacks:

Main LPV Interface

(This is the main callback for managing LockPatternView)


 @Override
  public void isPatternExist(boolean isExist) {

//this will be called with every activity/fragment start

if (isExist){

 //do something here if necessary...

}
 else{

 //do something else here if necessary...

}

  
}

 @Override
  public void patternConfirmed(boolean isFirstEnter, String patternPass) {

//this will be called after user successfully creates new pattern

//or when he successfully confirms existing pattern

//here you can make some intent into inner activity of your app...

if (isFirstEnter){

 //do something here if necessary...

 //it means that user has just set up a pattern and used it for the first time

}

//patternPass - by default return null

//if you need to know which password was created, then add flag "showPassStr = true" to your custom style
  
}

 @Override
  public void patternFailed() {

//do something here if necessary...

//it will be called if set password and confirmed password don't match

//or saved password and just entered password don't match
  
}

 @Override
  public void setPatternCanceled() {

 //do something here if necessary...

  //it will be called if user cancels setting process of new pattern
  
}
 
Dialog Interface

(This callback is set as a default, but can be cancelled. It provides possibility to set the second password in case user forgets his pattern and further pattern recovery is needed. In order to cancel the second password and password recovery dialogs add secondPassDialogEnable = false to your style).


 @Override
  public void setSecondPassCanceled() {

//it will be called, if user dismisses the second password dialog

//after this user will be asked to set up new pattern from the first step
  
}

@Override
  public void secondPassCreated(String secondPass) {

//it will be called, if user successfully creates the second recovery password

 //secondPass - by default return null

//if you need to know which answer is used for the secret question by user, then add flag "showPassStr = true" into your style
  
}

@Override
  public void passRestoreConfirmed() {

//it will be called, if user gives correct answer on secret question

//after this a new pattern creation view will be opened
  
}

@Override
  public void passRestoreFailed() {

//it will be called, if user gives incorrect answer on secret question
  
}
 

Password Managing:

Manually clean/get user passwords:


 SharedPreferencesLPV shp = new SharedPreferencesLPV(context);

  shp.clearSharedPreferences();

  shp.getMainSavedPass();

  shp.getSecondPassQuestion();

  shp.getSecondSavedPass();
 

Resources

Android quantity view with add and remove button to simply use as a complex widget with handful of quick customizations.

Gitter.im Java SDK that facilitates communication with Gitter API.

AutoBundle generates boilerplate code for field binding with android.os.Bundle.

Github API for Android platform.

Animated value change on a TextView made easy. Just call setValue(float value) on a CountingTextView and watch the magic happen.

Library that allows you to eaisly switch between your content, progress, error and blur view. It does it with smooth crossfade animation. It also lets you add on click listener to the error view. You only show content, progress or error view. The switcher finds out what's currently visible and hides it.

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