s-num lines-num-new">
//                        try {
259
//                            str = strbuf.deleteCharAt(0).toString();
260
//                            Log.e("data",str);
261
//                            ssv.initData(str);
262
//                        }catch (Exception e){
263
//                            str = "";
264
//                            Log.e("data",str);
265
//                            ssv.initData(str);
266
//                        }
267
268 208
                    } catch (JSONException e) {
269 209
                        e.printStackTrace();
270 210
                    }
@ -274,10 +214,6 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
274 214
                    ArrayList<JSONObject> datas = new ArrayList<JSONObject>();
275 215
                    try {
276 216
                        JSONArray jsonArray = new JSONArray(msg.obj.toString());
277
//                        JSONObject jsonObject = jsonArray.getJSONObject()
278
//                        JSONObject jsonObj = new JSONObject(msg.obj.toString());
279
280
//                        JSONArray jsonArray=jsonObj.getJSONArray("comment");
281 217
                        datas.clear();
282 218
                        for (int j = 0; j < jsonArray.length(); j++) {
283 219
                            JSONObject jsonObject4 = (JSONObject) jsonArray
@ -285,18 +221,7 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
285 221
                            datas.add(jsonObject4);
286 222
                        }
287 223
                        comment_num = datas.size();
288
//                        if (comment_num != 0){
289
//                            btn_zhanCommentNo.setVisibility(View.VISIBLE);
290
//                        }
291 224
                        tv_pinglun.setText("评论(" + comment_num + ")");
292
//                        btn_zhanCommentNo.setVisibility(View.VISIBLE);
293
//                        btn_zhanCommentNo.setText("(" + comment_num + ")");
294
//                        Log.e("@@@@@@@@@@@@", datas.size() + "");
295
296
297
//                        setListViewHeightBasedOnChildren(web_content);
298
299
//                        Toast.makeText(ZhanDetailsNew.this,msg.obj+"", Toast.LENGTH_SHORT).show();
300 225
                    } catch (Exception e) {
301 226
                        e.printStackTrace();
302 227
                    }
@ -349,25 +274,13 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
349 274
                            pr.remove(prov);
350 275
                            pr.add(prov);
351 276
352
//                            spinnerProvince.setSelection(de);
353
//                                    spinnerCity
354 277
                        }
355 278
356 279
                    } catch (JSONException e) {
357 280
                        e.printStackTrace();
358 281
                    }
359
//				pr =(List<Province>) JsonUtils.parseToObjectBean(msg.obj.toString(), Province.class);
360
//                    Log.e("pe", pr.size() + "");
361
//                    Log.e("pe", pr.get(0).getCities().size() + "");
362
//                    Log.e("pe", pr.get(1).getCities().size() + "");
363
//                    Log.e("pe", pr.get(2).getCities().size() + "");
364
//                    Log.e("pe", pr.get(3).getCities().size() + "");
365
//				Log.e("pe", pr.size()+"");
366
//				Log.e("pe", pr.size()+"");
367
368 282
369 283
                    ArrayAdapter<Province> provinceAdapter = new ArrayAdapter<Province>(NewZhanDetailsActivity.this, R.layout.simple_spinner_item, pr);
370
//                    spinnerProvince.setAdapter(provinceAdapter);
371 284
372 285
                    provinceAdapter.notifyDataSetChanged();
373 286
                    if (default_brand != -1) {
@ -380,7 +293,6 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
380 293
                        JSONObject object = new JSONObject(msg.obj.toString());
381 294
                        String rtnCode = object.getString("rtnCode");
382 295
                        String rtnMsg = object.getString("rtnMsg");
383
//                        Log.e("rtnMsg", rtnMsg);
384 296
                    } catch (JSONException e) {
385 297
                        e.printStackTrace();
386 298
                    }
@ -406,34 +318,23 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
406 318
407 319
        dialog = new LoadingDialog(this);
408 320
        dialog.setCanceledOnTouchOutside(false);
409
//        System.out.print("canCollect===="+canCollect);
410 321
        imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
411 322
        commentsBean = null;
412 323
413 324
        String intent_id = getIntent().getStringExtra("zhan_id");
414 325
415
//        zhan = (Zhan) getIntent().getSerializableExtra("zhan");
416
417 326
        initView();
418 327
        if (MainApplication.details_flag.equals("1")) {
419 328
            zhan_id = getIntent().getStringExtra("zhanid");
420 329
            viewPager.setCurrentItem(2);
421
//            jingdu = poi_jing;
422
//            weidu = poi_wei;
423
//            MainApplication.details_flag = "0";
424 330
        } else if (MainApplication.details_flag.equals("2")) {
425 331
426 332
            zhan_id = getIntent().getStringExtra("zhan_id");
427
//            Log.e("9999",zhan_id);
428
//            jingdu = poi_jing;
429
//            weidu = poi_wei;
430
//            MainApplication.details_flag = "0";
431 333
        } else if (MainApplication.details_flag.equals("3")) {
432 334
            zhan_id = intent_id;
433 335
            viewPager.setCurrentItem(2);
434 336
            jingdu = getIntent().getStringExtra("poi_jing");
435 337
            weidu = getIntent().getStringExtra("poi_wei");
436
//            MainApplication.details_flag = "0";
437 338
        } else if (MainApplication.details_flag.equals("4")) {
438 339
            zhan_id = getIntent().getStringExtra("zhan_id");
439 340
            viewPager.setCurrentItem(2);
@ -451,24 +352,11 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
451 352
            jingdu = getIntent().getStringExtra("poi_jing");
452 353
            weidu = getIntent().getStringExtra("poi_wei");
453 354
        }
454
//        getPic();//获得图片
455
456 355
        getZhanCommentNum(zhan_id);
457 356
458 357
459 358
        mapp = (MainApplication) getApplication();
460 359
        mContext = this;
461
//        getComment("","");
462
463
//         int j = AboutActivity.i;
464
//            int w = AboutActivity.j;
465
//        if (zhan.getSupplier().toString().equals("特来电")){
466
//            getDetailThread(zhan.getTid());
467
//        }
468
469
470
//        resetViewPagerHeight(viewPager.getCurrentItem());
471
//        fragments = new ArrayList<Fragment>();
472 360
473 361
474 362
        // 模拟网络请求完成之后重置ViewPager高度
@ -494,14 +382,6 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
494 382
        tv_submit_comment.setOnClickListener(this);
495 383
        iv_back = (ImageView) findViewById(R.id.iv_back);
496 384
        iv_back.setOnClickListener(this);
497
//        ll_zhanComment = (LinearLayout) findViewById(R.id.ll_zhanComment);
498
//        ll_zhanComment.setOnClickListener(this);
499
//        ll_zhanSuit = (LinearLayout) findViewById(R.id.ll_zhanSuit);
500
//        btn_zhanSuitNo = (TextView) findViewById(R.id.btn_zhanSuitNo);
501
//        btn_zhanComment.setText("车友评论"+"("+SuitCarFragment+")");
502
//        btn_zhanComment.setOnClickListener(this);
503
//        btn_zhanSuit = (TextView) findViewById(R.id.btn_zhanSuit);
504
//        btn_zhanSuit.setOnClickListener(this);
505 385
        share = (ImageView) findViewById(R.id.iv_share);
506 386
        share.setOnClickListener(this);
507 387
        collect = (ImageView) findViewById(R.id.iv_collect);
@ -514,17 +394,19 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
514 394
515 395
        viewPager = (ViewPager) findViewById(R.id.viewPager);
516 396
        addDetailsFragment = new DetailsFragment();
517
//        addCommentFragment = new CommentFragment();
397
        addDetailsFragment.setOnUpdateScanChargeFragmentListener(new DetailsFragment.OnDetailsFragmentListener() {
398
            @Override
399
            public void updateScanCharge(String ownPay) {
400
                rl_detail_scan.setVisibility("1".equals(ownPay) ? View.VISIBLE : View.GONE);
401
            }
402
        });
518 403
        addZhanCommentFragment = new ZhanCommentFragment();
519 404
        addZhanStatusFragment = new ZhanStatusFragment();
520
//        addSuitCarFragment = new SuitCarFragment();
521 405
522 406
        adapter = new ViewPagerFragmentAdapter(getSupportFragmentManager());
523 407
        adapter.addFragment(addDetailsFragment);
524 408
        adapter.addFragment(addZhanStatusFragment);
525 409
        adapter.addFragment(addZhanCommentFragment);
526
//        adapter.addFragment(addCommentFragment);
527
//        adapter.addFragment(addSuitCarFragment);
528 410
        viewPager.setOffscreenPageLimit(2);
529 411
        viewPager.setOnPageChangeListener(listener);
530 412
        viewPager.setAdapter(adapter);

+ 0 - 1
app/src/main/java/com/electric/chargingpile/activity/PileCostDetailsActivity.java

