Flip git---Logic clear, easy to use app internal lock control Pinlockview

Source: Internet
Author: User

Reprint please indicate the source of Wang 亟亟 's Daniel Road

First Amway, storage library: Https://github.com/ddwhan0123/Useful-Open-Source-Android every day in more!!!

A few comments on learning and the workplace, review Good reading volume (estimated not to share the reason for the homepage, here again Amway): http://blog.csdn.net/ddwhan0123/article/details/51646255

Not much nonsense to say, to start the content of this article

Before also saw some similar application lock implementation, today see a better look + easy to recommend to everyone

First look at the effect of the operation:

How do I use?

Gradle

dependencies {    // other dependencies here    ‘com.andrognito.pinlockview:pinlockview:1.0.0‘}

Maven

<dependency>  <groupId>com.andrognito.pinlockview</groupId>  <artifactId>pinlockview</artifactId>  <version>1.0.0</version>  <type>pom</type></dependency>

Bye, Eclipse Boys!!!

Let's see how it's used in the example.

<?xml version= "1.0" encoding= "Utf-8"?><relativelayout xmlns:android="Http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools"android:layout_width="Match_ Parent "android:layout_height="match_parent "xmlns:app=" http// Schemas.android.com/apk/res-auto "android:background=" @color/mine_shaft "tools: Context="com.andrognito.pinlockviewapp.SampleActivity">                            <ImageViewandroid:id= "@+id/profile_image"android:layout_width=" 84DP "android:layout_height=" 84DP "android:layout_centerhorizontal=" true "  android:layout_margintop="124DP"android:src="@drawable/img_no_ Avatar " />                                                    <TextView        Android:id="@+id/profile_name"        Android:layout_width="256DP"        Android:layout_height="Wrap_content"        Android:layout_below="@+id/profile_image"        Android:layout_centerhorizontal="true"        Android:layout_margintop="36DP"        android:fontfamily="Sans-serif-thin"        android:gravity="Center"        Android:maxlines="1"        Android:text="Welcome"        Android:textcolor="@color/white"        android:textsize="34SP"/>    <com.andrognito.pinlockview.IndicatorDotsandroid:id="@+id/indicator_dots" android:layout_width="Wrap_content"android:layout_height="Wrap_content" android:layout_below= "@id/profile_name"android:layout_centerhorizontal="true "android:layout_margintop=" 36DP " />                                                    <Com.andrognito.pinlockview.PinLockView        Android:id="@+id/pin_lock_view"        Android:layout_width="Wrap_content"        Android:layout_height="Wrap_content"        Android:layout_below="@id/indicator_dots"        app:keypadbuttonsize="72DP"        app:keypadtextsize="18DP"        App:keypadshowdeletebutton="false"        App:keypadtextcolor="@color/white"        Android:layout_centerhorizontal="true"        Android:layout_margintop="16DP"/></relativelayout>

The key is the indicatordots of the password lock and the "key implementation" Pinlockview just like normal controls, with a maximum number of custom labels, the label will explain later

See how it's used in the activity (explanation in the gaze)

 Public  class sampleactivity extends appcompatactivity {     Public Static FinalString TAG ="Pinlockview";PrivatePinlockview Mpinlockview;PrivateIndicatordots mindicatordots;//Monitor Password input situation    PrivatePinlocklistener Mpinlocklistener =NewPinlocklistener () {//Input length is reached and then triggered        @Override         Public void OnComplete(String pin) {LOG.D (TAG,"Pin Complete:"+ pin); Toast.maketext (sampleactivity. This,"The password was lost."+ PIN, toast.length_short). Show (); }//Is empty when triggered        @Override         Public void Onempty() {LOG.D (TAG,"Pin Empty"); }//trigger when input content changes        @Override         Public void Onpinchange(intPinlength, String intermediatepin) {log.d (TAG,"Pin changed, new length"+ Pinlength +"with intermediate pin"+ Intermediatepin); }    };@Override    protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate);        Requestwindowfeature (Window.feature_no_title);        GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);        Setcontentview (r.layout.activity_sample);        Mpinlockview = (Pinlockview) Findviewbyid (R.id.pin_lock_view); Mindicatordots = (indicatordots) Findviewbyid (r.id.indicator_dots);///2 controls to generate associationsMpinlockview.attachindicatordots (mindicatordots);//Add Listener EventsMpinlockview.setpinlocklistener (Mpinlocklistener);//Set Password total lengthMpinlockview.setpinlength (4);//Set Button color Mpinlockview.settextcolor (getresources (). GetColor (R.color.white));}}

List some of the other custom labels

App:pinlength="6"                                       //Change the length of the pinApp:keypadtextcolor="#E6E6E6"                           //Set keyboard font colorApp:keypadtextsize="16DP"                               //Set keyboard font sizeApp:keypadbuttonsize="72DP"                             //Set button sizeapp:keypadverticalspacing="24DP"                        //Change the vertical spacing between keyboard buttonsapp:keypadhorizontalspacing="36DP"                      //Change the horizontal spacing between keyboard buttonsapp:keypadbuttonbackgrounddrawable="@drawable/bg"       //Set button background imageapp:keypaddeletebuttondrawable="@drawable/ic_back"      //Set Delete button pictureApp:keypaddeletebuttonsize="16DP"                       //Set Delete button icon sizeapp:keypadshowdeletebutton="false"                      //Set whether the Delete button is displayed, not displayed by defaultApp:keypaddeletebuttonpressedcolor="#C8C8C8"            //Change the On/focus state color of the Delete buttonApp:dotemptybackground="@drawable/empty"                //The empty state of the custom pointApp:dotfilledbackground"@drawable/filled"               //Custom point fill statusApp:dotdiameter="12DP"                                  //Change the diameter of the pointapp:dotspacing="16DP"                                   //change the spacing between individual points

Source Address: Https://github.com/aritraroy/PinLockView/archive/master.zip

The Library has revenue

Flip git---Logic clear, easy to use app internal lock control Pinlockview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.