517 519
    }
518 520
519 521
    /**
520
     * 异步方式插入图片
521
     *
522
     * @param data
522
     * @param type 1表示插入图片成功 2表示插入视频成功 -1表示 插入数据为null
523 523
     */
524
    private void insertImagesSync(final Intent data) {
525
        insertDialog.show();
526
        Observable.create(new ObservableOnSubscribe<String>() {
527
            @Override
528
            public void subscribe(ObservableEmitter<String> subscriber) throws Exception {
529
                try {
530
                    mSelectionData= PictureSelector.obtainMultipleResult(data);
531
532
//                    List<Uri> uriList = Matisse.obtainResult(data);
533
                    for (LocalMedia media : mSelectionData) {
534
//                        Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
535
//                        File file = FileUtils.from(ChargingCommentActivity.this, uri);
536
//
537
//                        bitmap = FileUtils.rotateIfRequired(file, bitmap);
538
//                        bitmap = imageZoom(bitmap);
539
                        String path="";
540
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
541
                            path= media.getAndroidQToPath();
542
                        }else{
543
                            path=media.getPath();
544
                        }
545
                        ImageItem takePhoto = new ImageItem();
546
                        takePhoto.setBitmap(imageZoom(BitmapFactory.decodeFile(path)));
547
                        Bimp.tempSelectBitmap.add(takePhoto);
548
                        subscriber.onNext("");
549
                    }
550
                    subscriber.onComplete();
551
                } catch (Exception e) {
552
                    e.printStackTrace();
553
                    subscriber.onError(e);
554
                }
555
            }
556
        })
557
                .subscribeOn(Schedulers.io())//生产事件在io
558
                .observeOn(AndroidSchedulers.mainThread())//消费事件在UI线程
559
                .subscribe(new Observer<String>() {
560
                    @Override
561
                    public void onSubscribe(Disposable d) {
562
563
                    }
564
565
                    @Override
566
                    public void onNext(String s) {
567
568
                    }
569
570
                    @Override
571
                    public void onError(Throwable e) {
572
                        insertDialog.dismiss();
573
                        Log.e(TAG, "onError: " + "图片插入失败:" + e.getMessage());
574
                        ToastUtil.showToast(getApplicationContext(), "图片插入失败", Toast.LENGTH_SHORT);
575
                    }
576
577
                    @Override
578
                    public void onComplete() {
579
                        Log.e(TAG, "onCompleted: -------------");
580
                        insertDialog.dismiss();
581
                        adapter.update();
582
583
                    }
584
                });
524
    public void setLayoutHintVisible(int type) {
525
        if (type == 1) {
526
            noScrollgridview.setVisibility(View.VISIBLE);
527
            layoutHint.setVisibility(View.GONE);
528
        } else if (type == 2) {
529
            noScrollgridview.setVisibility(View.VISIBLE);
530
            layoutHint.setVisibility(View.GONE);
531
        } else if (type == -1) {
532
            layoutHint.setVisibility(View.VISIBLE);
533
            noScrollgridview.setVisibility(View.GONE);
534
        }
585 535
    }
586 536
537
587 538
    public void shite(String s) throws Exception {
588
        Map<String, String> par = new HashMap<String, String>();
589
        String file;
590
        long appTime1 = System.currentTimeMillis() / 1000;
591
        Log.i("appTime(long)---", appTime1 + "");
592
        long updatetime = appTime1 - MainMapActivity.cha - 1;
593
        Log.i("updatetime(long)---", updatetime + "");
594
        Log.i("cha---", MainMapActivity.cha + "");
595
        String token = String.valueOf(updatetime);
596
        Log.i("token---", token);
597
        for (int i = 0; i < Bimp.tempSelectBitmap.size(); i++) {
598
            try {
599
                bm = imageZoom(Bimp.tempSelectBitmap.get(i).getBitmap());
600
                file = bitmapToBase64(bm);
601
                par.put("file", file);
602
                Log.i("file--------" + (i + 1), file);
603
                par.put("filename", "androidapp.jpg");
604
            } catch (Exception e) {
605
                e.printStackTrace();
539
        ArrayList<String> fileList=new ArrayList<>();
540
541
        for (int i = 0; i < Bimp.tempSelectMedia.size(); i++) {
542
            LocalMedia media = Bimp.tempSelectMedia.get(i);
543
            String path = "";
544
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q)
545
                path = media.getAndroidQToPath();
546
            else {
547
                path = media.getPath();
548
            }
549
            bm = imageZoom(BitmapFactory.decodeFile(path));
550
            String file = bitmapToBase64(bm);
551
            Map<String, String> par = new HashMap<String, String>();
552
553
            par.put("file", file);
554
            par.put("filename", "androidapp" + i + ".jpg");
555
            String u = UploadUtil.post(MainApplication.url + "/zhannew/basic/web/index.php/fileupload/upload", par, null);
556
            JSONObject jsonObject = new JSONObject(u);
557
558
            String code = jsonObject.getString("code");
559
            if (code.equals("200")) {
560
                String fileUrl = jsonObject.getString("fileUrl");
561
                fileList.add(fileUrl);
562
            }else{
563
                Message msg = new Message();
564
                msg.what = IMG_ERROR;
565
                handler.sendMessage(msg);
566
                return;
606 567
            }
607
608
        }
609
        try {
610
            String u = UploadUtil.post(MainApplication.url + "/zhannew/basic/web/index.php/fileupload/upload",
611
                    par, null);
612
            System.err.println(u);
613
            // submit(u);
614
            Message msg = new Message();
615
            msg.obj = u;
616
            msg.what = 2;
617
            handler.sendMessage(msg);
618
        } catch (IOException e) {
619
            e.printStackTrace();
620 568
        }
569
570
        Message msg = new Message();
571
        msg.obj = mGson.toJson(fileList);
572
573
        msg.what = IMGRESLUT;
574
        handler.sendMessage(msg);
621 575
    }
622 576
623 577
    private void initData() {
@ -695,28 +649,6 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
695 649
                Log.e("select===", select_s);
696 650
697 651
698
                if (et_pinglun.getText().toString().equals("") && NewZhanDetailsActivity.replaceBlank(et_pinglun.getText().toString()).equals("")) {
699
                    if (!star_level.equals("") && !select_s.equals("")) {
700
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
701
                        tv_make_sure.setEnabled(true);
702
                    } else {
703
                        tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
704
                        tv_make_sure.setEnabled(false);
705
                    }
706
                } else {
707
                    if (et_pinglun.getText().toString().equals("#" + MainApplication.huodonglabel + "# ")) {
708
                        if (!star_level.equals("") && !select_s.equals("")) {
709
                            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
710
                            tv_make_sure.setEnabled(true);
711
                        } else {
712
                            tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
713
                            tv_make_sure.setEnabled(false);
714
                        }
715
                    } else {
716
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
717
                        tv_make_sure.setEnabled(true);
718
                    }
719
                }
720 652
                return true;
721 653
            }
722 654
        });
@ -731,20 +663,41 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
731 663
        }
732 664
    }