@ -62,7 +62,6 @@ public class PileCostDetailsActivity extends AppCompatActivity {
62 62
            String end = list.get(i).getEnd();
63 63
            String service_free = list.get(i).getService_free();
64 64
            String charge_free = list.get(i).getCharge_free();
65
//            String is_dui = DetailsFragment.datas.get(i).getString("is_dui");
66 65
67 66
            item_time.setText(start + "-" + end);
68 67

+ 0 - 1
app/src/main/java/com/electric/chargingpile/activity/PriceDetailsActivity.java

@ -53,7 +53,6 @@ public class PriceDetailsActivity extends Activity implements View.OnClickListen
53 53
            String end = DetailsFragment.datas.get(i).getString("end");
54 54
            String service_free = DetailsFragment.datas.get(i).getString("service_free");
55 55
            String charge_free = DetailsFragment.datas.get(i).getString("charge_free");
56
//            String is_dui = DetailsFragment.datas.get(i).getString("is_dui");
57 56
58 57
            item_time.setText(start + "-" + end);
59 58

+ 0 - 280
app/src/main/java/com/electric/chargingpile/activity/RoutePlanMapActivity.java

@ -2683,286 +2683,6 @@ public class RoutePlanMapActivity extends Activity implements LocationSource, AM
2683 2683
                        String info = JsonUtils.getKeyResult(response, "info");
2684 2684
                        ZhanData zhanInfo = JsonUtils.parseToObjectBean(info, ZhanData.class);
2685 2685
                        showInfoWindowData(zhan_id, infoWindow, zhanInfo, marker);
2686
//                        try {
2687
//                            JSONObject object = new JSONObject(response);
2688
//                            JSONObject obj = object.getJSONObject("info");
2689
//                            final String zhan_name = obj.getString("zhan_name");
2690
//                            final String fast_num = obj.getString("fast_num");
2691
//                            String slow_num = obj.getString("slow_num");
2692
//                            String charge_cost = obj.getString("charge_cost");
2693
//                            String stop_cost = obj.getString("stop_cost");
2694
//                            String other_cost = obj.getString("other_cost");
2695
//                            String charge_cost_way = obj.getString("supplier");
2696
//                            String belong_attribute = obj.getString("belong_attribute");
2697
////                                    rl_infowindow.setVisibility(View.VISIBLE);
2698
//                            tv_route_name.setText(zhan_name);
2699
//                            if (charge_cost_way.equals("") || belong_attribute.equals("私人")) {
2700
//                                tv_route_costway.setText("");
2701
//                            } else {
2702
//                                tv_route_costway.setText(charge_cost_way);
2703
//                            }
2704
////                            Log.e("123", "onResponse: 111111");
2705
//
2706
//                            if (fast_num.equals("")) {
2707
//                                tv_route_fast.setText("0");
2708
//                            } else {
2709
//                                tv_route_fast.setText(fast_num);
2710
//                            }
2711
//
2712
//                            if (slow_num.equals("")) {
2713
//                                tv_route_slow.setText("0");
2714
//                            } else {
2715
//                                tv_route_slow.setText(slow_num);
2716
//                            }
2717
//
2718
//
2719
//                            rl_details.setOnClickListener(new View.OnClickListener() {
2720
//                                @Override
2721
//                                public void onClick(View v) {
2722
//                                    MainApplication.details_flag = "2";
2723
//                                    Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
2724
//                                    intent.putExtra("zhan_id", zhan_id);
2725
//                                    startActivity(intent);
2726
//                                }
2727
//                            });
2728
//
2729
////                            rl_routebtn.setOnClickListener(new View.OnClickListener() {
2730
////                                @Override
2731
////                                public void onClick(View v) {
2732
////
2733
////                                }
2734
////                            });
2735
//
2736
//
2737
//                            final String poi_wei = wei;
2738
//                            final String poi_jing = jing;
2739
//
2740
//                            LatLng ll = new LatLng(Double.parseDouble(start_wei), Double.parseDouble(start_jing));
2741
//                            LatLng l = new LatLng(Double.parseDouble(wei), Double.parseDouble(jing));
2742
////                        double d = DistanceUtil.getDistance(MainMapActivity.center, ll);
2743
//
2744
//                            double d = AMapUtils.calculateLineDistance(l, ll);
2745
////                                Toast.makeText(getApplicationContext(),Util.getDistance(d),Toast.LENGTH_SHORT).show();
2746
//                            tv_distance.setText(Util.getDistance(d));
2747
//
2748
//                            String acNum = "", dcNum = "", acableNum = "", dcableNum = "";
2749
//                            if (!obj.isNull("acNum")) {
2750
//                                acNum = obj.getString("acNum");
2751
//                                dcNum = obj.getString("dcNum");
2752
//                                acableNum = obj.getString("acableNum");
2753
//                                dcableNum = obj.getString("dcableNum");
2754
//                            }
2755
//
2756
//                            detail_name.setText(zhan_name);
2757
//
2758
//                            tv_charge.setText(charge_cost);
2759
//                            tv_service.setText(other_cost);
2760
//                            tv_park.setText(stop_cost);
2761
//                            tv_cost_way.setText(charge_cost_way);
2762
//                            if (!obj.isNull("acNum") && !obj.isNull("dcNum")) {
2763
//                                tv_slowNum.setText("空闲" + acableNum + "/共" + acNum + "个");
2764
//                                tv_fastNum.setText("空闲" + dcableNum + "/共" + dcNum + "个");
2765
//                            } else {
2766
//                                if (fast_num.equals("")) {
2767
//                                    tv_fastNum.setText("0");
2768
//                                } else {
2769
//                                    tv_fastNum.setText(fast_num);
2770
//                                }
2771
//                                if (slow_num.equals("")) {
2772
//                                    tv_slowNum.setText("0");
2773
//                                } else {
2774
//                                    tv_slowNum.setText(slow_num);
2775
//                                }
2776
//                            }
2777
//                            if (list_zhong != null) {
2778
//                                if (zhan_id.equals(p1) || zhan_id.equals(p2) || zhan_id.equals(p3)) {
2779
////                                    tv_zhong.setText("删除此途经站点");
2780
//                                    rl_routebtn.setBackgroundResource(R.drawable.icon_route_minus);
2781
//                                } else {
2782
////                                    tv_zhong.setText("设置为途经站点");
2783
//                                    rl_routebtn.setBackgroundResource(R.drawable.icon_route_plus);
2784
//                                }
2785
//                            }
2786
////                            rela_paopao.setVisibility(View.VISIBLE);
2787
//
2788
//
2789
2790
//
2791
//                            ll_paoxiang.setOnClickListener(new View.OnClickListener() {
2792
//                                @Override
2793
//                                public void onClick(View v) {
2794
//                                    MainApplication.details_flag = "2";
2795
//                                    Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
2796
//                                    intent.putExtra("zhan_id", zhan_id);
2797
//                                    startActivity(intent);
2798
//
2799
//                                }
2800
//                            });
2801
//
2802
//                            ll_comment.setOnClickListener(new View.OnClickListener() {
2803
//                                @Override
2804
//                                public void onClick(View v) {
2805
//                                    MainApplication.details_flag = "4";
2806
//                                    Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
2807
//                                    intent.putExtra("zhan_id", zhan_id);
2808
//                                    startActivity(intent);
2809
//                                }
2810
//                            });
2811
//
2812
//                            tv_daohang.setOnClickListener(new View.OnClickListener() {
2813
//                                @Override
2814
//                                public void onClick(View v) {
2815
//
2816
//                                    if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap") &&
2817
//                                            !isAvilible(getApplicationContext(), "com.autonavi.minimap")) {
2818
//                                        Intent intent = new Intent(getApplication(), BasicNaviActivity.class);
2819
//                                        intent.putExtra("start_jing", center.longitude + "");
2820
//                                        intent.putExtra("start_wei", center.latitude + "");
2821
//                                        intent.putExtra("stop_jing", jing + "");
2822
//                                        intent.putExtra("stop_wei", wei + "");
2823
//                                        startActivity(intent);
2824
////                                        detailsBack = true;
2825
////                                        HashMap<String,String> map = new HashMap<String,String>();
2826
////                                        map.put("Name",finalMarkerInfo.getZhan_name());
2827
////                                        map.put("CostWay",finalMarkerInfo.getCharge_cost_way());
2828
////                                        map.put("City",finalMarkerInfo.getCity());
2829
////                                        MobclickAgent.onEvent(context, "0033", map);
2830
////                                        map.clear();
2831
//                                    } else {
2832
//                                        if (center != null) {
2833
//                                            LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
2834
//                                            popupWindowView = inflater1.inflate(R.layout.item_selectmap, null);
2835
//                                            popupWindow = new PopupWindow(popupWindowView,
2836
//                                                    ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT,
2837
//                                                    true);
2838
//                                            popupWindow.setBackgroundDrawable(new BitmapDrawable());
2839
//                                            // 设置PopupWindow的弹出和消失效果
2840
//                                            popupWindow.setAnimationStyle(R.style.popupAnimation);
2841
//                                            LinearLayout ll_tvTwo = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvTwo);
2842
//                                            if (!isAvilible(getApplicationContext(), "com.autonavi.minimap")) {
2843
//                                                ll_tvTwo.setVisibility(View.GONE);
2844
//                                            }
2845
//                                            LinearLayout ll_tvOne = (LinearLayout) popupWindowView.findViewById(R.id.ll_tvOne);
2846
//                                            if (!isAvilible(getApplicationContext(), "com.baidu.BaiduMap")) {
2847
//                                                ll_tvOne.setVisibility(View.GONE);
2848
//                                            }
2849
//                                            cancleButton = (Button) popupWindowView
2850
//                                                    .findViewById(R.id.cancleButton);
2851
//                                            cancleButton.setOnClickListener(new View.OnClickListener() {
2852
//                                                @Override
2853
//                                                public void onClick(View view) {
2854
////                        Toast.makeText(ZhanDetailsNew.this, "NO", Toast.LENGTH_SHORT).show();
2855
//                                                    popupWindow.dismiss();
2856
//                                                }
2857
//                                            });
2858
//                                            tvThree = (TextView) popupWindowView.findViewById(R.id.tvThree);
2859
//                                            tvThree.setOnClickListener(new View.OnClickListener() {
2860
//                                                @Override
2861
//                                                public void onClick(View v) {
2862
//                                                    Intent intent = new Intent(getApplication(), BasicNaviActivity.class);
2863
//                                                    intent.putExtra("start_jing", center.longitude + "");
2864
//                                                    intent.putExtra("start_wei", center.latitude + "");
2865
//                                                    intent.putExtra("stop_jing", jing + "");
2866
//                                                    intent.putExtra("stop_wei", wei + "");
2867
//                                                    startActivity(intent);
2868
////                                                    detailsBack = true;
2869
//                                                    popupWindow.dismiss();
2870
//                                                    HashMap<String, String> map = new HashMap<String, String>();
2871
////                                                    map.put("Name",finalMarkerInfo.getZhan_name());
2872
////                                                    map.put("CostWay",finalMarkerInfo.getCharge_cost_way());
2873
////                                                    map.put("City",finalMarkerInfo.getCity());
2874
////                                                    MobclickAgent.onEvent(context, "0033", map);
2875
////                                                    map.clear();
2876
//                                                }
2877
//                                            });
2878
//                                            tvOne = (TextView) popupWindowView.findViewById(R.id.tvOne);
2879
//                                            tvOne.setOnClickListener(new View.OnClickListener() {
2880
//                                                @Override
2881
//                                                public void onClick(View view) {
2882
//                                                    Intent intent = null;
2883
////                                        try {
2884
//////                                            intent = Intent.getIntent("intent://map/direction?origin=latlng:"+center.latitude+","+center.longitude+"&destination=latlng:"+ll.latitude+","+ll.longitude+"|name:"+finalMarkerInfo.getZhan_name()+"&mode=driving&region=&src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
2885
////                                        } catch (URISyntaxException e) {
2886
////                                            e.printStackTrace();
2887
////                                        }
2888
//                                                    double dwei = Double.parseDouble(poi_wei);
2889
//                                                    double djing = Double.parseDouble(poi_jing);
2890
//                                                    getBaidu(center.longitude, center.latitude);
2891
//                                                    try {
2892
//                                                        String s = "intent://map/direction?" +
2893
//                                                                "origin=" + bd_lat + "," + bd_lon + "&" +
2894
//                                                                "destination=" + dwei + "," + djing +
2895
//                                                                "&mode=driving&" +
2896
//                                                                "src=充电桩#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end";
2897
//                                                        Log.e("sss", s);
2898
//                                                        intent = Intent.getIntent(s);
2899
////                                                        detailsBack = true;
2900
////                                                        HashMap<String,String> map = new HashMap<String,String>();
2901
////                                                        map.put("Name",finalMarkerInfo.getZhan_name());
2902
////                                                        map.put("CostWay",finalMarkerInfo.getCharge_cost_way());
2903
////                                                        map.put("City",finalMarkerInfo.getCity());
2904
////                                                        MobclickAgent.onEvent(context, "0031", map);
2905
////                                                        map.clear();
2906
//                                                    } catch (URISyntaxException e) {
2907
//                                                        e.printStackTrace();
2908
//                                                    }
2909
//                                                    startActivity(intent);
2910
////                                                    if (MainFragment.center != null) {
2911
////                                                        double dwei = Double.parseDouble(zhan.getPoi_wei());
2912
////                                                        double djing = Double.parseDouble(zhan.getPoi_jing());
2913
////                                                        LatLng ll = new LatLng(dwei, djing);
2914
////
2915
////                                                        startNavi(MainFragment.center, ll);
2916
////
2917
////                                                    }
2918
////                                    startNavi(center, ll);
2919
//                                                    popupWindow.dismiss();
2920
//
2921
//                                                }
2922
//
2923
//                                            });
2924
//                                            tvTwo = (TextView) popupWindowView.findViewById(R.id.tvTwo);
2925
//                                            tvTwo.setOnClickListener(new View.OnClickListener() {
2926
//                                                @Override
2927
//                                                public void onClick(View view) {
2928
//                                                    try {
2929
////                                            getGaode(ll.longitude, ll.latitude);
2930
////                                            getBeginGaode(center.longitude, center.latitude);
2931
//                                                        Intent intent4 = new Intent("android.intent.action.VIEW",
2932
//                                                                android.net.Uri.parse("androidamap://route?sourceApplication=amap&slat=" + center.latitude + "&slon=" + center.longitude + "&sname=我的位置&dlat=" + wei + "&dlon=" + jing + "&dname=" + zhan_name + "&dev=0&m=0&t=2"));
2933
//                                                        intent4.setPackage("com.autonavi.minimap");
2934
//                                                        startActivity(intent4);
2935
////                                                        detailsBack = true;
2936
//                                                        popupWindow.dismiss();
2937
////                                                        HashMap<String,String> map = new HashMap<String,String>();
2938
////                                                        map.put("Name",finalMarkerInfo.getZhan_name());
2939
////                                                        map.put("CostWay",finalMarkerInfo.getCharge_cost_way());
2940
////                                                        map.put("City",finalMarkerInfo.getCity());
2941
////                                                        MobclickAgent.onEvent(context, "0032", map);
2942
////                                                        map.clear();
2943
//                                                    } catch (Exception e) {
2944
//                                                        e.printStackTrace();
2945
//                                                        Toast.makeText(getApplication(), "请您确认是否安装高德地图APP", Toast.LENGTH_SHORT).show();
2946
//                                                    }
2947
//
2948
//                                                }
2949
//                                            });
2950
//                                            popupWindow.showAtLocation(cancleButton, Gravity.CENTER, 0, 0);
2951
////                                            startNavi(center, ll);
2952
//                                        } else {
2953
//                                            Toast.makeText(getApplication(),
2954
//                                                    "没有定位到您的当前位置", Toast.LENGTH_SHORT)
2955
//                                                    .show();
2956
//                                        }
2957
//                                    }
2958
//                                }
2959
//                            });
2960
//
2961
//                        } catch (Exception e) {
2962
//                            e.printStackTrace();
2963
//                        }
2964
2965
2966 2686
                    }
