Giter Site home page Giter Site logo

msoftware / lock-screen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amirarcane/lock-screen

0.0 2.0 0.0 5.31 MB

Simple and beautiful Lock Screen library to set an check pin code. Integrated with fingerprint authentication.

License: MIT License

Java 100.00%

lock-screen's Introduction

Lock Screen

Simple and beautiful Lock Screen library to set an check pin code. Integrated with fingerprint authentication.

Easily secure your app with Lock Screen library as easy as starting an intent.

With great animations for fingerprint authentication.

Set Pin:

Screenshots

Check Pin:

Screenshots

Lock Screen gets a 4 digit pincode from user at first running time. After that every time that you start the intent, It asks
for pincode.

Watching this repository will allow GitHub to email you whenever I publish a release.


Gradle Dependency

Add this line to your build.gradle project

compile 'com.amirarcane.lock-screen:lockscreen:1.0.0'

Usage

Just add Lock Screen activity to your manifest:

<activity android:name="com.amirarcane.lockscreen.activity.EnterPinActivity"
          android:theme="@style/Theme.AppCompat.NoActionBar"/>

Now easily start the Intent:

 Intent intent = new Intent(getContext(), EnterPinActivity.class);
 startActivity(intent);

That's it. As easy as piece of cake.

At first run It checks if you entered pin before or not, If pin was set, It asks for Entering pin else It asks for setting pincode. If you need to change pin or for any reason you want to set pin again just start the intent like below:

  Intent intent = EnterPinActivity.getIntent(getContext(), SET_PIN);
  startActivity(intent);

SET_PIN is boolean.

If you need to handle back press of Lock Screen activity, just try onActivityResult:

  @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          switch (requestCode) {
              case REQUEST_CODE:
              if (resultCode == EnterPinActivity.RESULT_BACK_PRESSED) {
                  Toast.makeText(MainActivity.this, "back pressed", Toast.LENGTH_LONG).show();
              }
              break;
          }
      }

See MainActivity class in Sample app for understanding how this library works.


Customization

If you need to set font for this library try like below:

  Intent intent = EnterPinActivity.getIntent(getContext(), FONT_TEXT, FONT_NUMBERS);
  startActivity(intent);

FONT_TEXT and FONT_NUMBERS are path of your fonts in assets folder like "font/Arial.ttf"

IF need set pin and changing fonts, do this:

  Intent intent = EnterPinActivity.getIntent(getContext(), SET_PIN, FONT_TEXT, FONT_NUMBERS);
  startActivity(intent);

I customized PinLockView by andrognito for my Lock Screen view. In case of any further customization, fork the library and change it.

lock-screen's People

Contributors

amirarcane avatar

Watchers

Michael jentsch avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.