package net.micode.notes.ui;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import net.micode.notes.R;

public class Cypher implements View.OnClickListener{
    //声明控件
    private Button confirm;
    private EditText passwd;
    @Override
    protected void onCreate (Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setConteneView(R.layout.cypher);
        //找到控件
        confirm = findViewById(R.id.confirm);
        passwd = findViewById(R.id.edittext);
        //实现跳转
        confirm.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = null;
                intent = new Intent(NotesListActivity.this.NotesListActivity2.class);
                startActivity(intent);
            }
        });
        //匹配后跳转
        confirm.setOnClickListener(this);

    }
    //密码匹配
    public void onClick(View v){
        //获取密码
        String password = passwd.getText().toString();
        Intent intent = null;
        //弹出内容设置
        String fail = "密码错误"
        //一般调用锁屏密码，这里使用123456
        if(password.equals("123456")){
            //匹配正确后，跳转到密码箱
            Toast.makeText(getApplicationContext)
            intent = new Intent(Cypher.this, NotesListActivity2.class)
            startActivity(intent);
        }
        else{
            //提示错误toast
            Toast.makeText(getApplicationContext(),fail,Toast.LENGTH_SHORT).show();
        }
    }
    @Override
    public void onPointerCaptureChanged(boolean hasCapture){

    }
}