2967 2687
                });
2968 2688

+ 0 - 143
app/src/main/java/com/electric/chargingpile/adapter/CommentAdapter.java

@ -74,58 +74,6 @@ public class CommentAdapter extends BaseAdapter {
74 74
    private String zhan_id, name0, name1;
75 75
    private Context mContext;
76 76
    private String[] stringArr;
77
//    private Handler handler = new Handler() {
78
//        // 主线程通过这个方法处理消息
79
//        @Override
80
//        public void handleMessage(Message msg) {
81
//            switch (msg.what) {
82
//
83
//                case 6:
84
////                    InputMethodManager imm =(InputMethodManager)getSystemService(
85
////                            Context.INPUT_METHOD_SERVICE);
86
////                    imm.hideSoftInputFromWindow(et_comment.getWindowToken(), 0);
87
////                    try {
88
////                        JSONObject jsonObjadd = new JSONObject(msg.obj.toString());
89
////                        String rtnCode = jsonObjadd.getString("rtnCode");
90
////                        dismissDialog();
91
////                        if (rtnCode.equals("01")){
92
//////                            userGrowUp();
93
////                            et_comment.setText("");
94
////                        }
95
//////                        resetViewPagerHeight(1);
96
////                        addCommentFragment.reference();
97
//////                        CommentFragment.point.setVisibility(View.VISIBLE);
98
//////                        CommentFragment.point.startAnimation(CommentFragment.animation);
99
//////                        new Handler().postDelayed(new Runnable() {
100
//////                            public void run() {
101
//////                                CommentFragment.point.setVisibility(View.GONE);
102
//////                            }
103
//////                        }, 1000);
104
////                        CommentFragment.relativeLayout.setVisibility(View.VISIBLE);
105
////                        CommentFragment.textView.setVisibility(View.VISIBLE);
106
////                        CommentFragment.textView.startAnimation(CommentFragment.animation);
107
////                        new Handler().postDelayed(new Runnable() {
108
////                            public void run() {
109
////                                CommentFragment.textView.setVisibility(View.GONE);
110
////                            }
111
////                        }, 2000);
112
////
113
//////                        resetViewPagerHeight(1);
114
////
115
////                        Toast.makeText(NewZhanDetailsActivity.this, "评论成功", Toast.LENGTH_SHORT).show();
116
////                    } catch (Exception e) {
117
////                        e.printStackTrace();
118
////                    }
119
//
120
//                    break;
121

122
//                default:
123
//                    break;
124
//            }
125
//        }
126
//    };
127

128
//    public static int open =0;
129 77

130 78
    public CommentsBean getParentBean(String parentId) {
131 79
        for (CommentsBean cb : datas) {
@ -327,22 +275,7 @@ public class CommentAdapter extends BaseAdapter {
327 275
            childIndex = 0;
328 276
            if (!imm.isActive()) {
329 277
                ZhanCommentActivity.commentType = 1;
330
//                ZhanCommentActivity.et_pinglun.setHint("有什么想吐槽的吗?来跟其他车友分享一下吧...");
331 278
            }
332
//            holder.rl_parent.setOnClickListener(new OnClickListener() {
333
//                @Override
334
//                public void onClick(View v) {
335
//                    NewZhanDetailsActivity.commentType = 2;
336
////                    Toast.makeText(v.getContext(),commentsBean.getNickname(),Toast.LENGTH_SHORT).show();
337
//                    NewZhanDetailsActivity.et_comment.setFocusable(true);
338
//                    NewZhanDetailsActivity.et_comment.setFocusableInTouchMode(true);
339
//                    NewZhanDetailsActivity.et_comment.requestFocus();
340
//                    NewZhanDetailsActivity.et_comment.setHint("回复:"+commentsBean.getNickname());
341
//                    NewZhanDetailsActivity.commentsBean = commentsBean;
342
//                    imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
343
//                    imm.showSoftInput(NewZhanDetailsActivity.et_comment,InputMethodManager.SHOW_FORCED);
344
//                }
345
//            });
346 279
            String tag = commentsBean.getTag();
347 280

348 281

@ -555,17 +488,8 @@ public class CommentAdapter extends BaseAdapter {
555 488
                @Override
556 489
                public void onClick(View v) {
557 490

558
//                    WindowManager.LayoutParams params = mActivity.getWindow().getAttributes();
559
//                    if (imm.isActive()) {
560
//                        // 隐藏软键盘
561
//
562
//                        NewZhanDetailsActivity.commentType = 1;
563
//                        NewZhanDetailsActivity.et_comment.setHint("说点什么吧...");
564
//                        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
565
//                    }else {
566 491
                    CommentFragment.web_content.smoothScrollToPosition(3);
567 492
                    NewZhanDetailsActivity.commentType = 2;
568
//                    Toast.makeText(v.getContext(),commentsBean.getNickname(),Toast.LENGTH_SHORT).show();
569 493
                    NewZhanDetailsActivity.et_comment.setFocusable(true);
570 494
                    NewZhanDetailsActivity.et_comment.setFocusableInTouchMode(true);
571 495
                    NewZhanDetailsActivity.et_comment.requestFocus();
@ -579,16 +503,6 @@ public class CommentAdapter extends BaseAdapter {
579 503
                    imm.showSoftInput(NewZhanDetailsActivity.et_comment, InputMethodManager.SHOW_FORCED);
580 504
                    NewZhanDetailsActivity.ll_comment.setVisibility(View.VISIBLE);
581 505
                    NewZhanDetailsActivity.tv_submit_comment.setVisibility(View.GONE);
582
//                    }
583
//                    Intent intent = new Intent(finalConvertView.getContext(),ZhanCommentActivity.class);
584
//                    intent.putExtra("zhan_id",NewZhanDetailsActivity.zhan_id);
585
//                    if (!commentsBean.getNickname().equals("")) {
586
//                        intent.putExtra("show_txt","回复:" + commentsBean.getNickname());
587
//                    }else{
588
//                        intent.putExtra("show_txt","回复:" + Util.handlePhoneComment(commentsBean.getTel()));
589
//                    }
590
//
591
//                    finalConvertView.getContext().startActivity(intent);
592 506
                }
593 507
            });
594 508
        } else if (commentsBean.getType() == CommentsBean.CHILD_MOMMENT) {
@ -597,39 +511,11 @@ public class CommentAdapter extends BaseAdapter {
597 511
            holder.vvv.setVisibility(View.GONE);
598 512
            holder.vvvv.setVisibility(View.VISIBLE);
599 513
            holder.rl_son.setVisibility(View.VISIBLE);
600
//            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) holder.ll_main.getLayoutParams();
601
//            lp.setMargins(135, 45, 0, 0);
602
//            holder.ll_main.setLayoutParams(lp);
603 514
            childIndex++;
604 515
            if (childIndex <= 3 && masterCount == childIndex) {
605 516
                holder.vvv.setVisibility(View.VISIBLE);
606 517
                holder.vvvv.setVisibility(View.GONE);
607 518
            }
608
//            if (!imm.isActive()){
609
//                NewZhanDetailsActivity.commentType = 1;
610
//                NewZhanDetailsActivity.et_comment.setHint("说点什么吧...");
611
//            }
612
//            holder.ll_out.setOnClickListener(new OnClickListener() {
613
//                @Override
614
//                public void onClick(View v) {
615
//
616
//                        NewZhanDetailsActivity.commentType = 1;
617
//                        NewZhanDetailsActivity.et_comment.setHint("说点什么吧...");
618
//                        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
619
//                }
620
//            });
621
//            holder.rl_son.setOnClickListener(new OnClickListener() {
622
//                @Override
623
//                public void onClick(View v) {
624
//                    NewZhanDetailsActivity.commentType = 2;
625
//                    NewZhanDetailsActivity.et_comment.setFocusable(true);
626
//                    NewZhanDetailsActivity.et_comment.setFocusableInTouchMode(true);
627
//                    NewZhanDetailsActivity.et_comment.requestFocus();
628
//                    NewZhanDetailsActivity.et_comment.setHint("回复:"+commentsBean.getNickname());
629
//                    imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
630
//                    imm.showSoftInput(NewZhanDetailsActivity.et_comment,InputMethodManager.SHOW_FORCED);
631
//                }
632
//            });
633 519
            String tel = commentsBean.getTel();
634 520
            String chexing = commentsBean.getChexing();
635 521
            if (!commentsBean.getNickname().equals("") && !commentsBean.getNickname().equals("null")) {
@ -638,12 +524,10 @@ public class CommentAdapter extends BaseAdapter {
638 524
                holder.tv_carTypeson.setText(Util.handlePhoneComment(tel));
639 525
            }
640 526
            String[] strarray = chexing.split("\\$\\$");
641
//
642 527
            if (strarray.length > 1) {
643 528
                name0 = strarray[0];//江淮
644 529
                name1 = strarray[1];//iEV3
645 530
            }
646
//            Log.e("name0+name1",name0+name1);
647 531

648 532
            holder.tv_commentson.setText(commentsBean.getContent());
649 533
            if (chexing == null || chexing.equals("") || chexing.equals("null") || chexing.equals("品牌$$车型") || chexing.equals("null$$null")) {
@ -666,38 +550,11 @@ public class CommentAdapter extends BaseAdapter {
666 550
            holder.vvv.setVisibility(View.GONE);
667 551
            holder.vvvv.setVisibility(View.VISIBLE);
668 552
            holder.rl_son.setVisibility(View.VISIBLE);
669
//            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) holder.ll_main.getLayoutParams();
670
//            lp.setMargins(135, 45, 0, 0);
671
//            holder.ll_main.setLayoutParams(lp);
672 553
            childIndex++;
673 554
            if (childIndex <= 3 && masterCount == childIndex) {
674 555
                holder.vvv.setVisibility(View.VISIBLE);
675 556
                holder.vvvv.setVisibility(View.GONE);
676 557
            }
677
//            if (!imm.isActive()){
678
//                NewZhanDetailsActivity.commentType = 1;
679
//                NewZhanDetailsActivity.et_comment.setHint("说点什么吧...");
680
//            }
681
//            holder.ll_out.setOnClickListener(new OnClickListener() {
682
//                @Override
683
//                public void onClick(View v) {
684
//                    NewZhanDetailsActivity.commentType = 1;
685
//                    NewZhanDetailsActivity.et_comment.setHint("说点什么吧...");
686
//                    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
687
//                }
688
//            });
689
//            holder.rl_son.setOnClickListener(new OnClickListener() {
690
//                @Override
691
//                public void onClick(View v) {
692
//                    NewZhanDetailsActivity.commentType = 2;
693
//                    NewZhanDetailsActivity.et_comment.setFocusable(true);
694
//                    NewZhanDetailsActivity.et_comment.setFocusableInTouchMode(true);
695
//                    NewZhanDetailsActivity.et_comment.requestFocus();
696
//                    NewZhanDetailsActivity.et_comment.setHint("回复:"+commentsBean.getNickname());
697
//                    imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
698
//                    imm.showSoftInput(NewZhanDetailsActivity.et_comment,InputMethodManager.SHOW_FORCED);
699
//                }
700
//            });
701 558
            String tel = commentsBean.getTel();
702 559
            String chexing = commentsBean.getChexing();
703 560
            if (!commentsBean.getNickname().equals("") && !commentsBean.getNickname().equals("null")) {

+ 0 - 73
app/src/main/java/com/electric/chargingpile/adapter/SonCommentAdapter.java

@ -141,28 +141,7 @@ public class SonCommentAdapter extends BaseAdapter {
141 141
            try {
142 142
                String tel = datas.get(position).getString("tel");
143 143
                String chexing = datas.get(position).getString("chexing");
144
//                String[] strarray=chexing.split("$$");
145
//
146
//                if(strarray.length>1){
147
//                   name0=strarray[0];//江淮
148
//                     name1=strarray[1];//iEV3
149
//                }
150
151
//                String a[] = chexing.split("$$");
152
//                name0 =a[0];
153
//                name1 = a[1];
154
//                System.out.println(strarray[0]);
155
//                System.out.println(strarray[1]);
156
157
158
//                String[] newStr = chexing.split("//$//$");
159 144
                Log.e("!!!", chexing);
160
//                Log.e("@@@",newStr);
161
//                if (datas.get(position).getString(
162
//                        "nickname").equals("") || datas.get(position).getString(
163
//                        "nickname").equals(null)){
164
//                    holder.tv_carType.setText(Util.handlePhoneComment(tel));
165
//                }
166 145
                if (!datas.get(position).getString(
167 146
                        "nickname").equals("") && !datas.get(position).getString(
168 147
                        "nickname").equals("null")) {
@ -172,49 +151,6 @@ public class SonCommentAdapter extends BaseAdapter {
172 151
                    holder.tv_carType.setText(Util.handlePhoneComment(tel));
173 152
                }
174 153
175
176
//                if (datas.get(position).getJSONArray("childs").length() >0){
177
//                    holder.list_son.setVisibility(View.VISIBLE);
178
//                }else {
179
//                    holder.list_son.setVisibility(View.GONE);
180
//                }
181
//                ArrayList<JSONObject> son=new ArrayList<JSONObject>();
182
//                try {
183
//                    JSONArray jsonArray = new JSONArray(datas.get(position).getJSONArray("childs").toString());
184
////                    Log.e("@!@",msg.obj.toString());
185
////                        JSONObject jsonObject = jsonArray.getJSONObject()
186
////                        JSONObject jsonObj = new JSONObject(msg.obj.toString());
187
//
188
////                        JSONArray jsonArray=jsonObj.getJSONArray("comment");
189
//                    son.clear();
190
//                    for (int j = 0; j < jsonArray.length(); j++) {
191
//                        JSONObject jsonObject4 = (JSONObject) jsonArray
192
//                                .opt(j);
193
//                        son.add(jsonObject4);
194
//                    }
195
//                    Log.e("#1#",son.size()+"");
196
197
////                        comment_num.setText("车友评论"+"("+num+")");
198
////                        if (num != 0){
199
//                    NewZhanDetailsActivity.btn_zhanCommentNo.setVisibility(View.VISIBLE);
200
////                        }
201
//                    NewZhanDetailsActivity.btn_zhanCommentNo.setText("(" + num + ")");
202
//                    Log.e("!!!!!", datas.size() + "");
203
//                    holder.list_son.setAdapter(new CommentAdapter(datas, , handler, zhan_id));
204
205
//                    NewZhanDetailsActivity.resetViewPagerHeight(1);
206
//                    Utility.setListViewHeightBasedOnChildren(web_content);
207
208
//                        setListViewHeightBasedOnChildren(web_content);
209
210
//                        Toast.makeText(ZhanDetailsNew.this,msg.obj+"", Toast.LENGTH_SHORT).show();
211
//                } catch (Exception e) {
212
//                    e.printStackTrace();
213
//                }
214
215
216
//                PicassoUtil.loadingNetImage(convertView.getContext(), "http://cdz.d1ev.com/zhannew/uploadfile/"+datas.get(position).getString(
217
//                        "userpic"), holder.iv_icon);
218 154
                Picasso.with(MainApplication.context)
219 155
                        .load("http://cdz.d1ev.com/zhannew/uploadfile/" + datas.get(position).getString("userpic"))
220 156
                        .error(R.drawable.icon_face2_0)
@ -237,14 +173,8 @@ public class SonCommentAdapter extends BaseAdapter {
237 173
                Log.e("name0+name1", name0 + name1);
238 174
239 175
240
//                if((datas.get(position).getString("nickname"))==null){
241
//                    holder.tv_carType.setText("充电桩app用户");
242
//                }
243
//                holder.tv_id.setText(datas.get(position).getString(
244
//                        "zhan_id"));
245 176
                holder.tv_comment.setText(datas.get(position).getString(
246 177
                        "content"));
247
//                holder.tv_city.setText(name0+""+name1);
248 178
                if (chexing == null || chexing.equals("") || chexing.equals("null") || chexing.equals("品牌$$车型") || chexing.equals("null$$null")) {
249 179
                    holder.tv_city.setText("");
250 180
                } else {
@ -252,9 +182,6 @@ public class SonCommentAdapter extends BaseAdapter {
252 182
                }
253 183
                holder.tv_time.setText(TimeStamp2Date(datas.get(position).getString("addtime"), "yyyy-MM-dd HH:mm:ss"));
254 184
                holder.tv_parentName.setText((datas.get(position).getString("nickname")));
255
//                if ((datas.get(position).getString("nickname")).equals("")){
256
//                    holder.tv_parentName.setText("未绑定车型用户");
257
//                }
258 185
                holder.tv_reply.setOnClickListener(new OnClickListener() {
259 186
                    @Override
260 187
                    public void onClick(View v) {

+ 0 - 18
app/src/main/java/com/electric/chargingpile/fragment/CommentFragment.java

@ -711,24 +711,6 @@ public class CommentFragment extends Fragment {
711 711
                        mes.obj = dealJackson(mes);
712 712
                        handler.sendMessage(mes);
713 713
                    }
714
//                    Log.d("dddddss",msg);
715
//                    JSONArray jsonArray = new JSONArray(msg);
716
//                    int i = jsonArray.length();
717
//                    Log.e("length==",jsonArray.length()+"");
718
//                    String s = jsonArray.get(0).toString();
719
//                    Log.e("get(0)==",s);
720
//
721
//                    if (i>0){
722
//                        DetailsFragment.rl_new_comment.setVisibility(View.VISIBLE);
723
//                        String nickname = JsonUtils.getKeyResult(s,"nickname");
724
//                        String tel = JsonUtils.getKeyResult(s,"tel");
725
//                        String content = JsonUtils.getKeyResult(s,"content");
726
//
727
//                        DetailsFragment.tv_new_comment.setText(content);
728
////                        DetailsFragment.tv_new_name.setText(nickname);
729
//                    }else if (i == 0){
730
//                        DetailsFragment.rl_new_comment.setVisibility(View.GONE);
731
//                    }
732 714
                } catch (JSONException e) {
733 715
                } catch (UnknownHostException e) {
734 716
                    e.printStackTrace();

+ 13 - 42
app/src/main/java/com/electric/chargingpile/fragment/DetailsFragment.java

@ -142,6 +142,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
142 142
    private String[] stringArr;
143 143
    private RelativeLayout rlclaimer;
144 144
    private View detail_view;
145
    private OnDetailsFragmentListener detailsFragmentListener;
145 146
    private Handler handler = new Handler() {
146 147
        // 主线程通过这个方法处理消息
147 148
        @TargetApi(Build.VERSION_CODES.KITKAT)
@ -150,34 +151,16 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
150 151
            switch (msg.what) {
151 152
                case 1:
152 153
                    try {
153
//                        new Thread(new Runnable() {
154
//                            @Override
155
//                            public void run() {
156
//                                createDialog();
157
//                            }
158
//                        }).start();
159 154
                        final JSONObject object = new JSONObject(msg.obj.toString());
160
//                        Log.e(TAG, "handleMessage: msg="+msg.obj.toString() );
161 155
                        String info = JsonUtils.getKeyResult(msg.obj.toString(), "info");
162
//                        Log.e(TAG, "handleMessage: info="+info );
163 156
                        String info_decode = DES3S.decode(info);
164
//                        Log.e(TAG, "handleMessage: info_decode="+info_decode );
165
//                            JSONObject jsonObject1 = object.optJSONObject("info");
166
//                            claimer_name = jsonObject1.getString("claimer");
167
//                            Log.e("claimer", claimer_name);
168
169 157
170 158
                        JSONArray jsonArray = null;
171 159
                        try {
172 160
                            jsonArray = object.getJSONArray("pic");
173
//                            Log.e("pic===&&",jsonArray.toString());
174 161
                        } catch (JSONException e) {
175 162
                            e.printStackTrace();
176 163
                        }
177
//                        Log.e("jsonarray",jsonArray.length()+"");
178
//                            String a[] = new String[jsonArray.length()];
179
//                            Pattern p = Pattern.compile("p");
180
//                            Matcher m;s
181 164
                        String[] strArray = new String[jsonArray.length()];
182 165
                        StringBuffer strbuf = new StringBuffer();
183 166
@ -192,7 +175,6 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
192 175
                            }
193 176
                            Log.e("!!!", MainApplication.url + "/zhannew//uploadfile/" + s);
194 177
                            strbuf.append("|").append(MainApplication.url + "/zhannew//uploadfile/" + s);
195
//                            Log.e("url===", s);
196 178
197 179
                        }
198 180
@ -202,13 +184,11 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
202 184
                        if (jsonArray.length() > 0) {
203 185
                            String result;
204 186
                            str = strbuf.deleteCharAt(0).toString();
205
//                            Log.e("data===",str);
206 187
                            if (str.contains("|")) {
207 188
                                result = str.substring(0, str.indexOf("|"));
208 189
                            } else {
209 190
                                result = str;
210 191
                            }
211
//                            Log.e("result====",result);
212 192
                            final String[] s = str.split("\\|");
213 193
                            detail_picnum.setText(s.length + "");
214 194
@ -219,13 +199,10 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
219 199
                                    .into(detail_zhan_pic);
220 200
221 201
222
//                            ssv.initData(str);
223
//                            Log.e("ssv===",str);
224 202
                            detail_zhan_pic.setOnClickListener(new View.OnClickListener() {
225 203
                                @Override
226 204
                                public void onClick(View v) {
227 205
                                    Intent intent = new Intent(getContext(), ImagePagerActivity.class);
228
//                                    Log.e(TAG, "onClick: s="+s );
229 206
                                    // 图片url,为了演示这里使用常量,一般从数据库中或网络中获取
230 207
                                    intent.putExtra(ImagePagerActivity.EXTRA_IMAGE_URLS, s);
231 208
                                    intent.putExtra(ImagePagerActivity.EXTRA_IMAGE_INDEX, 0);
@ -241,7 +218,6 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
241 218
                                    if (!MainApplication.isLogin()) {
242 219
                                        Toast.makeText(getContext(), "请先登录", Toast.LENGTH_SHORT).show();
243 220
                                        startActivity(new Intent(getContext(), LoginActivity.class));
244
//                    finish();
245 221
                                    } else {
246 222
                                        Intent intent = new Intent(getContext(), AlterOneActivity.class);
247 223
                                        intent.putExtra("zhanname", NewZhanDetailsActivity.zhanname);
@ -249,18 +225,10 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
249 225
                                        intent.putExtra("title", "添加站点图片");
250 226
                                        startActivity(intent);
251 227
                                    }
252
//                                    ToastUtil.showToast(getContext(),"没图片", Toast.LENGTH_SHORT);
253 228
                                }
254 229
                            });
255 230
                        }
256 231
257
258
//                        String info = DES3S.decode(object.getString("info"));
259
//                        Log.e(TAG, "handleMessage: info="+info );
260
261
//                        JSONObject obj = object.getJSONObject("info");
262
263
264 232
                        zhan_id = JsonUtils.getKeyResult(info_decode, "id");
265 233
                        zhan_name = JsonUtils.getKeyResult(info_decode, "zhan_name");
266 234
                        zhan_address = JsonUtils.getKeyResult(info_decode, "zhan_address");
@ -284,6 +252,9 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
284 252
285 253
                        String park_location = JsonUtils.getKeyResult(info_decode, "park_location");
286 254
                        String own_pay = JsonUtils.getKeyResult(info_decode, "own_pay");
255
                        if (detailsFragmentListener != null) {
256
                            detailsFragmentListener.updateScanCharge(own_pay);
257
                        }
287 258
                        String fenshi_info = JsonUtils.getKeyResult(info_decode, "fenshi_info");
288 259
                        String fenshi_is = JsonUtils.getKeyResult(info_decode, "fenshi_is");
289 260
@ -317,11 +288,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
317 288
                                Date curDate = new Date(System.currentTimeMillis());
318 289
                                String token = formatter.format(curDate);
319 290
320
//                                long appTime1 = System.currentTimeMillis() / 1000;
321
//                                String token = String.valueOf(appTime1);
322
//                                Log.e(TAG, "handleMessage: token="+token );
323 291
                                String t = String.valueOf(DateUtils.getShortStringToDate(token));
324
//                                Log.e(TAG, "handleMessage: t="+t );
325 292
                                for (int i = 0; i < datas.size(); i++) {
326 293
                                    if (Integer.parseInt(String.valueOf(DateUtils.getShortStringToDate(datas.get(i).getString("start")))) < Integer.parseInt(t)
327 294
                                            && Integer.parseInt(String.valueOf(DateUtils.getShortStringToDate(datas.get(i).getString("end")))) > Integer.parseInt(t)) {
@ -579,11 +546,6 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
579 546
                case 111:
580 547
                    try {
581 548
                        String mssg = DES.decrypt(msg.obj.toString(), key);
582
//                        System.out.print("mssg==="+mssg);
583
//                    if (NewZhanDetailsActivity.addDetailsFragment != null){
584
//                        NewZhanDetailsActivity.addDetailsFragment.setViewValues(mssg);
585
//                        Log.e("@@@!!!!@##",mssg);
586
//                    }
587 549
                        setViewValues(mssg);
588 550
                    } catch (Exception e) {
589 551
                        e.printStackTrace();
@ -1564,4 +1526,13 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
1564 1526
            }
1565 1527
        });
1566 1528
    }
1529
1530
1531
    public interface OnDetailsFragmentListener {
1532
        void updateScanCharge(String ownPay);
1533
    }
1534
1535
    public void setOnUpdateScanChargeFragmentListener(OnDetailsFragmentListener listener) {
1536
        this.detailsFragmentListener = listener;
1537
    }
1567 1538
}

+ 0 - 9
app/src/main/java/com/electric/chargingpile/view/SlideShowView.java

@ -397,15 +397,6 @@ public class SlideShowView extends FrameLayout {
397 397
//                }
398 398
//                Log.e("imageUrls!",imageUrls);
399 399
                imageUrls = params[0].split("\\|");
400
//                new Thread(new Runnable() {
401
//                    @Override
402
//                    public void run() {
403
//                        DetailsFragment.tv_picnum.setText(imageUrls.length+"");
404
//                    }
405
//                }).start();
406
407
//                System.out.print(imageUrls);
408
//                Log.d("123456",imageUrls.length+"");
409 400
                return true;
410 401
            } catch (Exception e) {
411 402
                e.printStackTrace();

+ 4 - 1
app/src/main/res/layout/activity_new_zhan_details.xml

@ -1,4 +1,5 @@
1 1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
2 3
    android:layout_width="match_parent"
3 4
    android:layout_height="match_parent"
4 5
    android:background="@color/activity_bgcolor"
@ -240,7 +241,9 @@
240 241
            android:layout_width="0dp"
241 242
            android:layout_height="match_parent"
242 243
            android:layout_weight="1"
243
            android:background="#00B536">
244
            android:background="#00B536"
245
            android:visibility="gone"
246
            tools:visibility="visible">
244 247
245 248
            <TextView
246 249
                android:layout_width="wrap_content"

主题详情页开发完成 · 43208863a3 - Gogs: Go Git Service
Parcourir la Source

主题详情页开发完成

huyuguo 7 ans auparavant
Parent
commit
43208863a3

+ 2 - 1
app/build.gradle

258
    compile 'com.android.support:appcompat-v7:26.1.0'
258
    compile 'com.android.support:appcompat-v7:26.1.0'
259
    compile 'com.android.support:design:26.1.0'
259
    compile 'com.android.support:design:26.1.0'
260
    //    compile 'com.nineoldandroids:library:2.4.0'
260
    //    compile 'com.nineoldandroids:library:2.4.0'
261
    compile 'com.github.bumptech.glide:glide:4.1.1'
261
//    compile 'com.github.bumptech.glide:glide:4.1.1'
262
    compile 'com.github.bumptech.glide:glide:4.2.0'
262
    compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
263
    compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
263
    compile 'top.zibin:Luban:1.1.2'
264
    compile 'top.zibin:Luban:1.1.2'
264
    compile 'com.ms-square:expandableTextView:0.1.4'
265
    compile 'com.ms-square:expandableTextView:0.1.4'

+ 104 - 8
app/src/main/java/com/electric/chargingpile/activity/TopicDetailActivity.java

1
package com.electric.chargingpile.activity;
1
package com.electric.chargingpile.activity;
2
2
3
import android.content.Intent;
3
import android.os.Bundle;
4
import android.os.Bundle;
4
import android.support.annotation.Nullable;
5
import android.support.annotation.Nullable;
5
import android.support.v7.app.AppCompatActivity;
6
import android.support.v7.app.AppCompatActivity;
6
import android.support.v7.widget.RecyclerView;
7
import android.support.v7.widget.RecyclerView;
7
import android.support.v7.widget.StaggeredGridLayoutManager;
8
import android.support.v7.widget.StaggeredGridLayoutManager;
9
import android.text.TextUtils;
8
import android.util.Log;
10
import android.util.Log;
9
import android.view.View;
11
import android.view.View;
12
import android.widget.ImageView;
10
import android.widget.TextView;
13
import android.widget.TextView;
11
import android.widget.Toast;
14
import android.widget.Toast;
12
15
14
import com.electric.chargingpile.R;
17
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.adapter.TopicDetailAdapter;
18
import com.electric.chargingpile.adapter.TopicDetailAdapter;
16
import com.electric.chargingpile.application.MainApplication;
19
import com.electric.chargingpile.application.MainApplication;
20
import com.electric.chargingpile.data.ChatRecommendBean;
17
import com.electric.chargingpile.data.HomePageBean;
21
import com.electric.chargingpile.data.HomePageBean;
18
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
22
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
23
import com.electric.chargingpile.manager.ProfileManager;
19
import com.electric.chargingpile.util.CommonParams;
24
import com.electric.chargingpile.util.CommonParams;
20
import com.electric.chargingpile.util.JsonUtils;
25
import com.electric.chargingpile.util.JsonUtils;
26
import com.electric.chargingpile.util.LoadingDialog;
21
import com.electric.chargingpile.util.NetUtil;
27
import com.electric.chargingpile.util.NetUtil;
22
import com.electric.chargingpile.util.ToastUtil;
28
import com.electric.chargingpile.util.ToastUtil;
23
import com.zhy.http.okhttp.OkHttpUtils;
29
import com.zhy.http.okhttp.OkHttpUtils;
33
 */
39
 */
34
public class TopicDetailActivity extends AppCompatActivity implements View.OnClickListener {
40
public class TopicDetailActivity extends AppCompatActivity implements View.OnClickListener {
35
    private static final String TAG = "TopicDetailActivity";
41
    private static final String TAG = "TopicDetailActivity";
42
    public static final int CLICK_PUBLISH_BTN_TOPIC = 1011;
36
    private TextView titleTextView;
43
    private TextView titleTextView;
37
    private XRefreshView xRefreshView;
44
    private XRefreshView xRefreshView;
38
    private RecyclerView recyclerView;
45
    private RecyclerView recyclerView;
46
    private LoadingDialog loadingDialog;
39
47
40
    private int topicId;
48
    private int topicId;
41
    private int sort = 1;
49
    private int sort = 1;
42
    private int page = 1;
50
    private int page = 1;
43
    private TopicDetailAdapter topicDetailAdapter;
51
    private TopicDetailAdapter topicDetailAdapter;
44
    private StaggeredGridLayoutManager staggeredGridLayoutManager;
52
    private StaggeredGridLayoutManager staggeredGridLayoutManager;
53
    public boolean isFirst = false;
54
    private ImageView chatPublishTips;
55
    private ImageView chatPublishIcon;
45
56
46
    @Override
57
    @Override
47
    protected void onCreate(@Nullable Bundle savedInstanceState) {
58
    protected void onCreate(@Nullable Bundle savedInstanceState) {
52
63
53
        if (NetUtil.CheckNetwork(this)) {
64
        if (NetUtil.CheckNetwork(this)) {
54
            xRefreshView.startRefresh();
65
            xRefreshView.startRefresh();
55
            requestData();
66
            requestData("1");
56
        } else {
67
        } else {
57
            // TODO by hyg
68
            // TODO by hyg
58
        }
69
        }
60
71
61
    private void initView() {
72
    private void initView() {
62
        topicId = getIntent().getIntExtra("topicId", 0);
73
        topicId = getIntent().getIntExtra("topicId", 0);
74
        loadingDialog = new LoadingDialog(TopicDetailActivity.this);
75
        loadingDialog.setCanceledOnTouchOutside(false);
76
63
        titleTextView = findViewById(R.id.titleTextView);
77
        titleTextView = findViewById(R.id.titleTextView);
64
        xRefreshView = findViewById(R.id.xRefreshView);
78
        xRefreshView = findViewById(R.id.xRefreshView);
65
        xRefreshView.setPullLoadEnable(true); // 允许加载更多
79
        xRefreshView.setPullLoadEnable(true); // 允许加载更多
66
        xRefreshView.setPinnedTime(1000);
80
        xRefreshView.setPinnedTime(0);
67
        xRefreshView.setMoveForHorizontal(true);
81
        xRefreshView.setMoveForHorizontal(true);
68
        xRefreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
82
        xRefreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
69
            @Override
83
            @Override
70
            public void onRefresh(boolean isPullDown) {
84
            public void onRefresh(boolean isPullDown) {
71
                super.onRefresh(isPullDown);
85
                super.onRefresh(isPullDown);
72
                page = 1;
86
                page = 1;
73
                requestData();
87
                requestData("1");
74
            }
88
            }
75
89
76
            @Override
90
            @Override
77
            public void onLoadMore(boolean isSilence) {
91
            public void onLoadMore(boolean isSilence) {
78
                super.onLoadMore(isSilence);
92
                super.onLoadMore(isSilence);
79
                page++;
93
                page++;
80
                requestData();
94
                requestData("0");
81
            }
95
            }
82
        });
96
        });
83
97
91
        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
105
        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
92
            @Override
106
            @Override
93
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
107
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
94
                // TODO by hyg 发布功能
108
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
109
                    chatPublishIcon.setVisibility(View.VISIBLE);
110
                    if (isFirst) {
111
                        chatPublishTips.setVisibility(View.VISIBLE);
112
                    }
113
                } else if (newState == RecyclerView.SCREEN_STATE_ON) {
114
                    chatPublishIcon.setVisibility(View.GONE);
115
                    if (isFirst) {
116
                        chatPublishTips.setVisibility(View.GONE);
117
                    }
118
                }
95
            }
119
            }
96
120
97
            @Override
121
            @Override
98
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
122
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
123
                super.onScrolled(recyclerView, dx, dy);
99
            }
124
            }
100
        });
125
        });
101
126
102
        recyclerView.setLayoutManager(staggeredGridLayoutManager);
127
        recyclerView.setLayoutManager(staggeredGridLayoutManager);
103
        recyclerView.setAdapter(topicDetailAdapter);
128
        recyclerView.setAdapter(topicDetailAdapter);
129
        recyclerView.addItemDecoration(new TopicDetailAdapter.ContentViewDecoration());
104
        topicDetailAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
130
        topicDetailAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
105
            @Override
131
            @Override
106
            public void onItemClickListener(int position, int index) {
132
            public void onItemClickListener(int position, int index) {
109
            }
135
            }
110
        });
136
        });
111
137
138
112
        topicDetailAdapter.setChooseTopicSortInterface(new TopicDetailAdapter.ChooseTopicSortInterface() {
139
        topicDetailAdapter.setChooseTopicSortInterface(new TopicDetailAdapter.ChooseTopicSortInterface() {
113
            @Override
140
            @Override
114
            public void chooseTopicSort(int s) {
141
            public void chooseTopicSort(int s) {
115
                sort = s;
142
                sort = s;
116
                page = 1;
143
                page = 1;
117
                requestData();
144
                requestData("1");
118
            }
145
            }
119
        });
146
        });
147
148
        chatPublishTips = findViewById(R.id.chatPublishTips);
149
        chatPublishIcon = findViewById(R.id.chatPublishIcon);
150
        chatPublishIcon.setOnClickListener(this);
151
152
        String clickedUserPublishTopic = ProfileManager.getInstance().getClickedUserPublishTopic(getApplicationContext());
153
        if (TextUtils.isEmpty(clickedUserPublishTopic)) {
154
            isFirst = true;
155
            chatPublishTips.setVisibility(View.VISIBLE);
156
        } else {
157
            chatPublishTips.setVisibility(View.GONE);
158
        }
120
    }
159
    }
121
160
122
    private void initListener() {
161
    private void initListener() {
133
            case R.id.shareTextView: // 右上角分享功能
172
            case R.id.shareTextView: // 右上角分享功能
134
                shareInfo();
173
                shareInfo();
135
                break;
174
                break;
175
            case R.id.chatPublishIcon: // 发布功能
176
                if (MainApplication.isLogin()) {
177
                    loginSign();
178
                } else {
179
                    startActivity(new Intent(getApplicationContext().getApplicationContext(), LoginActivity.class));
180
                    ToastUtil.showToast(getApplicationContext().getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
181
                }
182
                break;
136
        }
183
        }
137
184
138
    }
185
    }
141
        // TODO by hyg share information
188
        // TODO by hyg share information
142
    }
189
    }
143
190
144
    private void requestData() {
191
    // 服务器签名验证
192
    private void loginSign() {
193
        String url = MainApplication.urlNew + "/topic/sign.do";
194
        final Map<String, String> map = new HashMap<>();
195
        map.put("fileNames", "android");
196
        map.put("targetType", ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT + "");
197
        CommonParams.addCommonParams(map);
198
        loadingDialog.show();
199
        OkHttpUtils.post().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
200
            @Override
201
            public void onError(Call call, Exception e) {
202
                loadingDialog.dismiss();
203
                ToastUtil.showToast(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT);
204
            }
205
206
            @Override
207
            public void onResponse(String response) {
208
                loadingDialog.dismiss();
209
                String code = JsonUtils.getKeyResult(response, "code");
210
                String desc = JsonUtils.getKeyResult(response, "desc");
211
                if ("1000".equals(code)) {
212
                    chatPublishTips.setVisibility(View.GONE);
213
                    ProfileManager.getInstance().setClickedUserPublishTopic(getApplicationContext(), "label");
214
                    isFirst = false;
215
                    startActivityForResult(new Intent(getApplicationContext(), PublishItemsActivity.class), CLICK_PUBLISH_BTN_TOPIC);
216
                } else if ("8010".equals(code)) {
217
                    startActivity(new Intent(getApplicationContext(), LoginActivity.class));
218
                    ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_LONG);
219
                } else {
220
                    ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
221
                }
222
            }
223
        });
