// Path: app/src/main/java/com/yan/mobilesafe/activity/Setup/SetupActivity1.java
// public class SetupActivity1 extends AppCompatActivity {
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_setup1);
//         Button next = (Button) findViewById(R.id.next);
// 
//         next.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
// 
//                 startActivity(new Intent(getApplicationContext(), SetupActivity2.class));
//                 finish();
//                 overridePendingTransition(R.anim.tran_in, R.anim.tran_out);//进入动画和退出动画
// 
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/com/yan/mobilesafe/utils/MD5utils.java
// public class MD5utils {
//     /**
//      * Md5加密
//      */
//     public static String encode(String password)  {
//         MessageDigest messageDigest = null;
//         try {
//             messageDigest = MessageDigest.getInstance("MD5");
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         }
//         byte[] digest = messageDigest.digest(password.getBytes());
// 
//         StringBuffer stringBuffer = new StringBuffer();
//         for (byte b : digest) {
//             int i = b & 0xff; //获取字节的低八位
//             String hexString = Integer.toHexString(i);  //转换成16进制
// 
//             if (hexString.length() < 2) {
//                 hexString = "0" + hexString;
//             }
//             stringBuffer.append(hexString);
//         }
//         return stringBuffer.toString();
//     }
// }


import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.yan.mobilesafe.R;
import com.yan.mobilesafe.activity.Setup.SetupActivity1;
import com.yan.mobilesafe.utils.MD5utils;
            public void onClick(View v) {
                String password = passwordInput.getText().toString();
                if (!TextUtils.isEmpty(password)) {
                    String savePassword = sharedPreferences.getString("password", null);
                    //校验密码
                    if (MD5utils.encode(password).equals(savePassword)) {
                        isFirstIn();
                        dialog.dismiss();
                        //把安全号码显示在界面上
                        String safePhone = sharedPreferences.getString("safe_number","");
                        safeNumber.setText(safePhone);

                        boolean protect = sharedPreferences.getBoolean("protect",false);
                        if (protect){
                            lockioc.setImageResource(R.drawable.lock);
                        }else {
                            lockioc.setImageResource(R.drawable.unlock);
                        }
                    } else {
                        Toast.makeText(getApplicationContext(),
                                "密码错误", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(getApplicationContext(),
                            "输入框内容不能为空", Toast.LENGTH_SHORT).show();
                }
            }
        });

        btnCancel.setOnClickListener(new View.OnClickListener() {
// Path: app/src/main/java/com/yan/mobilesafe/activity/Setup/SetupActivity1.java
// public class SetupActivity1 extends AppCompatActivity {
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_setup1);
//         Button next = (Button) findViewById(R.id.next);
// 
//         next.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
// 
//                 startActivity(new Intent(getApplicationContext(), SetupActivity2.class));
//                 finish();
//                 overridePendingTransition(R.anim.tran_in, R.anim.tran_out);//进入动画和退出动画
// 
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/com/yan/mobilesafe/utils/MD5utils.java
// public class MD5utils {
//     /**
//      * Md5加密
//      */
//     public static String encode(String password)  {
//         MessageDigest messageDigest = null;
//         try {
//             messageDigest = MessageDigest.getInstance("MD5");
//         } catch (NoSuchAlgorithmException e) {
//             e.printStackTrace();
//         }
//         byte[] digest = messageDigest.digest(password.getBytes());
// 
//         StringBuffer stringBuffer = new StringBuffer();
//         for (byte b : digest) {
//             int i = b & 0xff; //获取字节的低八位
//             String hexString = Integer.toHexString(i);  //转换成16进制
// 
//             if (hexString.length() < 2) {
//                 hexString = "0" + hexString;
//             }
//             stringBuffer.append(hexString);
//         }
//         return stringBuffer.toString();
//     }
// }


// Path: app/src/main/java/com/yan/mobilesafe/activity/Simguard.java
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.yan.mobilesafe.R;
import com.yan.mobilesafe.activity.Setup.SetupActivity1;
import com.yan.mobilesafe.utils.MD5utils;

            public void onClick(View v) {
                String password = passwordInput.getText().toString();
                if (!TextUtils.isEmpty(password)) {
                    String savePassword = sharedPreferences.getString("password", null);
                    //校验密码
                    if (MD5utils.encode(password).equals(savePassword)) {
                        isFirstIn();
                        dialog.dismiss();
                        //把安全号码显示在界面上
                        String safePhone = sharedPreferences.getString("safe_number","");
                        safeNumber.setText(safePhone);

                        boolean protect = sharedPreferences.getBoolean("protect",false);
                        if (protect){
                            lockioc.setImageResource(R.drawable.lock);
                        }else {
                            lockioc.setImageResource(R.drawable.unlock);
                        }
                    } else {
                        Toast.makeText(getApplicationContext(),
                                "密码错误", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(getApplicationContext(),
                            "输入框内容不能为空", Toast.LENGTH_SHORT).show();
                }
            }
        });

        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override