package net.micode.notes.ui;

import android.annotation.SuppressLint;
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 PasswordActivity extends NotesListActivity {

    private Button mBtnEditText;
    EditText pwd;
    @SuppressLint("WrongViewCast")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.password);
        pwd = findViewById(R.id.qq_password);
        mBtnEditText = (Button) findViewById(R.id.button);
        mBtnEditText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (pwd.getText().toString().equals("12345678")) { //设计用户名为admin，密码为123456//
                    Toast.makeText(PasswordActivity.this, "登陆成功", Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(PasswordActivity.this, NotesListActivity.class);
                    startActivity(intent);
                } else if (pwd.getText().toString().equals("")) {
                    Toast.makeText(PasswordActivity.this, "密码不能为空!", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(PasswordActivity.this, "登录失败，密码错误!", Toast.LENGTH_SHORT).show();
                }

            }
        });
    }
}

