Nine-grid password lock entry program

Nine-grid password lock entry program

Source code introduction

Set the nine-grid password lock to enter the program, set, reset, cancel, etc. Android Bus Address http://www.apkbus.com/forum.php?mod=viewthread&tid=182620&extra=
Source code running screenshot

Source code snippet

  1. package com.example.demo;
  2.   
  3. import com.example.demo.LocusPassWordView.OnCompleteListener;
  4.   
  5. import android.app.Activity;
  6. import android.content.Intent;
  7. import android.os.Bundle;
  8. import android.os.Handler;
  9. import android.view.View;
  10. import android.widget.TextView;
  11. import android.widget.Toast;
  12.   
  13. public   class LoginActivity extends Activity {
  14.   
  15. private LocusPassWordView lpwv;
  16. private   static   final   int SPLASH_SHOW_TIME = 2000 ;
  17. Handler handler = new Handler();
  18. Intent intent = new Intent();
  19.   
  20. TextView title;
  21.   
  22. @Override  
  23. public   void onCreate(Bundle savedInstanceState) {
  24. super .onCreate(savedInstanceState);
  25. setContentView(R.layout.activity_login);
  26.   
  27. title = (TextView) findViewById(R.id.login_toast);
  28. lpwv = (LocusPassWordView) this .findViewById(R.id.mLocusPassWordView);
  29.   
  30. if (lpwv.isPasswordEmpty()) {
  31. title.setVisibility(View.GONE);
  32. lpwv.setVisibility(View.GONE);
  33.               
  34. handler.postDelayed( new Runnable() {
  35. @Override  
  36. public   void run() {
  37. intent.setClass(getApplicationContext(), MainActivity. class );
  38. startActivity(intent);
  39. finish();
  40. }
  41. }, SPLASH_SHOW_TIME);
  42. } else {
  43. lpwv.setVisibility(View.VISIBLE);
  44. lpwv.setOnCompleteListener( new OnCompleteListener() {
  45. @Override  
  46. public   void onComplete(String mPassword) {
  47. // If the password is correct, enter the main page.  
  48. if (lpwv.verifyPassword(mPassword)) {
  49. Toast.makeText(LoginActivity. this , "Login successful!" ,
  50. Toast.LENGTH_SHORT).show();
  51. intent.setClass(getApplicationContext(),
  52. MainActivity.class );
  53. startActivity(intent);
  54. finish();
  55. } else {
  56. Toast.makeText(LoginActivity. this , "Wrong password, please re-enter" ,
  57. Toast.LENGTH_SHORT).show();
  58. lpwv.clearPassword();
  59. }
  60. }
  61. });
  62. }
  63. }
  64. }

Source code download: http://download..com/data/1978597

<<:  NFC interface adaptation, reading and writing tags (Note and Galaxy series)

>>:  Global annotation and graffiti

Recommend

Former Faraday creative director appointed Aston Martin chief technology officer

According to foreign media reports, Aston Martin ...

How to create a landing page with high conversion rate? Share 2 pictures!

Unlike traditional industries that can bring prod...

Do elephants really have hidden graveyards?

In the new version of "The Lion King" r...

Introduction to 360 brand advertising and promotion!

Brand Advertising Brand advertising is based on t...

20 basic ideas that planners must have in 2020

I don’t know if you have ever had the feeling tha...

How to name your website? How to name a Google website?

The name and domain name of the website cannot be...

Why is Tik Tok rebelling against Tencent?

Toutiao and Tencent have recently started a fight...