224
225
    }
226
227
    private void requestData(String init) {
145
        String url = MainApplication.urlNew + "/topic/homepage.do";
228
        String url = MainApplication.urlNew + "/topic/homepage.do";
146
        Map<String, String> map = new HashMap<>();
229
        Map<String, String> map = new HashMap<>();
147
        map.put("topicId", topicId + "");
230
        map.put("topicId", topicId + "");
148
        map.put("sort", sort + "");              //   1:最新发布 2:最后回复 3:最热
231
        map.put("sort", sort + "");              //   1:最新发布 2:最后回复 3:最热
149
        map.put("init", "1");                   //   0:只返回话题下内容列表 1:返回话题名等信息
232
        map.put("init", init);                   //   0:只返回话题下内容列表 1:返回话题名等信息
150
        map.put("page", page + "");
233
        map.put("page", page + "");
151
        map.put("limit", "20");
234
        map.put("limit", "20");
152
        CommonParams.addCommonParams(map);
235
        CommonParams.addCommonParams(map);
174
                    HomePageBean homePageBean = (HomePageBean) JsonUtils.parseToObjectBean(data, HomePageBean.class);
257
                    HomePageBean homePageBean = (HomePageBean) JsonUtils.parseToObjectBean(data, HomePageBean.class);
175
                    if (page == 1) {
258
                    if (page == 1) {
176
                        xRefreshView.stopRefresh();
259
                        xRefreshView.stopRefresh();
260
                        xRefreshView.setLoadComplete(false);
177
                        topicDetailAdapter.setHeaderData(homePageBean.topicVo);
261
                        topicDetailAdapter.setHeaderData(homePageBean.topicVo);
178
                        topicDetailAdapter.setContentData(homePageBean.list);
262
                        topicDetailAdapter.setContentData(homePageBean.list);
263
264
                        if (homePageBean.list.size() == 0) {
265
                            topicDetailAdapter.setFooterData(true);
266
                        } else {
267
                            topicDetailAdapter.setFooterData(false);
268
                        }
179
                    } else {
269
                    } else {
270
                        if (homePageBean.list.size() == 0) {
271
                            topicDetailAdapter.setFooterData(true);
272
                            xRefreshView.setLoadComplete(true);
273
                        } else {
274
                            topicDetailAdapter.addContentData(homePageBean.list);
275
                        }
180
                        xRefreshView.stopLoadMore();
276
                        xRefreshView.stopLoadMore();
181
                    }
277
                    }
182
                } else {
278
                } else {

+ 114 - 13
app/src/main/java/com/electric/chargingpile/adapter/TopicDetailAdapter.java

2
2
3
import android.app.Activity;
3
import android.app.Activity;
4
import android.content.Context;
4
import android.content.Context;
5
import android.graphics.Rect;
5
import android.support.constraint.ConstraintLayout;
6
import android.support.constraint.ConstraintLayout;
6
import android.support.v7.widget.RecyclerView;
7
import android.support.v7.widget.RecyclerView;
7
import android.support.v7.widget.StaggeredGridLayoutManager;
8
import android.support.v7.widget.StaggeredGridLayoutManager;
22
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
23
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
23
import com.electric.chargingpile.util.CircleTransform;
24
import com.electric.chargingpile.util.CircleTransform;
24
import com.electric.chargingpile.util.CommonParams;
25
import com.electric.chargingpile.util.CommonParams;
26
import com.electric.chargingpile.util.DensityUtil;
25
import com.electric.chargingpile.util.ImageDisplayUtils;
27
import com.electric.chargingpile.util.ImageDisplayUtils;
26
import com.electric.chargingpile.util.JsonUtils;
28
import com.electric.chargingpile.util.JsonUtils;
29
import com.electric.chargingpile.util.ScreenUtils;
27
import com.electric.chargingpile.util.ToastUtil;
30
import com.electric.chargingpile.util.ToastUtil;
28
import com.electric.chargingpile.view.SortTopicPopWindow;
31
import com.electric.chargingpile.view.SortTopicPopWindow;
29
import com.squareup.picasso.Picasso;
32
import com.squareup.picasso.Picasso;
30
import com.zhy.http.okhttp.OkHttpUtils;
33
import com.zhy.http.okhttp.OkHttpUtils;
31
import com.zhy.http.okhttp.callback.StringCallback;
34
import com.zhy.http.okhttp.callback.StringCallback;
32
35
36
import org.w3c.dom.Text;
37
33
import java.util.ArrayList;
38
import java.util.ArrayList;
34
import java.util.HashMap;
39
import java.util.HashMap;
35
import java.util.List;
40
import java.util.List;
41
    private static final String TAG = "TopicDetailAdapter";
46
    private static final String TAG = "TopicDetailAdapter";
42
    public static final int TOPIC_DETAIL_HEADER = 1;
47
    public static final int TOPIC_DETAIL_HEADER = 1;
43
    public static final int TOPIC_DETAIL_CONTENT = 2;
48
    public static final int TOPIC_DETAIL_CONTENT = 2;
49
    public static final int TOPIC_DETAIL_FOOTER = 3;
44
    private int sort = 1;
50
    private int sort = 1;
45
    private Context context;
51
    private Context context;
46
    private Activity activity;
52
    private Activity activity;
49
    private HomePageBean.HomePageTopicBean topicDetailBean;
55
    private HomePageBean.HomePageTopicBean topicDetailBean;
50
    private RecyclerItemTypeClickListener onRecyclerItemClickListener;
56
    private RecyclerItemTypeClickListener onRecyclerItemClickListener;
51
    private ChooseTopicSortInterface chooseTopicSortInterface;
57
    private ChooseTopicSortInterface chooseTopicSortInterface;
58
    private final int screenWidth;
59
    private final int screenHeight;
60
    private final int statusHeight;
61
    private final int headerHeight;
62
    private int itemWidth;
63
    private boolean showFooter = false;
52
64
53
    public TopicDetailAdapter(Context context, Activity activity) {
65
    public TopicDetailAdapter(Context context, Activity activity) {
54
        this.context = context;
66
        this.context = context;
55
        this.activity = activity;
67
        this.activity = activity;
56
        this.layoutInflater = LayoutInflater.from(context);
68
        this.layoutInflater = LayoutInflater.from(context);
57
        beanLab = TopicDetailBeanLab.get(context);
69
        beanLab = TopicDetailBeanLab.get(context);
70
71
        screenWidth = ScreenUtils.getScreenWidth(context);
72
        screenHeight = ScreenUtils.getScreenHeight(context);
73
        statusHeight = ScreenUtils.getStatusHeight(context);
74
        headerHeight = DensityUtil.dip2px(context, 260);
75
        itemWidth = (screenWidth - DensityUtil.dip2px(context, 10 * 2)) / 2;
58
    }
76
    }
59
77
60
    @Override
78
    @Override
70
                itemView = layoutInflater.inflate(R.layout.activity_chat_content, parent, false);
88
                itemView = layoutInflater.inflate(R.layout.activity_chat_content, parent, false);
71
                viewHolder = new ContentViewHolder(itemView);
89
                viewHolder = new ContentViewHolder(itemView);
72
                break;
90
                break;
91
            case TOPIC_DETAIL_FOOTER:
92
                itemView = layoutInflater.inflate(R.layout.activity_chat_footer, parent, false);
93
                viewHolder = new FooterViewHolder(itemView);
94
                break;
73
        }