733 665
734
    private void addComments(String fileUrl, String thumUrl) throws Exception {
666
    private void addComments(ArrayList<String> fileUrlList, String thumUrl) throws Exception {
735 667
        long appTime1 = System.currentTimeMillis() / 1000;
736
        Log.i("appTime(long)---", appTime1 + "");
737 668
        long updatetime = appTime1 - MainMapActivity.cha - 2;
738
        Log.i("updatetime(long)---", updatetime + "");
739
        Log.i("cha---", MainMapActivity.cha + "");
669
        Log.e(TAG, "addComments: ");
740 670
        String token = String.valueOf(updatetime);
671
        String url = MainApplication.url + "/zhannew/basic/web/index.php/tpappcomments/add";
672
        Map<String,String> map=new HashMap<>();
673
        map.put("userid",MainApplication.userId);
674
        map.put("zhanid",zhan_id);
675
        map.put("order_id",order_id);
676
        map.put("comment",URLEncoder.encode(et_pinglun.getText().toString()));
677
        map.put("tel",MainApplication.userPhone);
678
        map.put("token",URLEncoder.encode(DES3.encode(token)));
679
        if (mTopicbean!=null){
680
            map.put("theme",mTopicbean.getMeg());
681
        }
682
        if (commentType == 1){
683
            if (fileUrlList.size()>0){
684
                for (int i = 0; i < fileUrlList.size(); i++) {
685
                    String value = fileUrlList.get(i);
686
                    if (i == 0){
687
                        map.put("fileUrl",value);
688
                    }else{
689
                        map.put("file"+(i+1)+"Url", value);
690
                    }
691
                }
692
                if (mInsterType == 1 && mInsterType == -1){
693
                    map.put("type", ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT + "");
694
                    map.put("thumUrl",fileUrlList.get(0));
695
                }else if (mInsterType == 2) {
696
                    map.put("type", ChatRecommendBean.TARGET_TYPE_VIDEO + "");
697
                }
698
            }
741 699
742
743
        String url = MainApplication.url +
744
                "/zhannew/basic/web/index.php/tpappcomments/add?userid=" +
745
                MainApplication.userId + "&zhanid=" + zhan_id + "&order_id=" + order_id +
746
                "&comment=" + URLEncoder.encode(et_pinglun.getText().toString()) +
747
                "&tel=" + MainApplication.userPhone + "&token=" + URLEncoder.encode(DES3.encode(token)) + "&fileUrl=" + fileUrl + "&thumUrl=" + thumUrl;
700
        }
748 701
749 702
        OkHttpUtils.get()
750 703
                .url(url)
@ -752,15 +705,17 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
752 705
                .execute(new StringCallback() {
753 706
                    @Override
754 707
                    public void onError(Call call, Exception e) {
755
708
                        dialog.cancel();
709
                        Toast.makeText(ChargingCommentActivity.this, "网络错误:"+e.getMessage(), Toast.LENGTH_SHORT).show();
756 710
                    }
757 711
758 712
                    @Override
759 713
                    public void onResponse(String response) {
714
                        dialog.cancel();
760 715
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
761 716
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
762 717
                        if (rtnCode.equals("01")) {
763
                            dialog.cancel();
718
764 719
                            final String data = JsonUtils.getKeyResult(response, "data");
765 720
                            String plusScore = JsonUtils.getKeyResult(response, "plusScore");
766 721
                            if (!plusScore.equals("")) {
@ -775,6 +730,8 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
775 730
                            }
776 731
777 732
                            submitPF(data);
733
                        }else{
734
                            Toast.makeText(ChargingCommentActivity.this, rtnMsg+"", Toast.LENGTH_SHORT).show();
778 735
                        }
779 736
780 737
                    }
@ -904,26 +861,37 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
904 861
            case R.id.tv_make_sure:
905 862
                if (MainApplication.isLogin()) {
906 863
                    try {
907
908
                        if (Bimp.tempSelectBitmap.size() > 0) {
864
                        if (Bimp.tempSelectMedia.size() > 0 && mInsterType == 1) {
909 865
                            dialog.show();
910
                            new Thread(new Runnable() {
911
                                @Override
912
                                public void run() {
913
                                    try {
914
                                        shite("");
915
                                    } catch (Exception e) {
916
                                        e.printStackTrace();
917
                                    }
866
                            new Thread(() -> {
867
                                try {
868
                                    shite("");
869
                                } catch (Exception e) {
870
                                    Message msg = new Message();
871
                                    msg.what = IMG_ERROR;
872
                                    handler.sendMessage(msg);
873
                                    e.printStackTrace();
918 874
                                }
919 875
                            }).start();
920 876
877
                        } else if (Bimp.tempSelectMedia.size() > 0 && mInsterType == 2) {
878
                            //进行视频验证
879
                            LocalMedia media = Bimp.tempSelectMedia.get(0);
880
                            String path = "";
881
                            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q)
882
                                path = media.getAndroidQToPath();
883
                            else {
884
                                path = media.getPath();
885
                            }
886
887
888
                            getYouPaiData(path);
921 889
                        } else {
922 890
                            if (containsEmoji(et_pinglun.getText().toString())) {
923 891
                                ToastUtil.showToast(MainApplication.context, "不支持输入表情", Toast.LENGTH_SHORT);
924 892
                            } else {
925 893
                                dialog.show();
926
                                addComments("", "");
894
                                addComments(new ArrayList<>(), "");
927 895
                            }
928 896
                        }
929 897
                    } catch (Exception e) {
@ -938,7 +906,187 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
938 906
            case R.id.iv_back:
939 907
                finish();
940 908
                break;
909
            case R.id.videoUpLoad:
910
                addVideo();
911
                break;
912
913
            case R.id.imgUpload:
914
                addImg();
915
                break;
916
        }
917
    }
918
    private void getYouPaiData(String filePath) {
919
        dialog.show();
920
921
//        String url = MainApplication.urlNew + "/get-sign-rest";
922
        String url = MainApplication.d1evTestUrl + "/api/topic/get-sign-rest2cdz";
923
        if (TextUtils.isEmpty(filePath)) {
924
            ToastUtil.showToast(getApplicationContext(), "请重新选择视频", Toast.LENGTH_SHORT);
925
            return;
926
        }
927
928
        String deviceId = JPushInterface.getUdid(MainApplication.context);
929
        String fileName = DateUtils.getSimpleCurrentDate();
930
        if (TextUtils.isEmpty(deviceId)) {
931
            fileName += "_" + Util.getRandom(15);
932
        } else {
933
            fileName += "_" + deviceId;
934
        }
935
936
        if (TextUtils.isEmpty(filePath)) {
937
            fileName = "";
938
        } else {
939
            String suffix = filePath.substring(filePath.lastIndexOf(".") + 1);
940
            fileName += "." + suffix;
941
        }
942
943
944
        Map<String, String> map = new HashMap<>();
945
        map.put("fileName", fileName);
946
        try {
947
            FileInputStream fileInputStream = new FileInputStream(new File(filePath));
948
            map.put("contentLength", String.valueOf(fileInputStream.available()));
949
        } catch (Exception e) {
950
            e.printStackTrace();
951
        }
952
        map.put("targetType", ChatRecommendBean.TARGET_TYPE_VIDEO + "");
953
        CommonParams.addCommonParams(map);
954
955
        String finalFileName = fileName;
956
        OkHttpUtils.get()
957
                .params(map)
958
                .url(url)
959
                .build()
960
                .connTimeOut(6000)
961
                .readTimeOut(6000)
962
                .execute(new StringCallback() {
963
                    @Override
964
                    public void onError(Call call, Exception e) {
965
                        ToastUtil.showToast(getApplicationContext(), "发布失败,请重试", Toast.LENGTH_SHORT);
966
                        dialog.dismiss();
967
                    }
968
969
                    @Override
970
                    public void onResponse(String response) {
971
                        Log.e("hyc--", response);
972
                        String code = JsonUtils.getKeyResult(response, "code");
973
                        String desc = JsonUtils.getKeyResult(response, "desc");
974
                        if ("1000".equals(code)) {
975
                            String data = JsonUtils.getKeyResult(response, "data");
976
                            AuthSignBean signBeans = (AuthSignBean) JsonUtils.parseToObjectBean(data, AuthSignBean.class);
977
                            if (null != signBeans) {
978
                                String sign = signBeans.sign;
979
                                String policy = signBeans.policy;
980
                                formUpload(filePath, sign, policy, finalFileName);
981
                            } else {
982
                                ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
983
                            }
984
                        } else {
985
                            ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
986
                            dialog.dismiss();
987
                        }
988
                    }
989
                });
990
991
    }
992
993
    /**
994
     * 表单上传
995
     *
996
     * @param SAMPLE_PIC_FILE
997
     * @param sign
998
     * @param policyServer
999
     */
1000
    private void formUpload(String SAMPLE_PIC_FILE, String sign, String policyServer, String fileName) {
1001
1002
        SerialUploader serialUploader = new SerialUploader();
1003
1004
        serialUploader.setCheckMD5(false);
1005
1006
        File temp = new File(SAMPLE_PIC_FILE);
1007
1008
        serialUploader.setOnProgressListener((bytesWrite, contentLength) -> {
1009
1010
        });
1011
        String decoder = new String(Base64.decode((policyServer), Base64.DEFAULT));
1012
1013
        JSONObject jsonObject = null;
1014
        try {
1015
            jsonObject = new JSONObject(decoder);
1016
        } catch (JSONException e) {
1017
            e.printStackTrace();
941 1018
        }
1019
        String uri = jsonObject.optString("URI");
1020
        String date = jsonObject.optString("Date");
1021
        String operator = jsonObject.optString("Operator");
1022
        String saveKey = jsonObject.optString("save-key");
1023
1024
        serialUploader.upload(
1025
                temp, uri, date, "UPYUN " + operator + ":" + sign, null, new UpCompleteListener() {
1026
                    @Override
1027
                    public void onComplete(boolean isSuccess, String result) {
1028
                        if (isSuccess) {
1029
                            try {
1030
                                ArrayList<String> list = new ArrayList<>();
1031
                                list.add(saveKey);
1032
                                addComments(list, saveKey);
1033
                            } catch (Exception e) {
1034
                                e.printStackTrace();
1035
                            }
1036
                        } else {
1037
                            ToastUtil.showToast(getApplicationContext(), "发布失败,请重试", Toast.LENGTH_SHORT);
1038
                            dialog.dismiss();
1039
                        }
1040
1041
                    }
1042
                });
1043
    }
1044
    private void addImg() {
1045
        PictureSelector.create(this)
1046
                .openGallery(PictureMimeType.ofImage())
1047
                .maxSelectNum(PIC_NUM)
1048
                .selectionMode(PictureConfig.MULTIPLE)
1049
                .selectionData(Bimp.tempSelectMedia)//是否传入已选图片
1050
                .isCompress(true)//是否压缩
1051
                .isPreviewEggs(true)//预览图片时是否增强左右滑动图片体验
1052
                .isGif(true)//是否显示gif
1053
                .isAndroidQTransform(true)
1054
                .imageEngine(GlideEngine.createGlideEngine())
1055
                .isWeChatStyle(false)// 是否开启微信图片选择风格
1056
                .isUseCustomCamera(false)// 是否使用自定义相机
1057
                .isPageStrategy(true)// 是否开启分页策略 & 每页多少条;默认开启
1058
                .setPictureStyle(Util.getWhiteStyle(this))// 动态自定义相册主题
1059
                .setRecyclerAnimationMode(AnimationType.SLIDE_IN_BOTTOM_ANIMATION)// 列表动画效果
1060
                .isMaxSelectEnabledMask(true)// 选择数到了最大阀值列表是否启用蒙层效果
1061
                .imageSpanCount(4)// 每行显示个数
1062
                .isReturnEmpty(false)// 未选择数据时点击按钮是否可以返回
1063
                .isAutomaticTitleRecyclerTop(true)//图片列表超过一屏连续点击顶部标题栏快速回滚至顶部
1064
                .forResult(REQUEST_CODE_CHOOSE);
1065
    }
1066
    private void addVideo() {
1067
        PictureSelector.create(this)
1068
                .openGallery(PictureMimeType.ofVideo())
1069
                .selectionMode(PictureConfig.SINGLE)
1070
                .isCompress(true)//是否压缩
1071
                .isPreviewEggs(true)//预览图片时是否增强左右滑动图片体验
1072
                .isAndroidQTransform(true)
1073
                .imageEngine(GlideEngine.createGlideEngine())
1074
                .isWeChatStyle(false)// 是否开启微信图片选择风格
1075
                .isUseCustomCamera(false)// 是否使用自定义相机
1076
                .isPageStrategy(true)// 是否开启分页策略 & 每页多少条;默认开启
1077
                .setPictureStyle(Util.getWhiteStyle(this))// 动态自定义相册主题
1078
                .setRecyclerAnimationMode(AnimationType.SLIDE_IN_BOTTOM_ANIMATION)// 列表动画效果
1079
                .isMaxSelectEnabledMask(true)// 选择数到了最大阀值列表是否启用蒙层效果
1080
                .imageSpanCount(4)// 每行显示个数
1081
                .isReturnEmpty(false)// 未选择数据时点击按钮是否可以返回
1082
                .isAutomaticTitleRecyclerTop(true)//图片列表超过一屏连续点击顶部标题栏快速回滚至顶部
1083
                .videoMaxSecond(16)   // 查询多少秒以内的视频
1084
                .videoMinSecond(2)   // 查询多少秒以内的视频
1085
                .recordVideoSecond(15)//录制视频秒数 默认60s
1086
                .isPreviewVideo(true)//是否预览视频
1087
                .isSingleDirectReturn(true)//PictureConfig.SINGLE模式下是否直接返回
1088
                .filterMaxFileSize( 100 * 1024 )//查询指定大小内的图片、视频、音频大小,单位 KB
1089
                .forResult(REQUEST_VIDEO_CODE_CHOOSE);
942 1090
    }
943 1091
944 1092
    public boolean isEmoji(String string) {
@ -976,7 +1124,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
976 1124
    @AfterPermissionGranted(RC_ALBUM_PERM)
977 1125
    public void permissionTask() {
978 1126
        if (isPermissionOK()) {
979
            callGallery();
1127
            addImg();
980 1128
            // Have permission, do the thing!
981 1129
//            Toast.makeText(this, "TODO: Camera things", Toast.LENGTH_LONG).show();
982 1130
//            ifTimeout();
@ -1011,136 +1159,21 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1011 1159
        }
1012 1160
    }
1013 1161
1014
    private File getFile(String path) {
1015
        File f = new File(path);
1016
        if (!f.exists()) {
1017
            try {
1018
                f.createNewFile();
1019
            } catch (IOException e) {
1020
                e.printStackTrace();
1021
            }
1022
        }
1023
        return f;
1024
    }
1025
1026
    private static String getPath(String path) {
1027
        File f = new File(path);
1028
        if (!f.exists()) {
1029
            f.mkdirs();
1030
        }
1031
        return f.getAbsolutePath();
1032
    }
1033
1034
    public class GridAdapter extends BaseAdapter {
1035
        private LayoutInflater inflater;
1036
        private int selectedPosition = -1;
1037
        private boolean shape;
1038
1039
        public boolean isShape() {
1040
            return shape;
1041
        }
1042
1043
        public void setShape(boolean shape) {
1044
            this.shape = shape;
1045
        }
1046
1047
        public GridAdapter(Context context) {
1048
            inflater = LayoutInflater.from(context);
1049
        }
1050
1051
        public void update() {
1052
            loading();
1053
        }
1054
1055
        public int getCount() {
1056
            if (Bimp.tempSelectBitmap.size() == 1) {
1057
                return 1;
1058
            }
1059
            return (Bimp.tempSelectBitmap.size() + 1);
1060
        }
1061
1062
        public Object getItem(int arg0) {
1063
            return null;
1064
        }
1065
1066
        public long getItemId(int arg0) {
1067
            return 0;
1068
        }
1069
1070
        public void setSelectedPosition(int position) {
1071
            selectedPosition = position;
1072
        }
1073
1074
        public int getSelectedPosition() {
1075
            return selectedPosition;
1076
        }
1077
1078
        public View getView(int position, View convertView, ViewGroup parent) {
1079
            GridAdapter.ViewHolder holder = null;
1080
            if (convertView == null) {
1081
                convertView = inflater.inflate(R.layout.item_published_grida,
1082
                        parent, false);
1083
                holder = new GridAdapter.ViewHolder();
1084
                holder.image = (ImageView) convertView
1085
                        .findViewById(R.id.item_grida_image);
1086
                convertView.setTag(holder);
1087
            } else {
1088
                holder = (GridAdapter.ViewHolder) convertView.getTag();
1089
            }
1090
1091
            if (position == Bimp.tempSelectBitmap.size()) {
1092
                holder.image.setImageBitmap(BitmapFactory.decodeResource(
1093
                        getResources(), R.drawable.icon_comment_upload));
1094
                if (position == 1) {
1095
                    holder.image.setVisibility(View.GONE);
1096
                }
1097
            } else {
1098
                holder.image.setImageBitmap(Bimp.tempSelectBitmap.get(position).getBitmap());
1099
            }
1100 1162
1101
            return convertView;
1102
        }
1103
1104
        public class ViewHolder {
1105
            public ImageView image;
1106
        }
1107
1108
        Handler handler = new Handler() {
1109
            public void handleMessage(Message msg) {
1110
                switch (msg.what) {
1111
                    case 1:
1112
                        adapter.notifyDataSetChanged();
1113
                        break;
1114
                }
1115
                super.handleMessage(msg);
1116
            }
1117
        };
1118
1119
        public void loading() {
1120
            new Thread(new Runnable() {
1121
                public void run() {
1122
                    while (true) {
1123
                        if (Bimp.max == Bimp.tempSelectBitmap.size()) {
1124
                            Message message = new Message();
1125
                            message.what = 1;
1126
                            handler.sendMessage(message);
1127
                            break;
1128
                        } else {
1129
                            Bimp.max += 1;
1130
                            Message message = new Message();
1131
                            message.what = 1;
1132
                            handler.sendMessage(message);
1133
                        }
1134
                    }
1135
                }
1136
            }).start();
1163
    @Override
1164
    protected void onResume() {
1165
        super.onResume();
1166
        mAdapter.notifyDataSetChanged();
1167
        if (mInsterType == 1 && mAdapter.getItemCount() == 1) {
1168
            setLayoutHintVisible(-1);
1169
            mInsterType = -1;
1170
        } else if (mInsterType == 2 && mAdapter.getItemCount() == 0) {
1171
            setLayoutHintVisible(-1);
1172
            mInsterType = -1;
1137 1173
        }
1138 1174
    }
1139 1175
1140
1141
1142 1176
    protected void onRestart() {
1143
        adapter.update();
1144 1177
        super.onRestart();
1145 1178
    }
1146 1179
@ -1149,6 +1182,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1149 1182
        super.onDestroy();
1150 1183
        Bimp.tempSelectBitmap.clear();
1151 1184
        Bimp.max = 0;
1185
        Bimp.tempSelectMedia.clear();
1152 1186
    }
1153 1187
1154 1188
    private String bitmapToBase64(Bitmap bitmap) {
@ -1345,5 +1379,33 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1345 1379
        });
1346 1380
    }
1347 1381
1382
    @Override
1383
    public void add() {
1384
        if (mInsterType == 1) {
1385
            addImg();
1386
        } else if (mInsterType == 2) {
1387
            addVideo();
1388
        }
1389
    }
1390
1391
    @Override
1392
    public void remove(int position) {
1393
        if (mAdapter.getItemCount() == 1) {
1394
            setLayoutHintVisible(-1);
1395
            mInsterType = -1;
1396
        }
1348 1397
1398
    }
1399
1400
    @Override
1401
    public void open(int position, LocalMedia mLocalMedia) {
1402
        if (mInsterType == 1) {
1403
            ImageDisplayActivity.actionStart(this, position);
1404
        } else if (mInsterType == 2) {
1405
            PictureSelector.create(ChargingCommentActivity.this)
1406
                    .themeStyle(R.style.picture_default_style)
1407
                    .setPictureStyle(Util.getWhiteStyle(ChargingCommentActivity.this))// 动态自定义相册主题
1408
                    .externalPictureVideo(TextUtils.isEmpty(mLocalMedia.getAndroidQToPath()) ? mLocalMedia.getPath() : mLocalMedia.getAndroidQToPath());
1409
        }
1410
    }
1349 1411
}

+ 6 - 2
app/src/main/java/com/electric/chargingpile/activity/SelectTopicActivity.java

@ -5,6 +5,7 @@ import android.content.Intent;
5 5
import android.os.Bundle;
6 6
import android.util.Log;
7 7
import android.view.View;
8
import android.widget.ImageView;
8 9
import android.widget.TextView;
9 10
import android.widget.Toast;
10 11
@ -34,6 +35,7 @@ public class SelectTopicActivity  extends AppCompatActivity {
34 35
35 36
    private RecyclerView mRecyclerView;
36 37
    private TextView noDataText;
38
    private ImageView imgNoData;
37 39
    private CommentTopicAdapter mAdapter;
38 40
    private LoadingDialog dialog = null;
39 41
    private final Gson mGson =new Gson();
@ -58,6 +60,7 @@ public class SelectTopicActivity  extends AppCompatActivity {
58 60
59 61
        mRecyclerView = findViewById(R.id.topicRecycelrView);
60 62
        noDataText = findViewById(R.id.noDataText);
63
        imgNoData = findViewById(R.id.imgNoData);
61 64
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
62 65
        mAdapter = new CommentTopicAdapter();
63 66
        mAdapter.setListener(pos -> {
@ -69,8 +72,6 @@ public class SelectTopicActivity  extends AppCompatActivity {
69 72
            finish();
70 73
        });
71 74
        mRecyclerView.setAdapter(mAdapter);
72
73
        noDataText.setVisibility(View.GONE);
74 75
        mRecyclerView.setVisibility(View.VISIBLE);
75 76
    }
76 77
@ -99,13 +100,16 @@ public class SelectTopicActivity  extends AppCompatActivity {
99 100
                        String data = JsonUtils.getKeyResult(response, "data");
100 101
                        ArrayList<TopicBean> list = mGson.fromJson(data, new TypeToken<ArrayList<TopicBean>>() {
101 102
                        }.getType());
103
                        list.clear();
102 104
                        if (list != null && list.size()>0){
103 105
                            mAdapter.setDatas(list);
104 106
                            mRecyclerView.setVisibility(View.VISIBLE);
105 107
                            noDataText.setVisibility(View.GONE);
108
                            imgNoData.setVisibility(View.GONE);
106 109
                        }else{
107 110
                            mRecyclerView.setVisibility(View.GONE);
108 111
                            noDataText.setVisibility(View.VISIBLE);
112
                            imgNoData.setVisibility(View.VISIBLE);
109 113
                        }
110 114
                    }
111 115
                }

+ 33 - 78
app/src/main/java/com/electric/chargingpile/activity/ZhanCommentActivity.java

@ -112,7 +112,10 @@ import pub.devrel.easypermissions.AfterPermissionGranted;
112 112
import pub.devrel.easypermissions.EasyPermissions;
113 113
114 114
import static android.text.Html.FROM_HTML_MODE_LEGACY;
115
115
/**
116
 * 如果更改此页面,则需要同步更改 ChargingCommentActivity,
117
 * ChargingCommentActivity 该页面为从我的->充电记录->去评论
118
 * */
116 119
public class ZhanCommentActivity extends AppCompatActivity implements View.OnClickListener, EasyPermissions.PermissionCallbacks, GridImageAdapter.GridImgListener {
117 120
    private static final String TAG = "ZhanCommentActivity";
118 121
    private static final int PIC_NUM = 3;
@ -475,38 +478,34 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
475 478
476 479
        String thumUrl="";
477 480
        for (int i = 0; i < Bimp.tempSelectMedia.size(); i++) {
478
            try {
479
                LocalMedia media = Bimp.tempSelectMedia.get(i);
480
                String path = "";
481
                if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q)
482
                    path = media.getAndroidQToPath();
483
                else {
484
                    path = media.getPath();
485
                }
486
                bm = imageZoom(BitmapFactory.decodeFile(path));
487
                String file = bitmapToBase64(bm);
488
                Map<String, String> par = new HashMap<String, String>();
489
490
                par.put("file", file);
491
                par.put("filename", "androidapp" + i + ".jpg");
492
                String u = UploadUtil.post(MainApplication.url + "/zhannew/basic/web/index.php/fileupload/upload",
493
                        par, null);
494
                JSONObject jsonObject = new JSONObject(u);
495
496
                String code = jsonObject.getString("code");
497
                if (code.equals("200")) {
498
                    String fileUrl = jsonObject.getString("fileUrl");
499
                    fileList.add(fileUrl);
500
                }else{
501
                    Message msg = new Message();
502
                    msg.what = IMG_ERROR;
503
                    handler.sendMessage(msg);
504
                    return;
505
                }
506 481
507
            } catch (Exception e) {
508
                e.printStackTrace();
482
            LocalMedia media = Bimp.tempSelectMedia.get(i);
483
            String path = "";
484
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q)
485
                path = media.getAndroidQToPath();
486
            else {
487
                path = media.getPath();
488
            }
489
            bm = imageZoom(BitmapFactory.decodeFile(path));
490
            String file = bitmapToBase64(bm);
491
            Map<String, String> par = new HashMap<String, String>();
492
493
            par.put("file", file);
494
            par.put("filename", "androidapp" + i + ".jpg");
495
            String u = UploadUtil.post(MainApplication.url + "/zhannew/basic/web/index.php/fileupload/upload", par, null);
496
            JSONObject jsonObject = new JSONObject(u);
497
498
            String code = jsonObject.getString("code");
499
            if (code.equals("200")) {
500
                String fileUrl = jsonObject.getString("fileUrl");
501
                fileList.add(fileUrl);
502
            }else{
503
                Message msg = new Message();
504
                msg.what = IMG_ERROR;
505
                handler.sendMessage(msg);
506
                return;
509 507
            }
508
510 509
        }
511 510
512 511
        Message msg = new Message();
@ -768,6 +767,9 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
768 767
                                try {
769 768
                                    shite("");
770 769
                                } catch (Exception e) {
770
                                    Message msg = new Message();
771
                                    msg.what = IMG_ERROR;
772
                                    handler.sendMessage(msg);
771 773
                                    e.printStackTrace();
772 774
                                }
773 775
                            }).start();
@ -1222,51 +1224,4 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
1222 1224
                ((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) || ((codePoint >= 0x10000)
1223 1225
                && (codePoint <= 0x10FFFF));
1224 1226
    }
1225
1226
    /**
1227
     * 将json 数组转换为Map 对象
1228
     *
1229
     * @param jsonString
1230
     * @return
1231
     */
1232
1233
    public static Map<String, Object> getMap(String jsonString) {
1234
        JSONObject jsonObject;
1235
        Map<String, Object> valueMap = new HashMap<String, Object>();
1236
        if (TextUtils.isEmpty(jsonString)) {
1237
            return valueMap;
1238
        }
1239
        try {
1240
            jsonObject = new JSONObject(jsonString);
1241
            @SuppressWarnings("unchecked")
1242
            Iterator<String> keyIter = jsonObject.keys();
1243
            String key;
1244
            Object value;
1245
1246
            while (keyIter.hasNext()) {
1247
                key = (String) keyIter.next();
1248
                value = jsonObject.get(key);
1249
                valueMap.put(key, value);
1250
            }
1251
            return valueMap;
1252
        } catch (JSONException e) {
1253
            e.printStackTrace();
1254
        }
1255
1256
        return valueMap;
1257
1258
    }
1259
    public String getFileExtension(String path) {
1260
        String extension = "";
1261
        File file = new File(path);
1262
        try {
1263
            if (file != null && file.exists()) {
1264
                String name = file.getName();
1265
                extension = name.substring(name.lastIndexOf("."));
1266
            }
1267
        } catch (Exception e) {
1268
            extension = "";
1269
        }
1270
        return extension;
1271
    }
1272 1227
}

+ 1 - 1
app/src/main/java/com/electric/chargingpile/adapter/GridImageAdapter.java

@ -107,7 +107,7 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
107 107
            holder.remove.setOnClickListener(v->{
108 108
                //删除
109 109
                mDatas.remove(position);
110
                notifyItemRemoved(position);
110
                notifyDataSetChanged();
111 111
                if (mListener!=null){
112 112
                    mListener.remove(position);
113 113
                }

BIN
app/src/main/res/drawable-xxhdpi/ic_topic_no_data.webp


+ 61 - 14
app/src/main/res/layout/activity_charging_comment.xml

@ -66,8 +66,9 @@
66 66
67 67
    <com.electric.chargingpile.view.ObservableScrollView
68 68
        android:id="@+id/sv"
69
        android:background="@color/white"
69 70
        android:layout_width="match_parent"
70
        android:layout_height="wrap_content"
71
        android:layout_height="match_parent"
71 72
        android:layout_below="@+id/view_title"
72 73
        android:layout_alignParentLeft="true"
73 74
        android:layout_alignParentStart="true">
@ -75,11 +76,11 @@
75 76
        <com.zhy.autolayout.AutoLinearLayout
76 77
            android:id="@+id/ll_pingfen"
77 78
            android:layout_width="match_parent"
78
            android:layout_height="wrap_content"
79
            android:layout_height="match_parent"
79 80
            android:focusable="true"
80 81
            android:focusableInTouchMode="true"
81 82
            android:orientation="vertical"
82
            android:background="@color/white"
83
83 84
            android:layout_alignParentLeft="true"
84 85
            android:layout_alignParentStart="true">
85 86
@ -190,25 +191,71 @@
190 191
                android:visibility="visible"
191 192
                android:layout_marginBottom="7dp"/>
192 193
193
            <GridView
194
            <TextView
195
                android:paddingEnd="11dp"
196
                android:paddingStart="11dp"
197
                android:paddingBottom="6dp"
198
                android:paddingTop="6dp"
199
                android:layout_marginBottom="13dp"
200
                android:id="@+id/topicText"
201
                android:background="@drawable/bg_topic_tab"
202
                android:layout_width="wrap_content"
203
                android:layout_height="wrap_content"
204
                android:layout_marginStart="15dp"
205
                android:gravity="center"
206
                android:text="╋  话题"
207
                android:textColor="#ff0e0e0e"
208
                android:textSize="13sp" />
209
            <LinearLayout
210
                android:id="@+id/layoutHint"
211
                android:layout_marginEnd="15dp"
212
                android:layout_marginStart="15dp"
213
                android:layout_width="wrap_content"
214
                android:layout_height="wrap_content">
215
216
                <ImageView
217
                    android:id="@+id/imgUpload"
218
                    android:src="@drawable/icon_comment_upload"
219
                    android:layout_width="wrap_content"
220
                    android:layout_height="wrap_content"/>
221
222
                <ImageView
223
                    android:id="@+id/videoUpLoad"
224
                    android:layout_marginStart="12dp"
225
                    android:src="@drawable/ic_comment_video_upload"
226
                    android:layout_width="wrap_content"
227
                    android:layout_height="wrap_content"/>
228
229
                <TextView
230
                    android:id="@+id/commentHint"
231
                    android:layout_marginStart="12dp"
232
                    android:gravity="bottom"
233
                    android:layout_width="wrap_content"
234
                    android:layout_height="match_parent"
235
                    tools:text="30字以上+图片或15s视频有机会被评为优质评论获得充电优惠券"
236
                    android:textColor="#ff7a7a7a"
237
                    android:textSize="12sp"
238
                    />
239
            </LinearLayout>
240
241
            <androidx.recyclerview.widget.RecyclerView
242
                android:visibility="gone"
194 243
                android:id="@+id/noScrollgridview"
195 244
                android:layout_width="match_parent"
196 245
                android:layout_height="wrap_content"
197 246
                android:layout_marginLeft="15dp"
198 247
                android:layout_marginRight="15dp"
199
                android:horizontalSpacing="3dp"
200
                android:numColumns="3"
201 248
                android:scrollbars="none"
202
                android:verticalSpacing="5dp" >
203
            </GridView>
204
205
            <View
206
                android:layout_width="match_parent"
207
                android:layout_height="0.5dp"
208
                android:background="@color/Line"
209
                android:layout_marginTop="15dp"
210 249
                />
211 250
251
            <ImageView
252
                android:visibility="gone"
253
                android:id="@+id/imgAd"
254
                android:layout_marginTop="30dp"
255
                android:layout_gravity="center"
256
                android:layout_width="wrap_content"
257
                android:layout_height="wrap_content"/>
258
212 259
        </com.zhy.autolayout.AutoLinearLayout>
213 260
214 261
    </com.electric.chargingpile.view.ObservableScrollView>

+ 2 - 1
app/src/main/res/layout/activity_main_map.xml

@ -1532,6 +1532,7 @@
1532 1532
            android:visibility="gone">
1533 1533
1534 1534
            <TextView
1535
                android:layout_centerInParent="true"
1535 1536
                android:paddingStart="20dp"
1536 1537
                android:id="@+id/tvNotification"
1537 1538
                android:paddingEnd="25dp"
@ -1540,7 +1541,7 @@
1540 1541
                android:layout_width="wrap_content"
1541 1542
                android:layout_height="34dp"
1542 1543
                android:gravity="center"
1543
                android:text="您有一笔订单正在进行中您有一笔订单正在进行中,点击查看详情..."
1544
                tools:text="您有一笔订,点击查看详情..."
1544 1545
                android:textColor="@color/huimain"
1545 1546
                android:textSize="13sp" />
1546 1547

+ 17 - 6
app/src/main/res/layout/activity_slelect_topic.xml

@ -51,17 +51,28 @@
51 51
        app:layout_constraintStart_toStartOf="parent"
52 52
        app:layout_constraintTop_toBottomOf="@+id/rl_title"
53 53
        tools:listitem="@layout/layout_item_topic" />
54
54
    <ImageView
55
        tools:visibility="visible"
56
        android:visibility="gone"
57
        android:id="@+id/imgNoData"
58
        android:src="@drawable/ic_topic_no_data"
59
        android:layout_width="wrap_content"
60
        android:layout_height="wrap_content"
61
        app:layout_constraintBottom_toBottomOf="parent"
62
        app:layout_constraintEnd_toEndOf="parent"
63
        app:layout_constraintStart_toStartOf="parent"
64
        app:layout_constraintTop_toBottomOf="@+id/rl_title" />
55 65
    <TextView
56
        android:visibility="visible"
66
        tools:visibility="visible"
67
        android:layout_marginTop="20dp"
68
        android:visibility="gone"
57 69
        android:id="@+id/noDataText"
58 70
        android:layout_width="wrap_content"
59 71
        android:layout_height="wrap_content"
60 72
        android:text="没有相关话题"
61 73
        android:textColor="#ff7b7b7b"
62 74
        android:textSize="14sp"
63
        app:layout_constraintBottom_toBottomOf="parent"
64
        app:layout_constraintEnd_toEndOf="parent"
65
        app:layout_constraintStart_toStartOf="parent"
66
        app:layout_constraintTop_toBottomOf="@+id/rl_title" />
75
        android:layout_marginEnd="12dp"
76
        app:layout_constraintEnd_toEndOf="@+id/imgNoData"
77
        app:layout_constraintTop_toBottomOf="@+id/imgNoData" />
67 78
</androidx.constraintlayout.widget.ConstraintLayout>

优质评价添加完成 · 9ad1e8d95a - Gogs: Go Git Service
Ver Código Fonte

优质评价添加完成

huyuguo 5 anos atrás
pai
commit
9ad1e8d95a

+ 10 - 32
app/src/main/java/com/electric/chargingpile/adapter/ZhanCommentsAapter.java

@ -118,13 +118,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
118 118
119 119
        if (holder == null) {
120 120
            holder = new ViewHolder();
121
122
//            holder.tv_sname = (TextView) convertView
123
//                    .findViewById(R.id.tv);
124
//            holder.tv_stime = (TextView) convertView
125
//                    .findViewById(R.id.tv_time);
126
//            holder.tv_scontext = (TextView) convertView
127
//                    .findViewById(R.id.tv_comment);
128 121
            holder.tv_pname = (TextView) convertView.findViewById(R.id.tv_pname);
129 122
            holder.tv_pdelete = (TextView) convertView.findViewById(R.id.tv_pdelete);
130 123
            holder.tv_ptime = (TextView) convertView.findViewById(R.id.tv_ptime);
@ -136,14 +129,13 @@ public class ZhanCommentsAapter extends BaseAdapter {
136 129
            holder.lv_scomment = (ListView) convertView.findViewById(R.id.lv_scomment);
137 130
138 131
            holder.iv_picon = (ImageView) convertView.findViewById(R.id.iv_picon);
139
            holder.certified_icon = (ImageView)convertView.findViewById(R.id.certified_icon);
132
            holder.certified_icon = (ImageView) convertView.findViewById(R.id.certified_icon);
133
            holder.high_grade_comment_icon = (ImageView) convertView.findViewById(R.id.high_grade_comment_icon);
140 134
            holder.iv_pgrade = (ImageView) convertView.findViewById(R.id.iv_pgrade);
141 135
            holder.iv_commentPic = (ImageView) convertView.findViewById(R.id.iv_commentPic);
142 136
            holder.iv_level_img = (ImageView) convertView.findViewById(R.id.iv_level_img);
143 137
            holder.iv_pzan = (ImageView) convertView.findViewById(R.id.iv_pzan);
144
//            holder.ll_pinglunn = (LinearLayout) convertView.findViewById(R.id.ll_pinglunn);
145 138
            holder.ll_pzan = (LinearLayout) convertView.findViewById(R.id.ll_pzan);
146
//            holder.iv_havemessage = (ImageView) convertView.findViewById(R.id.iv_havemessage);
147 139
            holder.fl_ptag = (TagFlowLayout) convertView.findViewById(R.id.fl_ptag);
148 140
            holder.parent = (RelativeLayout) convertView.findViewById(R.id.parent);
149 141
@ -172,7 +164,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
172 164
                        holder.iv_level_img.setVisibility(View.GONE);
173 165
                    } else if (title.equals("V0")) {
174 166
                        holder.iv_level_img.setVisibility(View.GONE);
175
//                    holder.iv_level_img.setImageResource(R.drawable.icon_level_putong);
176 167
                    } else if (title.equals("V1")) {
177 168
                        holder.iv_level_img.setVisibility(View.VISIBLE);
178 169
                        holder.iv_level_img.setImageResource(R.drawable.icon_qingtong);
@ -210,13 +201,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
210 201
                //父级头像
211 202
                holder.iv_picon.setImageResource(R.drawable.icon_face2_0);
212 203
                final String pic_url = MainApplication.url + "/zhannew/uploadfile/" + datas.get(position).getString("userpic");
213
//                PicassoUtil.loadingNetImage(mContext,pic_url,holder.iv_picon);
214
//                Glide.with(MainApplication.context)
215
//                        .load(pic_url)
216
//                        .error(R.drawable.icon_face2_0)
217
//                        .placeholder(R.drawable.icon_face2_0)
218
//                        .into(holder.iv_picon);
219
220 204
                Picasso.with(MainApplication.context)
221 205
                        .load(pic_url)
222 206
                        .error(R.drawable.icon_face2_0)
@ -240,20 +224,24 @@ public class ZhanCommentsAapter extends BaseAdapter {
240 224
                String chexing = datas.get(position).getString("hascar");
241 225
                int isCertifiedOwner = datas.get(position).getInt("is_certified_owner");
242 226
                holder.tv_pcar.setText(CarTypeUtil.getCarType(chexing));
243
//                holder.tv_pcar.setText(carSeries);
244 227
                if (isCertifiedOwner == 1) {
245 228
                    holder.certified_icon.setVisibility(View.VISIBLE);
246 229
                } else {
247 230
                    holder.certified_icon.setVisibility(View.GONE);
248 231
                }
249 232
233
                String fine = datas.get(position).getString("fine");
234
                if ("1".equals(fine)) {
235
                    holder.high_grade_comment_icon.setVisibility(View.VISIBLE);
236
                } else {
237
                    holder.high_grade_comment_icon.setVisibility(View.GONE);
238
                }
239
250 240
                //父级回复
251 241
                holder.tv_preply.setOnClickListener(new View.OnClickListener() {
252 242
                    @Override
253 243
                    public void onClick(View v) {
254 244
                        MobclickAgent.onEvent(mContext, "0204", new HashMap<String, String>().put("type", "回复"));
255
//                        Toast.makeText(mContext,"!!!",Toast.LENGTH_SHORT).show();
256
//                        ZhanCommentFragment.lv_comment.smoothScrollToPosition(position);
257 245
                        NewZhanDetailsActivity.commentType = 2;
258 246
                        NewZhanDetailsActivity.et_comment.setFocusable(true);
259 247
                        NewZhanDetailsActivity.et_comment.setFocusableInTouchMode(true);
@ -282,14 +270,12 @@ public class ZhanCommentsAapter extends BaseAdapter {
282 270
                if (datas.get(position).getJSONArray("subcomments").length() == 0) {
283 271
                    holder.lv_scomment.setVisibility(View.GONE);
284 272
                    holder.tv_more.setVisibility(View.GONE);
285
//                    Log.i("childs_gone",datas.get(position).getJSONArray("subcomments").length()+"");
286 273
                } else {
287 274
                    holder.lv_scomment.setVisibility(View.VISIBLE);
288 275
                    if (Integer.parseInt(num) > 3) {
289 276
                        holder.tv_more.setVisibility(View.VISIBLE);
290 277
                        holder.tv_more.setText("共" + num + "条回复>");
291 278
                    }
292
//                    Log.i("childs_visible",datas.get(position).getJSONArray("subcomments").toString());
293 279
                    ArrayList<JSONObject> data = new ArrayList<JSONObject>();
294 280
                    JSONArray jsonArray = new JSONArray(datas.get(position).getJSONArray("subcomments").toString());
295 281
                    for (int j = 0; j < jsonArray.length(); j++) {
@ -297,8 +283,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
297 283
                                .opt(j);
298 284
                        data.add(jsonObject4);
299 285
                    }
300
//                    Log.d("comments_size==!",data.size()+"");
301
302 286
                    holder.lv_scomment.setAdapter(new ZhanSCommentsAdapter(data, mActivity, mContext, "1", String.valueOf(position)));
303 287
                }
304 288
                //父级评论标签
@ -388,7 +372,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
388 372
                            } catch (Exception e) {
389 373
                                e.printStackTrace();
390 374
                            }
391
//                            Log.e("zan_url",url);
392 375
                            OkHttpUtils.get()
393 376
                                    .url(url)
394 377
                                    .build()
@ -441,7 +424,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
441 424
                    final String url = MainApplication.url + "/zhannew/uploadfile/" + datas.get(position).getString("thumUrl");
442 425
                    final String file_url = MainApplication.url + "/zhannew/uploadfile/" + datas.get(position).getString("fileUrl");
443 426
                    final String[] s = {file_url};
444
//                    PicassoUtil.loadingNetImage(mContext,url,holder.iv_commentPic);
445 427
                    Picasso.with(MainApplication.context)
446 428
                            .load(url)
447 429
                            .into(holder.iv_commentPic);
@ -462,7 +444,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
462 444
                //设置删除
463 445
                String userid = datas.get(position).getString("userid");
464 446
                final String id = datas.get(position).getString("id");
465
//                Log.e("eeee", userid );
466 447
                holder.tv_pdelete.setVisibility(View.GONE);
467 448
                if (!MainApplication.isLogin()) {
468 449
                    holder.tv_pdelete.setVisibility(View.GONE);
@ -490,7 +471,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
490 471
491 472
                                                    @Override
492 473
                                                    public void onResponse(String response) {
493
//                                                        Log.e("eeee", response );
494 474
                                                        ZhanCommentFragment.dialog.cancel();
495 475
                                                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
496 476
                                                        if (rtnCode.equals("01")) {
@ -508,8 +488,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
508 488
                                    public void onClick(View v) {
509 489
                                    }
510 490
                                }).show();
511
//                                String url = MainApplication.url+"/zhannew/basic/web/index.php/tpappcomments/delete-comments?id=23068&phone="+MainApplication.userPhone+"&password="+MainApplication.userPassword;
512
513 491
                            }
514 492
                        });
515 493
                    }
@ -525,7 +503,7 @@ public class ZhanCommentsAapter extends BaseAdapter {
525 503
526 504
    private class ViewHolder {
527 505
        TextView tv_pdelete, tv_pname, tv_sname, tv_ptime, tv_stime, tv_pcontext, tv_scontext, tv_preply, tv_pcar, tv_more, tv_pzan;
528
        ImageView iv_picon, certified_icon;
506
        ImageView iv_picon, certified_icon, high_grade_comment_icon;
529 507
        LinearLayout ll_pzan;
530 508
        ImageView iv_havemessage, iv_commentPic;
531 509
        ImageView iv_pgrade, iv_pzan, iv_level_img;

BIN
app/src/main/res/drawable-hdpi/high_grade_comment_icon.png


BIN
app/src/main/res/drawable-xhdpi/high_grade_comment_icon.png


BIN
app/src/main/res/drawable-xxhdpi/high_grade_comment_icon.png


BIN
app/src/main/res/drawable-xxxhdpi/high_grade_comment_icon.png


+ 77 - 54
app/src/main/res/layout/item_zhancomments.xml

@ -1,6 +1,7 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    xmlns:zhy="http://schemas.android.com/tools"
5 6
    android:id="@+id/ll_zhan_comments"
6 7
    android:layout_width="match_parent"
@ -41,76 +42,98 @@
41 42
42 43
        </RelativeLayout>
43 44
44
45
        <TextView
46
            android:id="@+id/tv_pname"
47
            android:layout_width="wrap_content"
45
        <LinearLayout
46
            android:id="@+id/tv_info"
47
            android:layout_width="match_parent"
48 48
            android:layout_height="wrap_content"
49 49
            android:layout_alignTop="@+id/rl_icon"
50
            android:layout_gravity="center_vertical"
51 50
            android:layout_marginLeft="10dp"
52
            android:layout_toEndOf="@+id/rl_icon"
51
            android:layout_marginRight="15dp"
53 52
            android:layout_toRightOf="@+id/rl_icon"
54
            android:ellipsize="end"
55
            android:maxEms="8"
56
            android:singleLine="true"
57
            android:text="EV200车主"
58
            android:textAppearance="?android:attr/textAppearanceSmall"
59
            android:textColor="@color/ui_65"
60
            android:textSize="13sp" />
53
            android:orientation="horizontal">
61 54
62
        <ImageView
63
            android:id="@+id/certified_icon"
64
            android:layout_width="18dp"
65
            android:layout_height="18dp"
66
            android:layout_alignTop="@+id/tv_pname"
67
            android:layout_marginTop="2dp"
68
            android:layout_alignBottom="@+id/tv_pname"
69
            android:layout_marginLeft="5dp"
70
            android:layout_toRightOf="@+id/tv_pname"
71
            android:src="@drawable/certified_icon" />
55
            <LinearLayout
56
                android:layout_width="wrap_content"
57
                android:layout_height="wrap_content"
58
                android:orientation="vertical">
59
60
                <LinearLayout
61
                    android:layout_width="wrap_content"
62
                    android:layout_height="wrap_content"
63
                    android:orientation="horizontal">
64
65
                    <TextView
66
                        android:id="@+id/tv_pname"
67
                        android:layout_width="wrap_content"
68
                        android:layout_height="wrap_content"
69
                        android:ellipsize="end"
70
                        android:maxEms="8"
71
                        android:singleLine="true"
72
                        android:textAppearance="?android:attr/textAppearanceSmall"
73
                        android:textColor="@color/ui_65"
74
                        android:textSize="13sp"
75
                        tools:text="gin" />
76
77
                    <ImageView
78
                        android:id="@+id/certified_icon"
79
                        android:layout_width="18dp"
80
                        android:layout_height="18dp"
81
                        android:layout_marginLeft="5dp"
82
                        android:layout_marginTop="2dp"
83
                        android:src="@drawable/certified_icon" />
84
85
                    <TextView
86
                        android:id="@+id/tv_pcar"
87
                        android:layout_width="match_parent"
88
                        android:layout_height="wrap_content"
89
                        android:layout_marginLeft="5dp"
90
                        android:layout_marginRight="5dp"
91
                        android:ellipsize="end"
92
                        android:singleLine="true"
93
                        android:textAppearance="?android:attr/textAppearanceSmall"
94
                        android:textColor="#888888"
95
                        android:textSize="13sp"
96
                        tools:text="本田CR-V" />
97
                </LinearLayout>
98
99
                <ImageView
100
                    android:id="@+id/iv_pgrade"
101
                    android:layout_width="wrap_content"
102
                    android:layout_height="wrap_content"
103
                    android:layout_marginTop="5dp"
104
                    android:src="@drawable/icon_5xing"
105
                    android:textAppearance="?android:attr/textAppearanceSmall" />
106
            </LinearLayout>
72 107
73
        <TextView
74
            android:id="@+id/tv_pcar"
75
            android:layout_width="match_parent"
76
            android:layout_height="wrap_content"
77
            android:layout_alignTop="@+id/tv_pname"
78
            android:layout_gravity="center_vertical"
79
            android:layout_marginLeft="5dp"
80
            android:layout_marginRight="5dp"
81
            android:layout_toLeftOf="@+id/iv_pgrade"
82
            android:layout_toRightOf="@+id/certified_icon"
83
            android:ellipsize="end"
84
            android:singleLine="true"
85
            android:text="北京市"
86
            android:textAppearance="?android:attr/textAppearanceSmall"
87
            android:textColor="#888888"
88
            android:textSize="13sp" />
108
            <TextView
109
                android:layout_width="wrap_content"
110
                android:layout_height="wrap_content"
111
                android:layout_weight="1" />
112
113
            <ImageView
114
                android:id="@+id/high_grade_comment_icon"
115
                android:layout_width="42dp"
116
                android:layout_height="42dp"
117
                android:layout_alignParentRight="true"
118
                android:src="@drawable/high_grade_comment_icon"
119
                android:visibility="gone"
120
                tools:visibility="visible" />
121
        </LinearLayout>
89 122
90
        <ImageView
91
            android:id="@+id/iv_pgrade"
92
            android:layout_width="wrap_content"
93
            android:layout_height="wrap_content"
94
            android:layout_alignTop="@+id/tv_pname"
95
            android:layout_alignParentRight="true"
96
            android:layout_gravity="center_vertical"
97
            android:layout_marginRight="15dp"
98
            android:src="@drawable/icon_5xing"
99
            android:textAppearance="?android:attr/textAppearanceSmall" />
100 123
101 124
        <TextView
102 125
            android:id="@+id/tv_pcontext"
103 126
            android:layout_width="wrap_content"
104 127
            android:layout_height="wrap_content"
105
            android:layout_below="@+id/tv_pname"
106
            android:layout_alignStart="@+id/tv_pname"
107
            android:layout_alignLeft="@+id/tv_pname"
128
            android:layout_below="@+id/tv_info"
129
            android:layout_alignStart="@+id/tv_info"
130
            android:layout_alignLeft="@+id/tv_info"
108 131
            android:layout_marginTop="10dp"
109 132
            android:layout_marginRight="15dp"
110
            android:text=""
111 133
            android:textAppearance="?android:attr/textAppearanceSmall"
112 134
            android:textSize="15sp"
113
            android:visibility="visible" />
135
            android:visibility="visible"
136
            tools:text="打扫房间临时冻结疯狂老爹设计费枯鲁杜鹃时空裂缝坚实的考虑放假" />
114 137
115 138
        <com.zhy.view.flowlayout.TagFlowLayout
116 139
            android:id="@+id/fl_ptag"