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

Automatic day and night change & full screen mini program! WeChat 7.0.3 is here

[[256644]] Recently, WeChat released version 7.0....

When planning a hit event, you need to pay attention to 3 issues

Activities are an important means of operation an...

Guide to submitting new apps to the App Store for review in Apple iOS 9

In the tenth lecture, we mentioned the details th...

Event Operation Design Framework

This article takes games as an example to introdu...

This pre-meal step is possible, but not necessary

When dining out, many people are used to boiling ...

Are we living in a giant 'cosmic hologram'?

In science fiction movies, we often see virtual o...

Why is it difficult for domestic apps to dominate overseas markets?

[[137790]] China is the most populous country in ...

Get pregnant as early as possible! HPV vaccines are free in many places...

The 2022 Government Work Report pointed out that ...

How to operate a product well with insufficient budget?

Insufficient funds is a common problem faced by m...

up to date! Data rankings of 59 advertising platforms!

Let’s take a detailed look at the data performanc...

The city with zero "mortality rate": here, birth and death are "illegal"

Birth, aging, illness and death are the most natu...