passcode

Introduction: passcode android example
More: Author   ReportBugs   
Tags:

Android Passcode view

Usage

Adding to build.gradle for app level

    compile(group: 'in.ashish29agre.passcode', name: 'passcode', version: '1.0.0', ext: 'aar');
    or
    compile 'com.github.ashish29agre:passcode:1.0.0' for jitpack

Adding to project level gradle

    repositories {
        jcenter()
        maven {
            url  "http://dl.bintray.com/ashish29agre/passcode-repo"
            //for jitpack
            url "https://jitpack.io"
        }
    }

XML

 <in.ashish29agre.passcode.PasscodeView
         android:id="@+id/passcode_view"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"/>

Java

PasscodeView passcodeView = (PasscodeView) findViewById(R.id.passcode_view);
        passcodeView.setPassCodeCount(4);
        passcodeView.setDrawableSize(48);
        passcodeView.setPasscodeItemMargin(8);
        passcodeView.clearAndShow();
        passcodeView.setPasscodeCallback(new PasscodeCallback() {
            @Override
            public void onComplete(CharSequence sequence) {
                if(sequence.equals("4728")) {
                    Toast.makeText(MainActivity.this, "Passcode verified", Toast.LENGTH_SHORT).show();
                    passcodeView.hideSoftKeyboard();
                } else {
                    Toast.makeText(MainActivity.this, "Please try again", Toast.LENGTH_SHORT).show();
                }
            }
        });

Image of Yaktocat

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools