master
pc4y93prn 2 years ago
commit e9142f3dc7

@ -0,0 +1,26 @@
package com.example.hamburger;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.hamburger", appContext.getPackageName());
}
}

@ -0,0 +1,84 @@
package com.example.hamburger;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import com.example.hamburger.dao.UserDao;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.view.View;
import android.widget.Toast;
import android.widget.Button;
import android.os.Handler;
import android.os.Message;
import android.annotation.SuppressLint;
import com.example.hamburger.dao.UserDao;
import com.example.hamburger.entity.User;
@RunWith(AndroidJUnit4.class)
public class Mtest {
@Test
public void text_1() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.hamburger", appContext.getPackageName());
new Thread(){
@Override
public void run() {
UserDao userDao = new UserDao();
int msg = userDao.login("1","1");
}
}.start();
}
@Test
public void text_2() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.hamburger", appContext.getPackageName());
User user = new User();
user.setUserAccount("11");
user.setUserPassword("11");
user.setUserName("11");
user.setUserType(1);
user.setUserState(0);
user.setUserDel(0);
new Thread(){
@Override
public void run() {
int msg = 0;
UserDao userDao = new UserDao();
User uu = userDao.findUser(user.getUserAccount());
if(uu != null){
msg = 1;
}
else{
boolean flag = userDao.register(user);
if(flag){
msg = 2;
}
}
}
}.start();
}
}

@ -0,0 +1,70 @@
package com.example.hamburger;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.view.View;
import android.widget.Toast;
import android.widget.Button;
import android.os.Handler;
import android.os.Message;
import android.annotation.SuppressLint;
import com.example.hamburger.dao.UserDao;
public class MainActivity extends AppCompatActivity {
//这个类主要用来进行,账号密码的验证,以及监听事件的编写。
// 所以首先需要将一开始设计的输入文本框id name 和passwd获取。
EditText name;//创建账号
EditText passwd;//创建密码
private static final String TAG="mysql-party-MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void login(View view){
EditText EditTextAccount = findViewById(R.id.name);
EditText EditTextPassword = findViewById(R.id.passwd);
Button button = (Button) findViewById(R.id.button);
new Thread(){
@Override
public void run() {
UserDao userDao = new UserDao();
int msg = userDao.login(EditTextAccount.getText().toString(),EditTextPassword.getText().toString());
hand1.sendEmptyMessage(msg);
}
}.start();
}
public void reg(View view){
startActivity(new Intent(getApplicationContext(),register.class));
}
@SuppressLint("HandlerLeak")
final Handler hand1 = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == 0){
Toast.makeText(getApplicationContext(), "登录失败", Toast.LENGTH_LONG).show();
} else if (msg.what == 1) {
Toast.makeText(getApplicationContext(), "登录成功", Toast.LENGTH_LONG).show();
startActivity(new Intent(getApplicationContext(),MainActivity2.class));
} else if (msg.what == 2){
Toast.makeText(getApplicationContext(), "密码错误", Toast.LENGTH_LONG).show();
} else if (msg.what == 3){
Toast.makeText(getApplicationContext(), "账号不存在", Toast.LENGTH_LONG).show();
}
}
};
}

@ -0,0 +1,37 @@
package com.example.hamburger;
import android.os.Bundle;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.example.hamburger.databinding.ActivityMain2Binding;
public class MainActivity2 extends AppCompatActivity {
private ActivityMain2Binding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMain2Binding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
BottomNavigationView navView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main2);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(binding.navView, navController);
}
}

