(staffDao.queryBuilder().orderAsc(StaffDao.Properties.StaffId).list(), R.layout.item_staff_manage) {
27 | @Override
28 | public void bindView(ViewHolder holder, Staff obj) {
29 | holder.setText(R.id.employeeID, obj.getStaffId() + "");
30 | holder.setText(R.id.name, obj.getStaffName());
31 | holder.setText(R.id.gender, obj.getStaffGender());
32 | holder.setText(R.id.department, obj.getStaffDepartment());
33 | }
34 | };
35 | employeeList.setAdapter(reusableAdapter);
36 | employeeList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
37 | @Override
38 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
39 | Intent intent = new Intent(StaffManageActivity.this, ModifyEmployeeActivity.class);
40 | intent.putExtra("staff", (Staff) reusableAdapter.getItem(position));
41 | startActivity(intent);
42 | }
43 | });
44 | }
45 |
46 | @Override
47 | protected void onResume() {
48 | super.onResume();
49 | //清除单个DAO的标识范围:不要返回“缓存”对象。
50 | staffDao.detachAll();
51 | reusableAdapter.updateAll(staffDao.queryBuilder().orderAsc(StaffDao.Properties.StaffId).list());
52 | }
53 |
54 | public void onClick(View view) {
55 | switch (view.getId()) {
56 | case R.id.newEmployee:
57 | startActivity(new Intent(this, NewEmployeeActivity.class));
58 | break;
59 | default:
60 | break;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/bean/Admin.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.bean;
2 |
3 |
4 | import org.greenrobot.greendao.annotation.Entity;
5 | import org.greenrobot.greendao.annotation.Generated;
6 | import org.greenrobot.greendao.annotation.Id;
7 | import org.greenrobot.greendao.annotation.Index;
8 | import org.greenrobot.greendao.annotation.NotNull;
9 | import org.greenrobot.greendao.annotation.Property;
10 | import org.greenrobot.greendao.annotation.Transient;
11 |
12 | import java.io.Serializable;
13 |
14 | /**
15 | * 使用注释来定义模式和考勤实体类
16 | * 该@Entity注解打开Java类到数据库支持的实体。这也将指示greenDAO生成必要的代码(例如DAO)。@Entity 注解标记了一个Java类作为greenDAO一个presistable实体。
17 | *
18 | * 数据库端的表和列名称是从实体和属性名称派生的。而不是Java中使用的驼峰案例样式,默认数据库名称是大写的,使用下划线来分隔单词。
19 | * 例如,名为creationDate的属性 将成为数据库列 CREATION_DATE。
20 | */
21 | @Entity(
22 | // 如果您有多个模式,您可以告诉greenDAO一个实体属于哪个模式(选择任意字符串作为名称)。
23 | // schema = "myschema",
24 |
25 | // 标记使实体“活动”:活动实体具有更新、删除和刷新方法。
26 | // active = true,
27 |
28 | // 指定数据库中表的名称。默认情况下,名称基于实体类名称。
29 | // nameInDb = "AWESOME_USERS",
30 |
31 | // 在这里定义跨越多个列的索引。
32 | // indexes = {
33 | // @Index(value = "name DESC", unique = true)
34 | // },
35 |
36 | //标记DAO是否应该创建数据库表(默认为true)。如果您有多个实体映射到一个表,或者创建表是在greenDAO之外完成的,则将此设置为false。
37 | // createInDb = false,
38 |
39 | // 是否应该生成all properties构造函数。总是需要一个无args构造函数。
40 | generateConstructors = true,
41 |
42 | // 如果缺少属性的getter和setter,是否应该生成它们。
43 | generateGettersSetters = true
44 |
45 | //Note that multiple schemas are currently not supported when using the Gradle plugin.(https://github.com/greenrobot/greenDAO/issues/356)
46 | // For the time being, continue to use your generator project.(http://greenrobot.org/greendao/documentation/generator/)
47 | )
48 | public class Admin implements Serializable {
49 |
50 | /**
51 | * 这个@Id注释选择long / Long属性作为实体ID。 在数据库方面,它是主键。 参数autoincrement是一个标志,使ID值不断增加(不重用旧值)。
52 | * 目前,实体必须用 long或 Long属性作为其主键。这是Android和SQLite的推荐做法。要解决这个问题,可以将key属性定义为一个附加属性,但是要为它创建一个惟一的索引
53 | */
54 | @Id(autoincrement = true)
55 | /**
56 | * 在属性上使用@Index为相应的数据库列创建数据库索引。 使用以下参数进行自定义:
57 | * name:如果你不喜欢greenDAO为索引生成的默认名称,你可以在这里指定你的名字。
58 | * unique:向索引添加UNIQUE约束,强制所有值都是唯一的。
59 | * 这个@Unique注释向数据库列添加唯一约束。注意,SQLite还隐式地为它创建了一个索引。
60 | * 注意:要添加跨越多个属性的索引,请参阅@Entity注释的文档。(http://greenrobot.org/greendao/documentation/modelling-entities/#The_Entity_Annotation)
61 | */
62 | @Index(unique = true)
63 | /**
64 | * 这个@Property注释允许您定义属性映射到的非默认列名称。 @Property(nameInDb = "USERNAME")
65 | * 如果不存在,greenDAO将以SQL-ish方式使用字段名称(大写,下划线而不是camel情况,例如customName将成为CUSTOM_NAME)。 注意:您当前只能使用内联常量来指定列名。
66 | */
67 | @Property(nameInDb = "ADMIN_ID")
68 | private long adminId;
69 | /**
70 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
71 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
72 | */
73 | @NotNull
74 | private String adminAccount;
75 | /**
76 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
77 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
78 | */
79 | @NotNull
80 | private String adminPassword;
81 | /**
82 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
83 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
84 | */
85 | @NotNull
86 | private String adminName;
87 | /**
88 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
89 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
90 | */
91 | @NotNull
92 | private String adminGender;
93 | /**
94 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
95 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
96 | */
97 | @NotNull
98 | private String adminEmail;
99 | /**
100 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
101 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
102 | */
103 | @NotNull
104 | private String adminPhone;
105 | /**
106 | * 这个@Transient注释标记要从持久性中排除的属性。 将它们用于临时状态等。或者,您也可以使用Java中的transient关键字。
107 | */
108 | @Transient
109 | private static final long serialVersionUID = -8997430981657272709L;
110 |
111 | @Generated(hash = 1139986266)
112 | public Admin(long adminId, @NotNull String adminAccount, @NotNull String adminPassword, @NotNull String adminName, @NotNull String adminGender,
113 | @NotNull String adminEmail, @NotNull String adminPhone) {
114 | this.adminId = adminId;
115 | this.adminAccount = adminAccount;
116 | this.adminPassword = adminPassword;
117 | this.adminName = adminName;
118 | this.adminGender = adminGender;
119 | this.adminEmail = adminEmail;
120 | this.adminPhone = adminPhone;
121 | }
122 |
123 | @Generated(hash = 1708792177)
124 | public Admin() {
125 | }
126 |
127 | public long getAdminId() {
128 | return this.adminId;
129 | }
130 |
131 | public void setAdminId(long adminId) {
132 | this.adminId = adminId;
133 | }
134 |
135 | public String getAdminAccount() {
136 | return this.adminAccount;
137 | }
138 |
139 | public void setAdminAccount(String adminAccount) {
140 | this.adminAccount = adminAccount;
141 | }
142 |
143 | public String getAdminPassword() {
144 | return this.adminPassword;
145 | }
146 |
147 | public void setAdminPassword(String adminPassword) {
148 | this.adminPassword = adminPassword;
149 | }
150 |
151 | public String getAdminName() {
152 | return this.adminName;
153 | }
154 |
155 | public void setAdminName(String adminName) {
156 | this.adminName = adminName;
157 | }
158 |
159 | public String getAdminGender() {
160 | return this.adminGender;
161 | }
162 |
163 | public void setAdminGender(String adminGender) {
164 | this.adminGender = adminGender;
165 | }
166 |
167 | public String getAdminEmail() {
168 | return this.adminEmail;
169 | }
170 |
171 | public void setAdminEmail(String adminEmail) {
172 | this.adminEmail = adminEmail;
173 | }
174 |
175 | public String getAdminPhone() {
176 | return this.adminPhone;
177 | }
178 |
179 | public void setAdminPhone(String adminPhone) {
180 | this.adminPhone = adminPhone;
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/bean/Attendance.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.bean;
2 |
3 |
4 | import org.greenrobot.greendao.annotation.Entity;
5 | import org.greenrobot.greendao.annotation.Generated;
6 | import org.greenrobot.greendao.annotation.Id;
7 | import org.greenrobot.greendao.annotation.Index;
8 | import org.greenrobot.greendao.annotation.NotNull;
9 | import org.greenrobot.greendao.annotation.Property;
10 | import org.greenrobot.greendao.annotation.Transient;
11 |
12 | import java.io.Serializable;
13 |
14 | /**
15 | * 使用注释来定义模式和考勤实体类
16 | * 该@Entity注解打开Java类到数据库支持的实体。这也将指示greenDAO生成必要的代码(例如DAO)。@Entity 注解标记了一个Java类作为greenDAO一个presistable实体。
17 | *
18 | * 数据库端的表和列名称是从实体和属性名称派生的。而不是Java中使用的驼峰案例样式,默认数据库名称是大写的,使用下划线来分隔单词。
19 | * 例如,名为creationDate的属性 将成为数据库列 CREATION_DATE。
20 | */
21 | @Entity(
22 | // 如果您有多个模式,您可以告诉greenDAO一个实体属于哪个模式(选择任意字符串作为名称)。
23 | // schema = "myschema",
24 |
25 | // 标记使实体“活动”:活动实体具有更新、删除和刷新方法。
26 | // active = true,
27 |
28 | // 指定数据库中表的名称。默认情况下,名称基于实体类名称。
29 | // nameInDb = "AWESOME_USERS",
30 |
31 | // 在这里定义跨越多个列的索引。
32 | // indexes = {
33 | // @Index(value = "name DESC", unique = true)
34 | // },
35 |
36 | //标记DAO是否应该创建数据库表(默认为true)。如果您有多个实体映射到一个表,或者创建表是在greenDAO之外完成的,则将此设置为false。
37 | // createInDb = false,
38 |
39 | // 是否应该生成all properties构造函数。总是需要一个无args构造函数。
40 | generateConstructors = true,
41 |
42 | // 如果缺少属性的getter和setter,是否应该生成它们。
43 | generateGettersSetters = true
44 |
45 | //Note that multiple schemas are currently not supported when using the Gradle plugin.(https://github.com/greenrobot/greenDAO/issues/356)
46 | // For the time being, continue to use your generator project.(http://greenrobot.org/greendao/documentation/generator/)
47 | )
48 | public class Attendance implements Serializable {
49 |
50 | /**
51 | * 这个@Id注释选择long / Long属性作为实体ID。 在数据库方面,它是主键。 参数autoincrement是一个标志,使ID值不断增加(不重用旧值)。
52 | * 目前,实体必须用 long或 Long属性作为其主键。这是Android和SQLite的推荐做法。要解决这个问题,可以将key属性定义为一个附加属性,但是要为它创建一个惟一的索引
53 | */
54 | @Id(autoincrement = true)
55 | /**
56 | * 在属性上使用@Index为相应的数据库列创建数据库索引。 使用以下参数进行自定义:
57 | * name:如果你不喜欢greenDAO为索引生成的默认名称,你可以在这里指定你的名字。
58 | * unique:向索引添加UNIQUE约束,强制所有值都是唯一的。
59 | * 这个@Unique注释向数据库列添加唯一约束。注意,SQLite还隐式地为它创建了一个索引。
60 | * 注意:要添加跨越多个属性的索引,请参阅@Entity注释的文档。(http://greenrobot.org/greendao/documentation/modelling-entities/#The_Entity_Annotation)
61 | */
62 | @Index(unique = true)
63 | /**
64 | * 这个@Property注释允许您定义属性映射到的非默认列名称。 @Property(nameInDb = "USERNAME")
65 | * 如果不存在,greenDAO将以SQL-ish方式使用字段名称(大写,下划线而不是camel情况,例如customName将成为CUSTOM_NAME)。 注意:您当前只能使用内联常量来指定列名。
66 | */
67 | @Property(nameInDb = "ATTENDANCE_ID")
68 | private long attendanceId;
69 |
70 | /**
71 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
72 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
73 | */
74 | @NotNull
75 | private long staffId;
76 | /**
77 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
78 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
79 | */
80 | @NotNull
81 | private String staffName;
82 | /**
83 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
84 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
85 | */
86 | @NotNull
87 | private String staffDepartment;
88 | /**
89 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
90 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
91 | */
92 | @NotNull
93 | private long signInTime;
94 | /**
95 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
96 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
97 | */
98 | @NotNull
99 | private double signInLatitude;
100 | /**
101 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
102 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
103 | */
104 | @NotNull
105 | private double signInLongitude;
106 | /**
107 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
108 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
109 | */
110 | @NotNull
111 | private long signOutTime;
112 | /**
113 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
114 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
115 | */
116 | @NotNull
117 | private double signOutLatitude;
118 | /**
119 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
120 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
121 | */
122 | @NotNull
123 | private double signOutLongitude;
124 | /**
125 | * 这个@Transient注释标记要从持久性中排除的属性。 将它们用于临时状态等。或者,您也可以使用Java中的transient关键字。
126 | */
127 | @Transient
128 | private static final long serialVersionUID = -1134974556013000026L; // not persisted
129 |
130 | @Generated(hash = 2099981814)
131 | public Attendance(long attendanceId, long staffId, @NotNull String staffName, @NotNull String staffDepartment, long signInTime, double signInLatitude,
132 | double signInLongitude, long signOutTime, double signOutLatitude, double signOutLongitude) {
133 | this.attendanceId = attendanceId;
134 | this.staffId = staffId;
135 | this.staffName = staffName;
136 | this.staffDepartment = staffDepartment;
137 | this.signInTime = signInTime;
138 | this.signInLatitude = signInLatitude;
139 | this.signInLongitude = signInLongitude;
140 | this.signOutTime = signOutTime;
141 | this.signOutLatitude = signOutLatitude;
142 | this.signOutLongitude = signOutLongitude;
143 | }
144 |
145 | @Generated(hash = 812698609)
146 | public Attendance() {
147 | }
148 |
149 | public long getAttendanceId() {
150 | return this.attendanceId;
151 | }
152 |
153 | public void setAttendanceId(long attendanceId) {
154 | this.attendanceId = attendanceId;
155 | }
156 |
157 | public long getStaffId() {
158 | return this.staffId;
159 | }
160 |
161 | public void setStaffId(long staffId) {
162 | this.staffId = staffId;
163 | }
164 |
165 | public String getStaffName() {
166 | return this.staffName;
167 | }
168 |
169 | public void setStaffName(String staffName) {
170 | this.staffName = staffName;
171 | }
172 |
173 | public String getStaffDepartment() {
174 | return this.staffDepartment;
175 | }
176 |
177 | public void setStaffDepartment(String staffDepartment) {
178 | this.staffDepartment = staffDepartment;
179 | }
180 |
181 | public long getSignInTime() {
182 | return this.signInTime;
183 | }
184 |
185 | public void setSignInTime(long signInTime) {
186 | this.signInTime = signInTime;
187 | }
188 |
189 | public double getSignInLatitude() {
190 | return this.signInLatitude;
191 | }
192 |
193 | public void setSignInLatitude(double signInLatitude) {
194 | this.signInLatitude = signInLatitude;
195 | }
196 |
197 | public double getSignInLongitude() {
198 | return this.signInLongitude;
199 | }
200 |
201 | public void setSignInLongitude(double signInLongitude) {
202 | this.signInLongitude = signInLongitude;
203 | }
204 |
205 | public long getSignOutTime() {
206 | return this.signOutTime;
207 | }
208 |
209 | public void setSignOutTime(long signOutTime) {
210 | this.signOutTime = signOutTime;
211 | }
212 |
213 | public double getSignOutLatitude() {
214 | return this.signOutLatitude;
215 | }
216 |
217 | public void setSignOutLatitude(double signOutLatitude) {
218 | this.signOutLatitude = signOutLatitude;
219 | }
220 |
221 | public double getSignOutLongitude() {
222 | return this.signOutLongitude;
223 | }
224 |
225 | public void setSignOutLongitude(double signOutLongitude) {
226 | this.signOutLongitude = signOutLongitude;
227 | }
228 |
229 | }
230 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/bean/AttendanceAddress.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.bean;
2 |
3 |
4 | import org.greenrobot.greendao.annotation.*;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * 使用注释来定义模式和考勤实体类
10 | * 该@Entity注解打开Java类到数据库支持的实体。这也将指示greenDAO生成必要的代码(例如DAO)。@Entity 注解标记了一个Java类作为greenDAO一个presistable实体。
11 | *
12 | * 数据库端的表和列名称是从实体和属性名称派生的。而不是Java中使用的驼峰案例样式,默认数据库名称是大写的,使用下划线来分隔单词。
13 | * 例如,名为creationDate的属性 将成为数据库列 CREATION_DATE。
14 | */
15 | @Entity(
16 | // 如果您有多个模式,您可以告诉greenDAO一个实体属于哪个模式(选择任意字符串作为名称)。
17 | // schema = "myschema",
18 |
19 | // 标记使实体“活动”:活动实体具有更新、删除和刷新方法。
20 | // active = true,
21 |
22 | // 指定数据库中表的名称。默认情况下,名称基于实体类名称。
23 | // nameInDb = "AWESOME_USERS",
24 |
25 | // 在这里定义跨越多个列的索引。
26 | // indexes = {
27 | // @Index(value = "name DESC", unique = true)
28 | // },
29 |
30 | //标记DAO是否应该创建数据库表(默认为true)。如果您有多个实体映射到一个表,或者创建表是在greenDAO之外完成的,则将此设置为false。
31 | // createInDb = false,
32 |
33 | // 是否应该生成all properties构造函数。总是需要一个无args构造函数。
34 | generateConstructors = true,
35 |
36 | // 如果缺少属性的getter和setter,是否应该生成它们。
37 | generateGettersSetters = true
38 |
39 | //Note that multiple schemas are currently not supported when using the Gradle plugin.(https://github.com/greenrobot/greenDAO/issues/356)
40 | // For the time being, continue to use your generator project.(http://greenrobot.org/greendao/documentation/generator/)
41 | )
42 | public class AttendanceAddress implements Serializable {
43 | /**
44 | * 这个@Id注释选择long / Long属性作为实体ID。 在数据库方面,它是主键。 参数autoincrement是一个标志,使ID值不断增加(不重用旧值)。
45 | * 目前,实体必须用 long或 Long属性作为其主键。这是Android和SQLite的推荐做法。要解决这个问题,可以将key属性定义为一个附加属性,但是要为它创建一个惟一的索引
46 | */
47 | @Id(autoincrement = true)
48 | /**
49 | * 在属性上使用@Index为相应的数据库列创建数据库索引。 使用以下参数进行自定义:
50 | * name:如果你不喜欢greenDAO为索引生成的默认名称,你可以在这里指定你的名字。
51 | * unique:向索引添加UNIQUE约束,强制所有值都是唯一的。
52 | * 这个@Unique注释向数据库列添加唯一约束。注意,SQLite还隐式地为它创建了一个索引。
53 | * 注意:要添加跨越多个属性的索引,请参阅@Entity注释的文档。(http://greenrobot.org/greendao/documentation/modelling-entities/#The_Entity_Annotation)
54 | */
55 | @Index(unique = true)
56 | /**
57 | * 这个@Property注释允许您定义属性映射到的非默认列名称。 @Property(nameInDb = "USERNAME")
58 | * 如果不存在,greenDAO将以SQL-ish方式使用字段名称(大写,下划线而不是camel情况,例如customName将成为CUSTOM_NAME)。 注意:您当前只能使用内联常量来指定列名。
59 | */
60 | @Property(nameInDb = "ATTENDANCE_ADDRESS_ID")
61 | private long attendanceAddressId;
62 | /**
63 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
64 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
65 | */
66 | @NotNull
67 | private double latitude;
68 | /**
69 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
70 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
71 | */
72 | @NotNull
73 | private double longitude;
74 | /**
75 | * 这个@Transient注释标记要从持久性中排除的属性。 将它们用于临时状态等。或者,您也可以使用Java中的transient关键字。
76 | */
77 | @Transient
78 | private static final long serialVersionUID = 6943697476627540544L;
79 |
80 | @Generated(hash = 1189626702)
81 | public AttendanceAddress(long attendanceAddressId, double latitude, double longitude) {
82 | this.attendanceAddressId = attendanceAddressId;
83 | this.latitude = latitude;
84 | this.longitude = longitude;
85 | }
86 |
87 | @Generated(hash = 301105554)
88 | public AttendanceAddress() {
89 | }
90 |
91 | public long getAttendanceAddressId() {
92 | return this.attendanceAddressId;
93 | }
94 |
95 | public void setAttendanceAddressId(long attendanceAddressId) {
96 | this.attendanceAddressId = attendanceAddressId;
97 | }
98 |
99 | public double getLatitude() {
100 | return this.latitude;
101 | }
102 |
103 | public void setLatitude(double latitude) {
104 | this.latitude = latitude;
105 | }
106 |
107 | public double getLongitude() {
108 | return this.longitude;
109 | }
110 |
111 | public void setLongitude(double longitude) {
112 | this.longitude = longitude;
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/bean/Staff.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.bean;
2 |
3 | import org.greenrobot.greendao.annotation.Entity;
4 | import org.greenrobot.greendao.annotation.Generated;
5 | import org.greenrobot.greendao.annotation.Id;
6 | import org.greenrobot.greendao.annotation.Index;
7 | import org.greenrobot.greendao.annotation.NotNull;
8 | import org.greenrobot.greendao.annotation.Property;
9 | import org.greenrobot.greendao.annotation.Transient;
10 |
11 | import java.io.Serializable;
12 |
13 | /**
14 | * 使用注释来定义模式和员工实体类
15 | * 该@Entity注解打开Java类到数据库支持的实体。这也将指示greenDAO生成必要的代码(例如DAO)。@Entity 注解标记了一个Java类作为greenDAO一个presistable实体。
16 | *
17 | * 数据库端的表和列名称是从实体和属性名称派生的。而不是Java中使用的驼峰案例样式,默认数据库名称是大写的,使用下划线来分隔单词。
18 | * 例如,名为creationDate的属性 将成为数据库列 CREATION_DATE。
19 | */
20 | @Entity(
21 | // 如果您有多个模式,您可以告诉greenDAO一个实体属于哪个模式(选择任意字符串作为名称)。
22 | // schema = "myschema",
23 |
24 | // 标记使实体“活动”:活动实体具有更新、删除和刷新方法。
25 | // active = true,
26 |
27 | // 指定数据库中表的名称。默认情况下,名称基于实体类名称。
28 | // nameInDb = "AWESOME_USERS",
29 |
30 | // 在这里定义跨越多个列的索引。
31 | // indexes = {
32 | // @Index(value = "name DESC", unique = true)
33 | // },
34 |
35 | //标记DAO是否应该创建数据库表(默认为true)。如果您有多个实体映射到一个表,或者创建表是在greenDAO之外完成的,则将此设置为false。
36 | // createInDb = false,
37 |
38 | // 是否应该生成all properties构造函数。总是需要一个无args构造函数。
39 | generateConstructors = true,
40 |
41 | // 如果缺少属性的getter和setter,是否应该生成它们。
42 | generateGettersSetters = true
43 |
44 | //Note that multiple schemas are currently not supported when using the Gradle plugin.(https://github.com/greenrobot/greenDAO/issues/356)
45 | // For the time being, continue to use your generator project.(http://greenrobot.org/greendao/documentation/generator/)
46 | )
47 | public class Staff implements Serializable {
48 | /**
49 | * 这个@Id注释选择long / Long属性作为实体ID。 在数据库方面,它是主键。 参数autoincrement是一个标志,使ID值不断增加(不重用旧值)。
50 | * 目前,实体必须用 long或 Long属性作为其主键。这是Android和SQLite的推荐做法。要解决这个问题,可以将key属性定义为一个附加属性,但是要为它创建一个惟一的索引
51 | */
52 | @Id(autoincrement = true)
53 | /**
54 | * 在属性上使用@Index为相应的数据库列创建数据库索引。 使用以下参数进行自定义:
55 | * name:如果你不喜欢greenDAO为索引生成的默认名称,你可以在这里指定你的名字。
56 | * unique:向索引添加UNIQUE约束,强制所有值都是唯一的。
57 | * 这个@Unique注释向数据库列添加唯一约束。注意,SQLite还隐式地为它创建了一个索引。
58 | * 注意:要添加跨越多个属性的索引,请参阅@Entity注释的文档。(http://greenrobot.org/greendao/documentation/modelling-entities/#The_Entity_Annotation)
59 | */
60 | @Index(unique = true)
61 | /**
62 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
63 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
64 | */
65 | @NotNull
66 | /**
67 | * 这个@Property注释允许您定义属性映射到的非默认列名称。 @Property(nameInDb = "USERNAME")
68 | * 如果不存在,greenDAO将以SQL-ish方式使用字段名称(大写,下划线而不是camel情况,例如customName将成为CUSTOM_NAME)。 注意:您当前只能使用内联常量来指定列名。
69 | */
70 | @Property(nameInDb = "STAFF_ID")
71 | private long staffId;
72 | /**
73 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
74 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
75 | */
76 | @NotNull
77 | private String staffName;
78 | /**
79 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
80 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
81 | */
82 | @NotNull
83 | private String staffGender;
84 | /**
85 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
86 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
87 | */
88 | @NotNull
89 | private String staffDepartment;
90 | /**
91 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
92 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
93 | */
94 | @NotNull
95 | private String staffFaceOne;
96 | @NotNull
97 | private byte[] staffFaceOneFeatureData;
98 | /**
99 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
100 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
101 | */
102 | @NotNull
103 | private String staffFaceTwo;
104 | @NotNull
105 | private byte[] staffFaceTwoFeatureData;
106 | /**
107 | * 这个@NotNull注释使该属性成为数据库端的“NOT NULL”列。
108 | * 通常使用@NotNull标记基本类型(long,int,short,byte)是有意义的,同时使用包装类(Long,Integer,Short,Byte)具有可空值。
109 | */
110 | @NotNull
111 | private String staffFaceThree;
112 | @NotNull
113 | private byte[] staffFaceThreeFeatureData;
114 | /**
115 | * 这个@Transient注释标记要从持久性中排除的属性。 将它们用于临时状态等。或者,您也可以使用Java中的transient关键字。
116 | */
117 | @Transient
118 | private static final long serialVersionUID = 769026186178017624L; // not persisted
119 |
120 | @Generated(hash = 2117539648)
121 | public Staff(long staffId, @NotNull String staffName, @NotNull String staffGender, @NotNull String staffDepartment, @NotNull String staffFaceOne,
122 | @NotNull byte[] staffFaceOneFeatureData, @NotNull String staffFaceTwo, @NotNull byte[] staffFaceTwoFeatureData,
123 | @NotNull String staffFaceThree, @NotNull byte[] staffFaceThreeFeatureData) {
124 | this.staffId = staffId;
125 | this.staffName = staffName;
126 | this.staffGender = staffGender;
127 | this.staffDepartment = staffDepartment;
128 | this.staffFaceOne = staffFaceOne;
129 | this.staffFaceOneFeatureData = staffFaceOneFeatureData;
130 | this.staffFaceTwo = staffFaceTwo;
131 | this.staffFaceTwoFeatureData = staffFaceTwoFeatureData;
132 | this.staffFaceThree = staffFaceThree;
133 | this.staffFaceThreeFeatureData = staffFaceThreeFeatureData;
134 | }
135 |
136 | @Generated(hash = 1774984890)
137 | public Staff() {
138 | }
139 |
140 | public long getStaffId() {
141 | return this.staffId;
142 | }
143 |
144 | public void setStaffId(long staffId) {
145 | this.staffId = staffId;
146 | }
147 |
148 | public String getStaffName() {
149 | return this.staffName;
150 | }
151 |
152 | public void setStaffName(String staffName) {
153 | this.staffName = staffName;
154 | }
155 |
156 | public String getStaffGender() {
157 | return this.staffGender;
158 | }
159 |
160 | public void setStaffGender(String staffGender) {
161 | this.staffGender = staffGender;
162 | }
163 |
164 | public String getStaffDepartment() {
165 | return this.staffDepartment;
166 | }
167 |
168 | public void setStaffDepartment(String staffDepartment) {
169 | this.staffDepartment = staffDepartment;
170 | }
171 |
172 | public String getStaffFaceOne() {
173 | return this.staffFaceOne;
174 | }
175 |
176 | public void setStaffFaceOne(String staffFaceOne) {
177 | this.staffFaceOne = staffFaceOne;
178 | }
179 |
180 | public byte[] getStaffFaceOneFeatureData() {
181 | return this.staffFaceOneFeatureData;
182 | }
183 |
184 | public void setStaffFaceOneFeatureData(byte[] staffFaceOneFeatureData) {
185 | this.staffFaceOneFeatureData = staffFaceOneFeatureData;
186 | }
187 |
188 | public String getStaffFaceTwo() {
189 | return this.staffFaceTwo;
190 | }
191 |
192 | public void setStaffFaceTwo(String staffFaceTwo) {
193 | this.staffFaceTwo = staffFaceTwo;
194 | }
195 |
196 | public byte[] getStaffFaceTwoFeatureData() {
197 | return this.staffFaceTwoFeatureData;
198 | }
199 |
200 | public void setStaffFaceTwoFeatureData(byte[] staffFaceTwoFeatureData) {
201 | this.staffFaceTwoFeatureData = staffFaceTwoFeatureData;
202 | }
203 |
204 | public String getStaffFaceThree() {
205 | return this.staffFaceThree;
206 | }
207 |
208 | public void setStaffFaceThree(String staffFaceThree) {
209 | this.staffFaceThree = staffFaceThree;
210 | }
211 |
212 | public byte[] getStaffFaceThreeFeatureData() {
213 | return this.staffFaceThreeFeatureData;
214 | }
215 |
216 | public void setStaffFaceThreeFeatureData(byte[] staffFaceThreeFeatureData) {
217 | this.staffFaceThreeFeatureData = staffFaceThreeFeatureData;
218 | }
219 |
220 |
221 | }
222 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/AppManager.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.app.Activity;
4 | import android.app.ActivityManager;
5 | import android.content.Context;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | import java.util.Stack;
9 |
10 | /**
11 | * Created by MJCoder on 2019-03-04.
12 | */
13 |
14 | public class AppManager {
15 | private static Stack activityStack = new Stack();
16 |
17 | /**
18 | * 添加Activity到堆栈
19 | */
20 | public static void addActivity(AppCompatActivity activity) {
21 | activityStack.add(activity);
22 | }
23 |
24 | /**
25 | * 获取当前Activity(堆栈中最后一个压入的)
26 | */
27 | public static Activity currentActivity() {
28 | AppCompatActivity activity = activityStack.lastElement();
29 | return activity;
30 | }
31 |
32 | /**
33 | * 结束当前Activity(堆栈中最后一个压入的)
34 | */
35 | public static void finishActivity() {
36 | AppCompatActivity activity = activityStack.lastElement();
37 | finishActivity(activity);
38 | }
39 |
40 | /**
41 | * 结束指定的Activity
42 | */
43 | public static void finishActivity(AppCompatActivity activity) {
44 | if (activity != null) {
45 | activityStack.remove(activity);
46 | activity.finish();
47 | activity = null;
48 | }
49 | }
50 |
51 | /**
52 | * 结束指定类名的Activity
53 | */
54 | public static void finishActivity(Class> cls) {
55 | for (AppCompatActivity activity : activityStack) {
56 | if (activity.getClass().equals(cls)) {
57 | finishActivity(activity);
58 | break;
59 | }
60 | }
61 | }
62 |
63 | /**
64 | * 结束所有Activity
65 | */
66 | public static void finishAllActivity() {
67 | for (int i = 0, size = activityStack.size(); i < size; i++) {
68 | if (null != activityStack.get(i)) {
69 | activityStack.get(i).finish();
70 | }
71 | }
72 | activityStack.clear();
73 | }
74 |
75 | /**
76 | * 退出应用程序
77 | */
78 | public static void AppExit(Context context) {
79 | try {
80 | finishAllActivity();
81 | ActivityManager activityMgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
82 | activityMgr.restartPackage(context.getPackageName());
83 | System.exit(0);
84 | } catch (Exception e) {
85 | e.printStackTrace();
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/ArcFaceUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import java.nio.ByteBuffer;
6 |
7 | /**
8 | * Created by MJCoder on 2019-03-14.
9 | */
10 | public class ArcFaceUtil {
11 |
12 | /**
13 | * Bitmap转化为ARGB数据,再转化为NV21数据
14 | *
15 | * @param src 传入的Bitmap,格式为{@link Bitmap.Config#ARGB_8888}
16 | * @param width NV21图像的宽度
17 | * @param height NV21图像的高度
18 | * @return nv21数据
19 | */
20 | public static byte[] bitmapToNv21(Bitmap src, int width, int height) {
21 | if (src != null && src.getWidth() >= width && src.getHeight() >= height) {
22 | int[] argb = new int[width * height];
23 | src.getPixels(argb, 0, width, 0, 0, width, height);
24 | return argbToNv21(argb, width, height);
25 | } else {
26 | return null;
27 | }
28 | }
29 |
30 | /**
31 | * ARGB数据转化为NV21数据
32 | *
33 | * @param argb argb数据
34 | * @param width 宽度
35 | * @param height 高度
36 | * @return nv21数据
37 | */
38 | private static byte[] argbToNv21(int[] argb, int width, int height) {
39 | int frameSize = width * height;
40 | int yIndex = 0;
41 | int uvIndex = frameSize;
42 | int index = 0;
43 | byte[] nv21 = new byte[width * height * 3 / 2];
44 | for (int j = 0; j < height; ++j) {
45 | for (int i = 0; i < width; ++i) {
46 | int R = (argb[index] & 0xFF0000) >> 16;
47 | int G = (argb[index] & 0x00FF00) >> 8;
48 | int B = argb[index] & 0x0000FF;
49 | int Y = (66 * R + 129 * G + 25 * B + 128 >> 8) + 16;
50 | int U = (-38 * R - 74 * G + 112 * B + 128 >> 8) + 128;
51 | int V = (112 * R - 94 * G - 18 * B + 128 >> 8) + 128;
52 | nv21[yIndex++] = (byte) (Y < 0 ? 0 : (Y > 255 ? 255 : Y));
53 | if (j % 2 == 0 && index % 2 == 0 && uvIndex < nv21.length - 2) {
54 | nv21[uvIndex++] = (byte) (V < 0 ? 0 : (V > 255 ? 255 : V));
55 | nv21[uvIndex++] = (byte) (U < 0 ? 0 : (U > 255 ? 255 : U));
56 | }
57 |
58 | ++index;
59 | }
60 | }
61 | return nv21;
62 | }
63 |
64 | /**
65 | * bitmap转化为bgr数据,格式为{@link Bitmap.Config#ARGB_8888}
66 | *
67 | * @param image 传入的bitmap
68 | * @return bgr数据
69 | */
70 | public static byte[] bitmapToBgr(Bitmap image) {
71 | if (image == null) {
72 | return null;
73 | }
74 | int bytes = image.getByteCount();
75 |
76 | ByteBuffer buffer = ByteBuffer.allocate(bytes);
77 | image.copyPixelsToBuffer(buffer);
78 | byte[] temp = buffer.array();
79 | byte[] pixels = new byte[(temp.length / 4) * 3];
80 | for (int i = 0; i < temp.length / 4; i++) {
81 | pixels[i * 3] = temp[i * 4 + 2];
82 | pixels[i * 3 + 1] = temp[i * 4 + 1];
83 | pixels[i * 3 + 2] = temp[i * 4];
84 | }
85 | return pixels;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/BitmapUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 | import android.graphics.drawable.BitmapDrawable;
6 |
7 | import java.lang.ref.SoftReference;
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * Bitmap的处理 解决out of memory的一些问题:
13 | *
14 | * 先使用软引用:把图片保存在内存之中 用到时候先去找,找不到再从路径加载
15 | *
16 | * 有个独立的释放函数 如果不用了 请记得调用释放函数
17 | */
18 | public class BitmapUtil {
19 | private static Map> bitmapCache = new HashMap>();
20 |
21 | public static Bitmap loadBitmap(String path) {
22 | if (bitmapCache.containsKey(path)) {
23 | SoftReference softReference = bitmapCache.get(path);
24 | Bitmap bitmap = softReference.get();
25 | if (null != bitmap) {
26 | return bitmap;
27 | }
28 | }
29 | BitmapFactory.Options options = new BitmapFactory.Options();
30 | options.inJustDecodeBounds = false;
31 | options.inSampleSize = 3;
32 | options.inDither = false;
33 | options.inPreferredConfig = Bitmap.Config.ARGB_8888;
34 | Bitmap bitmap = BitmapFactory.decodeFile(path, options);
35 | bitmapCache.put(path, new SoftReference(bitmap));
36 | return bitmap;
37 | }
38 |
39 | public static BitmapDrawable decodeImage(String path) {
40 | return new BitmapDrawable(loadBitmap(path));
41 | }
42 |
43 | public static void releaseBitmap(String path) {
44 | if (bitmapCache.containsKey(path)) {
45 | SoftReference softReference = bitmapCache.get(path);
46 | Bitmap bitmap = softReference.get();
47 | if (null != bitmap) {
48 | bitmap.recycle(); // 回收bitmap的内存
49 | bitmap = null;
50 | }
51 | bitmapCache.remove(path);
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/ConfigUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import com.arcsoft.face.enums.DetectFaceOrientPriority;
6 |
7 | public class ConfigUtil {
8 | private static final String APP_NAME = "ArcFaceDemo";
9 | private static final String TRACKED_FACE_COUNT = "trackedFaceCount";
10 | private static final String FT_ORIENT = "ftOrientPriority";
11 |
12 | public static boolean setTrackedFaceCount(Context context, int trackedFaceCount) {
13 | if (context == null) {
14 | return false;
15 | }
16 | SharedPreferences sharedPreferences = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE);
17 | return sharedPreferences.edit()
18 | .putInt(TRACKED_FACE_COUNT, trackedFaceCount)
19 | .commit();
20 | }
21 |
22 | public static int getTrackedFaceCount(Context context) {
23 | if (context == null) {
24 | return 0;
25 | }
26 | SharedPreferences sharedPreferences = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE);
27 | return sharedPreferences.getInt(TRACKED_FACE_COUNT, 0);
28 | }
29 |
30 | public static boolean setFtOrient(Context context, DetectFaceOrientPriority ftOrient) {
31 | if (context == null) {
32 | return false;
33 | }
34 | SharedPreferences sharedPreferences = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE);
35 | return sharedPreferences.edit()
36 | .putString(FT_ORIENT, ftOrient.name())
37 | .commit();
38 | }
39 |
40 | public static DetectFaceOrientPriority getFtOrient(Context context) {
41 | if (context == null) {
42 | return DetectFaceOrientPriority.ASF_OP_270_ONLY;
43 | }
44 | SharedPreferences sharedPreferences = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE);
45 | return DetectFaceOrientPriority.valueOf(sharedPreferences.getString(FT_ORIENT, DetectFaceOrientPriority.ASF_OP_270_ONLY.name()));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/CopyFileToSD.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.os.Environment;
4 |
5 | import java.io.File;
6 | import java.io.FileInputStream;
7 | import java.io.FileOutputStream;
8 | import java.io.IOException;
9 |
10 | /**
11 | * 复制相关内容到SD卡中以便可视化查看
12 | * Created by MJCoder on 2017-10-09.
13 | */
14 | public class CopyFileToSD {
15 | /**
16 | * 将过大的内容或是过长的字符串复制到SD卡中以便可视化查看
17 | *
18 | * @param fileContent 过大的内容或是过长的字符串(例如:json、log、服务端返回的大数据等)
19 | * @param fileName 复制到SD卡的文件名称(切记:需要包含后缀)
20 | */
21 | public static void txtFile(String fileContent, String fileName) {
22 | FileOutputStream fos = null;
23 | try {
24 | //文件复制到sd卡中
25 | fos = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + fileName);
26 | fos.write(fileContent.getBytes()); //将String字符串以字节流的形式写入到输出流中
27 | fos.close();
28 | fos.flush();
29 | } catch (Exception e) {
30 | e.printStackTrace();
31 | } finally {
32 | //关闭数据流
33 | try {
34 | if (fos != null)
35 | fos.close();
36 | } catch (IOException e) {
37 | e.printStackTrace();
38 | }
39 |
40 | }
41 | }
42 |
43 | /**
44 | * 将Database文件复制到SD卡中以便可视化查看
45 | *
46 | * @param packageName 该APP的包名
47 | * @param databaseName Database文件的名称(切记:仅仅是名称不包含后缀)
48 | */
49 | public static void databaseFile(String packageName, String databaseName) {
50 | //找到文件的路径 /data/data/包名/databases/数据库名称
51 | File databaseFile = new File(Environment.getDataDirectory().getAbsolutePath() + "/data/" + packageName + "/databases/" + databaseName + ".db");
52 | FileInputStream fis = null;
53 | FileOutputStream fos = null;
54 | try {
55 | //文件复制到sd卡中
56 | fis = new FileInputStream(databaseFile);
57 | fos = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + databaseName + ".db");
58 | int len = 0;
59 | byte[] buffer = new byte[2048];
60 | while (-1 != (len = fis.read(buffer))) {
61 | fos.write(buffer, 0, len);
62 | }
63 | fos.flush();
64 | } catch (Exception e) {
65 | e.printStackTrace();
66 | } finally {
67 | //关闭数据流
68 | try {
69 | if (fos != null)
70 | fos.close();
71 | if (fis != null)
72 | fis.close();
73 | } catch (IOException e) {
74 | e.printStackTrace();
75 | }
76 |
77 | }
78 | }
79 |
80 |
81 | /**
82 | * 将SharedPrefs文件复制到SD卡中以便可视化查看
83 | *
84 | * @param packageName 该APP的包名
85 | * @param sharedPrefsName SharedPrefs文件的名称(切记:仅仅是名称不包含后缀)
86 | */
87 | public static void sharedPrefsFile(String packageName, String sharedPrefsName) {
88 | //找到文件的路径 /data/data/包名/databases/数据库名称
89 | File sharedPrefsFile = new File(Environment.getDataDirectory().getAbsolutePath() + "/data/" + packageName + "/shared_prefs/" + sharedPrefsName + ".xml");
90 | FileInputStream fis = null;
91 | FileOutputStream fos = null;
92 | try {
93 | //文件复制到sd卡中
94 | fis = new FileInputStream(sharedPrefsFile);
95 | fos = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + sharedPrefsName + ".xml");
96 | int len = 0;
97 | byte[] buffer = new byte[2048];
98 | while (-1 != (len = fis.read(buffer))) {
99 | fos.write(buffer, 0, len);
100 | }
101 | fos.flush();
102 | } catch (Exception e) {
103 | e.printStackTrace();
104 | } finally {
105 | //关闭数据流
106 | try {
107 | if (fos != null)
108 | fos.close();
109 | if (fis != null)
110 | fis.close();
111 | } catch (IOException e) {
112 | e.printStackTrace();
113 | }
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/FileUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.content.Context;
4 | import android.os.Environment;
5 | import android.os.storage.StorageManager;
6 |
7 | import java.io.File;
8 | import java.lang.reflect.Method;
9 |
10 | /**
11 | * Created by MJCoder on 2019-03-14.
12 | */
13 |
14 | public class FileUtil {
15 |
16 | /**
17 | * 获取新建的文件
18 | *
19 | * @param context 环境上下文
20 | * @param dirName 新建的文件所在的上级目录;可以为空(为空时该文件将直接插入项目的根目录)
21 | * @param fileName 新建的文件名:可以为空(为空时返回的时目录)
22 | * @return
23 | */
24 | public static File getFile(Context context, String dirName, String fileName) {
25 | File currentFile = null;
26 | try {
27 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
28 | File dir;
29 | if (dirName != null) {
30 | dir = new File(Environment.getExternalStorageDirectory(), "AttendanceSystem/" + dirName);
31 | } else {
32 | dir = new File(Environment.getExternalStorageDirectory(), "AttendanceSystem");
33 | }
34 | if (!dir.exists()) {
35 | dir.mkdirs();
36 | }
37 | // File[] files = dir.listFiles();//获取文件列表
38 | // for (int i = 0; i < files.length; i++) {
39 | // files[i].delete();//删除该文档下的所有文件
40 | // }
41 | if (fileName != null) {
42 | currentFile = new File(dir, fileName);
43 | if (!currentFile.exists()) {
44 | currentFile.createNewFile();
45 | }
46 | } else {
47 | currentFile = dir;
48 | }
49 | } else {
50 | String dirTemp = null;
51 | StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
52 | Class>[] paramClasses = {};
53 | Method getVolumePathsMethod;
54 | getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", paramClasses);
55 | // 在反射调用之前将此对象的 accessible 标志设置为 true,以此来提升反射速度。
56 | getVolumePathsMethod.setAccessible(true);
57 | Object[] params = {};
58 | Object invoke = getVolumePathsMethod.invoke(storageManager, params);
59 | for (int i = 0; i < ((String[]) invoke).length; i++) {
60 | if (!((String[]) invoke)[i].equals(Environment.getExternalStorageDirectory().toString())) {
61 | dirTemp = ((String[]) invoke)[i];
62 | }
63 | }
64 | File dir;
65 | if (dirName != null) {
66 | dir = new File(dirTemp, "AttendanceSystem/" + dirName);
67 | } else {
68 | dir = new File(dirTemp, "AttendanceSystem");
69 | }
70 | if (!dir.exists()) {
71 | dir.mkdirs();
72 | }
73 | // File[] files = dir.listFiles();//获取文件列表
74 | // for (int i = 0; i < files.length; i++) {
75 | // files[i].delete();//删除该文档下的所有文件
76 | // }
77 | if (fileName != null) {
78 | currentFile = new File(dir, fileName);
79 | if (!currentFile.exists()) {
80 | currentFile.createNewFile();
81 | }
82 | } else {
83 | currentFile = dir;
84 | }
85 | }
86 | } catch (Exception e) {
87 | e.printStackTrace();
88 | }
89 | return currentFile;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lzf/attendancesystem/util/ScreenUtils.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.graphics.Rect;
6 | import android.util.DisplayMetrics;
7 |
8 | /**
9 | * 手机屏幕工具类:可用于多机型适配
10 | *
11 | * @author MJCoder
12 | */
13 | public class ScreenUtils {
14 | /**
15 | * 手机屏幕的宽(widthPixels-像素)
16 | */
17 | private static int screenW;
18 | /**
19 | * 手机屏幕的高(heightPixels-像素)
20 | */
21 | private static int screenH;
22 | /**
23 | * 手机屏幕的密度/分辨率
24 | */
25 | private static float screenDensity;
26 |
27 | /**
28 | * 获取手机屏幕的宽(widthPixels-像素)
29 | *
30 | * @param context 环境/上下文
31 | * @return 手机屏幕的宽(widthPixels-像素)
32 | */
33 | public static int getScreenW(Context context) {
34 | if (screenW == 0) {
35 | initScreen(context);
36 | }
37 | return screenW;
38 | }
39 |
40 | /**
41 | * 获取手机屏幕的高(heightPixels-像素)
42 | *
43 | * @param context 环境/上下文
44 | * @return 手机屏幕的高(heightPixels-像素)
45 | */
46 | public static int getScreenH(Context context) {
47 | if (screenH == 0) {
48 | initScreen(context);
49 | }
50 | return screenH;
51 | }
52 |
53 | /**
54 | * 获取手机屏幕的密度/分辨率
55 | *
56 | * @param context 环境/上下文
57 | * @return 手机屏幕的密度/分辨率
58 | */
59 | public static float getScreenDensity(Context context) {
60 | if (screenDensity == 0) {
61 | initScreen(context);
62 | }
63 | return screenDensity;
64 | }
65 |
66 | /**
67 | * 初始化屏幕信息;并初始化赋值屏幕的宽(widthPixels-像素)、高(heightPixels-像素)、密度/分辨率
68 | *
69 | * @param context 环境/上下文
70 | */
71 | private static void initScreen(Context context) {
72 | DisplayMetrics metric = context.getResources().getDisplayMetrics();
73 | screenW = metric.widthPixels;
74 | screenH = metric.heightPixels;
75 | screenDensity = metric.density;
76 | }
77 |
78 | /**
79 | * 根据手机的密度/分辨率将以 dp 为单位的值转换为以 px-像素 为单位的值
80 | *
81 | * @param context 环境/上下文
82 | * @param dpValue 以 dp 为单位的值
83 | * @return 以 px-像素 为单位的值
84 | */
85 | public static int dp2px(Context context, float dpValue) {
86 | return (int) (dpValue * getScreenDensity(context) + 0.5f);
87 | }
88 |
89 | /**
90 | * 根据手机的密度/分辨率将以 px-像素 为单位的值转换为以 dp 为单位的值
91 | *
92 | * @param context 环境/上下文
93 | * @param pxValue 以 px-像素 为单位的值
94 | * @return 以 dp 为单位的值
95 | */
96 | public static int px2dp(Context context, float pxValue) {
97 | return (int) (pxValue / getScreenDensity(context) + 0.5f);
98 | }
99 |
100 | /**
101 | * 根据手机的密度/分辨率将以 sp 为单位的值转换为以 px-像素 为单位的值
102 | *
103 | * @param context 环境/上下文
104 | * @param spValue 以 sp 为单位的值
105 | * @return 以 px-像素 为单位的值
106 | */
107 | public static int sp2px(Context context, float spValue) {
108 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
109 | return (int) (spValue * fontScale + 0.5f);
110 | }
111 |
112 | /**
113 | * 计算状态栏高度
114 | *
115 | * @param activity 当前界面的Activity
116 | * @return 状态栏高度
117 | * @see Activity
118 | */
119 | public static int getStatusBarHeight(Activity activity) {
120 | Rect frame = new Rect();
121 | activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
122 | return frame.top;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libAMapSDK_MAP_v7_2_1.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:9b3025f2629a5ccbc09a6e91444701d9511d37f4ae15a0cc78a2577e696494c5
3 | size 6251896
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libarcsoft_face.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:02dd8e3830d5ab99c6955d6e8baeb0f7e282d8addd4a729c4bff12a91bd51acc
3 | size 42167760
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libarcsoft_face_engine.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:c23bf080560c3460f0013f8db1cf571b6a929f2c452aefb922eba6aca06323a7
3 | size 1477200
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/arm64-v8a/libarcsoft_image_util.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:b679f1143e00cf1739e3df493430b956097a270a01cf6e6a36050c929bd1bc1e
3 | size 79272
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi-v7a/libAMapSDK_MAP_v7_2_1.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:899a3d3793b94884b2490d51d5efb7732797d6e400491685be8c542792982731
3 | size 2280233
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi-v7a/libarcsoft_face.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:39609e2fd472ab358a7d7fa9f23699ca2b07087315fbc6cfccc37738f193ddc8
3 | size 41790380
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi-v7a/libarcsoft_face_engine.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:e7befe9b9ba5cac189891eedefe98ed2eca0fedf28063adea0f3acac0928bb4d
3 | size 915572
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi-v7a/libarcsoft_image_util.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:57524c6c16906470fe0f06a40b8faa7266e762acb37377f0c9759675189566f3
3 | size 143860
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/armeabi/libAMapSDK_MAP_v7_2_1.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:899a3d3793b94884b2490d51d5efb7732797d6e400491685be8c542792982731
3 | size 2280233
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/x86/libAMapSDK_MAP_v7_2_1.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:0a439aa5bc7e6002c26f357a59b272c1a6000c9cfa09f136ce59a321b7fff541
3 | size 2940052
4 |
--------------------------------------------------------------------------------
/app/src/main/jniLibs/x86_64/libAMapSDK_MAP_v7_2_1.so:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:1b62177948a4b0452366cc0b958b96f169adf0e28624f85e0dc76f305f5fd3d2
3 | size 3207292
4 |
--------------------------------------------------------------------------------
/app/src/main/res/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/delete.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fa_recognition.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_a_photo_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_autorenew_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_location_on_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_rectangle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_rectangle_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/success.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
13 |
16 |
19 |
22 |
25 |
28 |
31 |
34 |
37 |
40 |
43 |
46 |
49 |
52 |
55 |
58 |
61 |
64 |
67 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_admin_login.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
17 |
18 |
27 |
28 |
29 |
36 |
37 |
43 |
44 |
57 |
58 |
59 |
60 |
65 |
66 |
82 |
83 |
84 |
85 |
90 |
91 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_admin_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
25 |
26 |
35 |
44 |
45 |
54 |
55 |
64 |
65 |
75 |
76 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_attendance.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
27 |
28 |
36 |
37 |
43 |
44 |
50 |
51 |
57 |
58 |
59 |
65 |
66 |
67 |
71 |
72 |
82 |
83 |
91 |
92 |
98 |
99 |
105 |
106 |
112 |
113 |
114 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_attendance_data_export.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
26 |
27 |
31 |
32 |
43 |
44 |
45 |
49 |
50 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
18 |
19 |
29 |
30 |
40 |
41 |
42 |
47 |
48 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_native_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
27 |
28 |
32 |
33 |
42 |
43 |
59 |
60 |
61 |
62 |
63 |
64 |
68 |
69 |
78 |
79 |
88 |
89 |
90 |
91 |
95 |
96 |
105 |
106 |
116 |
117 |
118 |
119 |
131 |
132 |
140 |
146 |
147 |
153 |
154 |
160 |
161 |
162 |
163 |
171 |
172 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_new_employee.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
28 |
33 |
34 |
43 |
44 |
54 |
55 |
56 |
61 |
62 |
71 |
72 |
84 |
85 |
86 |
91 |
92 |
101 |
102 |
110 |
111 |
120 |
121 |
130 |
131 |
132 |
133 |
138 |
139 |
148 |
149 |
161 |
162 |
163 |
170 |
171 |
179 |
180 |
188 |
189 |
197 |
198 |
199 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_set_address_range.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
25 |
26 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sign_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
23 |
24 |
33 |
34 |
35 |
47 |
48 |
54 |
55 |
66 |
67 |
79 |
80 |
91 |
92 |
101 |
102 |
112 |
113 |
120 |
121 |
127 |
128 |
134 |
135 |
141 |
142 |
148 |
149 |
155 |
156 |
157 |
163 |
164 |
171 |
172 |
179 |
180 |
186 |
187 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sign_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
23 |
24 |
33 |
34 |
35 |
47 |
48 |
54 |
55 |
66 |
67 |
79 |
80 |
91 |
92 |
101 |
102 |
112 |
113 |
120 |
121 |
127 |
128 |
134 |
135 |
141 |
142 |
148 |
149 |
155 |
156 |
157 |
163 |
164 |
171 |
172 |
179 |
180 |
186 |
187 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_staff_manage.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
29 |
30 |
37 |
38 |
45 |
46 |
53 |
54 |
61 |
62 |
63 |
73 |
74 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_native_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
20 |
21 |
28 |
29 |
36 |
37 |
38 |
39 |
45 |
46 |
55 |
56 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_sign.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
13 |
20 |
21 |
28 |
29 |
36 |
37 |
38 |
39 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_staff_manage.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
29 |
30 |
38 |
39 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-xxhdpi/background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #CC450E
7 | #811DC5
8 | #FD3551
9 | #ED3117
10 | #00ED3117
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 考勤
3 | 登录
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
16 |
17 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/test/java/com/lzf/attendancesystem/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lzf.attendancesystem;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
7 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
8 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
9 | maven { url 'https://plugins.gradle.org/m2/' }
10 | mavenCentral()
11 | jcenter()
12 | google()
13 | }
14 | dependencies {
15 | // classpath 'com.android.tools.build:gradle:3.0.1'
16 | classpath 'com.android.tools.build:gradle:3.5.0'
17 | classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
18 |
19 | // NOTE: Do not place your application dependencies here; they belong
20 | // in the individual module build.gradle files
21 | }
22 | }
23 |
24 | allprojects {
25 | repositories {
26 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
27 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
28 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
29 | maven { url 'https://plugins.gradle.org/m2/' }
30 | mavenCentral()
31 | jcenter()
32 | google()
33 | }
34 | }
35 |
36 | task clean(type: Delete) {
37 | delete rootProject.buildDir
38 | }
39 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Feb 16 10:58:02 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/release/app-release.aab:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:86c8ca527ac3eccbfb17d1163b448e460a8736c72ec66e8475fa4526ccda65b6
3 | size 88848278
4 |
--------------------------------------------------------------------------------
/release/app-release.apk:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:9b0376fb9fad24d6ea4b34d313fa71bed599dcf23cc505023b1dd4212dc54baf
3 | size 89030602
4 |
--------------------------------------------------------------------------------
/release/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.3.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
--------------------------------------------------------------------------------
/release/private_key.pepk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MJCoderMJCoder/AttendanceSystem--/1d4692226bd65e35378b7d17bcad962dc4d8c631/release/private_key.pepk
--------------------------------------------------------------------------------
/remark:
--------------------------------------------------------------------------------
1 | 安卓app考勤系统-人脸识别(用虹软的离线sdk:https://ai.arcsoft.com.cn/index.html;在线的face++的api:https://www.faceplusplus.com.cn/)
2 |
3 | 安卓app考勤系统吗
4 | t3979
5 | 今天(2019-03-13)要把界面画出来
6 | 对的
7 | 要有人脸识别(用虹软的离线sdk:
8 | https://ai.arcsoft.com.cn/index.html
9 | 在线的face++的api:
10 | https://www.faceplusplus.com.cn/)
11 | 功能可以稍微晚点再完善
12 | 我要贴到论文里面去
13 | 界面做的稍微漂亮点
14 |
15 | 用虹软的离线sdk: https://ai.arcsoft.com.cn/index.html
16 | 产品概述
17 | ArcFace 离线SDK,包含人脸检测、性别检测、年龄检测、人脸识别、活体检测等能力,初次使用时需联网激活,激活后即可本地无网络环境下工作,
18 | 可根据业务需求结合人脸识别等SDK灵活地进行应用层开发。
19 | 运行环境
20 | Android armeabi-v7a
21 | 系统要求
22 | 支持Android 5.0 (API Level 21)及以上系统
23 | 权限申明
24 |
25 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------