95
        }
74
        return viewHolder;
96
        return viewHolder;
75
    }
97
    }
76
98
77
    @Override
99
    @Override
78
    public void onBindViewHolder(IViewHolder viewHolder, int position) {
100
    public void onBindViewHolder(IViewHolder viewHolder, int position) {
79
        switch (viewHolder.getItemViewType()) {
101
        switch (getItemViewType(position)) {
80
            case TOPIC_DETAIL_HEADER:
102
            case TOPIC_DETAIL_HEADER:
81
                bindHeaderViewHolder(viewHolder, position);
103
                bindHeaderViewHolder(viewHolder, position);
82
                break;
104
                break;
83
            case TOPIC_DETAIL_CONTENT:
105
            case TOPIC_DETAIL_CONTENT:
84
                bindContentViewHolder(viewHolder, position);
106
                bindContentViewHolder(viewHolder, position);
85
                break;
107
                break;
108
            case TOPIC_DETAIL_FOOTER:
109
                bindFooterViewHolder(viewHolder, position);
110
                break;
86
        }
111
        }
87
    }
112
    }
88
113
89
    @Override
114
    @Override
90
    public int getItemCount() {
115
    public int getItemCount() {
91
        return beanLab.beans().size() + 1;
116
        return beanLab.beans().size() + 1 + 1;
92
    }
117
    }
