public static RelativeLayout paoRl;
350 352
    public static LinearLayout rl_control;
@ -358,7 +360,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
358 360
    private ListView lvZhan;
359 361
    private ZhanAdapter adapter;
360 362
    private long exitTime = 0;
361
    private ImageView iv_clear;
363
    private ImageView iv_clear,imgActivityCenter;
362 364
    private ImageView iv_sceen;
363 365
    private ImageView iv_refresh, iv_route;
364 366
    private ImageView iv_our;
@ -646,32 +648,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
646 648
                //城市站点数量
647 649
                case 4:
648 650
                    try {
649
//                        JSONObject jsonObj = new JSONObject(msg.obj.toString());
650
//                        String data = jsonObj.getString("data");
651
//                        String time = jsonObj.getString("time");
652
//                    String pic = jsonObj.getString("pic");
653
//                        Log.i("data-----",data);
654
////                    Log.i("pic------",pic);
655
//                        String zhan_data = DES3.decode(data);
656
//                        Log.i("zhan_data-----",zhan_data);
657
//
658
////                    Log.d("appTime---", DateUtils.getCurrentDate());
659
//
660
//                        long phpTime = Long.parseLong(time);
661
//
662
//                        Log.i("phpTime(long)---", phpTime+"");
663
//                        long appTime1 = System.currentTimeMillis()/1000;
664
//                        Log.i("appTime(long)---", appTime1+"");
665
//                        cha = appTime1 - phpTime;
666
667
//                    SharedPreferences mySharedPreferences= MainFragment.getSharedPreferences("userName",
668
//                            Activity.MODE_PRIVATE);
669
//                    SharedPreferences.Editor editor = mySharedPreferences.edit();
670
//                    editor.putInt("cha", cha);
671
//                    editor.commit();
672
//                        Log.d("cha(long)---", cha + "");
673
674
675 651
                        try {
676 652
                            String date = JsonUtils.getKeyResult(msg.obj.toString(), "data");
677 653
//                            Log.e("data", date);
@ -933,6 +909,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
933 909
        }
934 910
935 911
        showPostDelayedDialog();
912
        getSwitch();
936 913
//        ConfirmOrderActivity.actionStart(this);
937 914
//        startActivity(new Intent(getApplication(), ChargingStatusActivity.class));
938 915
//        startActivity(new Intent(this, SkipUserInfoActivity.class));
@ -1033,6 +1010,9 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1033 1010
        windowComments = (RelativeLayout) findViewById(R.id.window_rl_comment);
1034 1011
1035 1012
        windowAd = (ImageView) findViewById(R.id.window_iv_ad);
1013
        imgActivityCenter = (ImageView) findViewById(R.id.imgActivityCenter);
1014
1015
1036 1016
        windowGradeImg = (ImageView) findViewById(R.id.window_iv_zhan_grade);
1037 1017
        iv_tuijian_close = (ImageView) findViewById(R.id.iv_tuijian_close);
1038 1018
        iv_tuijian_tip_close = (ImageView) findViewById(R.id.iv_tuijian_tip_close);
@ -1129,6 +1109,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1129 1109
        tv_sortStarLevel = (TextView) findViewById(R.id.tv_sortStarLevel);
1130 1110
        tv_sortStarLevel.setOnClickListener(this);
1131 1111
        tv_sortFreeTime = (TextView) findViewById(R.id.tv_sortFreeTime);
1112
        notificationText = (TextView) findViewById(R.id.notificationText);
1132 1113
        tv_sortFreeTime.setOnClickListener(this);
1133 1114
        rl_mapList = (RelativeLayout) findViewById(R.id.rl_mapList);
1134 1115
        iv_roadCondition = (ImageView) findViewById(R.id.iv_roadCondition);
@ -1186,7 +1167,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1186 1167
////            clickMarker = false;
1187 1168
//            firstOpen = false;
1188 1169
//        }
1189
//        getMessage();
1190 1170
1191 1171
        inBtn = (ImageView) findViewById(R.id.zoomin);
1192 1172
        inBtn.setOnClickListener(this);
@ -1411,6 +1391,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1411 1391
        if (hasLocationPermission() && center == null && mlocationClient!=null) {
1412 1392
            mlocationClient.startLocation();
1413 1393
        }
1394
        getMessage();
1414 1395
    }
1415 1396
1416 1397
    private void searchAll() {
@ -3645,68 +3626,56 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3645 3626
3646 3627
    //获取系统消息
3647 3628
    private void getMessage() {
3648
        new Thread(new Runnable() {
3649
            @Override
3650
            public void run() {
3651
                long appTime1 = System.currentTimeMillis() / 1000;
3652
//                Log.i("appTime(long)---", appTime1 + "");
3653
                String token = String.valueOf(appTime1);
3654
//                Log.e("token", token);
3655
                String url = null;
3656
                if (MainApplication.msgTime.equals("0")) {
3657
                    MainApplication.firstOpenTime = token;
3658
                    ProfileManager.getInstance().setFirstOpenTime(getApplicationContext(), token);
3659
                    MainApplication.msgTime = token;
3660
                    ProfileManager.getInstance().setSystemMsgTime(getApplicationContext(), token);
3661
                }
3662
                try {
3663
                    url = MainApplication.url + "/zhannew/basic/web/index.php/zhangonggao/release?timer=" + MainApplication.msgTime;
3664
//                    Log.e("890", url);
3665
                } catch (Exception e) {
3666
                    e.printStackTrace();
3667
                }
3668
                submitMessage(url);
3669
            }
3670
        }).start();
3671
    }
3629
        long appTime1 = System.currentTimeMillis() / 1000;
3630
        String token = String.valueOf(appTime1);
3672 3631
3673
    private void submitMessage(String sms) {
3632
        if (MainApplication.msgTime.equals("0")) {
3633
            MainApplication.firstOpenTime = token;
3634
            ProfileManager.getInstance().setFirstOpenTime(getApplicationContext(), token);
3635
            MainApplication.msgTime = token;
3636
            ProfileManager.getInstance().setSystemMsgTime(getApplicationContext(), token);
3637
        }
3638
        String url = MainApplication.url + "/zhannew/basic/web/index.php/zhangonggao/release2?timer=" + MainApplication.msgTime;
3639
//        Log.e(TAG, "onResponse hc url: "+url);
3640
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
3641
            @Override
3642
            public void onError(Call call, Exception e) {
3674 3643
3675
//        Log.e("url", sms);
3676
        Request request = new Request.Builder().url(sms).build();
3677
        Response response = null;
3678
        try {
3679
            if (request == null) {
3680
                Message msg = new Message();
3681
                msg.what = 5;
3682
                hand.sendMessage(msg);
3683
                return;
3684 3644
            }
3685
            response = OkHttpUtil.execute(request);
3686
            if (response.code() == 200) {
3687
                String json = "";
3645
3646
            @Override
3647
            public void onResponse(String response) {
3688 3648
                try {
3689
                    json = response.body().string();
3690
                    Message msg = new Message();
3691
                    msg.obj = json;
3692
                    msg.what = 7;
3693
                    hand.sendMessage(msg);
3694
//                    Log.e("url", json);
3695
                } catch (Exception e) {
3649
                    JSONArray jsonArray=new JSONArray(response);
3650
                    if (jsonArray.length()>0){
3651
                        JSONObject jsonObject = (JSONObject) jsonArray.get(0);
3652
                        String content = jsonObject.optString("content");
3653
                        String url = jsonObject.optString("url");
3654
                        if (rl_charging_notice.getVisibility() != View.VISIBLE){
3655
                            notificationText.setText(content);
3656
                            rl_charging_notice.setOnClickListener(view -> {
3657
                                if (!TextUtils.isEmpty(url)){
3658
                                    Uri.Builder builder = Uri.parse(url).buildUpon();
3659
                                    builder.appendQueryParameter("user_id", MainApplication.userId);
3660
                                    builder.appendQueryParameter("tel", MainApplication.userPhone);
3661
                                    builder.appendQueryParameter("token", MainApplication.userId);
3662
                                    LogUtils.e(builder.toString());
3663
                                    Intent intent = new Intent(getApplicationContext(), MyWebViewActivity.class);
3664
                                    intent.putExtra("url", url);
3665
                                    startActivity(intent);
3666
                                }
3667
                            });
3668
                            rl_charging_notice.setVisibility(View.VISIBLE);
3669
                        }
3670
                    }
3671
                } catch (JSONException e) {
3696 3672
                    e.printStackTrace();
3697
                    Message msg = new Message();
3698
                    msg.what = 5;
3699
                    hand.sendMessage(msg);
3700 3673
                }
3701 3674
            }
3702
        } catch (Exception e) {
3703
            e.printStackTrace();
3704
            Message msg = new Message();
3705
            msg.what = 5;
3706
            hand.sendMessage(msg);
3707
        }
3675
        });
3708 3676
    }
3709 3677
3678
3710 3679
    public void MainMapp() {
3711 3680
        eteCityTime("{\"fun\":\"timer\"}");
3712 3681
        clickMarker = false;
@ -3817,6 +3786,45 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3817 3786
3818 3787
    }
3819 3788
3789
    /**
3790
     * 是否展示 活动中心
3791
     * */
3792
    private void getSwitch(){
3793
        String url =MainApplication.url+"/zhannew/basic/web/index.php/zhangonggao/switch";
3794
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
3795
            @Override
3796
            public void onError(Call call, Exception e) {
3797
3798
            }
3799
3800
            @Override
3801
            public void onResponse(String response) {
3802
                String rtnCode = JsonUtils.getKeyResult(response, "code");
3803
                if (!TextUtils.isEmpty(rtnCode) && rtnCode.equals("100")) {
3804
                    String data = JsonUtils.getKeyResult(response, "data");
3805
                    String url = JsonUtils.getKeyResult(response, "url")==null ?"":JsonUtils.getKeyResult(response, "url");
3806
3807
                    if (!TextUtils.isEmpty(data) && data.equals("1")){
3808
                        imgActivityCenter.setVisibility(View.VISIBLE);
3809
                        imgActivityCenter.setOnClickListener(v->{
3810
                            Uri.Builder builder = Uri.parse(url).buildUpon();
3811
                            builder.appendQueryParameter("user_id", MainApplication.userId);
3812
                            builder.appendQueryParameter("tel", MainApplication.userPhone);
3813
                            builder.appendQueryParameter("token", MainApplication.userId);
3814
                            LogUtils.e(builder.toString());
3815
                            Intent intent = new Intent(getApplicationContext(), MyWebViewActivity.class);
3816
                            intent.putExtra("url", url);
3817
                            startActivity(intent);
3818
                        });
3819
                    }else{
3820
                        imgActivityCenter.setVisibility(View.GONE);
3821
                    }
3822
                }
3823
            }
3824
        });
