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

A quick training course on making elegant PPT

Introduction to the resources of the quick traini...

How to be immune to fake traffic?

In recent years, China's Internet has faced a...

Battery dilemma: a game that can’t be stopped

At present, China has surpassed the United States...

Are nano products a waste of money? In fact, nanotechnology is not just "small"

The word “nano” sounds so technological, so putti...

How to obtain seed users during the cold start period?

In the initial stage of cold start, how do we ide...

Headache? Maybe you need to grow a brain!

Review expert: Yin Tielun, deputy chief physician...

Thunderbolt Bridge: Laptops running wild with GTX 780 Ti

Laptop graphics cards have always been weak, and e...

Forgotten interests, where is the operational value of mini programs?

In the open class on December 28, Zhang Xiaolong ...

From 0 to 1, build a massive Qianchuan delivery plan

On April 9, 2021, the 2021 Douyin E-commerce Ecos...

Weibo released a mobile phone report, and fewer and fewer people use iPhones

There is another new smartphone report, and this ...