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

iOS AFNetworking framework HTTPS request configuration

[Quoted from IamOkay's blog] Under Apple'...

Can marketing really do more with less money?

There are some things that you cannot think about...

News app finally appears in iOS 9 Beta 3 hands-on testing

Apple released its next-generation operating syst...

Insomnia, what is our body telling us?

Some people say that after the age of 30, you can...

Life is not easy, cherish every moment of it!

In the past two days, an article titled "In ...

"Chinese Tea" was successfully nominated for World Heritage!

On the evening of November 29th, Beijing time, th...

3 tips to teach you how to easily build a user operation system!

1. Opening What is important in operations is a w...

Are “fast-thinking” programmers better?

A few days ago, an article on Hacker News titled ...

Secret's demise reveals Silicon Valley startups' "flash in the pan" trend

A twist of fate Last summer, employees of the sta...