doum
6 天以前 2b287056e2f59518888d05a1bbc7e5a55fbd84d5
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
package com.example.settinglibrary;
 
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Switch;
import android.widget.TextView;
import com.example.datalibrary.activity.BaseActivity;
import com.example.datalibrary.utils.PWTextUtils;
 
import java.math.BigDecimal;
import java.text.DecimalFormat;
 
public class GateConfigQualtifyActivity extends BaseActivity {
    private Switch qcQuality;
 
    private ImageView qcGestureDecrease;
    private EditText qcGestureEtThreshold;
    private ImageView qcGestureIncrease;
 
    private ImageView qcIlluminiationDecrease;
    private EditText qcIlluminiationEtThreshold;
    private ImageView qcIlluminiationIncrease;
 
    private ImageView qcBlurDecrease;
    private EditText qcBlurEtThreshold;
    private ImageView qcBlurIncrease;
 
    private ImageView qcEyeDecrease;
    private EditText qcEyeEtThreshold;
    private ImageView qcEyeIncrease;
 
    private ImageView qcCheekDecrease;
    private EditText qcCheekEtThreshold;
    private ImageView qcCheekIncrease;
 
    private ImageView qcNoseDecrease;
    private EditText qcNoseEtThreshold;
    private ImageView qcNoseIncrease;
 
    private ImageView qcMouseDecrease;
    private EditText qcMouseEtThreshold;
    private ImageView qcMouseIncrease;
 
    private ImageView qcChinDecrease;
    private EditText qcChinEtThreshold;
    private ImageView qcChinIncrease;
 
    private LinearLayout qcLinerQuality;
 
    private float gesture;
    private float illum;
    private float blur;
    private float eye;
    private float cheek;
    private float nose;
    private float mouth;
    private float chinContour;
 
 
    private BigDecimal gestureDecimal;
    private BigDecimal blurDecimal;
    private BigDecimal occlusionLeftEyeDecimal;
    private BigDecimal occlusionLeftCheekDecimal;
    private BigDecimal noseDecimal;
    private BigDecimal chinContourDecimal;
    private BigDecimal illuminiationDecimal;
 
    private BigDecimal obNonmoralValue;
    private BigDecimal gestureNormalValue;
 
    private ImageView qcSave;
 
    private LinearLayout linerGesture;
    private TextView tvGesture;
    private Button cwGesture;
 
    private LinearLayout linerIlluminiation;
    private TextView tvIlluminiation;
    private Button cwIlluminiation;
 
    private LinearLayout linerBlur;
    private TextView tvBlur;
    private Button cwBlur;
 
