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
//package cn.flightfeather.thirdapp.module.inspectioninfo;
//
//import android.app.Dialog;
//import android.content.DialogInterface;
//import android.content.Intent;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
//import android.graphics.Matrix;
//import android.os.Build;
//import android.os.Bundle;
//import android.os.Environment;
//import android.support.annotation.RequiresApi;
//import android.support.constraint.ConstraintLayout;
//import android.support.constraint.Group;
//import android.support.v7.app.AlertDialog;
//import android.support.v7.app.AppCompatActivity;
//import android.transition.Explode;
//import android.view.View;
//import android.widget.Button;
//import android.widget.ImageView;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import com.amap.api.maps.AMap;
//import com.amap.api.maps.CameraUpdateFactory;
//import com.amap.api.maps.TextureMapView;
//import com.amap.api.maps.model.BitmapDescriptorFactory;
//import com.amap.api.maps.model.LatLng;
//import com.amap.api.maps.model.Marker;
//import com.amap.api.maps.model.MarkerOptions;
//import com.ping.greendao.gen.MediafileDao;
//
//import java.io.File;
//import java.io.IOException;
//import java.io.Serializable;
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.OnClick;
//import butterknife.Unbinder;
//import cn.flightfeather.thirdapp.CommonApplication;
//import cn.flightfeather.thirdapp.R;
//import cn.flightfeather.thirdapp.activity.PhotoViewerActivity;
//import cn.flightfeather.thirdapp.bean.entity.Mediafile;
//import cn.flightfeather.thirdapp.bean.vo.MediafileVo;
//import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo;
//import cn.flightfeather.thirdapp.httpservice.ProblemListService;
//import cn.flightfeather.thirdapp.module.base.BaseTakePicActivity;
//import cn.flightfeather.thirdapp.util.Constant;
//import cn.flightfeather.thirdapp.util.DateFormatter;
//import cn.flightfeather.thirdapp.util.DialogUtil;
//import cn.flightfeather.thirdapp.util.Domain;
//import cn.flightfeather.thirdapp.util.UUIDGenerator;
//import cn.flightfeather.thirdapp.util.file.FileUtil;
//import cn.flightfeather.thirdapp.util.photo.OnUpLoadListener;
//import cn.flightfeather.thirdapp.util.photo.PhotoUtil;
//import okhttp3.ResponseBody;
//import retrofit2.Call;
//import retrofit2.Callback;
//import retrofit2.Response;
//
//public class ProblemChangeDetailActivity_B extends AppCompatActivity {
//
//    //<editor-fold desc="全局变量">
//    public static final String ARG_PROBLEM = "problems";
//    public static final String ARG_PROBLEM_TYPE = "problemType";
//    public static final String ARG_TEXT_DATA = "textData";
//    //展示的问题对象
//    private ProblemlistVo problemlistVo = new ProblemlistVo();
//
//    /**
//     * 两种问题类型 {@link Constant#CHANGED}和{@link Constant#UNCHANGED}
//     */
//    private String problemType = "";
//    //内部数据类,前一个context传入一些不变的展示数据
//    private TextData textData = new TextData();
//
//
//
//    //requestCode
//    private final int TAKE_PROBLEM_PHOTO =13;
//    private final int TAKE_CHANGE_PHOTO =14;
//    private final int PICK_PROBLEM_PHOTO =15;
//    private final int PICK_CHANGE_PHOTO = 16;
//
//    private CommonApplication application;
//    private MediafileDao mediafileDao;
//
//    //是否已编辑过
//    private boolean isEdited;
//
//    private Unbinder unbinder;
//    //</editor-fold>
//
//    //<editor-fold desc="内部数据类">
//    public static class TextData implements Serializable {
//        //离整改承诺期限剩余或逾期多少天
//        String text_deadline_status = "";
//        String text_remaining_days = "";
//        //是否承诺整改
//        String text_promise = "";
//        boolean text_promise_selected;
//        //截止日期
//        String text_change_deadline = "";
//        int change_deadline_visible;
//        //超时整改天数
//        int cl_deadline_visible;
//
//        public TextData() {
//        }
//
//        public TextData(String text_deadline_status, String text_remaining_days, String text_promise, boolean text_promise_selected, String text_change_deadline, int change_deadline_visible, int cl_deadline_visible) {
//            this.text_deadline_status = text_deadline_status;
//            this.text_remaining_days = text_remaining_days;
//            this.text_promise = text_promise;
//            this.text_promise_selected = text_promise_selected;
//            this.text_change_deadline = text_change_deadline;
//            this.change_deadline_visible = change_deadline_visible;
//            this.cl_deadline_visible = cl_deadline_visible;
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="lifecycle">
//    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        //设置允许使用转场动画
//        getWindow().setEnterTransition(new Explode().setDuration(500));
//        getWindow().setExitTransition(new Explode().setDuration(300));
//        setContentView(R.layout.activity_problem_change_detail);
//
//        unbinder = ButterKnife.bind(this);
//        this.application = (CommonApplication) getApplication();
//
//        initParam();
//        updateMediafile();
//        initView();
//        initProblemPhoto(this.mediafileListProblem, this.imageViewProblemList);
//        initChangingPhoto(this.mediafileListChange, this.imageViewChangeList);
//        initMap(savedInstanceState);
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//        if (requestCode ==TAKE_CHANGE_PHOTO){
//            if (resultCode == RESULT_OK && fileCurrent != null && !mediafileListProblem.isEmpty()) {
//                Mediafile mediafile = MediafileVo.newMediaFile(fileCurrent, true, this.mediafileListProblem.get(0));
//                this.mediafileListChange.add(mediafile);
//                this.mediafileDao.insert(mediafile);
//                this.isEdited = true;
//                initChangingPhoto(this.mediafileListChange, this.imageViewChangeList);
//            }
//        }else if (requestCode ==PICK_CHANGE_PHOTO){
//            if (resultCode ==RESULT_OK){
//                List<String> paths = data.getStringArrayListExtra(BaseTakePicActivity.EXTRA_SELECT_IMAGES);
//                for (String p : paths) {
//                    File oldFile = new File(p);
//                    File newFile = getFilePath();
//                    try {
//                        FileUtil.copyFile(oldFile,newFile);
//                        if (!mediafileListProblem.isEmpty()) {
//                            Mediafile mediafile = MediafileVo.newMediaFile(newFile, true, this.mediafileListProblem.get(0));
//                            this.mediafileListChange.add(mediafile);
//                            this.mediafileDao.insert(mediafile);
//                            this.isEdited = true;
//                        }
//                    } catch (IOException e) {
//                        e.printStackTrace();
//                    }
//                }
//                initChangingPhoto(this.mediafileListChange, this.imageViewChangeList);
//                if (this.problemlistVo.getIschanged()) {
//                    refreshSaveBtn(3);
//                }
//            }
//        } else if (requestCode == PhotoViewerActivity.CHANGE_PHOTO && resultCode == RESULT_OK) {
//            if (data!=null){
//                int position = data.getIntExtra("position",-1);
//                if (position>-1){
//                    mediafileDao.deleteByKey(mediafileListChange.get(position).getGuid());
//                    this.mediafileListChange.remove(position);
//                    //fixme 2020/11/12 由于删除单张图片是直接联网将服务器数据一并删除,因此当图片全部删除后,立即更新问题为未整改状态
//                    if (mediafileListChange.isEmpty()) {
//                        uploadProblem();
//                    }
//                    this.isEdited = !mediafileListChange.isEmpty();
//                    initChangingPhoto(this.mediafileListChange, this.imageViewChangeList);
//                    if (this.problemlistVo.getIschanged()) {
//                        refreshSaveBtn(3);
//                    }
//                }
//            }
//        }
//    }
//
//    @Override
//    protected void onDestroy() {
//        super.onDestroy();
//        if (unbinder != null) {
//            unbinder.unbind();
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="初始化图片">
//    @BindView(R.id.iv_problem_photo1) ImageView iv_problem_photo1;
//    @BindView(R.id.iv_problem_photo2) ImageView iv_problem_photo2;
//    @BindView(R.id.iv_problem_photo3) ImageView iv_problem_photo3;
//    List<ImageView> imageViewProblemList = new ArrayList<>();
//
//    @BindView(R.id.iv_problem_change_photo1) ImageView iv_problem_change_photo1;
//    @BindView(R.id.iv_problem_change_photo2) ImageView iv_problem_change_photo2;
//    @BindView(R.id.iv_problem_change_photo3) ImageView iv_problem_change_photo3;
//    List<ImageView> imageViewChangeList = new ArrayList<>();
//
//    private void initParam() {
//        Bundle bundle = getIntent().getExtras();
//        if (bundle != null) {
//            this.problemlistVo = (ProblemlistVo) bundle.getSerializable(ARG_PROBLEM);
//            this.problemType = bundle.getString(ARG_PROBLEM_TYPE);
//            this.textData = (TextData) bundle.getSerializable(ARG_TEXT_DATA);
//        }
//        this.mediafileDao = application.getDaoSession().getMediafileDao();
//
//        this.imageViewProblemList.add(iv_problem_photo1);
//        this.imageViewProblemList.add(iv_problem_photo2);
//        this.imageViewProblemList.add(iv_problem_photo3);
//
//        this.imageViewChangeList.add(iv_problem_change_photo1);
//        this.imageViewChangeList.add(iv_problem_change_photo2);
//        this.imageViewChangeList.add(iv_problem_change_photo3);
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="初始化文本">
//    @BindView(R.id.tv_problem_type_name) TextView tv_problem_type_name;
//    @BindView(R.id.tv_problem_time) TextView tv_problem_time;
//    @BindView(R.id.tv_problem_location) TextView tv_problem_location;
//    @BindView(R.id.text_deadline_status) TextView text_deadline_status;
//    @BindView(R.id.text_remaining_days) TextView text_remaining_days;
//    @BindView(R.id.tv_problem_name) TextView tv_problem_name;
//    @BindView(R.id.image_promise) ImageView image_promise;
//    @BindView(R.id.text_promise) TextView text_promise;
//    @BindView(R.id.text_change_deadline) TextView text_change_deadline;
//    @BindView(R.id.text_change_type) TextView text_change_type;
//    @BindView(R.id.text_change_tips) TextView text_change_tips;
//    @BindView(R.id.text_upload_photo) TextView text_upload_photo;
//
//    @BindView(R.id.cl_deadline) ConstraintLayout cl_deadline;
//
//    @BindView(R.id.group_change_effect) Group group_change_effect;
//    @BindView(R.id.btn_save) Button btn_save;
//    private void initView() {
//        //问题基本信息
//        tv_problem_type_name.setText(this.problemlistVo.getTypename());
//        tv_problem_time.setText(DateFormatter.dateTimeFormat.format(this.problemlistVo.getTime()));
//        tv_problem_location.setText(this.problemlistVo.getLocation());
//        tv_problem_name.setText(this.problemlistVo.getProblemname());
//        //逾期天数
//        text_deadline_status.setText(this.textData.text_deadline_status);
//        text_remaining_days.setText(this.textData.text_remaining_days);
//        //是否整改
//        image_promise.setSelected(this.textData.text_promise_selected);
//        text_promise.setText(this.textData.text_promise);
//        //整改截止日期
//        text_change_deadline.setText(this.textData.text_change_deadline);
//        text_change_deadline.setVisibility(this.textData.change_deadline_visible);
//        //整改类型
//        if (problemType.equals(Constant.CHANGED)
//                && problemlistVo.getChangecatalog() != null) {
//            text_change_type.setText(problemlistVo.getChangecatalog());
//        } else {
//            text_change_type.setVisibility(View.INVISIBLE);
//        }
//        cl_deadline.setVisibility(this.textData.cl_deadline_visible);
//
//        //整改建议
//        if (problemlistVo.getAdvise() != null) {
//            text_change_tips.setText(problemlistVo.getAdvise());
//        }
//
//        if (problemType.equals(Constant.UNCHANGED)) {
//            refreshSaveBtn(1);
//            text_upload_photo.setText(R.string.click_to_upload_photo);
//            text_upload_photo.setTextColor(getResources().getColor(R.color.black));
//            group_change_effect.setVisibility(View.GONE);
//        } else {
//            refreshSaveBtn(2);
//            text_upload_photo.setText(R.string.changed_photo);
//            group_change_effect.setVisibility(View.VISIBLE);
//        }
//    }
//    //</editor-fold>
//
//    private void refreshSaveBtn(int status) {
//        switch (status) {
//            case 1: {
//                //未整改
//                btn_save.setText(R.string.submit);
//                btn_save.setBackgroundResource(R.drawable.shape_button_blue);
//                btn_save.setOnClickListener(new View.OnClickListener() {
//                    @Override
//                    public void onClick(View v) {
//                        onButtonClick();
//                    }
//                });
//                break;
//            }
//            case 2: {
//                //已整改
//                btn_save.setText(R.string.changed);
//                btn_save.setBackgroundResource(R.drawable.shape_button_green);
//                btn_save.setOnClickListener(null);
//                break;
//            }
//            case 3: {
//                //提交后修改图片
//                btn_save.setText(R.string.submit_again);
//                btn_save.setBackgroundResource(R.drawable.shape_button_blue);
//                btn_save.setOnClickListener(new View.OnClickListener() {
//                    @Override
//                    public void onClick(View v) {
//                        onButtonClick();
//                    }
//                });
//                break;
//            }
//        }
//    }
//
//    //<editor-fold desc="初始化地图定位">
//    @BindView(R.id.image_no_map) ImageView image_no_map;
//    @BindView(R.id.tmv_main) TextureMapView tmv_main;
//    private void initMap(Bundle savedInstanceState) {
//        tmv_main.onCreate(savedInstanceState);
//        AMap aMap = tmv_main.getMap();
//
//        LatLng latLng = null;
//        MarkerOptions options = new MarkerOptions();
//        Bitmap bm = null;
//
//        //获取问题定位
//        Double latitude = this.problemlistVo.getLatitude();
//        Double longitude =this.problemlistVo.getLongitude();
//        if ((latitude != null && longitude != null)
//                && (latitude != 0 && longitude != 0)) {
//            latLng = new LatLng(this.problemlistVo.getLatitude(), this.problemlistVo.getLongitude());
//            bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon_mark_red);
//
//            Matrix matrix = new Matrix();
//            matrix.setScale(0.28f, 0.28f);
//            Bitmap bmBig = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),
//                    bm.getHeight(), matrix, true);
//            options.icon(BitmapDescriptorFactory.fromBitmap(bmBig));
//
//            options.position(latLng);
//            Marker marker = aMap.addMarker(options);
//            marker.setInfoWindowEnable(false);
//            aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14f));
//            //隐藏默认图片
//            tmv_main.setVisibility(View.VISIBLE);
//            image_no_map.setVisibility(View.GONE);
//        } else {
//            tmv_main.setVisibility(View.GONE);
//            image_no_map.setVisibility(View.VISIBLE);
//        }
//
////        double scenseLat = application.getCurrentUser()
////        double scenseLng = intent.getDoubleExtra("scenseLng",0);
////        MarkerOptions siteMarkeroptions = new MarkerOptions().position(new LatLng(scenseLat,scenseLng));
////        aMap.addMarker(siteMarkeroptions);
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="获取已有的图片">
//    private List<Mediafile> mediafileListChange = new ArrayList<>();//整改图片列表
//    private List<Mediafile> mediafileListProblem = new ArrayList<>();//问题图片列表
//    private void updateMediafile() {
//        List<Mediafile> mediafileList = mediafileDao.queryBuilder()
//                .where(MediafileDao.Properties.Businessguid.eq(problemlistVo.getGuid()))
//                .where(MediafileDao.Properties.Remark.eq("未上传"))
//                .list();
//        if (problemlistVo.getMediafileList() != null) {
//            mediafileList.addAll(problemlistVo.getMediafileList());
//        }
//        for (Mediafile m : mediafileList) {
//            if (m.getIschanged()) {
//                this.mediafileListChange.add(m);
//            } else {
//                this.mediafileListProblem.add(m);
//            }
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="初始化问题图片">
//    private void initProblemPhoto(List<Mediafile> mediafileList, List<ImageView> imageViews) {
//        int photoCount = PhotoUtil.loadImage(mediafileList, imageViews, this);//将图片加载至对应的imageView上
//        List<File> files = new ArrayList<>();
//        for (Mediafile m :
//                mediafileList) {
//            File tempFile = FileUtil.getFileFromMediaFile(m);
//            files.add(tempFile);
//        }
//        for (int i = 0; i < photoCount; i++) {//添加图片放大点击事件
//            imageViews.get(i)
//                    .setOnClickListener(PhotoUtil.OnPhotoViewClickListener(this,
//                            files,
//                            i,
//                            mediafileList,
//                            PhotoViewerActivity.PROBLEM_PHOTO,
//                            false));
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="初始化已上传整改的图片">
//    //整改图片
//
//    /**
//     *
//     * @param mediafileList
//     * @param imageViews
//     * @deprecated 20190719 上传完成后,客户需要能够修改上传图片的功能,即也能拍照和删除图片,此函数删去
//     */
//    @Deprecated
//    private void initChangedPhoto(List<Mediafile> mediafileList, List<ImageView> imageViews) {
//        int photoCount = PhotoUtil.loadImage(mediafileList, imageViews, this);//将图片加载至对应的imageView上
//        List<File> files = new ArrayList<>();
//        for (Mediafile m :
//                mediafileList) {
//            File tempFile = FileUtil.getFileFromMediaFile(m);
//            files.add(tempFile);
//        }
//        for (int i = 0; i < photoCount; i++) {//添加图片放大点击事件
//            imageViews.get(i)
//                    .setOnClickListener(PhotoUtil.OnPhotoViewClickListener(this,
//                            files,
//                            i,
//                            mediafileList,
//                            PhotoViewerActivity.CHANGE_PHOTO,
//                            true));
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="初始化未上传整改的图片">
//    /**
//     *
//     * @param mediafileList 在未整改时,列表{@link #mediafileListChange}从数据库获取的结果是空,因此此处可直接将该列表对象用于整改时的新图片上传
//     * @param imageViews
//     */
//    private void initChangingPhoto(final List<Mediafile> mediafileList, final List<ImageView> imageViews) {
//        int photoCount = PhotoUtil.loadImage(mediafileList, imageViews, this);
//        List<File> files = new ArrayList<>();
//        for (Mediafile m :
//                mediafileList) {
//            File tempFile = FileUtil.getFileFromMediaFile(m);
//            files.add(tempFile);
//        }
//        for (int i = 0; i < photoCount; i++) {//添加图片放大点击事件
//            imageViews.get(i)
//                    .setOnClickListener(PhotoUtil.OnPhotoViewClickListener(this,
//                            files,
//                            i,
//                            mediafileList,
//                            PhotoViewerActivity.CHANGE_PHOTO,
//                            true));
//        }
//        if (photoCount >= 3) return;
//        final int leftCount = 3 - photoCount > 0 ? 3 - photoCount : 0;
//
//        ImageView image_addPhoto = imageViews.get(photoCount);
//        image_addPhoto.setImageResource(R.drawable.icon_add_photo);
//        image_addPhoto.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                PhotoUtil.pickPhoto2(ProblemChangeDetailActivity_B.this, PICK_CHANGE_PHOTO, leftCount);
//            }
//        });
//
//        while (++photoCount < imageViews.size()) {
//            imageViews.get(photoCount).setImageResource(R.drawable.icon_add_photo_blank);
//        }
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="获取整改图片路径">
//    private File fileCurrent;
//
//    private File getFilePath() {
//        Mediafile mediafile = this.mediafileListProblem.get(0);
//        String path = mediafile.getPath()
//                + "整改/"
//                + this.problemlistVo.getProblemname()
//                + " "
//                + this.problemlistVo.getLocation()
//                +" 整改 "
//                + UUIDGenerator.generateUUID(4)
//                +".jpg";
//        File newFile = new File(Environment.getExternalStorageDirectory(), path);
//        if (!newFile.getParentFile().exists()) {
//            newFile.getParentFile().mkdirs();
//        }
//        this.fileCurrent = newFile;
//        return newFile;
//    }
//    //</editor-fold>
//
//    //<editor-fold desc="点击事件">
//    private void refreshProblemStatus() {
//        //整改图片全删除后,问题退回未整改审核通过状态
//        if (mediafileListChange.isEmpty()) {
//            this.problemlistVo.setIschanged(false);//设置为未整改
//            this.problemlistVo.setExtension3(Domain.PROBLEM_CHECK_PASS);
//            this.problemlistVo.setChangedtime(null);
//            this.problemlistVo.setChangecatalog(null);
//        } else {
//            this.problemlistVo.setIschanged(true);//设置为已整改
//            this.problemlistVo.setExtension3(Domain.CHANGE_UNCHECKED);//设置为整改待审核
//            this.problemlistVo.setChangedtime(new Date());//设置整改时间为当前时间
//            this.problemlistVo.getMediafileList().clear();
//            this.problemlistVo.getMediafileList().addAll(this.mediafileListProblem);
//            this.problemlistVo.getMediafileList().addAll(this.mediafileListChange);//将新增的图片添加进媒体文件列表,用于app数据刷新
//
//            Calendar calendar = Calendar.getInstance();
//            int today = calendar.get(Calendar.DAY_OF_YEAR);
//            calendar.setTime(this.problemlistVo.getTime());
//            int problemDay = calendar.get(Calendar.DAY_OF_YEAR);
//            //有承诺整改的日期
//            if (this.problemlistVo.getExtension1() != null) {
//                //整改时间已超过监管当天的24点,则认为是承诺整改
//                if (today > problemDay) {
//                    this.problemlistVo.setChangecatalog(Domain.PROMISE_CHANGE);
//                }
//                //否则是现场当天整改
//                else {
//                    this.problemlistVo.setChangecatalog(Domain.LOACAL_CHANGE);
//                }
//            }
//            //没有承诺整改的日期是未承诺整改
//            else {
//                this.problemlistVo.setChangecatalog(Domain.UNPROMISE_CHANGE);
//            }
//        }
//    }
//
//    //提交问题
//    Dialog loadingDialog;
//
//    public void onButtonClick() {
////        if (!problemType.equals(Constant.UNCHANGED)) {
////            return;
////        }
//        if (this.isEdited){
//            loadingDialog = DialogUtil.createLoadingDialog(this, "");
//            upLoadPic();
//        }else {
//            Toast.makeText(application, R.string.take_one_change_photo_at_least, Toast.LENGTH_SHORT).show();
//        }
//    }
//
//    @Override
//    public void onBackPressed() {
////        super.onBackPressed();
//        close();
//    }
//
//    @OnClick(R.id.image_close)
//    void onCloseClick() {
//        close();
//    }
//
//    private void close() {
//        if (this.isEdited) {
//            AlertDialog.Builder dialog = new AlertDialog.Builder(this);
//            dialog.setMessage("整改图片还未提交,是否退出?");
//            dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
//                @Override
//                public void onClick(DialogInterface dialogInterface, int i) {
//                    finish();
//                }
//            });
//            dialog.setNegativeButton("取消", null);
//            dialog.show();
//        } else {
//            supportFinishAfterTransition();
//        }
//    }
//
//    private void uploadProblem() {
//        refreshProblemStatus();
//        Call<ResponseBody> updateProblemList = application.getRetrofit().create(ProblemListService.class).updateProblemList(this.problemlistVo);
//        updateProblemList.enqueue(new Callback<ResponseBody>() {
//            @Override
//            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//                if (response.body()!=null){
//                    Toast.makeText(application, R.string.submit_success, Toast.LENGTH_LONG).show();
//
//                    if (loadingDialog != null && loadingDialog.isShowing()) {
//                        loadingDialog.dismiss();
//                    }
//                    //返回requestCode
//                    Intent intent = new Intent();
//                    intent.putExtra(ARG_PROBLEM, problemlistVo);
//                    setResult(RESULT_OK, intent);
//
//                    //发送数据更新广播
//                    Intent intent1 = new Intent("cn.flightfeather.thirdapp.broadcasereceiver.MainReceiver");
//                    intent1.setAction(Constant.REFRESH_DATA);
//                    intent1.putExtra(ARG_PROBLEM, problemlistVo);
//                    sendBroadcast(intent1);
//
//                    finish();
//
//                }else if (response.errorBody()!=null){
//                    Toast.makeText(application, R.string.submit_unsuccess, Toast.LENGTH_LONG).show();
//                    loadingDialog.dismiss();
//                }
//            }
//
//            @Override
//            public void onFailure(Call<ResponseBody> call, Throwable t) {
//                Toast.makeText(application, R.string.network_error, Toast.LENGTH_LONG).show();
//                loadingDialog.dismiss();
//            }
//        });
//    }
//
//
//    private void upLoadPic() {
//
//        //筛选“未上传”的图片
//        List<Mediafile> mediafiles = new ArrayList<>();
//        for (Mediafile m : this.mediafileListChange) {
//            if (m.getRemark().equals("未上传")) {
//                mediafiles.add(m);
//            }
//        }
//
//        PhotoUtil photoUtil = new PhotoUtil(mediafiles.size(), application, new OnUpLoadListener() {
//            @Override
//            public void onSuccess() {
//                uploadProblem();
//            }
//
//            @Override
//            public void onFail() {
//                Toast.makeText(application, "上传失败,请重试", Toast.LENGTH_SHORT).show();
//                loadingDialog.dismiss();
////                AlertDialog.Builder dialog = new AlertDialog.Builder(application);
////                dialog.setMessage("图片上传失败,请重试");
////                dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
////                    @Override
////                    public void onClick(DialogInterface dialogInterface, int i) {
////                        finish();
////                    }
////                });
////                dialog.show();
//            }
//        });
//
//        photoUtil.upLoadPhoto(mediafiles);
//    }
//
//    //</editor-fold>
//}