3825
3826
    }
3827
3820 3828
    //登陆状态判断
3821 3829
    private void setlogin() {
3822 3830
        if (TextUtils
@ -3952,6 +3960,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
3952 3960
                    String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
3953 3961
                    if ("306".equals(rtnCode)) {
3954 3962
                        LogUtils.e("有订单");
3963
                        notificationText.setText("您有一笔订单正在进行中,点击查看详情...");
3955 3964
                        rl_charging_notice.setVisibility(View.VISIBLE);
3956 3965
                        if (firstCheck) {
3957 3966
                            if (isStatusBack == false) {

+ 10 - 1
app/src/main/java/com/electric/chargingpile/activity/SearchActivity.java

@ -79,7 +79,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
79 79
    private TextView tvSearch;
80 80
    private Toast toast = null;
81 81
    private EditText etSearch;
82
    private ImageView ivClear;
82
    private ImageView ivClear,imgNoData;
83 83
    private ListView lvContent;
84 84
    private SearchAdapter adapter;
85 85
    private List<Map<String, String>> addressList = new ArrayList<Map<String, String>>();
@ -132,6 +132,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
132 132
        ivClear = (ImageView) findViewById(R.id.iv_search_clear);
133 133
        ivClear.setOnClickListener(this);
134 134
        no_result = findViewById(R.id.no_result);
135
        imgNoData = findViewById(R.id.imgNoData);
135 136

136 137
        etSearch = (EditText) findViewById(R.id.et_search);
137 138
        etSearch.setOnClickListener(new OnClickListener() {
@ -214,6 +215,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
214 215
                        lvContent.setVisibility(View.GONE);
215 216
                    } else {
216 217
                        no_result.setVisibility(View.GONE);
218
                        imgNoData.setVisibility(View.GONE);
217 219
                        keyWord = s;
218 220
                        doSearchQuery();
219 221
                        doPointNameSearchQuery();
@ -488,8 +490,10 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
488 490

489 491
                            if (addressList.size() == 0 && pointList.size() == 0) {
490 492
                                no_result.setVisibility(View.VISIBLE);
493
                                imgNoData.setVisibility(View.VISIBLE);
491 494
                            } else {
492 495
                                no_result.setVisibility(View.GONE);
496
                                imgNoData.setVisibility(View.GONE);
493 497
                            }
494 498

495 499
                        } catch (Exception e) {
@ -503,9 +507,12 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
503 507

504 508
                        if (addressList.size() == 0 && pointList.size() == 0) {
505 509
                            no_result.setVisibility(View.VISIBLE);
510
                            imgNoData.setVisibility(View.VISIBLE);
506 511
                        } else {
507 512
                            no_result.setVisibility(View.GONE);
513
                            imgNoData.setVisibility(View.GONE);
508 514
                        }
515

509 516
                    }
510 517
                }
511 518
            } else {
@ -1020,8 +1027,10 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
1020 1027

1021 1028
                if (addressList.size() == 0 && pointList.size() == 0) {
1022 1029
                    no_result.setVisibility(View.VISIBLE);
1030
                    imgNoData.setVisibility(View.VISIBLE);
1023 1031
                } else {
1024 1032
                    no_result.setVisibility(View.GONE);
1033
                    imgNoData.setVisibility(View.GONE);
1025 1034
                }
1026 1035
            }
1027 1036
        });

+ 4 - 46
app/src/main/java/com/electric/chargingpile/activity/UserCenterActivity.java

@ -664,7 +664,7 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
664 664
                    MobclickAgent.onEvent(getApplicationContext(), "1093");
665 665
//                    startActivity(new Intent(getApplicationContext(), PersonalPageActivity.class));
666 666
//                    startActivity(new Intent(getApplicationContext(), UserInfoActivity.class));
667
                    startActivity(new Intent(getApplicationContext(), UserPageActivity.class));
667
//                    startActivity(new Intent(getApplicationContext(), UserPageActivity.class));
668 668
                }
669 669
            });
670 670
            ll_userLogin.setVisibility(View.INVISIBLE);
@ -1609,53 +1609,11 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
1609 1609
                    String log_day = JsonUtils.getKeyResult(rtnMsg, "log_day");
1610 1610
                    String score = JsonUtils.getKeyResult(rtnMsg, "plusScore");
1611 1611
1612
                    String third = "", second = "", first = "";
1613
1614
                    int length = log_day.length();
1615
1616
                    char words[] = log_day.toCharArray();
1617
                    if (length == 1) {
1618
                        third = "";
1619
                        second = "";
1620
                        first = String.valueOf(words[0]);
1621
                    } else if (length == 2) {
1622
                        third = "";
1623
                        second = String.valueOf(words[0]);
1624
                        first = String.valueOf(words[1]);
1625
                    } else if (length == 3) {
1626
                        third = String.valueOf(words[0]);
1627
                        second = String.valueOf(words[1]);
1628
                        first = String.valueOf(words[2]);
1629
                    }
1630
1631 1612
1632
//                    String weather = JsonUtils.getKeyResult(rtnMsg,"weather");
1633
////                    Log.e(TAG, "onResponse: weather="+weather );
1634
//                    String status = JsonUtils.getKeyResult(weather,"status");
1635
////                    Log.e(TAG, "onResponse: status="+status );
1636
//                    String results = JsonUtils.getKeyResult(weather,"results");
1637
////                    Log.e(TAG, "onResponse: results="+results );
1638
//                    try {
1639
//                        JSONArray jsArray = new JSONArray(results);
1640
////                        if (jsArray.length() >1) {
1641
//                            String s = jsArray.getString(0);
1642
//                            Log.e(TAG, "onResponse: s=" + s);
1643
//                            String pm25 = JsonUtils.getKeyResult(s, "pm25");//*
1644
//                            Log.e(TAG, "onResponse: pm25=" + pm25);
1645
//                            String weather_data = JsonUtils.getKeyResult(s, "weather_data");
1646
//                            Log.e(TAG, "onResponse: weather_data=" + weather_data);
1647
//                            List<WeatherResults.WeatherDataBean> list = JsonUtils.parseToObjectList(weather_data, WeatherResults.WeatherDataBean.class);
1648
//                            String now_weather = list.get(0).getWeather();//*
1649
//                            String temperature = list.get(0).getTemperature();//*
1650
//                            temperature = temperature.replace(" ", "");
1651
//                            temperature = temperature.substring(0, temperature.length() - 1);
1652
//                            String date = list.get(0).getDate();
1653
//                            String now_temperature = date.substring(date.length() - 4, date.length() - 2);//*
1654
//                            Log.e(TAG, "onResponse: now_weather=" + now_weather + "--temperature=" + temperature + "--now_temperature=" + now_temperature);
1655 1613
                    if (activity == null || activity.isFinishing()) {
1656 1614
                        return;
1657 1615
                    } else {
1658
                        showDialog(third, second, first, score, now_temperature, now_weather, temperature, MainMapActivity.location_city);
1616
                        showDialog(log_day, score, now_temperature, now_weather, temperature, MainMapActivity.location_city);
1659 1617
                    }
1660 1618
1661 1619
@ -1687,11 +1645,11 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
1687 1645
1688 1646
    }