    private LinearLayout linerocclusion;
    private TextView tvocclusion;
    private Button cwocclusion;
    private String msgTag = "";
    private int showWidth;
    private int showXLocation;
    private LinearLayout qcLinerFirst;
    private boolean qualityControl;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gate_config_qualtifys);
 
        init();
    }
 
    public void init() {
        // 获取Intent对象
        Intent intent = getIntent();
        linerGesture = findViewById(R.id.linergesture);
        qcLinerFirst = findViewById(R.id.qc_LinerFirst);
 
        qcSave = findViewById(R.id.qc_save);
 
        tvGesture = findViewById(R.id.tvgesture);
        cwGesture = findViewById(R.id.cwgesture);
 
        linerIlluminiation = findViewById(R.id.linerilluminiation);
        tvIlluminiation = findViewById(R.id.tvilluminiation);
        cwIlluminiation = findViewById(R.id.cwilluminiation);
 
        linerBlur = findViewById(R.id.linerblur);
        tvBlur = findViewById(R.id.tvblur);
        cwBlur = findViewById(R.id.cwblur);
 
        linerocclusion = findViewById(R.id.linerocclusion);
        tvocclusion = findViewById(R.id.tvocclusion);
        cwocclusion = findViewById(R.id.cwocclusion);
 
        qcQuality = findViewById(R.id.qc_Quality);
        qcLinerQuality = findViewById(R.id.qc_LinerQuality);
 
        qcGestureDecrease = findViewById(R.id.qc_GestureDecrease);
        qcGestureEtThreshold = findViewById(R.id.qc_GestureEtThreshold);
        qcGestureIncrease = findViewById(R.id.qc_GestureIncrease);
 
        qcIlluminiationDecrease = findViewById(R.id.qc_IlluminiationDecrease);
        qcIlluminiationEtThreshold = findViewById(R.id.qc_IlluminiationEtThreshold);
        qcIlluminiationIncrease = findViewById(R.id.qc_IlluminiationIncrease);
 
        qcBlurDecrease = findViewById(R.id.qc_BlurDecrease);
        qcBlurEtThreshold = findViewById(R.id.qc_BlurEtThreshold);
        qcBlurIncrease = findViewById(R.id.qc_BlurIncrease);
 
        qcEyeDecrease = findViewById(R.id.qc_EyeDecrease);
        qcEyeEtThreshold = findViewById(R.id.qc_EyeEtThreshold);
        qcEyeIncrease = findViewById(R.id.qc_EyeIncrease);
 
        qcCheekDecrease = findViewById(R.id.qc_CheekDecrease);
        qcCheekEtThreshold = findViewById(R.id.qc_CheekEtThreshold);
        qcCheekIncrease = findViewById(R.id.qc_CheekIncrease);
 
        qcNoseDecrease = findViewById(R.id.qc_NoseDecrease);
        qcNoseEtThreshold = findViewById(R.id.qc_NoseEtThreshold);
        qcNoseIncrease = findViewById(R.id.qc_NoseIncrease);
 
        qcMouseDecrease = findViewById(R.id.qc_MouseDecrease);
        qcMouseEtThreshold = findViewById(R.id.qc_MouseEtThreshold);
        qcMouseIncrease = findViewById(R.id.qc_MouseIncrease);
 
        qcChinDecrease = findViewById(R.id.qc_ChinDecrease);
        qcChinEtThreshold = findViewById(R.id.qc_ChinEtThreshold);
        qcChinIncrease = findViewById(R.id.qc_ChinIncrease);
 
        gesture = intent.getFloatExtra("gesture" , 0.8f);
        illum = intent.getFloatExtra("illum" , 0.8f);
        blur = intent.getFloatExtra("blur" , 0.8f);
        eye = intent.getFloatExtra("eye" , 0.8f);
        cheek = intent.getFloatExtra("cheek" , 0.8f);
        nose = intent.getFloatExtra("nose" , 0.8f);
        mouth = intent.getFloatExtra("mouth" , 0.8f);
        chinContour = intent.getFloatExtra("chinContour" , 1.0f);
        qualityControl = intent.getBooleanExtra("qualityControl" , true);
 
        qcGestureEtThreshold.setText((int) gesture + "");
        qcIlluminiationEtThreshold.setText(+illum + "");
        qcBlurEtThreshold.setText(blur + "");
        qcEyeEtThreshold.setText(eye + "");
        qcCheekEtThreshold.setText(cheek + "");
        qcNoseEtThreshold.setText(nose + "");
        qcMouseEtThreshold.setText(mouth + "");
        qcChinEtThreshold.setText(chinContour + "");
 
        obNonmoralValue = new BigDecimal(0.1 + "");
        gestureNormalValue = new BigDecimal(5 + "");
 
        if (qualityControl) {
            qcQuality.setChecked(true);
            qcLinerQuality.setVisibility(View.VISIBLE);
        } else {
            qcQuality.setChecked(false);
            qcLinerQuality.setVisibility(View.GONE);
        }
 
        PWTextUtils.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @SuppressLint("NewApi")
            @Override
            public void onDismiss() {
                cwGesture.setBackground(getDrawable(R.mipmap.icon_setting_question));
                cwBlur.setBackground(getDrawable(R.mipmap.icon_setting_question));
                cwIlluminiation.setBackground(getDrawable(R.mipmap.icon_setting_question));
                cwocclusion.setBackground(getDrawable(R.mipmap.icon_setting_question));
            }
        });
 
        qcQuality.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    qcQuality.setChecked(true);
                    qcLinerQuality.setVisibility(View.VISIBLE);
                } else {
                    qcQuality.setChecked(false);
                    qcLinerQuality.setVisibility(View.GONE);
                }
                qualityControl = isChecked;
            }
        });
        setClickListener();
        initEdittextStatus();
    }
 
    private void initEdittextStatus() {
 
        qcGestureEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Integer.valueOf(s.toString()) == 90) {
                    qcGestureIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Integer.valueOf(s.toString()) == 0) {
                    qcGestureDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Integer.valueOf(s.toString()) > 0 && Integer.valueOf(s.toString()) < 90) {
                    qcGestureIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcGestureDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
            }
        });
 
        if (Integer.valueOf(qcGestureEtThreshold.getText().toString()) == 90) {
            qcGestureIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
        }
        if (Integer.valueOf(qcGestureEtThreshold.getText().toString()) == 0) {
            qcGestureDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
        qcIlluminiationEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1) {
                    qcIlluminiationIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0) {
                    qcIlluminiationDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0 && Float.valueOf(s.toString()) < 1) {
                    qcIlluminiationIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcIlluminiationDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcIlluminiationEtThreshold.getText().toString()) == 1) {
            qcIlluminiationIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcIlluminiationEtThreshold.getText().toString()) == 0) {
            qcIlluminiationDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
 
        qcBlurEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcBlurIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcBlurDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcBlurIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcBlurDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcBlurEtThreshold.getText().toString()) == 1f) {
            qcBlurIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcBlurEtThreshold.getText().toString()) == 0f) {
            qcBlurDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
 
        qcEyeEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcEyeIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcEyeDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcEyeIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcEyeDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcEyeEtThreshold.getText().toString()) == 1f) {
            qcEyeIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcEyeEtThreshold.getText().toString()) == 0f) {
            qcEyeDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
 
        qcCheekEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcCheekIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcCheekDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcCheekIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcCheekDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcCheekEtThreshold.getText().toString()) == 1f) {
            qcCheekIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcCheekEtThreshold.getText().toString()) == 0f) {
            qcCheekDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
        qcNoseEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcNoseIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcNoseDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcNoseIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcNoseDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcNoseEtThreshold.getText().toString()) == 1f) {
            qcNoseIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcNoseEtThreshold.getText().toString()) == 0f) {
            qcNoseDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
        qcMouseEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcMouseIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcMouseDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcMouseIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcMouseDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcMouseEtThreshold.getText().toString()) == 1f) {
            qcMouseIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcMouseEtThreshold.getText().toString()) == 0f) {
            qcMouseDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
 
        qcChinEtThreshold.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
            }
 
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
 
            }
 
            @Override
            public void afterTextChanged(Editable s) {
                if (Float.valueOf(s.toString()) == 1f) {
                    qcChinIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
                }
                if (Float.valueOf(s.toString()) == 0f) {
                    qcChinDecrease.setImageResource(R.mipmap.icon_setting_minus);
                }
                if (Float.valueOf(s.toString()) > 0f && Float.valueOf(s.toString()) < 1f) {
                    qcChinIncrease.setImageResource(R.mipmap.icon_setting_add);
                    qcChinDecrease.setImageResource(R.mipmap.icon_setting_minus );
                }
            }
        });
 
        if (Float.valueOf(qcChinEtThreshold.getText().toString()) == 1f) {
            qcChinIncrease.setImageResource(R.mipmap.adding_sign_to_gray);
 
        }
        if (Float.valueOf(qcChinEtThreshold.getText().toString()) == 0f) {
            qcChinDecrease.setImageResource(R.mipmap.icon_setting_minus);
        }
    }
 
    public void setClickListener() {
 
        qcGestureDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (gesture <= 90 && gesture > 0) {
                    gestureDecimal = new BigDecimal(gesture + "");
                    gesture = gestureDecimal.subtract(gestureNormalValue).floatValue();
                    qcGestureEtThreshold.setText((int) gesture + "");
                }
            }
        });
 
        qcGestureIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (gesture < 90 && gesture >= 0) {
                    gestureDecimal = new BigDecimal(gesture + "");
                    gesture = gestureDecimal.add(gestureNormalValue).floatValue();
                    qcGestureEtThreshold.setText((int) gesture + "");
                }
            }
        });
 
        qcIlluminiationDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (illum > 0f && illum <= 1f) {
                    illuminiationDecimal = new BigDecimal(illum + "");
                    illum = illuminiationDecimal.subtract(obNonmoralValue).floatValue();
                    qcIlluminiationEtThreshold.setText(illum + "");
                }
            }
        });
 
        qcIlluminiationIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (illum >= 0f && illum < 1f) {
                    illuminiationDecimal = new BigDecimal(illum + "");
                    illum = illuminiationDecimal.add(obNonmoralValue).floatValue();
                    qcIlluminiationEtThreshold.setText(illum + "");
                }
            }
        });
 
        qcBlurDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (blur > 0f && blur <= 1f) {
                    blurDecimal = new BigDecimal(blur + "");
                    blur = blurDecimal.subtract(obNonmoralValue).floatValue();
                    qcBlurEtThreshold.setText(blur + "");
                }
            }
        });
 
        qcBlurIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (blur >= 0f && blur < 1f) {
                    blurDecimal = new BigDecimal(blur + "");
                    blur = blurDecimal.add(obNonmoralValue).floatValue();
                    qcBlurEtThreshold.setText(blur + "");
                }
            }
        });
 
        qcEyeDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (eye > 0f && eye <= 1f) {
                    occlusionLeftEyeDecimal = new BigDecimal(eye + "");
                    eye = occlusionLeftEyeDecimal.subtract(obNonmoralValue).floatValue();
                    qcEyeEtThreshold.setText(eye + "");
                }
            }
        });
 
        qcEyeIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (eye >= 0f && eye < 1f) {
                    occlusionLeftEyeDecimal = new BigDecimal(eye + "");
                    eye = occlusionLeftEyeDecimal.add(obNonmoralValue).floatValue();
                    qcEyeEtThreshold.setText(eye + "");
                }
            }
        });
 
        qcCheekDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (cheek > 0f && cheek <= 1f) {
                    occlusionLeftCheekDecimal = new BigDecimal(cheek + "");
                    cheek = occlusionLeftCheekDecimal.subtract(obNonmoralValue).floatValue();
                    qcCheekEtThreshold.setText(cheek + "");
                }
            }
        });
 
        qcCheekIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (cheek >= 0f && cheek < 1f) {
                    occlusionLeftCheekDecimal = new BigDecimal(cheek + "");
                    cheek = occlusionLeftCheekDecimal.add(obNonmoralValue).floatValue();
                    qcCheekEtThreshold.setText(cheek + "");
                }
            }
        });
 
        qcNoseDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (nose > 0f && nose <= 1f) {
                    noseDecimal = new BigDecimal(nose + "");
                    nose = noseDecimal.subtract(obNonmoralValue).floatValue();
                    qcNoseEtThreshold.setText(nose + "");
                }
            }
        });
 
        qcNoseIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (nose >= 0f && nose < 1f) {
                    noseDecimal = new BigDecimal(nose + "");
                    nose = noseDecimal.add(obNonmoralValue).floatValue();
                    qcNoseEtThreshold.setText(nose + "");
                }
            }
        });
 
        qcMouseDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mouth > 0f && mouth <= 1f) {
                    noseDecimal = new BigDecimal(mouth + "");
                    mouth = noseDecimal.subtract(obNonmoralValue).floatValue();
                    qcMouseEtThreshold.setText(mouth + "");
                }
            }
        });
 
        qcMouseIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mouth >= 0f && mouth < 1f) {
                    noseDecimal = new BigDecimal(mouth + "");
                    mouth = noseDecimal.add(obNonmoralValue).floatValue();
                    qcMouseEtThreshold.setText(mouth + "");
                }
            }
        });
 
        qcChinDecrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (chinContour > 0f && chinContour <= 1f) {
                    chinContourDecimal = new BigDecimal(chinContour + "");
                    chinContour = chinContourDecimal.subtract(obNonmoralValue).floatValue();
                    qcChinEtThreshold.setText(chinContour + "");
                }
            }
        });
 
        qcChinIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (chinContour >= 0f && chinContour < 1f) {
                    chinContourDecimal = new BigDecimal(chinContour + "");
                    chinContour = chinContourDecimal.add(obNonmoralValue).floatValue();
                    qcChinEtThreshold.setText(chinContour + "");
                }
            }
        });
 
 
        qcSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
 
        cwGesture.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("NewApi")
            @Override
            public void onClick(View v) {
                if (msgTag.equals(getString(R.string.cw_gesture))) {
                    msgTag = "";
                    return;
                }
                msgTag = getString(R.string.cw_gesture);
                cwGesture.setBackground(getDrawable(R.mipmap.icon_setting_question_hl));
                PWTextUtils.showDescribeText(linerGesture, tvGesture, GateConfigQualtifyActivity.this,
                        getString(R.string.cw_gesture), showWidth, showXLocation);
            }
        });
        cwIlluminiation.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("NewApi")
            @Override
            public void onClick(View v) {
                if (msgTag.equals(getString(R.string.cw_illuminiation))) {
                    msgTag = "";
                    return;
                }
                msgTag = getString(R.string.cw_illuminiation);
                cwIlluminiation.setBackground(getDrawable(R.mipmap.icon_setting_question_hl));
                PWTextUtils.showDescribeText(linerIlluminiation, tvIlluminiation, GateConfigQualtifyActivity.this,
                        getString(R.string.cw_illuminiation), showWidth, showXLocation);
            }
        });
        cwBlur.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("NewApi")
            @Override
            public void onClick(View v) {
                if (msgTag.equals(getString(R.string.cw_blur))) {
                    msgTag = "";
                    return;
                }
                msgTag = getString(R.string.cw_blur);
                cwBlur.setBackground(getDrawable(R.mipmap.icon_setting_question_hl));
                PWTextUtils.showDescribeText(linerBlur, tvBlur, GateConfigQualtifyActivity.this,
                        getString(R.string.cw_blur), showWidth, showXLocation);
            }
        });
        cwocclusion.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("NewApi")
            @Override
            public void onClick(View v) {
                if (msgTag.equals(getString(R.string.cw_occulusion))) {
                    msgTag = "";
                    return;
                }
                msgTag = getString(R.string.cw_occulusion);
                cwocclusion.setBackground(getDrawable(R.mipmap.icon_setting_question_hl));
                PWTextUtils.showDescribeText(linerocclusion, tvocclusion, GateConfigQualtifyActivity.this,
                        getString(R.string.cw_occulusion), showWidth, showXLocation);
            }
        });
    }
 
    @Override
    public void finish() {
        Intent intent = new Intent();
        intent.putExtra("gesture", Float.valueOf(qcGestureEtThreshold.getText().toString()));
        intent.putExtra("illum", Float.valueOf(qcIlluminiationEtThreshold.getText().toString()));
        intent.putExtra("blur", Float.valueOf(qcBlurEtThreshold.getText().toString()));
        intent.putExtra("eye", Float.valueOf(qcEyeEtThreshold.getText().toString()));
        intent.putExtra("cheek", Float.valueOf(qcCheekEtThreshold.getText().toString()));
        intent.putExtra("nose", Float.valueOf(qcNoseEtThreshold.getText().toString()));
        intent.putExtra("mouth", Float.valueOf(qcMouseEtThreshold.getText().toString()));
        intent.putExtra("chinContour", Float.valueOf(qcChinEtThreshold.getText().toString()));
        intent.putExtra("qualityControl", qualityControl);
        // 设置返回码和返回携带的数据
        setResult(Activity.RESULT_OK, intent);
        super.finish();
    }
 
    public static String roundByScale(float numberValue) {
        // 构造方法的字符格式这里如果小数不足2位,会以0补足.
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        // format 返回的是字符串
        String resultNumber = decimalFormat.format(numberValue);
        return resultNumber;
    }
 
    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        showWidth = qcLinerFirst.getWidth();
        showXLocation = (int) linerGesture.getX();
    }
}