Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Commit a14e3f5

Browse files
author
itning
committed
register face
1 parent d08f7f4 commit a14e3f5

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

app/src/main/java/top/itning/smpandroid/ui/activity/FaceActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import androidx.annotation.NonNull;
1919
import androidx.appcompat.app.AlertDialog;
2020
import androidx.appcompat.app.AppCompatActivity;
21+
import androidx.appcompat.widget.AppCompatButton;
2122

2223
import org.bytedeco.javacv.AndroidFrameConverter;
2324
import org.bytedeco.javacv.Frame;
@@ -70,6 +71,8 @@ public class FaceActivity extends AppCompatActivity {
7071
private Camera camera;
7172
@BindView(R2.id.sv)
7273
SurfaceView surfaceView;
74+
@BindView(R2.id.btn_face)
75+
AppCompatButton faceBtn;
7376

7477
public FaceActivity() {
7578
previewCallback = new PreviewCallbackImpl(this);
@@ -88,6 +91,12 @@ protected void onCreate(Bundle savedInstanceState) {
8891
* 初始化资源和视图
8992
*/
9093
private void init() {
94+
String btnName = getIntent().getStringExtra("btnName");
95+
if (btnName != null) {
96+
faceBtn.setText(btnName);
97+
} else {
98+
faceBtn.setText(R.string.face_do_btn_str);
99+
}
91100
checkHasFrontFaceCamera();
92101
initHaarcascadesData();
93102
initView();

app/src/main/java/top/itning/smpandroid/ui/activity/PersonalActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ protected void onDestroy() {
207207
* @param view View
208208
*/
209209
public void handleRegisterFaceBtnClick(View view) {
210-
startActivityForResult(new Intent(this, FaceActivity.class), START_FACE_ACTIVITY_REQUEST_CODE);
210+
Intent intent = new Intent(this, FaceActivity.class);
211+
intent.putExtra("btnName", "点击注册");
212+
startActivityForResult(intent, START_FACE_ACTIVITY_REQUEST_CODE);
211213
}
212214

213215
@Override

app/src/main/res/layout/activity_face.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
android:src="@drawable/face" />
1818

1919
<androidx.appcompat.widget.AppCompatButton
20+
android:id="@+id/btn_face"
2021
android:layout_width="wrap_content"
2122
android:layout_height="wrap_content"
2223
android:layout_gravity="bottom|center_horizontal"
@@ -27,8 +28,8 @@
2728
android:paddingTop="16dp"
2829
android:paddingEnd="32dp"
2930
android:paddingBottom="16dp"
30-
android:text="@string/face_do_btn_str"
3131
android:textAppearance="?android:attr/textAppearanceLargeInverse"
3232
android:textSize="16sp"
33-
android:theme="@style/AppTheme" />
33+
android:theme="@style/AppTheme"
34+
tools:text="@string/face_do_btn_str" />
3435
</merge>

0 commit comments

Comments
 (0)