93
118
94
    @Override
119
    @Override
95
    public int getItemViewType(int position) {
120
    public int getItemViewType(int position) {
96
        return position == 0 ? TOPIC_DETAIL_HEADER : TOPIC_DETAIL_CONTENT;
121
        if (position == 0) {
122
            return TOPIC_DETAIL_HEADER;
123
        } else if (position == getItemCount() - 1) {
124
            return TOPIC_DETAIL_FOOTER;
125
        } else {
126
            return TOPIC_DETAIL_CONTENT;
127
        }
97
    }
128
    }
98
129
99
    private void bindHeaderViewHolder(IViewHolder viewHolder, int position) {
130
    private void bindHeaderViewHolder(IViewHolder viewHolder, int position) {
126
                                sortPopWindow.dismiss();
157
                                sortPopWindow.dismiss();
127
                                headerViewHolder.sortTextView.setText("最新发布");
158
                                headerViewHolder.sortTextView.setText("最新发布");
128
                                headerViewHolder.chooseTopicSort(sort);
159
                                headerViewHolder.chooseTopicSort(sort);
129
//                                page = 1;
130
//                                requestData();
131
                                break;
160
                                break;
132
                            case R.id.tv_2:
161
                            case R.id.tv_2:
133
                                sort = 2;
162
                                sort = 2;
134
                                sortPopWindow.dismiss();
163
                                sortPopWindow.dismiss();
135
                                headerViewHolder.sortTextView.setText("最后回复");
164
                                headerViewHolder.sortTextView.setText("最后回复");
136
                                headerViewHolder.chooseTopicSort(sort);
165
                                headerViewHolder.chooseTopicSort(sort);
137
//                                page = 1;
138
//                                requestData();
139
                                break;
166
                                break;
140
                            case R.id.tv_3:
167
                            case R.id.tv_3:
141
                                sort = 3;
168
                                sort = 3;
142
                                sortPopWindow.dismiss();
169
                                sortPopWindow.dismiss();
143
                                headerViewHolder.sortTextView.setText("最热");
170
                                headerViewHolder.sortTextView.setText("最热");
144
                                headerViewHolder.chooseTopicSort(sort);
171
                                headerViewHolder.chooseTopicSort(sort);
145
//                                page = 1;
146
//                                requestData();
147
                                break;
172
                                break;
148
                        }
173
                        }