1689 1647
1690
    private void showDialog(String third, String second, String first, String score, String now_temperature, String now_weather, String temperature, String city) {
1648
    private void showDialog(String log_day, String score, String now_temperature, String now_weather, String temperature, String city) {
1691 1649
        SignInDialog signInDialog = new SignInDialog(this);
1692 1650
        signInDialog.builder()
1693 1651
                .setCancelable(true)
1694
                .setTitle(third, second, first, score, city)
1652
                .setTitle(log_day, score, city)
1695 1653
                .setWeatherUI(now_temperature, now_weather, temperature)
1696 1654
                .show();
1697 1655
    }

+ 22 - 80
app/src/main/java/com/electric/chargingpile/activity/ZhanCommentActivity.java

@ -267,7 +267,18 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
267 267
268 268
            @Override
269 269
            public void afterTextChanged(Editable s) {
270
                if (et_pinglun.getText().toString().equals("") && NewZhanDetailsActivity.replaceBlank(et_pinglun.getText().toString()).equals("")) {
270
271
272
                String s1 = et_pinglun.getText().toString();
273
                s1= s1.replace(" " ,"");
274
                if (s1.length() >= 5){
275
                    tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
276
                    tv_make_sure.setEnabled(true);
277
                }else{
278
                    tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
279
                    tv_make_sure.setEnabled(false);
280
                }
281
               /* if (s1.equals("") && NewZhanDetailsActivity.replaceBlank(s1).equals("")) {
271 282
                    if (!star_level.equals("") && !select_s.equals("")) {
272 283
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
273 284
                        tv_make_sure.setEnabled(true);
@ -276,8 +287,8 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
276 287
                        tv_make_sure.setEnabled(false);
277 288
                    }
278 289
                } else {
279
                    Log.e("edit===", et_pinglun.getText().toString());
280
                    if (et_pinglun.getText().toString().equals("#" + MainApplication.huodonglabel + "# ")) {
290
                    Log.e("edit===", s1);
291
                    if (s1.equals("#" + MainApplication.huodonglabel + "# ")) {
281 292
                        if (!star_level.equals("") && !select_s.equals("")) {
282 293
                            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
283 294
                            tv_make_sure.setEnabled(true);
@ -290,8 +301,8 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
290 301
                        tv_make_sure.setEnabled(true);
291 302
                    }
292 303
293
                }
294
                if (!et_pinglun.getText().toString().contains("#" + MainApplication.huodonglabel + "#")) {
304
                }*/
305
                if (!s1.contains("#" + MainApplication.huodonglabel + "#")) {
295 306
                    final LayoutInflater mInflater = LayoutInflater.from(getApplicationContext());
296 307
                    mFlowLayoutTwo.setAdapter(new TagAdapter<String>(mValss) {
297 308
                        @Override
@ -317,29 +328,7 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
317 328
                star_level = String.valueOf(RatingScore);
318 329
                mFlowLayout.setVisibility(View.VISIBLE);
319 330
                select_s = "";
320
                if (et_pinglun.getText().toString().equals("") && NewZhanDetailsActivity.replaceBlank(et_pinglun.getText().toString()).equals("")) {
321
                    if (!star_level.equals("") && !select_s.equals("")) {
322
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
323
                        tv_make_sure.setEnabled(true);
324
                    } else {
325
                        tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
326
                        tv_make_sure.setEnabled(false);
327
                    }
328
                } else {
329
                    if (et_pinglun.getText().toString().equals("#" + MainApplication.huodonglabel + "# ")) {
330
                        if (!star_level.equals("") && !select_s.equals("")) {
331
                            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
332
                            tv_make_sure.setEnabled(true);
333
                        } else {
334
                            tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
335
                            tv_make_sure.setEnabled(false);
336
                        }
337
                    } else {
338
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
339
                        tv_make_sure.setEnabled(true);
340
                    }
341 331
342
                }
343 332
                switch (RatingScore) {
344 333
                    case 1:
345 334
                        if (!MainApplication.level_one.equals("")) {
@ -413,31 +402,7 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
413 402
                    select_ss = MainApplication.huodonglabel;
414 403
                    setTopic();
415 404
                }
416
                if (et_pinglun.getText().toString().equals("") && NewZhanDetailsActivity.replaceBlank(et_pinglun.getText().toString()).equals("")) {
417
                    if (!star_level.equals("") && !select_s.equals("")) {
418
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
419
                        tv_make_sure.setEnabled(true);
420
                    } else {
421
                        tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
422
                        tv_make_sure.setEnabled(false);
423
                    }
424
                } else {
425
                    if (et_pinglun.getText().toString().equals("#" + MainApplication.huodonglabel + "# ")) {
426
//                        tv_make_sure.setBackgroundResource(R.color.huise);
427
//                        tv_make_sure.setEnabled(false);
428
                        if (!star_level.equals("") && !select_s.equals("")) {
429
                            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
430
                            tv_make_sure.setEnabled(true);
431
                        } else {
432
                            tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
433
                            tv_make_sure.setEnabled(false);
434
                        }
435
                    } else {
436
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
437
                        tv_make_sure.setEnabled(true);
438
                    }
439 405
440
                }
441 406
//                Toast.makeText(getApplicationContext(), mVals[position], Toast.LENGTH_SHORT).show();
442 407
                return true;
443 408
            }
@ -646,29 +611,6 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
646 611
                }
647 612
                Log.e("select===", select_s);
648 613
649
650
                if (et_pinglun.getText().toString().equals("") && NewZhanDetailsActivity.replaceBlank(et_pinglun.getText().toString()).equals("")) {
651
                    if (!star_level.equals("") && !select_s.equals("")) {
652
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
653
                        tv_make_sure.setEnabled(true);
654
                    } else {
655
                        tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
656
                        tv_make_sure.setEnabled(false);
657
                    }
658
                } else {
659
                    if (et_pinglun.getText().toString().equals("#" + MainApplication.huodonglabel + "# ")) {
660
                        if (!star_level.equals("") && !select_s.equals("")) {
661
                            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
662
                            tv_make_sure.setEnabled(true);
663
                        } else {
664
                            tv_make_sure.setTextColor(getResources().getColor(R.color.huise));
665
                            tv_make_sure.setEnabled(false);
666
                        }
667
                    } else {
668
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
669
                        tv_make_sure.setEnabled(true);
670
                    }
671
                }
672 614
                return true;
673 615
            }
674 616
        });
@ -1223,8 +1165,8 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
1223 1165
                new Thread(new Runnable() {
1224 1166
                    @Override
1225 1167
                    public void run() {
1226
                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
1227
                        tv_make_sure.setEnabled(true);
1168
//                        tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
1169
//                        tv_make_sure.setEnabled(true);
1228 1170
                    }
1229 1171
                }).start();
1230 1172
@ -1235,10 +1177,10 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
1235 1177
    @Override
1236 1178
    protected void onResume() {
1237 1179
        super.onResume();
1238
        if (Bimp.tempSelectBitmap.size() > 0) {
1239
            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
1240
            tv_make_sure.setEnabled(true);
1241
        }
1180
//        if (Bimp.tempSelectBitmap.size() > 0) {
1181
//            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
1182
//            tv_make_sure.setEnabled(true);
1183
//        }
1242 1184
        mAdapter.notifyDataSetChanged();
1243 1185
1244 1186
        if (mInsterType == 1 && mAdapter.getItemCount() == 1) {

+ 2 - 2
app/src/main/java/com/electric/chargingpile/adapter/CommentTopicAdapter.java

@ -58,8 +58,8 @@ public class CommentTopicAdapter extends RecyclerView.Adapter<CommentTopicAdapte
58 58
59 59
        holder.title.setText(data.getMeg());
60 60
61
        holder.participateText.setText(Util.convetW(data.getPartake_number(),"暂无","车主参与"));
62
        holder.onlookersText.setText(Util.convetW(data.getLook_number(),"暂无","车主围观"));
61
        holder.participateText.setText(data.getPartake_number());
62
        holder.onlookersText.setText(data.getLook_number());
63 63
64 64
        holder.itemView.setOnClickListener(v->{
65 65
            if (mListener!=null)

+ 0 - 8
app/src/main/java/com/electric/chargingpile/adapter/NewPingLunAdapter.java

@ -156,14 +156,6 @@ public class NewPingLunAdapter extends BaseAdapter {
156 156
        {
157 157
            final View finalConvertView2 = convertView;
158 158
            try {
159
                String is_play = TextUtils.isEmpty( datas.get(position).getString("is_play"))?"": datas.get(position).getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
160
161
                if (!TextUtils.isEmpty(is_play) && is_play.equals("1")){
162
                    convertView.setVisibility(View.VISIBLE);
163
                }else{
164
                    convertView.setVisibility(View.GONE);
165
                }
166
167 159
//                "fileUrl":"","thumUrl":""
168 160
                //父级评论图片
169 161
                String fileUrl = datas.get(position).getString("fileUrl");

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

@ -433,13 +433,8 @@ public class ZhanCommentsAapter extends BaseAdapter {
433 433
                    }
434 434
                });
435 435
436
                String is_play = TextUtils.isEmpty( datas.get(position).getString("is_play"))?"": datas.get(position).getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
436
                String type = TextUtils.isEmpty(datas.get(position).getString("type"))?"":datas.get(position).getString("type"); //23 视频,24 图片
437 437
438
                if (!TextUtils.isEmpty(is_play) && is_play.equals("1")){
439
                    convertView.setVisibility(View.VISIBLE);
440
                }else{
441
                    convertView.setVisibility(View.GONE);
442
                }
443 438
444 439
                //父级评论图片
445 440
                String fileUrl = datas.get(position).getString("fileUrl");
@ -448,7 +443,6 @@ public class ZhanCommentsAapter extends BaseAdapter {
448 443
                fileUrl = fileUrl == null?"":fileUrl;
449 444
                file2Url= file2Url == null?"":file2Url;
450 445
                file3Url= file3Url == null?"":file3Url;
451
                String type = TextUtils.isEmpty(datas.get(position).getString("type"))?"":datas.get(position).getString("type"); //23 视频,24 图片
452 446
                if (type.equals("23")){
453 447
                    holder.imgVideo.setVisibility(View.VISIBLE);
454 448
                    holder.imgStart.setVisibility(View.VISIBLE);

+ 6 - 1
app/src/main/java/com/electric/chargingpile/fragment/NewMyMessageFragment.java

@ -136,7 +136,12 @@ public class NewMyMessageFragment extends Fragment {
136 136
                                    JSONObject jsonObject4 = (JSONObject) jsonArray
137 137
                                            .opt(j);
138 138
                                    String is_play = TextUtils.isEmpty( jsonObject4.getString("is_play"))?"": jsonObject4.getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
139
                                    if (is_play.equals("1")){
139
                                    String type = TextUtils.isEmpty(jsonObject4.getString("type"))?"":jsonObject4.getString("type"); //23 视频,24 图片
140
                                    if (type.equals("23")){
141
                                        if (is_play.equals("1")){
142
                                            datas.add(jsonObject4);
143
                                        }
144
                                    }else{
140 145
                                        datas.add(jsonObject4);
141 146
                                    }
142 147
                                }

+ 14 - 4
app/src/main/java/com/electric/chargingpile/fragment/ZhanCommentFragment.java

@ -229,7 +229,7 @@ public class ZhanCommentFragment extends Fragment {
229 229
    public void initCommentData(RankinglistRefreshEvent event) {
230 230
        String url = MainApplication.url + "/zhannew/basic/web/index.php/tpappcomments/get-comments?zhanid=" + NewZhanDetailsActivity.zhan_id + "&page=1";
231 231
//        String url = MainApplication.url+"/zhannew/basic/web/index.php/tpappcomments/get-comments?zhanid=" + NewZhanDetailsActivity.zhan_id + "&page=1";
232
//        Log.e(TAG, "getCommentsData=" + url);
232
        Log.e(TAG, "getCommentsData=" + url);
233 233
        OkHttpUtils.get().url(url)
234 234
                .build().connTimeOut(6000).readTimeOut(6000)
235 235
                .execute(new StringCallback() {
@ -256,7 +256,12 @@ public class ZhanCommentFragment extends Fragment {
256 256
                                for (int j = 0; j < jsonArray.length(); j++) {
257 257
                                    JSONObject jsonObject = (JSONObject) jsonArray.opt(j);
258 258
                                    String is_play = TextUtils.isEmpty( jsonObject.getString("is_play"))?"": jsonObject.getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
259
                                    if (is_play.equals("1")){
259
                                    String type = TextUtils.isEmpty(jsonObject.getString("type"))?"":jsonObject.getString("type"); //23 视频,24 图片
260
                                    if (type.equals("23")){
261
                                        if (is_play.equals("1")){
262
                                            datas.add(jsonObject);
263
                                        }
264
                                    }else {
260 265
                                        datas.add(jsonObject);
261 266
                                    }
262 267
                                }
@ -309,9 +314,14 @@ public class ZhanCommentFragment extends Fragment {
309 314
                                JSONArray jsonArray = new JSONArray(commentData);
310 315
                                for (int j = 0; j < jsonArray.length(); j++) {
311 316
                                    JSONObject jsonObject = (JSONObject) jsonArray.opt(j);
312
                                    String is_play = TextUtils.isEmpty( jsonObject.getString("is_play"))?"": jsonObject.getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
313 317
314
                                    if (is_play.equals("1")){
318
                                    String is_play = TextUtils.isEmpty( jsonObject.getString("is_play"))?"": jsonObject.getString("is_play")  ; //0 审核未通过 item隐藏,1 审核通过,item显示
319
                                    String type = TextUtils.isEmpty(jsonObject.getString("type"))?"":jsonObject.getString("type"); //23 视频,24 图片
320
                                     if (type.equals("23")){
321
                                        if (is_play.equals("1")){
322
                                            datas.add(jsonObject);
323
                                        }
324
                                    }else{
315 325
                                        datas.add(jsonObject);
316 326
                                    }
317 327
                                }

+ 2 - 0
app/src/main/java/com/electric/chargingpile/util/CarTypeUtil.java

@ -26,6 +26,8 @@ public class CarTypeUtil {
26 26
                        name0 = strarray[0];
27 27
                    }
28 28
                    car = name0 + name1;
29
                }else{
30
                    car=s;
29 31
                }
30 32
            }
31 33
        }catch (Exception e) {

+ 45 - 7
app/src/main/java/com/electric/chargingpile/view/SignInDialog.java

@ -1,6 +1,8 @@
1 1
package com.electric.chargingpile.view;
2 2
3 3
import android.content.Context;
4
import android.text.Html;
5
import android.text.TextUtils;
4 6
import android.view.Display;
5 7
import android.view.LayoutInflater;
6 8
import android.view.View;
@ -19,7 +21,7 @@ public class SignInDialog {
19 21
    private Context context;
20 22
    private android.app.Dialog dialog;
21 23
    private Display display;
22
    private TextView tv_num, tv_third, tv_second, tv_first, tv_now_temperature, tv_du, tv_w, tv_pm, tv_city;
24
    private TextView tv_num, tv_third, tv_second, tv_first, tv_now_temperature, tv_du, tv_w, tv_pm, tv_city,tv_2;
23 25
    private LinearLayout dialog_bg;
24 26
25 27
    public SignInDialog(Context context) {
@ -37,6 +39,7 @@ public class SignInDialog {
37 39
        // 获取自定义Dialog布局中的控件
38 40
        dialog_bg = (LinearLayout) view.findViewById(R.id.dialog_bg);
39 41
        tv_num = (TextView) view.findViewById(R.id.tv_num);
42
        tv_2 = (TextView) view.findViewById(R.id.tv_2);
40 43
        tv_third = (TextView) view.findViewById(R.id.tv_third);
41 44
        tv_second = (TextView) view.findViewById(R.id.tv_second);
42 45
        tv_first = (TextView) view.findViewById(R.id.tv_first);
@ -59,13 +62,33 @@ public class SignInDialog {
59 62
        return this;
60 63
    }
61 64
62
    public SignInDialog setTitle(String third, String second, String first, String score, String city) {
63
        if (score != null && !score.equals("")) {
64
            tv_num.setText(score);
65
        } else {
66
            tv_num.setText("");
65
    public SignInDialog setTitle(String log_day, String score, String city) {
66
        String third = "", second = "", first = "";
67
        if (TextUtils.isEmpty(log_day)){
68
            log_day="1";
67 69
        }
68
        tv_num.setText(score);
70
        int length = log_day.length();
71
72
        char words[] = log_day.toCharArray();
73
        if (length == 1) {
74
            third = "";
75
            second = "";
76
            first = String.valueOf(words[0]);
77
        } else if (length == 2) {
78
            third = "";
79
            second = String.valueOf(words[0]);
80
            first = String.valueOf(words[1]);
81
        } else if (length == 3) {
82
            third = String.valueOf(words[0]);
83
            second = String.valueOf(words[1]);
84
            first = String.valueOf(words[2]);
85
        }
86
87
88
89
90
91
69 92
        if (third.equals("")) {
70 93
            tv_third.setText("0");
71 94
        } else {
@ -83,6 +106,21 @@ public class SignInDialog {
83 106
        } else {
84 107
            tv_first.setText(first);
85 108
        }
109
110
        if (score != null && !score.equals("")) {
111
            tv_num.setText(Html.fromHtml("今天签到获得 <font color='#01b637'>"+score+"</font> 个充电币"));
112
            int i = 7 - Integer.parseInt(log_day);
113
            if (i>=0){
114
                tv_2.setText("还有"+ i+"天获得充电优惠哦~");
115
            }
116
        } else {
117
            tv_num.setText("");
118
        }
119
120
        if (Integer.parseInt(log_day)>= 7){
121
            tv_num.setText("充电订单折扣优惠券已到账");
122
            tv_2.setText("充电订单八折");
123
        }
86 124
        return this;
87 125
    }
88 126

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


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


+ 15 - 0
app/src/main/res/layout/activity_main_map.xml

@ -1497,6 +1497,9 @@
1497 1497
            android:visibility="gone">
1498 1498
1499 1499
            <TextView
1500
                android:id="@+id/notificationText"
1501
                android:maxLines="1"
1502
                android:ellipsize="end"
1500 1503
                android:layout_width="match_parent"
1501 1504
                android:layout_height="27dp"
1502 1505
                android:drawableLeft="@drawable/icon_main_order"
@ -1620,6 +1623,18 @@
1620 1623
                tools:visibility="visible" />
1621 1624
1622 1625
            <ImageView
1626
                android:layout_centerVertical="true"
1627
                android:id="@+id/imgActivityCenter"
1628
                android:layout_width="80dp"
1629
                android:layout_height="80dp"
1630
                android:layout_alignParentRight="true"
1631
                android:layout_marginTop="30dp"
1632
                android:layout_marginRight="12dp"
1633
                android:src="@drawable/ic_activity_center"
1634
                android:visibility="gone"
1635
                tools:visibility="visible" />
1636
1637
            <ImageView
1623 1638
                android:id="@+id/iv_route"
1624 1639
                android:layout_width="wrap_content"
1625 1640
                android:layout_height="wrap_content"

+ 27 - 10
app/src/main/res/layout/activity_search.xml

@ -1,20 +1,12 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
3 4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:layout_width="match_parent"
5 6
    android:layout_height="match_parent">
6 7

7
    <TextView
8
        android:id="@+id/no_result"
9
        android:layout_width="match_parent"
10
        android:layout_height="match_parent"
11
        android:gravity="center"
12
        android:text="没有匹配到搜索结果"
13
        android:textColor="#999999"
14
        android:visibility="gone"
15
        tools:visibility="visible"
16
        android:textSize="16sp" />
17 8
    <com.zhy.autolayout.AutoLinearLayout
9
        android:id="@+id/autoLinearLayout"
18 10
        android:layout_width="match_parent"
19 11
        android:layout_height="match_parent"
20 12
        android:background="@color/activity_bgcolor"
@ -189,5 +181,30 @@
189 181
            android:listSelector="@color/transparent" />
190 182
    </com.zhy.autolayout.AutoLinearLayout>
191 183

184
    <ImageView
185
        android:id="@+id/imgNoData"
186
        android:layout_width="wrap_content"
187
        android:layout_height="wrap_content"
188
        android:src="@drawable/ic_no_data_search"
189
        app:layout_constraintBottom_toBottomOf="parent"
190
        app:layout_constraintEnd_toEndOf="parent"
191
        app:layout_constraintStart_toStartOf="parent"
192
        android:visibility="gone"
193
        app:layout_constraintTop_toTopOf="parent" tools:visibility="visible" />
194

195
    <TextView
196
        android:layout_marginTop="28dp"
197
        android:id="@+id/no_result"
198
        android:layout_width="wrap_content"
199
        android:layout_height="wrap_content"
200
        android:gravity="center"
201
        android:text="小主没有您要的内容,请重新输入试试"
202
        android:textColor="#999999"
203
        android:textSize="16sp"
204
        android:visibility="gone"
205
        app:layout_constraintStart_toStartOf="@+id/imgNoData"
206
        app:layout_constraintEnd_toEndOf="@+id/imgNoData"
207
        app:layout_constraintTop_toBottomOf="@+id/imgNoData"
208
        tools:visibility="visible" />
192 209

193 210
</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 1
app/src/main/res/layout/activity_zhan_comment.xml

@ -189,7 +189,7 @@
189 189
                android:layout_marginBottom="7dp"
190 190
                android:background="@color/white"
191 191
                android:gravity="left|top"
192
                android:hint="对本次充电感受如何?跟其他车友分享一下吧~"
192
                android:hint="您的充电体验、站点吐槽、充电趣事,来和其他车友分享吧~"
193 193
                android:paddingLeft="15dp"
194 194
                android:paddingTop="12dp"
195 195
                android:paddingRight="15dp"

+ 3 - 19
app/src/main/res/layout/item_signin.xml

@ -158,28 +158,12 @@
158 158
            android:layout_marginBottom="6dp">
159 159
160 160
            <TextView
161
                android:layout_width="wrap_content"
162
                android:layout_height="wrap_content"
163
                android:text="今天签到获得"
164
                android:textSize="16sp"
165
                android:textColor="@color/ui_62"/>
166
167
            <TextView
168 161
                android:id="@+id/tv_num"
169
                android:layout_width="wrap_content"
162
                android:layout_width="match_parent"
170 163
                android:layout_height="wrap_content"
171 164
                android:text=""
172
                android:textSize="16sp"
173
                android:textColor="@color/lvse"/>
174
175
            <TextView
176
                android:layout_width="wrap_content"
177
                android:layout_height="wrap_content"
178
                android:text="个充电币"
179
                android:textSize="16sp"
180
                android:textColor="@color/ui_62"/>
181
182
165
                android:textColor="@color/ui_62"
166
                android:textSize="16sp" />
183 167
        </LinearLayout>
184 168
185 169
        <TextView

+ 3 - 0
app/src/main/res/layout/item_zhancomments.xml

@ -63,6 +63,7 @@
63 63
                    android:orientation="horizontal">
64 64
65 65
                    <TextView
66
                        android:layout_gravity="center_vertical"
66 67
                        android:id="@+id/tv_pname"
67 68
                        android:layout_width="wrap_content"
68 69
                        android:layout_height="wrap_content"
@ -75,6 +76,7 @@
75 76
                        tools:text="gin" />
76 77
77 78
                    <ImageView
79
                        android:layout_gravity="center_vertical"
78 80
                        android:id="@+id/certified_icon"
79 81
                        android:layout_width="18dp"
80 82
                        android:layout_height="18dp"
@ -83,6 +85,7 @@
83 85
                        android:src="@drawable/certified_icon" />
84 86
85 87
                    <TextView
88
                        android:layout_gravity="center_vertical"
86 89
                        android:id="@+id/tv_pcar"
87 90
                        android:layout_width="match_parent"
88 91
                        android:layout_height="wrap_content"

+ 1 - 1
app/src/main/res/values/strings.xml

@ -18,7 +18,7 @@
18 18
    <string name="updated_at">上次更新于%1$s前</string>
19 19
    <string name="updated_just_now">刚刚更新</string>
20 20
    <string name="time_error">时间有问题</string>
21
    <string name="string_tab_qa">社区</string>
21
    <string name="string_tab_qa">互助</string>
22 22
23 23
24 24
    <string name="main_name">主界面</string>

我的收藏修改 · 9b113d9fa2 - Gogs: Go Git Service
瀏覽代碼

我的收藏修改

huyuguo 5 年之前
父節點
當前提交
9b113d9fa2

+ 89 - 378
app/src/main/java/com/electric/chargingpile/activity/MyCollectActivity.java

@ -1,215 +1,82 @@
1 1
package com.electric.chargingpile.activity;
2 2

3
import android.annotation.TargetApi;
4 3
import android.app.Activity;
5
import android.content.Context;
6 4
import android.content.Intent;
7 5
import android.database.Cursor;
8
import android.os.Build;
6
import android.database.sqlite.SQLiteDatabase;
9 7
import android.os.Bundle;
10
import android.os.Handler;
11
import android.os.Message;
12
import android.util.Log;
13
import android.view.Gravity;
14 8
import android.view.View;
15
import android.view.ViewGroup;
16 9
import android.widget.AdapterView;
17 10
import android.widget.ImageView;
18 11
import android.widget.LinearLayout;
19
import android.widget.ListView;
20
import android.widget.SimpleCursorAdapter;
21 12
import android.widget.Toast;
22 13

14
import androidx.recyclerview.widget.LinearLayoutManager;
15
import androidx.recyclerview.widget.RecyclerView;
16

23 17
import com.electric.chargingpile.R;
24
import com.electric.chargingpile.adapter.CollectAdapter;
18
import com.electric.chargingpile.adapter.MyCollectAdapter;
25 19
import com.electric.chargingpile.application.MainApplication;
26 20
import com.electric.chargingpile.data.CollectData;
27
import com.electric.chargingpile.data.Zhan;
28 21
import com.electric.chargingpile.util.BarColorUtil;
29
import com.electric.chargingpile.util.DES3;
30 22
import com.electric.chargingpile.util.DatabaseHandler;
31
import com.electric.chargingpile.util.OkHttpUtil;
32 23
import com.electric.chargingpile.util.SharedPreferencesHelper;
33 24
import com.electric.chargingpile.view.AlertDialog;
34
import com.electric.chargingpile.view.CustomProgressDialog;
35
import com.google.gson.Gson;
36
import com.google.gson.reflect.TypeToken;
37
import com.squareup.okhttp.Request;
38
import com.squareup.okhttp.Response;
39 25
import com.umeng.analytics.MobclickAgent;
40 26

41
import org.json.JSONObject;
42

43 27
import java.util.ArrayList;
28
import java.util.HashMap;
44 29
import java.util.List;
30
import java.util.Map;
45 31

46
public class MyCollectActivity extends Activity implements
47
        View.OnClickListener, AdapterView.OnItemLongClickListener,
48
        AdapterView.OnItemClickListener {
32
public class MyCollectActivity extends Activity implements View.OnClickListener {
49 33

50 34
    private ImageView back;
51
    private ListView collectListView;
52
    private MainApplication mapp;
53
    private List<Zhan> list = new ArrayList<Zhan>();
35
    private RecyclerView collectListView;
54 36
    private CollectData collectData;
55
    private List<CollectData> mCollect = new ArrayList<CollectData>();
56
    private CollectAdapter adapter;
57 37
    private ImageView tv_share;
58 38
    private LinearLayout ll_collect;
59
    private CustomProgressDialog pd_info;
60
    private Context mContext;
61 39
    int currPos;
62 40
    SharedPreferencesHelper sharedPreferencesHelper;
63

64
    private Handler handler = new Handler() {
65
        // 主线程通过这个方法处理消息
66
        @Override
67
        public void handleMessage(Message msg) {
68
            switch (msg.what) {
69

70
                case 3:
71
//                    Toast.makeText(getActivity(), "服务器处理错误", Toast.LENGTH_SHORT).show();
72
                    break;
73

74
                case 5:
75
                    dismissDialog();
76
                    try {
77
                        JSONObject jsonObj = new JSONObject(msg.obj.toString());
78
                        String data = jsonObj.getString("data");
79
                        String time = jsonObj.getString("time");
80
//                    String pic = jsonObj.getString("pic");
81
                        Log.i("data-----", data);
82
//                    Log.i("pic------",pic);
83
                        String zhan_data = DES3.decode(data);
84
                        Log.i("zhan_data-----", zhan_data);
85

86
//                    Log.d("appTime---", DateUtils.getCurrentDate());
87

88

89
                        try {
90
                            Gson g = new Gson();
91
                            List<Zhan> l = g.fromJson(zhan_data, new TypeToken<List<Zhan>>() {
92
                            }.getType());
93

94

95
                            mapp.collectList.clear();
96
//                            mBaiduMap.clear();
97
                            if (l != null && l.size() > 0) {
98
//                        List<Zhan> ll = DES3.encode(l);
99
                                mapp.collectList.addAll(l);
100
//                                if (list.get(i).getSupplier().equals("特来电"))
101
//                                initOverlay(list);
102

103

104
                            }
105
//                                if (list.get(i).getSupplier().equals("特来电")){
106
//                                    zhanOne=list.get(i);
107
//                                    getDetailThread(list.get(i).getTid());
108
//                                    Log.e("Tid",list.get(i).getTid());
109
//                                }
110
//                                initOverlay(list);
111

112
                            Log.d("dddddd", mapp.collectList.size() + "");
113
//							getData();
114

115

116
                        } catch (Exception e) {
117
                            e.printStackTrace();
118
                        }
119

120
                    } catch (Exception e) {
121
                        e.printStackTrace();
122
                    }
123

124
                    break;
125

126

127
                default:
128
                    break;
129
            }
130
        }
131
    };
41
    private ImageView no_data;
42
    private List<CollectData> mCollectDataList = new ArrayList<CollectData>();
43
    private MyCollectAdapter myCollectAdapter;
132 44

133 45
    @Override
134 46
    protected void onCreate(Bundle savedInstanceState) {
135 47
        super.onCreate(savedInstanceState);
136 48
        setContentView(R.layout.activity_my_collect);
137 49
        BarColorUtil.initStatusBarColor(MyCollectActivity.this);
138
//		Log.d("eeeeee", list.size() + "");
139
        mContext = this;
140

141
        collectListView = ((ListView) findViewById(R.id.collect_listView));
142
        ll_collect = (LinearLayout) findViewById(R.id.ll_collect);
143

144
        MainMap();
145
//		getData();
146

147 50
        initView();
148
//		collectListView.setAdapter(adapter);
149

150

151 51
    }
152 52

153

154
    // 利用SharedPreferences中收藏的数据和获取到的所有数据进行匹配,得到数据源
155
    // 添加顺序
156
    private void getData() {
157
        mapp = (MainApplication) getApplication();
158
        Log.d("aaaaa", mapp.collectList.size() + "");
159
        for (int i = 0; i < mapp.collectList.size(); i++) {
160
            String name = mapp.collectList.get(i).getZhan_name();
161
            if (mapp.sph.getInt(name) != -1) {
162
                list.add(mapp.collectList.get(i));
163
            }
164
        }
165
        Log.d("!!!!!", list.size() + "");
166

167
        initView();
168

169
        if (list.size() == 0) {
170

171

172
            ImageView emptyView = new ImageView(MyCollectActivity.this);
173
            emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
174
            emptyView.setImageResource(R.drawable.bg_collection2_0);
175
            ll_collect.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
176
            emptyView.setVisibility(View.GONE);
177
            ((ViewGroup) collectListView.getParent()).addView(emptyView);
178
            collectListView.setEmptyView(emptyView);
179
        }
180
    }
181

182
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
183 53
    private void initView() {
184
//		adapter = new CollectAdapter(list, this);
185
        collectListView = ((ListView) findViewById(R.id.collect_listView));
186
        back = (ImageView) findViewById(R.id.iv_back);
187
        collectListView.setOnItemClickListener(this);
188
        collectListView.setOnItemLongClickListener(this);
54
        ll_collect = (LinearLayout) findViewById(R.id.ll_collect);
189 55
        tv_share = (ImageView) findViewById(R.id.tv_share);
190 56
        tv_share.setOnClickListener(this);
191

57
        back = (ImageView) findViewById(R.id.iv_back);
192 58
        back.setOnClickListener(this);
59
        no_data = findViewById(R.id.no_data);
60
        collectListView = findViewById(R.id.collect_listView);
61
        List<CollectData> list = getCollectList();
62
        myCollectAdapter = new MyCollectAdapter(this, list);
63
        collectListView.setLayoutManager(new LinearLayoutManager(this));
64
        collectListView.setAdapter(myCollectAdapter);
65

66
        myCollectAdapter.setOnItemClickListener(new AdapterView.OnItemClickListener() {
67
            @Override
68
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
69
                onCollectItemClick(position);
70
            }
71
        });
193 72

194

195
//		collectListView.setAdapter(adapter);
196
//
197

198
    }
199

200
    public void createDialog() {
201
        if (pd_info == null) {
202
            pd_info = CustomProgressDialog.createDialog(mContext);
203
            pd_info.setMessage("收藏信息加载中");
204
            pd_info.show();
205
        }
206
    }
207

208
    public void dismissDialog() {
209
        if (pd_info != null) {
210
            pd_info.dismiss();
211
            pd_info = null;
212
        }
73
        myCollectAdapter.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
74
            @Override
75
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
76
                onCollectItemLongClick(position);
77
                return true;
78
            }
79
        });
213 80
    }
214 81

215 82
    @Override
@ -224,264 +91,108 @@ public class MyCollectActivity extends Activity implements
224 91
        }
225 92
    }
226 93

227
    public void MainMap() {
94
    public List<CollectData> getCollectList() {
95
        mCollectDataList.clear();
228 96
        DatabaseHandler db = new DatabaseHandler(MyCollectActivity.this, "");
229 97
        Cursor c = db.query();
230
        System.err.println(c.getCount());
231 98
        if (c.getCount() <= 0) {
232
//			Toast.makeText(this,"没有",Toast.LENGTH_SHORT).show();
233
            ImageView emptyView = new ImageView(MyCollectActivity.this);
234
            emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
235
            emptyView.setImageResource(R.drawable.bg_collection2_0);
236
            ll_collect.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
237
            emptyView.setVisibility(View.GONE);
238
            ((ViewGroup) collectListView.getParent()).addView(emptyView);
239
            collectListView.setEmptyView(emptyView);
240
            return;
99
            no_data.setVisibility(View.VISIBLE);
100
            return mCollectDataList;
101
        } else {
102
            no_data.setVisibility(View.GONE);
241 103
        }
242
        String[] from = {"zhan_name", "zhan_address", "fast_num", "slow_num"};
243
        int[] to = {R.id.item_collect_title, R.id.collect_item_address, R.id.item_collect_descriptionOR, R.id.item_collect_descriptionTR};
244
        mCollect.clear();
104

105
        List<CollectData> tmpList = new ArrayList<CollectData>();
245 106
        while (c.moveToNext()) {
246 107
            collectData = new CollectData();
247
            collectData.setZhan_id(c.getString(c
248
                    .getColumnIndex("zhan_id")));
249
            collectData.setZhan_name(c.getString(c
250
                    .getColumnIndex("zhan_name")));
251
            collectData.setZhan_address(c.getString(c
252
                    .getColumnIndex("zhan_address")));
253
            collectData.setFast_num(c.getString(c
254
                    .getColumnIndex("fast_num")));
255
            collectData.setSlow_num(c.getString(c
256
                    .getColumnIndex("slow_num")));
257
            mCollect.add(collectData);
108
            collectData.setZhan_id(c.getString(c.getColumnIndex("zhan_id")));
109
            collectData.setZhan_name(c.getString(c.getColumnIndex("zhan_name")));
110
            collectData.setZhan_address(c.getString(c.getColumnIndex("zhan_address")));
111
            collectData.setFast_num(c.getString(c.getColumnIndex("fast_num")));
112
            collectData.setSlow_num(c.getString(c.getColumnIndex("slow_num")));
113
            tmpList.add(collectData);
258 114
        }
259
        SimpleCursorAdapter adapter = new SimpleCursorAdapter(MyCollectActivity.this, R.layout.item_collect, c, from, to);
260
        collectListView.setAdapter(adapter);
261

262 115

263
    }
116
        String inStr = "(";
117
        for (CollectData data : tmpList) {
118
            inStr += data.getZhan_id() + ",";
119
        }
120
        inStr = inStr.substring(0, inStr.length() - 1);
121
        inStr += ")";
264 122

265
    private void submitShowAll(String sms) {
123
        Map<String, String> map = new HashMap<String, String>();
266 124

267
        Log.e("url", sms);
268
        Request request = new Request.Builder().url(sms).build();
269
        Response response = null;
125
        String sql = "select id,status from zhan_list where status = 4 and id in " + inStr;
126
        String dbPath = "/data/user/0/com.electric.chargingpile/databases/zhan_list";
270 127
        try {
271
            if (request == null) {
272
                Message msg = new Message();
273
                msg.what = 3;
274
                handler.sendMessage(msg);
275
                return;
276
            }
277
            response = OkHttpUtil.execute(request);
278
            if (response.code() == 200) {
279
                String json = "";
280
                try {
281
                    json = response.body().string();
282
                    Message msg = new Message();
283
                    msg.obj = json;
284
                    msg.what = 5;
285
                    handler.sendMessage(msg);
286
                    Log.e("url", json);
287
                } catch (Exception e) {
288
                    e.printStackTrace();
289
                    Message msg = new Message();
290
                    msg.what = 3;
291
                    handler.sendMessage(msg);
292
                }
128
            SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE);
129
            Cursor cursor = sqLiteDatabase.rawQuery(sql, null);
130
            while (cursor.moveToNext()) {
131
                String id = cursor.getString(cursor.getColumnIndex("id"));
132
                String status = cursor.getString(cursor.getColumnIndex("status"));
133
                map.put(id, status);
293 134
            }
135
            cursor.close();
136
            db.close();
294 137
        } catch (Exception e) {
295 138
            e.printStackTrace();
296
            Message msg = new Message();
297
            msg.what = 3;
298
            handler.sendMessage(msg);
299 139
        }
140

141
        for (CollectData d : tmpList) {
142
            if (map.get(d.getZhan_id()) != null) {
143
                mCollectDataList.add(d);
144
            }
145
        }
146
        return mCollectDataList;
300 147
    }
301 148

302
    @Override
303
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
149
    public void onCollectItemClick(int currPos) {
150
        this.currPos = currPos;
304 151
        Intent intent = new Intent(this, NewZhanDetailsActivity.class);
305
        currPos = i;
306
        intent.putExtra("zhan_id", mCollect.get(i).getZhan_id());
152
        intent.putExtra("zhan_id", mCollectDataList.get(currPos).getZhan_id());
307 153
        startActivityForResult(intent, 3);
308 154
        MainApplication.details_flag = "2";
309 155
    }
310 156

311
    @Override
312
    public boolean onItemLongClick(AdapterView<?> adapterView, View view,
313
                                   final int i, long l) {
314
//
315
//		String[] str = new String[] { "删除记录", "取消" };
316
//		Builder dialog = new Builder(MyCollectActivity.this)
317
//				.setTitle("请选择").setItems(str,
318
//						new DialogInterface.OnClickListener() {
319
//							public void onClick(DialogInterface dialog,
320
//									int which) {
321
//								switch (which) {
322
//								case 0:
323
//									SharedPreferencesHelper sharedPreferencesHelper = new SharedPreferencesHelper(
324
//											MyCollectActivity.this);
325
//									sharedPreferencesHelper.removeData(list
326
//											.get(i).getZhan_name());
327
//									list.remove(i);
328
//									Toast.makeText(MyCollectActivity.this,
329
//											"该站信息已删除", Toast.LENGTH_SHORT)
330
//											.show();
331
//									adapter.notifyDataSetChanged();
332
//									break;
333
//								case 1:
334
//									dialog.dismiss();
335
//									break;
336
//								default:
337
//									System.out.println("default...");
338
//									break;
339
//								}
340
//							}
341
//						});
342
//		dialog.create();
343
//		dialog.show();
157
    public void onCollectItemLongClick(int currPos) {
344 158
        new AlertDialog(MyCollectActivity.this).builder().setTitle("删除该条收藏")
345 159
                .setMsg("删除后将无法在我的收藏中查看该站信息,请确认是否删除?")
346 160
                .setPositiveButton("删除记录", new View.OnClickListener() {
347 161
                    @Override
348 162
                    public void onClick(View v) {
349
                        sharedPreferencesHelper = new SharedPreferencesHelper(
350
                                MyCollectActivity.this);
163
                        sharedPreferencesHelper = new SharedPreferencesHelper(MyCollectActivity.this);
351 164
                        DatabaseHandler db = new DatabaseHandler(MyCollectActivity.this, "");
352
                        db.del(mCollect.get(i).getZhan_id());
353
                        sharedPreferencesHelper.removeData(mCollect
354
                                .get(i).getZhan_name());
355
                        currPos = i;
356
                        mCollect.remove(i);
357
                        Toast.makeText(MyCollectActivity.this,
358
                                "删除记录成功", Toast.LENGTH_SHORT)
359
                                .show();
360
//						adapter.notifyDataSetChanged();
361
//						DatabaseHandler db = new DatabaseHandler(MyCollectActivity.this,"");
362
                        Cursor c = db.query();
363
                        System.err.println(c.getCount());
364
                        if (c.getCount() <= 0) {
365
//							Toast.makeText(this,"没有",Toast.LENGTH_SHORT).show();
366
                            collectListView.setVisibility(View.GONE);
367
                            ll_collect.setBackgroundResource(R.drawable.bg_collection2_0);
165
                        db.del(mCollectDataList.get(currPos).getZhan_id());
166
                        sharedPreferencesHelper.removeData(mCollectDataList.get(currPos).getZhan_name());
167
                        mCollectDataList.remove(currPos);
168
                        Toast.makeText(MyCollectActivity.this, "删除记录成功", Toast.LENGTH_SHORT).show();
368 169

369
                            return;
370
                        }
371
                        String[] from = {"zhan_name", "zhan_address", "fast_num", "slow_num"};
372
                        int[] to = {R.id.item_collect_title, R.id.collect_item_address, R.id.item_collect_descriptionOR, R.id.item_collect_descriptionTR};
373
                        mCollect.clear();
374
                        while (c.moveToNext()) {
375
                            collectData = new CollectData();
376
                            collectData.setZhan_id(c.getString(c
377
                                    .getColumnIndex("zhan_id")));
378
                            collectData.setZhan_name(c.getString(c
379
                                    .getColumnIndex("zhan_name")));
380
                            collectData.setZhan_address(c.getString(c
381
                                    .getColumnIndex("zhan_address")));
382
                            collectData.setFast_num(c.getString(c
383
                                    .getColumnIndex("fast_num")));
384
                            collectData.setSlow_num(c.getString(c
385
                                    .getColumnIndex("slow_num")));
386
                            mCollect.add(collectData);
387
                        }
388
                        SimpleCursorAdapter adapter = new SimpleCursorAdapter(MyCollectActivity.this, R.layout.item_collect, c, from, to);
389
                        collectListView.setAdapter(adapter);
390
//						Log.d("listSize",list.size()+"");
391
//						getData();
392
//						if (list.size() == 0){
393
//							ImageView emptyView = new ImageView(MyCollectActivity.this);
394
//							emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
395
//							emptyView.setImageResource(R.drawable.bg_collection2_0);
396
//							ll_collect.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
397
//							emptyView.setVisibility(View.GONE);
398
//							((ViewGroup)collectListView.getParent()).addView(emptyView);
399
//							collectListView.setEmptyView(emptyView);
400
//						}
170
                        List<CollectData> list = getCollectList();
171
                        myCollectAdapter.setData(list);
401 172
                    }
402 173
                }).setNegativeButton("取消", new View.OnClickListener() {
403 174
            @Override
404 175
            public void onClick(View v) {
405

406 176
            }
407 177
        }).show();
408

409
        return true;
410 178
    }
411 179

412 180
    @Override
413 181
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
414

415 182
        //先判断是哪个页面返回过来的
416 183
        switch (requestCode) {
417 184
            case 3:
418

419 185
                //再判断返回过来的情况,是成功还是失败还是其它的什么……
420 186
                switch (resultCode) {
421
                    case 0:
422
                        Log.e("!!!", "没删除");
423
                        //没删除
424
//						Log.e("!!!", "成功了");
425
//						sharedPreferencesHelper = new SharedPreferencesHelper(
426
//								MyCollectActivity.this);
427
//						sharedPreferencesHelper.removeData(list
428
//						.get(currPos).getZhan_name());
429
//						list.remove(currPos);
430
//						adapter.notifyDataSetChanged();
431
                        break;
432
                    case 1:
433
                        //删除
434
//						String d = getIntent().getStringExtra("data");
187
                    case 1: // 删除
188
                        sharedPreferencesHelper = new SharedPreferencesHelper(MyCollectActivity.this);
189
                        sharedPreferencesHelper.removeData(mCollectDataList.get(currPos).getZhan_name());
190
                        mCollectDataList.remove(currPos);
435 191

436
                        Log.e("!!!", "删除");
437
//						Log.e("!!!", d);
438
                        sharedPreferencesHelper = new SharedPreferencesHelper(
439
                                MyCollectActivity.this);
440
                        sharedPreferencesHelper.removeData(mCollect.get(currPos).getZhan_name());
441
                        mCollect.remove(currPos);
442
                        DatabaseHandler db = new DatabaseHandler(MyCollectActivity.this, "");
443
                        Cursor c = db.query();
444
                        System.err.println(c.getCount());
445
                        if (c.getCount() <= 0) {
446
                            collectListView.setVisibility(View.GONE);
447
                            ll_collect.setBackgroundResource(R.drawable.bg_collection2_0);
448
                            return;
449
                        }
450
                        String[] from = {"zhan_name", "zhan_address", "fast_num", "slow_num"};
451
                        int[] to = {R.id.item_collect_title, R.id.collect_item_address, R.id.item_collect_descriptionOR, R.id.item_collect_descriptionTR};
452
                        mCollect.clear();
453
                        while (c.moveToNext()) {
454
                            collectData = new CollectData();
455
                            collectData.setZhan_id(c.getString(c
456
                                    .getColumnIndex("zhan_id")));
457
                            collectData.setZhan_name(c.getString(c
458
                                    .getColumnIndex("zhan_name")));
459
                            collectData.setZhan_address(c.getString(c
460
                                    .getColumnIndex("zhan_address")));
461
                            collectData.setFast_num(c.getString(c
462
                                    .getColumnIndex("fast_num")));
463
                            collectData.setSlow_num(c.getString(c
464
                                    .getColumnIndex("slow_num")));
465
                            mCollect.add(collectData);
466
                        }
467
                        SimpleCursorAdapter adapter = new SimpleCursorAdapter(MyCollectActivity.this, R.layout.item_collect, c, from, to);
468
                        collectListView.setAdapter(adapter);
469
///						adapter.notifyDataSetChanged();
470
//						if (list.size() == 0) {
471
//							ImageView emptyView = new ImageView(MyCollectActivity.this);
472
//							emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
473
//							emptyView.setImageResource(R.drawable.bg_collection2_0);
474
//							ll_collect.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
475
//							emptyView.setVisibility(View.GONE);
476
//							((ViewGroup) collectListView.getParent()).addView(emptyView);
477
//							collectListView.setEmptyView(emptyView);
478
//						}
479
                        break;
192
                        List<CollectData> list = getCollectList();
193
                        myCollectAdapter.setData(list);
480 194
                }
481 195
                break;
482
//			case REQUEST_B:
483
//				//同上……
484
//				break;
485 196
        }
486 197
    }
487 198


+ 99 - 0
app/src/main/java/com/electric/chargingpile/adapter/MyCollectAdapter.java

@ -0,0 +1,99 @@
1
package com.electric.chargingpile.adapter;
2
3
import android.content.Context;
4
import android.view.LayoutInflater;
5
import android.view.View;
6
import android.view.ViewGroup;
7
import android.widget.AdapterView;
8
import android.widget.LinearLayout;
9
import android.widget.TextView;
10
11
import androidx.annotation.NonNull;
12
import androidx.recyclerview.widget.RecyclerView;
13
14
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.data.CollectData;
16
17
import java.util.ArrayList;
18
import java.util.List;
19
20
public class MyCollectAdapter extends RecyclerView.Adapter<MyCollectAdapter.MyCollectHolder> {
21
    private Context mContext;
22
    private LayoutInflater mLayoutInflater;
23
    private List<CollectData> mCollect = new ArrayList<CollectData>();
24
25
    public MyCollectAdapter(Context context, List<CollectData> list) {
26
        mContext = context;
27
        this.mCollect.addAll(list);
28
        mLayoutInflater = LayoutInflater.from(context);
29
    }
30
31
    @NonNull
32
    @Override
33
    public MyCollectHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
34
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_collect, null);
35
        return new MyCollectAdapter.MyCollectHolder(view);
36
    }
37
38
    @Override
39
    public void onBindViewHolder(@NonNull MyCollectHolder holder, int position) {
40
        CollectData collectData = mCollect.get(position);
41
        holder.name.setText(collectData.getZhan_name());
42
        holder.address.setText(collectData.getZhan_address());
43
44
        holder.item.setOnClickListener(new View.OnClickListener() {
45
            @Override
46
            public void onClick(View v) {
47
                if (onItemClickListener!=null) {
48
                    onItemClickListener.onItemClick(null, null, position, 0);
49
                }
50
            }
51
        });
52
53
        holder.item.setOnLongClickListener(new View.OnLongClickListener() {
54
            @Override
55
            public boolean onLongClick(View v) {
56
                if (onItemLongClickListener != null) {
57
                    onItemLongClickListener.onItemLongClick(null, null, position, 0);
58
                }
59
                return true;
60
            }
61
        });
62
    }
63
64
    @Override
65
    public int getItemCount() {
66
        return mCollect.size();
67
    }
68
69
    public void setData(List<CollectData> list) {
70
        mCollect.clear();
71
        mCollect.addAll(list);
72
        notifyDataSetChanged();
73
    }
74
75
    public class MyCollectHolder extends RecyclerView.ViewHolder {
76
        private final TextView name;
77
        private final TextView address;
78
        private final LinearLayout item;
79
80
        public MyCollectHolder(View itemView) {
81
            super(itemView);
82
            item = itemView.findViewById(R.id.item);
83
            name = itemView.findViewById(R.id.name);
84
            address = itemView.findViewById(R.id.address);
85
        }
86
    }
87
88
    AdapterView.OnItemClickListener onItemClickListener;
89
    AdapterView.OnItemLongClickListener onItemLongClickListener;
90
91
    public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
92
        this.onItemClickListener = onItemClickListener;
93
    }
94
95
    public void setOnItemLongClickListener(AdapterView.OnItemLongClickListener onItemLongClickListener) {
96
        this.onItemLongClickListener = onItemLongClickListener;
97
    }
98
99
}

+ 29 - 26
app/src/main/res/layout/activity_my_collect.xml

@ -1,9 +1,8 @@
1
<com.zhy.autolayout.AutoLinearLayout
2
    xmlns:android="http://schemas.android.com/apk/res/android"
3
              xmlns:tools="http://schemas.android.com/tools"
4
              android:layout_width="match_parent"
5
              android:layout_height="match_parent"
1
<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
6 3
    android:id="@+id/ll_collect"
4
    android:layout_width="match_parent"
5
    android:layout_height="match_parent"
7 6
    android:background="@drawable/bg_collection2_0"
8 7
    android:orientation="vertical">
9 8

@ -12,6 +11,7 @@
12 11
        android:layout_width="match_parent"
13 12
        android:layout_height="130px"
14 13
        android:background="@color/title_background">
14

15 15
        <ImageView
16 16
            android:id="@+id/iv_back"
17 17
            android:layout_width="wrap_content"
@ -19,55 +19,58 @@
19 19
            android:layout_alignParentLeft="true"
20 20
            android:layout_centerVertical="true"
21 21
            android:contentDescription="@null"
22
            android:paddingBottom="4dp"
23 22
            android:paddingLeft="44px"
24
            android:paddingRight="44px"
25 23
            android:paddingTop="4dp"
24
            android:paddingRight="44px"
25
            android:paddingBottom="4dp"
26 26
            android:src="@drawable/icon_lvback1119" />
27

27 28
        <TextView
28 29
            android:layout_width="wrap_content"
29 30
            android:layout_height="match_parent"
31
            android:layout_centerInParent="true"
32
            android:gravity="center"
30 33
            android:text="我的收藏"
31 34
            android:textColor="#222222"
32
            android:textSize="16sp"
33
            android:gravity="center"
34
            android:layout_centerInParent="true"
35
            />
35
            android:textSize="16sp" />
36 36

37 37
        <ImageView
38 38
            android:id="@+id/tv_share"
39 39
            android:layout_width="wrap_content"
40 40
            android:layout_height="match_parent"
41
            android:paddingRight="16dp"
41
            android:layout_alignParentEnd="true"
42
            android:layout_alignParentRight="true"
43
            android:layout_centerVertical="true"
44
            android:gravity="center"
42 45
            android:paddingLeft="16dp"
46
            android:paddingRight="16dp"
43 47
            android:src="@drawable/icon_more1124"
44
            android:gravity="center"
45 48
            android:textColor="@color/titleone"
46
            android:layout_centerVertical="true"
47
            android:layout_alignParentRight="true"
48
            android:layout_alignParentEnd="true"
49
            android:visibility="gone"/>
49
            android:visibility="gone" />
50 50

51 51

52 52
    </com.zhy.autolayout.AutoRelativeLayout>
53

53 54
    <View
54 55
        android:layout_width="match_parent"
55 56
        android:layout_height="0.5dp"
56
        android:background="@color/ui_titleline"/>
57
        android:background="@color/ui_titleline" />
57 58

59
    <ImageView
60
        android:id="@+id/no_data"
61
        android:visibility="gone"
62
        tools:visibility="visible"
63
        android:layout_width="match_parent"
64
        android:layout_height="match_parent"
65
        android:background="@drawable/bg_collection2_0" />
58 66

59
    <ListView
67
    <androidx.recyclerview.widget.RecyclerView
60 68
        android:id="@+id/collect_listView"
61 69
        android:layout_width="match_parent"
62 70
        android:layout_height="match_parent"
63
        android:background="@color/background"
64
        android:divider="@color/Line"
65
        android:dividerHeight="0.5dp"
66 71
        android:layout_below="@+id/rl_title"
72
        android:layout_alignParentStart="true"
67 73
        android:layout_alignParentLeft="true"
68
        android:layout_alignParentStart="true">
69
    </ListView>
70

71

74
        android:background="@color/background" />
72 75

73 76
</com.zhy.autolayout.AutoLinearLayout>

+ 57 - 109
app/src/main/res/layout/item_collect.xml

@ -1,111 +1,59 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
3 4
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    android:background="@color/bg_row">
6

7

8
    <ImageView
9
        android:layout_width="45dp"
10
        android:layout_height="45dp"
11
        android:id="@+id/item_collect_imageView"
12
        android:src="@drawable/icon_listzhan76"
13
        android:layout_marginLeft="8dp"
14
        android:layout_marginTop="16dp"
15
        android:layout_marginBottom="16dp"
16
        android:layout_alignParentTop="true"
17
        android:layout_alignParentLeft="true"
18
        android:layout_alignParentStart="true" />
19

20
    <TextView
21
        android:layout_width="wrap_content"
22
        android:layout_height="wrap_content"
23
        android:text="Medium Text"
24
        android:textColor="@color/ui_65"
25
        android:textSize="15sp"
26
        android:layout_marginLeft="10dp"
27
        android:id="@+id/item_collect_title"
28
        android:maxLines="1"
29
        android:layout_marginTop="18dp"
30
        android:layout_toRightOf="@+id/item_collect_imageView"
31
        android:layout_toEndOf="@+id/item_collect_imageView" />
32

33
    <TextView
34
        android:layout_width="wrap_content"
35
        android:layout_height="wrap_content"
36
        android:textAppearance="?android:attr/textAppearanceSmall"
37
        android:textSize="13sp"
38
        android:textColor="@color/hintColor"
39
        android:layout_marginTop="10dp"
40
        android:drawableLeft="@drawable/icon_fast612"
41
        android:gravity="center"
42
        android:drawablePadding="3dp"
43
        android:visibility="gone"
44
        android:id="@+id/item_collect_descriptionO"
45
        android:layout_below="@+id/item_collect_title"
46
        android:layout_alignLeft="@+id/item_collect_title"
47
        android:layout_alignStart="@+id/item_collect_title" />
48

49
    <TextView
50
        android:layout_width="wrap_content"
51
        android:layout_height="wrap_content"
52
        android:textAppearance="?android:attr/textAppearanceMedium"
53
        android:text="Medium Text"
54
        android:textColor="@color/hintColor"
55
        android:layout_marginTop="5dp"
56
        android:textSize="13sp"
57
        android:maxEms="35"
58
        android:singleLine="true"
59
        android:ellipsize="end"
60
        android:id="@+id/collect_item_address"
61
        android:layout_below="@+id/item_collect_title"
62
        android:layout_alignLeft="@+id/item_collect_descriptionO"
63
        android:layout_alignStart="@+id/item_collect_descriptionO" />
64

65
    <TextView
66
        android:layout_width="wrap_content"
67
        android:layout_height="wrap_content"
68
        android:textAppearance="?android:attr/textAppearanceSmall"
69
        android:textColor="@color/hintColor"
70
        android:textSize="13sp"
71
        android:drawableLeft="@drawable/icon_slow612"
72
        android:drawablePadding="3dp"
73
        android:layout_marginLeft="15dp"
74
        android:visibility="gone"
75
        android:gravity="center"
76
        android:id="@+id/textView16"
77
        android:layout_alignTop="@+id/item_collect_descriptionOR"
78
        android:layout_toRightOf="@+id/item_collect_descriptionOR"
79
        android:layout_toEndOf="@+id/item_collect_descriptionOR" />
80

81
    <TextView
82
        android:layout_width="wrap_content"
83
        android:layout_height="18dp"
84
        android:textAppearance="?android:attr/textAppearanceMedium"
85
        android:text="1"
86
        android:visibility="gone"
87
        android:textSize="14sp"
88
        android:textColor="@color/hintColor"
89
        android:layout_marginLeft="5dp"
90
        android:gravity="center"
91
        android:id="@+id/item_collect_descriptionOR"
92
        android:layout_alignTop="@+id/item_collect_descriptionO"
93
        android:layout_toRightOf="@+id/item_collect_descriptionO"
94
        android:layout_toEndOf="@+id/item_collect_descriptionO" />
95

96
    <TextView
97
        android:layout_width="wrap_content"
98
        android:layout_height="18dp"
99
        android:textAppearance="?android:attr/textAppearanceMedium"
100
        android:text="3"
101
        android:textColor="@color/hintColor"
102
        android:textSize="14sp"
103
        android:gravity="center"
104
        android:visibility="gone"
105
        android:layout_marginLeft="5dp"
106
        android:id="@+id/item_collect_descriptionTR"
107
        android:layout_alignTop="@+id/textView16"
108
        android:layout_toRightOf="@+id/textView16"
109
        android:layout_toEndOf="@+id/textView16" />
110

111
</RelativeLayout>
5
    android:layout_height="wrap_content"
6
    android:background="@color/bg_row"
7
    android:orientation="vertical">
8

9
    <LinearLayout
10
        android:id="@+id/item"
11
        android:layout_width="match_parent"
12
        android:layout_height="wrap_content">
13

14
        <ImageView
15
            android:layout_width="45dp"
16
            android:layout_height="45dp"
17
            android:layout_marginLeft="8dp"
18
            android:layout_marginTop="16dp"
19
            android:layout_marginBottom="16dp"
20
            android:src="@drawable/icon_listzhan76" />
21

22
        <LinearLayout
23
            android:layout_width="match_parent"
24
            android:layout_height="match_parent"
25
            android:layout_marginRight="15dp"
26
            android:orientation="vertical">
27

28
            <TextView
29
                android:id="@+id/name"
30
                android:layout_width="match_parent"
31
                android:layout_height="wrap_content"
32
                android:layout_marginLeft="10dp"
33
                android:layout_marginTop="18dp"
34
                android:maxLines="1"
35
                tools:text="名称"
36
                android:textColor="@color/ui_65"
37
                android:textSize="15sp" />
38

39
            <TextView
40
                android:id="@+id/address"
41
                android:layout_width="wrap_content"
42
                android:layout_height="wrap_content"
43
                android:layout_marginLeft="10dp"
44
                android:layout_marginTop="5dp"
45
                android:ellipsize="end"
46
                android:maxEms="35"
47
                android:singleLine="true"
48
                tools:text="地址"
49
                android:textAppearance="?android:attr/textAppearanceMedium"
50
                android:textColor="@color/hintColor"
51
                android:textSize="13sp" />
52
        </LinearLayout>
53
    </LinearLayout>
54

55
    <View
56
        android:layout_width="match_parent"
57
        android:layout_height="1dp"
58
        android:background="@color/lineColor" />
59
</LinearLayout>