@ -0,0 +1,247 @@
package com.example.hamburger.dao;
import com.example.hamburger.entity.IsolationUser;
import com.example.hamburger.entity.User;
import com.example.hamburger.utils.JDBCUtils;
import android.annotation.SuppressLint;
import android.util.Log;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
public class UserDao {
private static final String TAG = "mysql-party-UserDao";
/**
* function:
* */
@SuppressLint("LongLogTag")
public int login(String userAccount, String userPassword){
HashMap<String, Object> map = new HashMap<>();
// 根据数据库名称,建立连接
Connection connection = JDBCUtils.getConn();
int msg = 0;
try {
// mysql简单的查询语句。这里是根据user表的userAccount字段来查询某条记录
String sql = "select * from user_ where userAccount = ?";
if (connection != null){// connection不为null表示与数据库建立了连接
PreparedStatement ps = connection.prepareStatement(sql);
if (ps != null){
Log.e(TAG,"账号:" + userAccount);
//根据账号进行查询
ps.setString(1, userAccount);
// 执行sql查询语句并返回结果集
ResultSet rs = ps.executeQuery();
int count = rs.getMetaData().getColumnCount();
//将查到的内容储存在map里
while (rs.next()){
// 注意下标是从1开始的
for (int i = 1;i <= count;i++){
String field = rs.getMetaData().getColumnName(i);
map.put(field, rs.getString(field));
}
}
connection.close();
ps.close();
if (map.size()!=0){
StringBuilder s = new StringBuilder();
//寻找密码是否匹配
for (String key : map.keySet()){
if(key.equals("userPassword")){
if(userPassword.equals(map.get(key))){
msg = 1; //密码正确
}
else
msg = 2; //密码错误
break;
}
}
}else {
Log.e(TAG, "查询结果为空");
msg = 3;
}
}else {
msg = 0;
}
}else {
msg = 0;
}
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "异常login" + e.getMessage());
msg = 0;
}
return msg;
}
/**
* function:
* */
@SuppressLint("LongLogTag")
public boolean register(User user){
HashMap<String, Object> map = new HashMap<>();
// 根据数据库名称,建立连接
Connection connection = JDBCUtils.getConn();
try {
String sql = "insert into user_(userAccount,userPassword,userName,userType,userState,userDel) values (?,?,?,?,?,?)";
if (connection != null){// connection不为null表示与数据库建立了连接
PreparedStatement ps = connection.prepareStatement(sql);
if (ps != null){
//将数据插入数据库
ps.setString(1,user.getUserAccount());
ps.setString(2,user.getUserPassword());
ps.setString(3,user.getUserName());
ps.setInt(4,user.getUserType());
ps.setInt(5, user.getUserState());
ps.setInt(6,user.getUserDel());
// 执行sql查询语句并返回结果集
int rs = ps.executeUpdate();
if(rs>0)
return true;
else
return false;
}else {
return false;
}
}else {
return false;
}
}catch (Exception e){
e.printStackTrace();
Log.e(TAG, "异常register" + e.getMessage());
return false;
}
}
/**
* function:
* */
@SuppressLint("LongLogTag")
public boolean LogInfor(IsolationUser user){
HashMap<String, Object> map = new HashMap<>();
// 根据数据库名称,建立连接
Connection connection = JDBCUtils.getConn();
try {
String sql = "insert into infor_(name,gender,id_number,room_number,checkin_time) values (?,?,?,?,?)";
if (connection != null){// connection不为null表示与数据库建立了连接
PreparedStatement ps = connection.prepareStatement(sql);
if (ps != null){
//将数据插入数据库
ps.setString(1,user.getname());
ps.setString(2,user.getGender());
ps.setString(3,user.getIdnumber());
ps.setInt(4,user.getRoomnumber());
ps.setString(5, user.getCheckin_time());
// 执行sql查询语句并返回结果集
int rs = ps.executeUpdate();
if(rs>0)
return true;
else
return false;
}else {
return false;
}
}else {
return false;
}
}catch (Exception e){
e.printStackTrace();
Log.e(TAG, "异常loginfor" + e.getMessage());
return false;
}
}
/**
* function:
* */
@SuppressLint("LongLogTag")
public User findUser(String userAccount) {
// 根据数据库名称,建立连接
Connection connection = JDBCUtils.getConn();
User user = null;
try {
String sql = "select * from user_ where userAccount = ?";
if (connection != null){// connection不为null表示与数据库建立了连接
PreparedStatement ps = connection.prepareStatement(sql);
if (ps != null) {
ps.setString(1, userAccount);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
//注意下标是从1开始
int id = rs.getInt(1);
String userAccount1 = rs.getString(2);
String userPassword = rs.getString(3);
String userName = rs.getString(4);
int userType = rs.getInt(5);
int userState = rs.getInt(6);
int userDel = rs.getInt(7);
user = new User(userAccount1, userPassword);
}
}
}
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "异常findUser" + e.getMessage());
return null;
}
return user;
}
/**
* function:
* */
@SuppressLint("LongLogTag")
public IsolationUser findUser_(String name) {
// 根据数据库名称,建立连接
Connection connection = JDBCUtils.getConn();
IsolationUser user = null;
try {
String sql = "select * from infor_ where name = ?";
if (connection != null){// connection不为null表示与数据库建立了连接
PreparedStatement ps = connection.prepareStatement(sql);
if (ps != null) {
ps.setString(1, name);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
//注意下标是从1开始
int id = rs.getInt(1);
String name1 = rs.getString(2);
String gender = rs.getString(3);
String idnumber = rs.getString(4);
int roomnumber = rs.getInt(5);
String checkin_time = rs.getString(6);
user = new IsolationUser(name1,gender,idnumber,roomnumber,checkin_time);
}
}
}
}catch (Exception e){
e.printStackTrace();
Log.d(TAG, "异常findUser" + e.getMessage());
return null;
}
return user;
}
}