149
                    }
174
                    }
160
185
161
        final ChatRecommendBean bean = beans.get(position - 1);
186
        final ChatRecommendBean bean = beans.get(position - 1);
162
        ContentViewHolder contentViewHolder = (ContentViewHolder) viewHolder;
187
        ContentViewHolder contentViewHolder = (ContentViewHolder) viewHolder;
188
        ConstraintLayout.LayoutParams coverImageParams = (ConstraintLayout.LayoutParams) contentViewHolder.coverImage.getLayoutParams();
189
        coverImageParams.width = itemWidth;
190
191
        if (bean.coverImgW == 0 || bean.coverImgH == 0) {
192
            coverImageParams.height = (int) (itemWidth * 16f / 9f);
193
        } else {
194
            if ((float) bean.coverImgH / bean.coverImgW > 16f / 9f) {
195
                coverImageParams.height = (int) (itemWidth * 16f / 9f);
196
            } else {
197
                coverImageParams.height = (int) ((float) itemWidth * bean.coverImgH / bean.coverImgW);
198
            }
199
        }
200
        contentViewHolder.coverImage.setLayoutParams(coverImageParams);
163
        ImageDisplayUtils.dispalyImg(context, bean.coverImgUrl, contentViewHolder.coverImage);
201
        ImageDisplayUtils.dispalyImg(context, bean.coverImgUrl, contentViewHolder.coverImage);
164
        contentViewHolder.videoIcon.setVisibility(bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO ? View.VISIBLE : View.GONE);
165
202
203
        contentViewHolder.videoIcon.setVisibility(bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO ? View.VISIBLE : View.GONE);
166
        contentViewHolder.isTop.setVisibility(bean.isTop == 1 ? View.VISIBLE : View.GONE);
204
        contentViewHolder.isTop.setVisibility(bean.isTop == 1 ? View.VISIBLE : View.GONE);
167
        contentViewHolder.title.setText(bean.title);
205
        contentViewHolder.title.setText(bean.title);
168
        contentViewHolder.authorInfo.setOnClickListener(new View.OnClickListener() {
206
        contentViewHolder.authorInfo.setOnClickListener(new View.OnClickListener() {
248
        });
286
        });
249
    }
287
    }
250
288
289
    private void bindFooterViewHolder(IViewHolder viewHolder, final int position) {
290
        FooterViewHolder footerViewHolder = (FooterViewHolder) viewHolder;
291
        StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) footerViewHolder.footerContainer.getLayoutParams();
292
        layoutParams.setFullSpan(true);
293
294
        footerViewHolder.footerContainer.setVisibility(showFooter ? View.VISIBLE : View.GONE);
295
296
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) footerViewHolder.footerView.getLayoutParams();
297
        if (TopicDetailBeanLab.get(context).beans().size() == 0) {
298
            footerViewHolder.footTextView.setText("还没有任何内容哦,快来抢沙发~");
299
            params.height = DensityUtil.dip2px(context, (screenHeight - headerHeight - statusHeight) / 4);
300
            params.bottomMargin = 0;
301
        } else {
302
            footerViewHolder.footTextView.setText("已经全部加载完毕");
303
            params.height = DensityUtil.dip2px(context, 20);
304
            params.bottomMargin = DensityUtil.dip2px(context, 10);
305
        }
306
307
        if (showFooter == false) {
308
            params.height = 0;
309
            params.bottomMargin = DensityUtil.dip2px(context, 10);
310
        }
311
312
        footerViewHolder.footTextView.setLayoutParams(params);
313
    }
314
251
    private void showAuthorInfo(int position) {
315
    private void showAuthorInfo(int position) {
252
        // TODO
316
        // TODO
253
    }
317
    }
262
    public void addContentData(ArrayList<ChatRecommendBean> beans) {
326
    public void addContentData(ArrayList<ChatRecommendBean> beans) {
263
        int startSize = beanLab.beans().size();
327
        int startSize = beanLab.beans().size();
264
        beanLab.add(beans);
328
        beanLab.add(beans);
265
        int endSize = beanLab.beans().size();
266
        notifyItemRangeChanged(startSize, endSize);
329
        notifyItemRangeChanged(startSize, beans.size());
267
    }
330
    }
268
331
269
    public void setHeaderData(HomePageBean.HomePageTopicBean bean) {
332
    public void setHeaderData(HomePageBean.HomePageTopicBean bean) {
270
        topicDetailBean = bean;
333
        topicDetailBean = bean;
271
    }
334
    }
272
335
336
    public void setFooterData(Boolean showFooter) {
337
        this.showFooter = showFooter;
338
        notifyItemRangeChanged(getItemCount() - 1, 1);
339
    }
340
273
    class HeaderViewHolder extends IViewHolder {
341
    class HeaderViewHolder extends IViewHolder {
274
        ConstraintLayout topicDetailHeader;
342
        ConstraintLayout topicDetailHeader;
275
        ImageView headImage;
343
        ImageView headImage;
303
                chooseTopicSortInterface.chooseTopicSort(sort);
371
                chooseTopicSortInterface.chooseTopicSort(sort);
304
            }
372
            }
305
        }
373
        }
306
307
    }
374
    }
308
375
309
    public class ContentViewHolder extends IViewHolder {
376
    public class ContentViewHolder extends IViewHolder {
347
        }
414
        }
348
    }
415
    }
