rk
昨天 4a8ff39b0fab0627ef8f7459587d514cc01c3676
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
package com.example.settinglibrary;
 
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.datalibrary.activity.BaseActivity;
 
public class GateLensSettingsActivity extends BaseActivity implements View.OnClickListener {
 
    private TextView configTxSettingQualtify;
    private ImageView qcSave;
 
    private boolean rgbRevert;
    int rgbDetectDirection;
    int mirrorDetectRGB;
    int nirDetectDirection;
    int mirrorDetectNIR;
    // 摄像头个数
    int rgbVideoDirection;
    int mirrorVideoRGB;
    int nirVideoDirection;
    int mirrorVideoNIR;
    private int rbgCameraId;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gate_lens_settings);
 
        init();
    }
 
    private void init() {
        // 获取Intent对象
        Intent intent = getIntent();
        rgbRevert = intent.getBooleanExtra("rgbRevert" , false);
        rgbDetectDirection = intent.getIntExtra("rgbDetectDirection" , 0);
        mirrorDetectRGB = intent.getIntExtra("mirrorDetectRGB" , 0);
        nirDetectDirection = intent.getIntExtra("nirDetectDirection" , 0);
        mirrorDetectNIR = intent.getIntExtra("mirrorDetectNIR" , 0);
        rbgCameraId = intent.getIntExtra("rbgCameraId" , -1);
        // 获取传递的值
        rgbVideoDirection = intent.getIntExtra("rgbVideoDirection" , 0);
        mirrorVideoRGB = intent.getIntExtra("mirrorVideoRGB" , 0);
        nirVideoDirection = intent.getIntExtra("nirVideoDirection" , 0);
        mirrorVideoNIR = intent.getIntExtra("mirrorVideoNIR" , 0);
        // 人脸检测角度
        LinearLayout configFaceDetectAngle = findViewById(R.id.configFaceDetectAngle);
        configFaceDetectAngle.setOnClickListener(this);
        // 人脸回显角度
        LinearLayout configDisplayAngle = findViewById(R.id.configDisplayAngle);
        configDisplayAngle.setOnClickListener(this);
        // 镜像设置
        LinearLayout configMirror = findViewById(R.id.configMirror);
        configMirror.setOnClickListener(this);
        configTxSettingQualtify = findViewById(R.id.configTxSettingQualtify);
 
 
        qcSave = findViewById(R.id.qc_save);
        qcSave.setOnClickListener(this);
    }
 
    @Override
    protected void onResume() {
        super.onResume();
        if (rgbRevert) {
            configTxSettingQualtify.setText("开启");
        } else {
            configTxSettingQualtify.setText("关闭");
        }
    }
 
    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.configFaceDetectAngle) {
            Intent intent = new Intent(this, FaceDetectAngleActivity.class);
            intent.putExtra("rgbDetectDirection" , rgbDetectDirection);
            intent.putExtra("mirrorDetectRGB" , mirrorDetectRGB);
            intent.putExtra("nirDetectDirection" , nirDetectDirection);
            intent.putExtra("mirrorDetectNIR" , mirrorDetectNIR);
            intent.putExtra("rgbVideoDirection" , rgbVideoDirection);
            intent.putExtra("mirrorVideoRGB" , mirrorVideoRGB);
            intent.putExtra("nirVideoDirection" , nirVideoDirection);
            intent.putExtra("mirrorVideoNIR" , mirrorVideoNIR);
            intent.putExtra("rbgCameraId" , rbgCameraId);
            startActivityForResult(intent , 100);
        } else if (id == R.id.configDisplayAngle) {
            Intent intent = new Intent(this, CameraDisplayAngleActivity.class);
            intent.putExtra("rgbVideoDirection" , rgbVideoDirection);
            intent.putExtra("mirrorVideoRGB" , mirrorVideoRGB);
            intent.putExtra("nirVideoDirection" , nirVideoDirection);
            intent.putExtra("mirrorVideoNIR" , mirrorVideoNIR);
            intent.putExtra("rbgCameraId" , rbgCameraId);
            startActivityForResult(intent , 101);
        } else if (id == R.id.configMirror) {
            Intent intent = new Intent(this, MirrorSettingActivity.class);
            intent.putExtra("rgbRevert" , rgbRevert);
            startActivityForResult(intent , 102);
        } else if (id == R.id.qc_save) {
            finish();
        }
    }
 
    @Override
    public void finish() {
 
        Intent intent = new Intent();
        intent.putExtra("rgbRevert", rgbRevert);
        intent.putExtra("rgbDetectDirection" , rgbDetectDirection);
        intent.putExtra("mirrorDetectRGB" , mirrorDetectRGB);
        intent.putExtra("nirDetectDirection" , nirDetectDirection);
        intent.putExtra("mirrorDetectNIR" , mirrorDetectNIR);
        intent.putExtra("rgbVideoDirection" , rgbVideoDirection);
        intent.putExtra("mirrorVideoRGB" , mirrorVideoRGB);
        intent.putExtra("nirVideoDirection" , nirVideoDirection);
        intent.putExtra("mirrorVideoNIR" , mirrorVideoNIR);
        intent.putExtra("rbgCameraId" , rbgCameraId);
        // 设置返回码和返回携带的数据
        setResult(Activity.RESULT_OK, intent);
        super.finish();
    }
 
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        if (resultCode != Activity.RESULT_OK){
            return;
        }
        switch (requestCode) {
            case 100: // 返回的结果是来自于Activity B
                rgbDetectDirection = intent.getIntExtra("rgbDetectDirection" , 0);
                mirrorDetectRGB = intent.getIntExtra("mirrorDetectRGB" , 0);
                nirDetectDirection = intent.getIntExtra("nirDetectDirection" , 0);
                mirrorDetectNIR = intent.getIntExtra("mirrorDetectNIR" , 0);
                rbgCameraId = intent.getIntExtra("rbgCameraId" , -1);
                // 获取传递的值
                rgbVideoDirection = intent.getIntExtra("rgbVideoDirection" , 0);
                mirrorDetectRGB = intent.getIntExtra("mirrorDetectRGB" , 0);
                nirVideoDirection = intent.getIntExtra("nirVideoDirection" , 0);
                mirrorDetectNIR = intent.getIntExtra("mirrorDetectNIR" , 0);
                break;
            case 101: // 返回的结果是来自于Activity B
                rbgCameraId = intent.getIntExtra("rbgCameraId" , -1);
                // 获取传递的值
                rgbVideoDirection = intent.getIntExtra("rgbVideoDirection" , 0);
                mirrorVideoRGB = intent.getIntExtra("mirrorVideoRGB" , 0);
                nirVideoDirection = intent.getIntExtra("nirVideoDirection" , 0);
                mirrorVideoNIR = intent.getIntExtra("mirrorVideoNIR" , 0);
                break;
            case 102: // 返回的结果是来自于Activity B
                rgbRevert = intent.getBooleanExtra("rgbRevert" , false);
                break;
        }
    }
}