@ -0,0 +1,72 @@
package com.example.hamburger.entity;
public class IsolationUser {
private int id;
private String name;
private String gender;
private String idnumber;
private int roomnumber;
private String checkin_time;
public IsolationUser() {
}
public IsolationUser(String name, String gender, String idnumber, int roomnumber, String checkin_time) {
this.id = id;
this.name = name;
this.gender = gender;
this.idnumber = idnumber;
this.roomnumber = roomnumber;
this.checkin_time = checkin_time;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getname() {
return name;
}
public void setname(String name) {
this.name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getIdnumber() {
return idnumber;
}
public void setIdnumber(String idnumber) {
this.idnumber = idnumber;
}
public int getRoomnumber() {
return roomnumber;
}
public void setRoomnumber(int roomnumber) {
this.roomnumber = roomnumber;
}
public String getCheckin_time() {
return checkin_time;
}
public void setCheckin_time(String checkin_time) {
this.checkin_time = checkin_time;
}
}

@ -0,0 +1,83 @@
package com.example.hamburger.entity;
public class User {
private int id;
private String userAccount;
private String userPassword;
private String userName;
private int userType;
private int userState;
private int userDel;
public User() {
}
public User(String userAccount, String userPassword) {
this.id = id;
this.userAccount = userAccount;
this.userPassword = userPassword;
this.userName = userName;
this.userType = userType;
this.userState = userState;
this.userDel = userDel;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserAccount() {
return userAccount;
}
public void setUserAccount(String userAccount) {
this.userAccount = userAccount;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getUserType() {
return userType;
}
public void setUserType(int userType) {
this.userType = userType;
}
public int getUserState() {
return userState;
}
public void setUserState(int userState) {
this.userState = userState;
}
public int getUserDel() {
return userDel;
}
public void setUserDel(int userDel) {
this.userDel = userDel;
}
}

@ -0,0 +1,104 @@
package com.example.hamburger;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.hamburger.dao.UserDao;
import com.example.hamburger.entity.User;
import androidx.appcompat.app.AppCompatActivity;
public class register extends AppCompatActivity {
private static final String TAG = "mysql-party-register";
EditText userAccount = null;
EditText userPassword = null;
EditText userName = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
userAccount = findViewById(R.id.userAccount);
userPassword = findViewById(R.id.userPassword);
userName = findViewById(R.id.userName);
}
public void register(View view){
String userAccount1 = userAccount.getText().toString();
String userPassword1 = userPassword.getText().toString();
String userName1 = userName.getText().toString();
User user = new User();
user.setUserAccount(userAccount1);
user.setUserPassword(userPassword1);
user.setUserName(userName1);
user.setUserType(1);
user.setUserState(0);
user.setUserDel(0);
new Thread(){
@Override
public void run() {
int msg = 0;
UserDao userDao = new UserDao();
User uu = userDao.findUser(user.getUserAccount());
if(uu != null){
msg = 1;
}
else{
boolean flag = userDao.register(user);
if(flag){
msg = 2;
}
}
hand.sendEmptyMessage(msg);
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand = new Handler()
{
public void handleMessage(Message msg) {
if(msg.what == 0) {
Toast.makeText(getApplicationContext(),"注册失败",Toast.LENGTH_LONG).show();
} else if(msg.what == 1) {
Toast.makeText(getApplicationContext(),"该账号已经存在,请换一个账号",Toast.LENGTH_LONG).show();
} else if(msg.what == 2) {
Toast.makeText(getApplicationContext(), "注册成功", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//将想要传递的数据用putExtra封装在intent中
intent.putExtra("a","注册");
setResult(RESULT_CANCELED,intent);
finish();
}
}
};
public void Ret(View view){
//获取按钮
Button button = (Button) findViewById(R.id.ret);
//按钮进行监听
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//监听按钮,如果点击,就跳转
Intent intent = new Intent();
//前一个MainActivity.this是目前页面后面一个是要跳转的下一个页面
intent.setClass(register.this, MainActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,101 @@
package com.example.hamburger.ui.home;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.hamburger.R;
import com.example.hamburger.dao.UserDao;
import com.example.hamburger.entity.IsolationUser;
public class Inform_input extends AppCompatActivity{
private static final String TAG = "mysql-party-register";
EditText name = null;
EditText gender = null;
EditText idnumber = null;
EditText roomnumber = null;
EditText checkin_time = null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.infor_input);
name = findViewById(R.id.name);
gender = findViewById(R.id.gender);
idnumber = findViewById(R.id.ID_number);
roomnumber = findViewById(R.id.roomnumber);
checkin_time = findViewById(R.id.checkin_time);
}
public void addInfor(View view){
String name1 = name.getText().toString();
String gender1 = gender.getText().toString();
String idnumber1 = idnumber.getText().toString();
int roomnumber1 = Integer.parseInt(roomnumber.getText().toString());
String checkin_time1 = checkin_time.getText().toString();
IsolationUser user=new IsolationUser();
user.setname(name1);
user.setGender(gender1);
user.setIdnumber(idnumber1);
user.setRoomnumber(roomnumber1);
user.setCheckin_time(checkin_time1);
new Thread(){
@Override
public void run() {
int msg = 0;
UserDao userDao = new UserDao();
IsolationUser uu = userDao.findUser_(user.getname());
if(uu != null){
msg = 1;
}
else{
boolean flag = userDao.LogInfor(user);
if(flag){
msg = 2;
}
}
hand.sendEmptyMessage(msg);
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand = new Handler()
{
public void handleMessage(Message msg) {
if(msg.what == 0) {
Toast.makeText(getApplicationContext(),"录入失败",Toast.LENGTH_LONG).show();
} else if(msg.what == 1) {
Toast.makeText(getApplicationContext(),"该信息已经存在,请重新录入",Toast.LENGTH_LONG).show();
} else if(msg.what == 2) {
Toast.makeText(getApplicationContext(), "录入成功", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//将想要传递的数据用putExtra封装在intent中
intent.putExtra("a","录入");
setResult(RESULT_CANCELED,intent);
finish();
}
}
};
public void findInfor(View view){
}
}

@ -0,0 +1,37 @@
package com.example.hamburger.utils;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* function
*/
public class JDBCUtils {
private static final String TAG = "mysql-party-JDBCUtils";
private static String driver = "com.mysql.jdbc.Driver";// MySql驱动
private static String dbName = "party";// 数据库名称
private static String user = "rootes";// 用户名
private static String password = "123456";// 密码
public static Connection getConn(){
Connection connection = null;
try{
Class.forName(driver);// 动态加载类
String ip = "192.168.43.7";// 写成本机地址不能写成localhost同时手机和电脑连接的网络必须是同一个
// 尝试建立到给定数据库URL的连接
connection = DriverManager.getConnection("jdbc:mysql://" + ip + ":3306/" + dbName,
user, password);
}catch (Exception e){
e.printStackTrace();
}
return connection;
}
}

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#c8c7c5"
tools:context=".MainActivity">
<!--
思路
1.登录界面需要输入账号、密码,那么我们我要两个输入文本框。
2.需要点击一个登录,那么需要一个登录按钮,以及监听按钮的登陆事件。
3.作为一个简易的登录界面,我们并不加入数据库,添加一个账号密码识别认证即可。-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="-25dp"
tools:layout_editor_absoluteY="291dp">
<!--android:layout_marginLeft 这个作用是设置和左边的间距
android:layout_marginTop 这个作用是设置和顶部的间距
android:ems 这个作用是限制输入长度
android:hint 这个作用是设置输入文本框内的提示内容
android:inputType 这个作用是选择输入的内容类型
android:textColorHint 这个作用是设置文本框内提示内容的颜色-->
<!--android:onClick 这个作用是与java文件中的监听事件对应
android:text 这个作用是给按钮一个文本显示-->
<TextView
android:id="@+id/title"
android:layout_width="400dp"
android:layout_height="100dp"
android:text="隔离酒店智慧管理系统"
android:textColor="#083684"
android:gravity="center"
android:textSize="30dp"
>
</TextView>
<ImageView
android:id="@+id/icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/hotel_logo"
app:layout_constraintTop_toBottomOf="@id/title"
>
</ImageView>
<EditText
android:id="@+id/name"
android:layout_width="264dp"
android:layout_height="50dp"
android:background="@color/white"
android:ems="12"
android:layout_marginTop="10dp"
android:hint="输入用户名"
android:inputType="text"
android:textColorHint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="75dp"
tools:layout_editor_absoluteY="256dp"></EditText>
<EditText
android:id="@+id/passwd"
android:layout_width="264dp"
android:layout_height="50dp"
android:background="@color/white"
android:layout_marginTop="10dp"
android:ems="12"
android:hint="输入密码"
android:inputType="textPassword"
android:textColorHint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="75dp"
tools:layout_editor_absoluteY="360dp"></EditText>
<!-- <RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/radioButton"
android:orientation="horizontal"
android:layout_constraintTop_toBottomOf="@id/passwd">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/radioButton_1"
android:text="隔离人员"
android:textColor="#083684">
</RadioButton>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/radioButton_2"
android:text="管理员"
android:textColor="#083684">
</RadioButton>
</RadioGroup>-->
<Button
android:id="@+id/button"
android:layout_width="200dp"
android:layout_height="48dp"
android:onClick="login"
android:text="登录"
android:layout_marginTop="10dp"
android:backgroundTint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="105dp"
tools:layout_editor_absoluteY="469dp" />
<!---->
<Button
android:id="@+id/register"
android:layout_width="200dp"
android:layout_height="48dp"
android:onClick="reg"
android:text="注册"
android:layout_marginTop="10dp"
android:backgroundTint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="105dp"
tools:layout_editor_absoluteY="469dp" />
</LinearLayout>
<!---->
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#c8c7c5"
tools:context=".register">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="-25dp"
tools:layout_editor_absoluteY="291dp">
<TextView
android:layout_width="400dp"
android:layout_height="100dp"
android:text="酒店智慧管理系统"
android:textColor="#083684"
android:gravity="center"
android:textSize="30dp">
</TextView>
<EditText
android:id="@+id/userAccount"
android:layout_width="264dp"
android:layout_height="50dp"
android:background="@color/white"
android:ems="12"
android:layout_marginTop="10dp"
android:hint="创建用户名"
android:inputType="text"
android:textColorHint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="75dp"
tools:layout_editor_absoluteY="256dp"></EditText>
<EditText
android:id="@+id/userName"
android:layout_width="264dp"
android:layout_height="50dp"
android:background="@color/white"
android:layout_marginTop="10dp"
android:ems="12"
android:hint="创建昵称"
android:inputType="text"
android:textColorHint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="75dp"
tools:layout_editor_absoluteY="360dp"></EditText>
<EditText
android:id="@+id/userPassword"
android:layout_width="264dp"
android:layout_height="50dp"
android:background="@color/white"
android:layout_marginTop="10dp"
android:ems="12"
android:hint="创建密码"
android:inputType="textPassword"
android:textColorHint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="75dp"
tools:layout_editor_absoluteY="360dp"></EditText>
<Button
android:id="@+id/register"
android:layout_width="200dp"
android:layout_height="48dp"
android:onClick="register"
android:text="注册"
android:layout_marginTop="10dp"
android:backgroundTint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="105dp"
tools:layout_editor_absoluteY="469dp" />
<Button
android:id="@+id/ret"
android:layout_width="200dp"
android:layout_height="48dp"
android:onClick="Ret"
android:text="返回"
android:layout_marginTop="10dp"
android:backgroundTint="#083684"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="105dp"
tools:layout_editor_absoluteY="469dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="#c8c7c5"
tools:context=".ui.home.Inform_input">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_editor_absoluteX="219dp"
tools:layout_editor_absoluteY="207dp"
android:padding="50dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:text="姓名:" />
<EditText
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:text="性别:" />
<EditText
android:id="@+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:text="身份证号:"
/>
<EditText
android:id="@+id/ID_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text"
tools:ignore="DuplicateIds" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:text="房间号:"
/>
<EditText
android:id="@+id/roomnumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="15sp"
android:text="入住时间:"
/>
<EditText
android:id="@+id/checkin_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
<Button
android:layout_marginTop="50dp"
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="录入"
android:backgroundTint="#083684"
android:onClick="addInfor"
/>
<Button
android:layout_marginTop="10dp"
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="查询"
android:backgroundTint="#083684"
android:onClick="findInfor"
/>
<TextView
android:id="@+id/tv_response"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save