MainActivity.java
7.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//package com.huaheng.wms.facedete;
//
//import android.Manifest;
//import android.content.Context;
//import android.content.DialogInterface;
//import android.content.Intent;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
//import android.os.Bundle;
//import android.support.v4.app.ActivityCompat;
//import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
//import android.support.v7.app.AlertDialog;
//import android.support.v7.app.AppCompatActivity;
//import android.util.Base64;
//import android.util.Log;
//import android.view.View;
//import android.widget.ImageView;
//import android.widget.TextView;
//import android.widget.Toast;
//
//public class MainActivity extends AppCompatActivity {
//
// private TextView textView;
// private ImageView imageView;
// private Context mContext;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
// mContext = this;
// textView = (TextView)findViewById(R.id.tofacetest);
// imageView =(ImageView)findViewById(R.id.myimage);
// textView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
//
// startVerification();
//// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
//// Toast.makeText(MainActivity.this, "手机安卓版本过低不支持人脸识别", Toast.LENGTH_SHORT).show();
//// }else {
//// int rc = ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA);
//// if (rc == PackageManager.PERMISSION_GRANTED) {
//// Intent intent = new Intent(mContext, FaceDetectRGBActivity.class);
//// startActivity(intent);
////
////// Intent intent = new Intent();
////// intent.setClass(MainActivity.this, FaceDetectRGBActivity.class);
////// startActivityForResult(intent,3);
//// } else {
//// requestCameraPermission(1);
//// }
//// }
// }
// });
//
// TestObServernotice.getInstance().addObserver(deleteObserver);
// }
//
//
// private Observer deleteObserver = new Observer() {
// @Override
// public void update(int id,Bitmap param) {
// imageView.setImageBitmap(param);
// }
// };
//
// @Override
// protected void onDestroy() {
// super.onDestroy();
// TestObServernotice.getInstance().removeObserver(deleteObserver);
// deleteObserver = null;
// Log.v("lgq", "......11..onDestroy....");
// }
//
// private void requestCameraPermission(final int RC_HANDLE_CAMERA_PERM) {
//// Log.w(TAG, "Camera permission is not granted. Requesting permission");
//
// final String[] permissions = new String[]{Manifest.permission.CAMERA};
//
// ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
// }
//
// @Override
// public void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
// if(requestCode == 3) {
// if (resultCode == RESULT_OK) {
//
// String param = data.getStringExtra("test");
//// Log.i("lgq", "startPhotoZoom==fragment===="+"......."+param);
// Bitmap bitmap= stringToBitmap(param);
// imageView.setImageBitmap(bitmap);
// }
// }
// }
//
//
// public Bitmap stringToBitmap(String string) {
// // 将字符串转换成Bitmap类型
// Bitmap bitmap = null;
// try {
// byte[] bitmapArray;
// bitmapArray = Base64.decode(string, Base64.DEFAULT);
// bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0,
// bitmapArray.length);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return bitmap;
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// Log.i("lgq","hhhh=---");
//
// }
//
// private AlertDialog alertDialog;
// // 调用指纹验证方法
// private void startVerification() {
// FingerprintManagerUtil.startFingerprinterVerification(this,
// new FingerprintManagerUtil.FingerprintListenerAdapter() {
//
// @Override
// public void onAuthenticationStart() {
// AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
// .setTitle("指纹验证")
// .setMessage("指纹验证测试")
// .setCancelable(false)
// .setNegativeButton("取消", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// FingerprintManagerUtil.cancel();
// }
// });
// alertDialog = builder.create();
// alertDialog.show();
// }
//
// @Override
// public void onNonsupport() {
// Log.i("MainActivity", "onNonsupport");
// Toast.makeText(MainActivity.this, "不支持指纹验证", Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onEnrollFailed() {
// Log.i("MainActivity", "onEnrollFailed");
// Toast.makeText(MainActivity.this, "没有录入指纹", Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
// alertDialog.dismiss();
// Log.i("MainActivity", "onAuthenticationSucceeded result = [" + result + "]");
// Toast.makeText(MainActivity.this, "验证成功", Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onAuthenticationFailed() {
// Log.i("MainActivity", "onAuthenticationFailed");
// Toast.makeText(MainActivity.this, "验证失败", Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onAuthenticationError(int errMsgId, CharSequence errString) {
// Log.i("MainActivity", "onAuthenticationError errMsgId = [" + errMsgId + "], errString = [" + errString + "]");
// Toast.makeText(MainActivity.this, "提示: " + errString, Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
// Log.i("MainActivity", "onAuthenticationHelp helpMsgId = [" + helpMsgId + "], helpString = [" + helpString + "]");
// Toast.makeText(MainActivity.this, "提示: " + helpString, Toast.LENGTH_SHORT).show();
// }
// });
// }
//
//}