349
416
417
    public class FooterViewHolder extends IViewHolder {
418
419
        ConstraintLayout footerContainer;
420
        ConstraintLayout footerView;
421
        TextView footTextView;
422
423
        public FooterViewHolder(View itemView) {
424
            super(itemView);
425
            footerContainer = itemView.findViewById(R.id.footerContainer);
426
            footerView = itemView.findViewById(R.id.footerView);
427
            footTextView = itemView.findViewById(R.id.footTextView);
428
        }
429
    }
430
431
    public static class ContentViewDecoration extends RecyclerView.ItemDecoration {
432
        private StaggeredGridLayoutManager.LayoutParams layoutParams;
433
434
        @Override
435
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
436
            layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
437
            int position = parent.getChildAdapterPosition(view);
438
            if (position > 0) {
439
                if (layoutParams.getSpanIndex() % 2 == 0) {
440
                    outRect.left = DensityUtil.dip2px(view.getContext(), 15);
441
                    outRect.right = DensityUtil.dip2px(view.getContext(), 5);
442
                } else {
443
                    outRect.right = DensityUtil.dip2px(view.getContext(), 15);
444
                    outRect.left = DensityUtil.dip2px(view.getContext(), 5);
445
                }
446
            }
447
448
        }
449
    }
450
350
    public void setOnRecyclerItemClickListener(RecyclerItemTypeClickListener onRecyclerItemClickListener) {
451
    public void setOnRecyclerItemClickListener(RecyclerItemTypeClickListener onRecyclerItemClickListener) {
351
        this.onRecyclerItemClickListener = onRecyclerItemClickListener;
452
        this.onRecyclerItemClickListener = onRecyclerItemClickListener;
352
    }
453
    }

+ 5 - 5
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

73
    public static String firstPoint = "";
73
    public static String firstPoint = "";
74
    public static Boolean firstSsyd;
74
    public static Boolean firstSsyd;
75
    public static String password = "";
75
    public static String password = "";
76
//    public static String url = "http://59.110.68.162";// 充电桩测试环境
77
    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
78
//    public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
79
    public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
80
    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
76
    public static String url = "http://59.110.68.162";// 充电桩测试环境
77
//    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
78
    public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
79
//    public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
80
    public static String pic_url = "http:/s/cdz.evcharge.cc/zhannew/uploadfile/";
81
    //	public static String url = "https://cdz.d1ev.com";
81
    //	public static String url = "https://cdz.d1ev.com";
82
    public static String build_flag = "0";
82
    public static String build_flag = "0";
83
    public static String support = "0";
83
    public static String support = "0";

+ 11 - 0
app/src/main/java/com/electric/chargingpile/manager/ProfileManager.java

60
    private static final String KEY_DATA_UPTIME = "key_data_uptime";
60
    private static final String KEY_DATA_UPTIME = "key_data_uptime";
61
    private static final String KEY_FIND_DATE = "key_find_date";
61
    private static final String KEY_FIND_DATE = "key_find_date";
62
    private static final String KEY_ADD_COME_FIRST = "key_add_come_first";
62
    private static final String KEY_ADD_COME_FIRST = "key_add_come_first";
63
    private static final String KEY_CLICKED_USER_PUBLISH_TOPIC = "key_clicked_user_publish_topic";
63
    private static final String KEY_CLICKED_USER_PUBLISH_ROLE = "key_clicked_user_publish_role";
64
    private static final String KEY_CLICKED_USER_PUBLISH_ROLE = "key_clicked_user_publish_role";
64

65

65
    private static ProfileManager instance;
66
    private static ProfileManager instance;
187
                .putString(KEY_ADD_COME_FIRST, content);
188
                .putString(KEY_ADD_COME_FIRST, content);
188
    }
189
    }
189

190

191
    public void setClickedUserPublishTopic(Context context, String content) {
192
        PreferenceManager.getInstance(context)
193
                .putString(KEY_CLICKED_USER_PUBLISH_TOPIC, content);
194
    }
195

190
    public void setClickedUserPublishRole(Context context, String content) {
196
    public void setClickedUserPublishRole(Context context, String content) {
191
        PreferenceManager.getInstance(context)
197
        PreferenceManager.getInstance(context)
192
                .putString(KEY_CLICKED_USER_PUBLISH_ROLE, content);
198
                .putString(KEY_CLICKED_USER_PUBLISH_ROLE, content);
505
                "");
511
                "");
506
    }
512
    }
507

513

514
    public String getClickedUserPublishTopic(Context context) {
515
        return PreferenceManager.getInstance(context).getString(KEY_CLICKED_USER_PUBLISH_TOPIC,
516
                "");
517
    }
518

508
    public String getClickedUserPublishRole(Context context) {
519
    public String getClickedUserPublishRole(Context context) {
509
        return PreferenceManager.getInstance(context).getString(KEY_CLICKED_USER_PUBLISH_ROLE,
520
        return PreferenceManager.getInstance(context).getString(KEY_CLICKED_USER_PUBLISH_ROLE,
510
                "");
521
                "");

+ 9 - 10
app/src/main/res/layout/activity_chat_content.xml

18
18
19
        <ImageView
19
        <ImageView
20
            android:id="@+id/coverImage"
20
            android:id="@+id/coverImage"
21
            android:layout_width="168dp"
22
            android:layout_height="147dp"
21
            android:layout_width="wrap_content"
22
            android:layout_height="wrap_content"
23
            android:contentDescription="信息图片"
23
            android:contentDescription="信息图片"
24
            android:scaleType="fitXY"
24
            app:layout_constraintEnd_toEndOf="parent"
25
            app:layout_constraintEnd_toEndOf="parent"
25
            app:layout_constraintStart_toStartOf="parent"
26
            app:layout_constraintStart_toStartOf="parent"
26
            app:layout_constraintTop_toTopOf="parent"
27
            app:layout_constraintTop_toTopOf="parent"
59
            android:id="@+id/title"
60
            android:id="@+id/title"
60
            android:layout_width="0dp"
61
            android:layout_width="0dp"
61
            android:layout_height="wrap_content"
62
            android:layout_height="wrap_content"
62
            android:layout_marginLeft="10dp"
63
            android:layout_marginTop="10dp"
64
            android:layout_marginRight="10dp"
63
            android:paddingLeft="10dp"
64
            android:paddingRight="10dp"
65
            android:paddingTop="10dp"
65
            android:ellipsize="end"
66
            android:ellipsize="end"
66
            android:maxLines="2"
67
            android:maxLines="3"
67
            android:textColor="#222222"
68
            android:textColor="#222222"
68
            android:textSize="15sp"
69
            android:textSize="15sp"
69
            app:layout_constraintEnd_toEndOf="parent"
70
            app:layout_constraintEnd_toEndOf="parent"
74
        <android.support.constraint.ConstraintLayout
75
        <android.support.constraint.ConstraintLayout
75
            android:layout_width="0dp"
76
            android:layout_width="0dp"
76
            android:layout_height="48dp"
77
            android:layout_height="48dp"
78
            android:paddingLeft="10dp"
79
            android:paddingRight="10dp"
77
            app:layout_constraintLeft_toLeftOf="parent"
80
            app:layout_constraintLeft_toLeftOf="parent"
78
            app:layout_constraintRight_toRightOf="parent"
81
            app:layout_constraintRight_toRightOf="parent"
79
            app:layout_constraintTop_toBottomOf="@+id/title">
82
            app:layout_constraintTop_toBottomOf="@+id/title">
82
                android:id="@+id/authorInfo"
85
                android:id="@+id/authorInfo"
83
                android:layout_width="wrap_content"
86
                android:layout_width="wrap_content"
84
                android:layout_height="0dp"
87
                android:layout_height="0dp"
85
                android:paddingLeft="10dp"
86
                android:paddingRight="10dp"
87
                app:layout_constraintBottom_toBottomOf="parent"
88
                app:layout_constraintBottom_toBottomOf="parent"
88
                app:layout_constraintLeft_toLeftOf="parent"
89
                app:layout_constraintLeft_toLeftOf="parent"
89
                app:layout_constraintTop_toTopOf="parent">
90
                app:layout_constraintTop_toTopOf="parent">
114
                android:id="@+id/likeInfo"
115
                android:id="@+id/likeInfo"
115
                android:layout_width="wrap_content"
116
                android:layout_width="wrap_content"
116
                android:layout_height="0dp"
117
                android:layout_height="0dp"
117
                android:paddingLeft="10dp"
118
                android:paddingRight="10dp"
119
                app:layout_constraintBottom_toBottomOf="parent"
118
                app:layout_constraintBottom_toBottomOf="parent"
120
                app:layout_constraintRight_toRightOf="parent"
119
                app:layout_constraintRight_toRightOf="parent"
121
                app:layout_constraintTop_toTopOf="parent">
120
                app:layout_constraintTop_toTopOf="parent">

+ 34 - 0
app/src/main/res/layout/activity_chat_footer.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
5
    android:id="@+id/footerContainer"
6
    android:layout_width="match_parent"
7
    android:layout_height="wrap_content">
8
9
    <android.support.constraint.ConstraintLayout
10
        android:id="@+id/footerView"
11
        android:layout_width="match_parent"
12
        android:layout_height="20dp"
13
        app:layout_constraintBottom_toBottomOf="parent"
14
        app:layout_constraintEnd_toEndOf="parent"
15
        app:layout_constraintStart_toStartOf="parent"
16
        app:layout_constraintTop_toTopOf="parent">
17
18
        <TextView
19
            android:id="@+id/footTextView"
20
            android:layout_width="match_parent"
21
            android:layout_height="match_parent"
22
            android:gravity="center"
23
            android:paddingLeft="30dp"
24
            android:paddingRight="30dp"
25
            android:textColor="#555555"
26
            android:textSize="14sp"
27
            app:layout_constraintBottom_toBottomOf="parent"
28
            app:layout_constraintEnd_toEndOf="parent"
29
            app:layout_constraintStart_toStartOf="parent"
30
            app:layout_constraintTop_toTopOf="parent"
31
            tools:text="已经全部加载完毕" />
32
    </android.support.constraint.ConstraintLayout>
33
34
</android.support.constraint.ConstraintLayout>

+ 0 - 1
app/src/main/res/layout/activity_topic_detail.xml

74
            android:layout_width="match_parent"
74
            android:layout_width="match_parent"
75
            android:layout_height="match_parent"
75
            android:layout_height="match_parent"
76
            android:scrollbars="vertical" />
76
            android:scrollbars="vertical" />
77
78
    </com.andview.refreshview.XRefreshView>
77
    </com.andview.refreshview.XRefreshView>
79
78
80
    <ImageView
79
    <ImageView

+ 2 - 1
zxing/build.gradle

29
    })
29
    })
30
    compile 'pub.devrel:easypermissions:0.2.0'
30
    compile 'pub.devrel:easypermissions:0.2.0'
31
    compile 'com.google.code.gson:gson:2.2.4'
31
    compile 'com.google.code.gson:gson:2.2.4'
32
    compile 'com.github.bumptech.glide:glide:4.1.1'
32
//    compile 'com.github.bumptech.glide:glide:4.1.1'
33
    compile 'com.github.bumptech.glide:glide:4.2.0'
33
    compile 'com.google.zxing:core:+'
34
    compile 'com.google.zxing:core:+'
34
    compile 'com.google.zxing:android-core:+'
35
    compile 'com.google.zxing:android-core:+'
35
    compile 'com.blankj:utilcode:1.9.8'
36
    compile 'com.blankj:utilcode:1.9.8'