a"> */ 31 31
32 32
    ArrayAdapter<String> adapter;
@ -36,11 +36,12 @@ public class CheXingActivity extends Activity {
36 36
37 37
    Province mProvince;
38 38
39
    @Override
39 40
    public void onCreate(Bundle savedInstanceState) {
40 41
        super.onCreate(savedInstanceState);
41 42
        setContentView(R.layout.activity_che_xing);
42 43
        BarColorUtil.initStatusBarColor(CheXingActivity.this);
43
        mProvince=(Province) this.getIntent().getSerializableExtra("citys");
44
        mProvince = (Province) this.getIntent().getSerializableExtra("citys");
44 45
45 46
        listview = (ListView) this.findViewById(R.id.chexing_list);
46 47
@ -66,13 +67,14 @@ public class CheXingActivity extends Activity {
66 67
        listview.setTextFilterEnabled(true);
67 68
        // 设置ListView的监听事件
68 69
        listview.setOnItemClickListener(new OnItemClickListener() {
70
            @Override
69 71
            public void onItemClick(AdapterView<?> parent, View view,
70 72
                                    int position, long id) {
71 73
                String s = ((TextView) view).getText().toString();
72 74
//				Toast.makeText(getApplicationContext(), s+""+pr.get(position).getCities()+"", Toast.LENGTH_SHORT)
73 75
//						.show();
74 76
75
                Intent intent=new Intent(CheXingActivity.this,UserInfoActivity.class);
77
                Intent intent = new Intent(CheXingActivity.this, UserInfoActivity.class);
76 78
                mProvince.setId(position);
77 79
                intent.putExtra("222", mProvince.getCities().get(position).getName());
78 80
                CheXingActivity.this.setResult(55, intent);
@ -85,10 +87,9 @@ public class CheXingActivity extends Activity {
85 87
    }
86 88
87 89
88
89 90
    @Override
90 91
    public boolean onKeyDown(int keyCode, KeyEvent event) {
91
        Intent intent=new Intent();
92
        Intent intent = new Intent();
92 93
        intent.putExtra("222", "22222222");
93 94
        setResult(55, intent);
94 95
        return super.onKeyDown(keyCode, event);

+ 4 - 12
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -1794,7 +1794,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1794 1794
                    Token = getMD5(String.valueOf((System.currentTimeMillis() / 1000 - cha) / 10) + "qwerty");
1795 1795
                    ete2("{\"fun\":\"init\",\"timer\":" + "\"" + Token + "\"" + "}");
1796 1796
                    MainApplication.uptime = ProfileManager.getInstance().getDataUptime(getApplicationContext());
1797
                    LogUtils.e(MainApplication.uptime);
1798 1797
1799 1798
                    newUpdataZhanData(Token, MainApplication.uptime);
1800 1799
                } catch (Exception e) {
@ -1824,7 +1823,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1824 1823
                    if (EmptyUtils.isNotEmpty(data)) {
1825 1824
                        final List<UpdateZhanDataBean> list = JsonUtils.parseToObjectList(data, UpdateZhanDataBean.class);
1826 1825
                        if (list.size() > 0) {
1827
                            LogUtils.e(list.size());
1828 1826
                            new Thread(new Runnable() {
1829 1827
                                @Override
1830 1828
                                public void run() {
@ -4656,11 +4654,8 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
4656 4654
4657 4655
//        zhan_lists = zhan_listDao.loadAll();
4658 4656
        zhan_lists = zhan_listDao.queryRaw("where status = ? " + MainApplication.sql, new String[]{"4"});
4659
        LogUtils.e(zhan_lists.size() + "-----");
4660
//        Log.e(TAG, "getZhanData: "+"where status = ? "+MainApplication.sql);
4661
        if (onResumeRefresh == true) {
4662
//            Log.e(TAG, "getZhanData: "+"共" );
4663
            ToastUtil.showToast(getApplicationContext(), "共" + zhan_lists.size() + "个符合条件的站点", Toast.LENGTH_SHORT);
4657
         if (onResumeRefresh == true) {
4658
             ToastUtil.showToast(getApplicationContext(), "共" + zhan_lists.size() + "个符合条件的站点", Toast.LENGTH_SHORT);
4664 4659
//            isShow = false;
4665 4660
        }
4666 4661
//        Log.e(TAG, "getZhanData===" + zhan_lists.size());
@ -5857,14 +5852,12 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
5857 5852
5858 5853
            @Override
5859 5854
            public void onResponse(String response) {
5860
                LogUtils.e(response);
5861 5855
                if (EmptyUtils.isNotEmpty(response)) {
5862 5856
                    String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
5863 5857
                    if ("01".equals(rtnCode)) {
5864 5858
                        String data = JsonUtils.getKeyResult(response, "data");
5865 5859
                        List<FindData> list = JsonUtils.parseToObjectList(data, FindData.class);
5866
                        LogUtils.e(list.size());
5867
                        if (list.size() > 0) {
5860
                         if (list.size() > 0) {
5868 5861
                            for (FindData findData : list) {
5869 5862
                                if (findData.getUnread().equals("0")) {
5870 5863
                                    FindActivity.haveFindMessage = true;
@ -5873,8 +5866,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
5873 5866
                                }
5874 5867
                            }
5875 5868
                        }
5876
                        LogUtils.e("123456");
5877
                    }
5869
                     }
5878 5870
                }
5879 5871
5880 5872
            }

+ 0 - 10
app/src/main/java/com/electric/chargingpile/activity/RankingListActivity.java

@ -1,31 +1,21 @@
1 1
package com.electric.chargingpile.activity;
2 2
3
import android.app.Activity;
4 3
import android.content.Intent;
5 4
import android.os.Bundle;
6 5
import android.support.v4.app.FragmentActivity;
7 6
import android.support.v4.view.ViewPager;
8
import android.util.Log;
9 7
import android.view.View;
10 8
import android.widget.ImageView;
11 9
import android.widget.RelativeLayout;
12 10
import android.widget.TextView;
13
import android.widget.Toast;
14 11
15 12
import com.electric.chargingpile.R;
16 13
import com.electric.chargingpile.adapter.ViewPagerFragmentAdapter;
17
import com.electric.chargingpile.application.MainApplication;
18 14
import com.electric.chargingpile.data.MyOtto;
19 15
import com.electric.chargingpile.data.RankinglistRefreshEvent;
20 16
import com.electric.chargingpile.fragment.MonthListFragment;
21
import com.electric.chargingpile.fragment.MyMessageFragment;
22
import com.electric.chargingpile.fragment.NewMyMessageFragment;
23
import com.electric.chargingpile.fragment.SystemInfoFragment;
24 17
import com.electric.chargingpile.fragment.TotalListFragment;
25 18
import com.electric.chargingpile.util.BarColorUtil;
26
import com.electric.chargingpile.util.ToastUtil;
27
28
import de.greenrobot.event.EventBus;
29 19
30 20
public class RankingListActivity extends FragmentActivity implements View.OnClickListener {
31 21
    private ViewPager viewPager;

+ 2 - 1
app/src/main/java/com/electric/chargingpile/activity/SelectPileActivity.java

@ -35,6 +35,7 @@ import com.zhy.http.okhttp.OkHttpUtils;
35 35
import com.zhy.http.okhttp.callback.StringCallback;
36 36
37 37
import org.greenrobot.eventbus.Subscribe;
38
import org.greenrobot.eventbus.ThreadMode;
38 39
39 40
import java.net.URLEncoder;
40 41
import java.util.List;
@ -286,7 +287,7 @@ public class SelectPileActivity extends Activity implements View.OnClickListener
286 287
        }
287 288
    }
288 289
289
    @Subscribe
290
    @Subscribe(threadMode = ThreadMode.MAIN)
290 291
    public void eventHandler(String pileId){
291 292
        result = pileId;
292 293
    }

+ 1 - 2
app/src/main/java/com/electric/chargingpile/activity/UserInfoActivity.java

@ -68,6 +68,7 @@ import com.squareup.picasso.Picasso;
68 68
import com.squareup.picasso.Target;
69 69
import com.umeng.analytics.MobclickAgent;
70 70
71
import org.greenrobot.eventbus.EventBus;
71 72
import org.json.JSONArray;
72 73
import org.json.JSONException;
73 74
import org.json.JSONObject;
@ -82,7 +83,6 @@ import java.util.HashMap;
82 83
import java.util.List;
83 84
import java.util.Map;
84 85
85
import de.greenrobot.event.EventBus;
86 86
import me.iwf.photopicker.PhotoPicker;
87 87
import pub.devrel.easypermissions.AfterPermissionGranted;
88 88
import pub.devrel.easypermissions.EasyPermissions;
@ -141,7 +141,6 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,E
141 141
    @Override
142 142
    protected void onCreate(Bundle savedInstanceState) {
143 143
        super.onCreate(savedInstanceState);
144
        EventBus.getDefault().register(this);
145 144
        BarColorUtil.initStatusBarColor(UserInfoActivity.this);
146 145
        setContentView(R.layout.activity_user_info);
147 146
        dialog = new LoadingDialog(this);

+ 0 - 4
app/src/main/java/com/electric/chargingpile/activity/VideoDetaislActivity.java

@ -28,13 +28,9 @@ public class VideoDetaislActivity extends Activity implements View.OnClickListen
28 28
29 29
    private MyHandler mHandler = new MyHandler(this);
30 30
31
32
33 31
    int position = 0;
34 32
    List<TalkRecommendBean> talkRecommendBeans;
35 33
36
37
38 34
    static class MyHandler extends Handler {
39 35
        private WeakReference<VideoDetaislActivity> mWeakReference;
40 36

+ 5 - 9
app/src/main/java/com/electric/chargingpile/adapter/BrandAdapter.java

@ -4,14 +4,6 @@ package com.electric.chargingpile.adapter;
4 4
 * Created by Demon on 16/7/13.
5 5
 */
6 6
7
import java.util.List;
8
9
import com.electric.chargingpile.R;
10
import com.electric.chargingpile.data.Brand;
11
import com.electric.chargingpile.data.CarType;
12
import com.electric.chargingpile.data.Province;
13
14
15 7
import android.content.Context;
16 8
import android.view.View;
17 9
import android.view.ViewGroup;
@ -19,7 +11,11 @@ import android.widget.BaseAdapter;
19 11
import android.widget.ImageView;
20 12
import android.widget.LinearLayout;
21 13
import android.widget.TextView;
22
import android.widget.Toast;
14
15
import com.electric.chargingpile.R;
16
import com.electric.chargingpile.data.Brand;
17
18
import java.util.List;
23 19
24 20
public class BrandAdapter extends BaseAdapter {
25 21

+ 30 - 13
app/src/main/java/com/electric/chargingpile/adapter/VideoCommentAdapter.java

@ -3,6 +3,8 @@ package com.electric.chargingpile.adapter;
3 3
import android.content.Context;
4 4
import android.support.annotation.NonNull;
5 5
import android.support.v7.widget.RecyclerView;
6
import android.text.TextUtils;
7
import android.view.LayoutInflater;
6 8
import android.view.View;
7 9
import android.view.ViewGroup;
8 10
import android.widget.ImageView;
@ -16,6 +18,8 @@ import com.electric.chargingpile.application.MainApplication;
16 18
import com.electric.chargingpile.base.RecyclerViewHolder;
17 19
import com.electric.chargingpile.data.FindData;
18 20
import com.electric.chargingpile.data.VideoCommentBean;
21
import com.electric.chargingpile.util.CircleTransform;
22
import com.squareup.picasso.Picasso;
19 23
20 24
import java.util.ArrayList;
21 25
import java.util.List;
@ -35,7 +39,8 @@ public class VideoCommentAdapter extends RecyclerView.Adapter<VideoCommentAdapte
35 39
    @NonNull
36 40
    @Override
37 41
    public VideoCommentViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
38
        return null;
42
        View view = LayoutInflater.from(context).inflate(R.layout.item_show_comment, null);
43
        return new VideoCommentViewHolder(view);
39 44
    }
40 45
41 46
    @Override
@ -51,13 +56,25 @@ public class VideoCommentAdapter extends RecyclerView.Adapter<VideoCommentAdapte
51 56
52 57
        viewHolder.mItemUserLikeCount.setText(videoCommentBean.likeNums + "");
53 58
54
55
        Glide.with(context).load(videoCommentBean.headImgFromUser)
56
                .transition(withCrossFade()).into(viewHolder.mItemUserAvatar);
59
        if (TextUtils.isEmpty(videoCommentBean.headImgFromUser)) {
60
            Picasso.with(context)
61
                    .load(R.drawable.icon_face2_0)
62
                    .placeholder(R.drawable.icon_face2_0)
63
                    .error(R.drawable.icon_face2_0)
64
                    .transform(new CircleTransform())
65
                    .into(viewHolder.mItemUserAvatar);
66
        } else {
67
            Picasso.with(context)
68
                    .load(videoCommentBean.headImgFromUser)
69
                    .placeholder(R.drawable.icon_face2_0)
70
                    .error(R.drawable.icon_face2_0)
71
                    .transform(new CircleTransform())
72
                    .into(viewHolder.mItemUserAvatar);
73
        }
57 74
58 75
        viewHolder.mItemUserName.setText(videoCommentBean.nickNameFromUser);
59 76
60
        viewHolder.mItemUserTime.setText(videoCommentBean.addDate + "");
77
        viewHolder.mItemUserTime.setText(videoCommentBean.addTime + "");
61 78
        viewHolder.mItemUserCon.setText(videoCommentBean.content);
62 79
63 80
//        viewHolder.mItemUserOperation = (LinearLayout) itemView.findViewById(R.id.item_user_operation);
@ -67,19 +84,19 @@ public class VideoCommentAdapter extends RecyclerView.Adapter<VideoCommentAdapte
67 84
        } else {
68 85
            viewHolder.mItemUserReportLl.setVisibility(View.GONE);
69 86
        }
70
        if (MainApplication.isLogin()) {
71
            if (videoCommentBean.userId.equals(MainApplication.userId)) {
72
                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
73
            } else {
74
                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
75
            }
76
        }
87
//        if (MainApplication.isLogin()) {
88
//            if (videoCommentBean.userId.equals(MainApplication.userId)) {
89
//                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
90
//            } else {
91
//                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
92
//            }
93
//        }
77 94
78 95
    }
79 96
80 97
    @Override
81 98
    public int getItemCount() {
82
        return 0;
99
        return dataList.size();
83 100
    }
84 101
85 102
    public void cleanData() {

+ 1 - 1
app/src/main/java/com/electric/chargingpile/data/VideoCommentBean.java

@ -17,7 +17,7 @@ public class VideoCommentBean {
17 17
    public String content ;
18 18
    public int likeNums;
19 19
    public int likeFlg;
20
    public long addDate;
20
    public long addTime;
21 21
    public String commentsId;
22 22
    public String commentsId2;
23 23

+ 0 - 5
app/src/main/java/com/electric/chargingpile/fragment/MonthListFragment.java

@ -1,10 +1,8 @@
1 1
package com.electric.chargingpile.fragment;
2 2
3
import android.content.Context;
4 3
import android.content.Intent;
5 4
import android.os.Bundle;
6 5
import android.support.v4.app.Fragment;
7
import android.util.Log;
8 6
import android.view.LayoutInflater;
9 7
import android.view.View;
10 8
import android.view.ViewGroup;
@ -18,14 +16,12 @@ import com.electric.chargingpile.R;
18 16
import com.electric.chargingpile.activity.LoginActivity;
19 17
import com.electric.chargingpile.activity.MainMapActivity;
20 18
import com.electric.chargingpile.adapter.MonthListAdapter;
21
import com.electric.chargingpile.adapter.PingLunAdapter;
22 19
import com.electric.chargingpile.application.MainApplication;
23 20
import com.electric.chargingpile.data.MyOtto;
24 21
import com.electric.chargingpile.data.RankinglistRefreshEvent;
25 22
import com.electric.chargingpile.util.DES3;
26 23
import com.electric.chargingpile.util.JsonUtils;
27 24
import com.electric.chargingpile.util.LoadingDialog;
28
import com.electric.chargingpile.util.PicassoUtil;
29 25
import com.electric.chargingpile.util.ToastUtil;
30 26
import com.electric.chargingpile.util.Util;
31 27
import com.electric.chargingpile.view.CircleImageView;
@ -41,7 +37,6 @@ import org.json.JSONObject;
41 37
import java.net.URLEncoder;
42 38
import java.util.ArrayList;
43 39
44
import de.greenrobot.event.EventBus;
45 40
import okhttp3.Call;
46 41
47 42
public class MonthListFragment extends Fragment {

+ 17 - 2
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

@ -1,6 +1,7 @@
1 1
package com.electric.chargingpile.fragment;
2 2
3 3
import android.app.Activity;
4
import android.net.Uri;
4 5
import android.text.TextUtils;
5 6
import android.util.Log;
6 7
import android.view.LayoutInflater;
@ -17,6 +18,7 @@ import com.electric.chargingpile.data.TalkRecommendBean;
17 18
import com.electric.chargingpile.util.CircleTransform;
18 19
import com.electric.chargingpile.util.JsonUtils;
19 20
import com.electric.chargingpile.util.ToastUtil;
21
import com.electric.chargingpile.view.UpVideoView2;
20 22
import com.electric.chargingpile.view.VideoCommentDialog;
21 23
import com.electric.chargingpile.view.VideoPubilshDialog;
22 24
import com.squareup.picasso.Picasso;
@ -36,6 +38,7 @@ public class SvVideoShowView implements View.OnClickListener {
36 38
    private View view;
37 39
    private ViewGroup viewGroup;
38 40
    private TalkRecommendBean talkRecommendBean;
41
    private UpVideoView2 upVideoView2;
39 42
40 43
41 44
    private LinearLayout sv_show_forward, sv_show_comment_count_ll, sv_show_like_ll,
@ -144,6 +147,16 @@ public class SvVideoShowView implements View.OnClickListener {
144 147
                    .into(sv_show_user_avatar);
145 148
        }
146 149
150
        if (talkRecommendBean.targetType == 23) {
151
            String videoUrl = talkRecommendBean.videoUrl;
152
            videoUrl = "http://uprocess.b0.upaiyun.com/demo/short_video/UPYUN_0.flv";
153
            if (!TextUtils.isEmpty(videoUrl)) {
154
                upVideoView2.setVideoPath(videoUrl);
155
            }
156
        } else if (talkRecommendBean.targetType == 24) {
157
158
        }
159
147 160
        if (talkRecommendBean.likeFlg == 1) {
148 161
//            sv_show_like_img  like
149 162
        } else {
@ -221,7 +234,7 @@ public class SvVideoShowView implements View.OnClickListener {
221 234
    }
222 235
223 236
    private void initPlayer(View view) {
224
237
        upVideoView2 = view.findViewById(R.id.view_show_video);
225 238
    }
226 239
227 240
    private void initZoomPhoto(View view) {
@ -259,7 +272,9 @@ public class SvVideoShowView implements View.OnClickListener {
259 272
    }
260 273
261 274
    public void onDestroy() {
262
275
        if (upVideoView2 != null) {
276
            upVideoView2.release(true);
277
        }
263 278
//释放播放资源
264 279
    }
265 280

+ 0 - 5
app/src/main/java/com/electric/chargingpile/fragment/TotalListFragment.java

@ -12,19 +12,15 @@ import android.widget.ListView;
12 12
import android.widget.RelativeLayout;
13 13
import android.widget.TextView;
14 14
15
import com.alipay.security.mobile.module.commonutils.LOG;
16
import com.bumptech.glide.Glide;
17 15
import com.electric.chargingpile.R;
18 16
import com.electric.chargingpile.activity.LoginActivity;
19 17
import com.electric.chargingpile.activity.MainMapActivity;
20
import com.electric.chargingpile.adapter.MonthListAdapter;
21 18
import com.electric.chargingpile.adapter.TotalListAdapter;
22 19
import com.electric.chargingpile.application.MainApplication;
23 20
import com.electric.chargingpile.data.MyOtto;
24 21
import com.electric.chargingpile.data.RankinglistRefreshEvent;
25 22
import com.electric.chargingpile.util.DES3;
26 23
import com.electric.chargingpile.util.JsonUtils;
27
import com.electric.chargingpile.util.PicassoUtil;
28 24
import com.electric.chargingpile.util.Util;
29 25
import com.electric.chargingpile.view.CircleImageView;
30 26
import com.squareup.otto.Subscribe;
@ -39,7 +35,6 @@ import org.json.JSONObject;
39 35
import java.net.URLEncoder;
40 36
import java.util.ArrayList;
41 37
42
import de.greenrobot.event.EventBus;
43 38
import okhttp3.Call;
44 39
45 40
public class TotalListFragment extends Fragment {

+ 5 - 1
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

@ -4,6 +4,7 @@ import android.app.Dialog;
4 4
import android.content.Context;
5 5
import android.graphics.Color;
6 6
import android.os.Bundle;
7
import android.support.v7.widget.LinearLayoutManager;
7 8
import android.support.v7.widget.RecyclerView;
8 9
import android.text.Editable;
9 10
import android.text.TextUtils;
@ -141,6 +142,9 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
141 142
        showCommentLv = convertView.findViewById(R.id.show_comment_lv);
142 143
        showCommentEd = convertView.findViewById(R.id.show_comment_ed);
143 144
        showCommentPublish = convertView.findViewById(R.id.show_comment_publish);
145
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
146
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
147
        showCommentLv.setLayoutManager(linearLayoutManager);
144 148
        convertView.findViewById(R.id.show_comment_network_retry).setOnClickListener(this);
145 149
        show_comment_progress_ll.setVisibility(View.VISIBLE);
146 150
        showCommentPublish.addTextChangedListener(new TextWatcher() {
@ -212,7 +216,7 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
212 216
        }
213 217
214 218
        OkHttpUtils
215
                .get()
219
                .post()
216 220
                .params(map)
217 221
                .url(url)
218 222
                .build()

+ 9 - 8
app/src/main/res/layout/item_show_comment.xml

@ -1,15 +1,14 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4
    android:layout_height="wrap_content"
5
    android:layout_marginTop="20dp">
4
    android:layout_height="wrap_content">
6 5
7 6
    <LinearLayout
8 7
        android:id="@+id/item_user_comment_like"
9 8
        android:layout_width="wrap_content"
10 9
        android:layout_height="18dp"
11 10
        android:layout_alignParentEnd="true"
12
        android:layout_marginTop="3dp"
11
        android:layout_marginTop="23dp"
13 12
        android:layout_marginEnd="19dp"
14 13
        android:gravity="center_vertical">
15 14
@ -17,7 +16,7 @@
17 16
            android:id="@+id/item_user_like_img"
18 17
            android:layout_width="18dp"
19 18
            android:layout_height="18dp"
20
            android:background="#fff" />
19
            android:background="@drawable/icon_likeed" />
21 20
22 21
        <TextView
23 22
            android:id="@+id/item_user_like_count"
@ -35,8 +34,7 @@
35 34
        android:layout_width="20dp"
36 35
        android:layout_height="20dp"
37 36
        android:layout_marginStart="15dp"
38
        android:layout_marginTop="6dp"
39
        android:background="#3df" />
37
        android:layout_marginTop="26dp" />
40 38
41 39
42 40
    <TextView
@ -44,6 +42,7 @@
44 42
        android:layout_width="wrap_content"
45 43
        android:layout_height="wrap_content"
46 44
        android:layout_marginStart="5dp"
45
        android:layout_marginTop="20dp"
47 46
        android:layout_toEndOf="@+id/item_user_avatar"
48 47
        android:text="12sp12sp12sp"
49 48
        android:textColor="#fff"
@ -77,6 +76,7 @@
77 76
        android:id="@+id/item_user_operation"
78 77
        android:layout_width="wrap_content"
79 78
        android:layout_height="22dp"
79
80 80
        android:layout_below="@+id/item_user_con"
81 81
        android:layout_alignStart="@+id/item_user_name"
82 82
        android:layout_marginTop="10dp"
@ -95,7 +95,7 @@
95 95
                android:layout_width="16dp"
96 96
                android:layout_height="16dp"
97 97
                android:layout_marginStart="9dp"
98
                android:background="#fff" />
98
                android:background="@drawable/icon_comment" />
99 99
100 100
            <TextView
101 101
                android:id="@+id/item_user_report_count"
@ -116,7 +116,8 @@
116 116
            android:gravity="center"
117 117
            android:text="删除"
118 118
            android:textColor="#c2c2c2"
119
            android:textSize="12sp" />
119
            android:textSize="12sp"
120
            android:visibility="gone" />
120 121
    </LinearLayout>
121 122
122 123
    <View

+ 5 - 0
app/src/main/res/layout/view_show_view.xml

@ -8,6 +8,11 @@
8 8
        android:layout_height="match_parent"
9 9
        android:background="#fff0" />
10 10
11
    <com.electric.chargingpile.view.UpVideoView2
12
        android:id="@+id/view_show_video"
13
        android:layout_width="match_parent"
14
        android:layout_height="match_parent"></com.electric.chargingpile.view.UpVideoView2>
15
11 16
    <include layout="@layout/view_show_bottom" />
12 17
13 18
</RelativeLayout>

站点列表开发完成 · 416615eb11 - Gogs: Go Git Service
Pārlūkot izejas kodu

站点列表开发完成

huyuguo 4 gadi atpakaļ
vecāks
revīzija
416615eb11

+ 63 - 368
app/src/main/java/com/electric/chargingpile/activity/RecommendChargingStationActivity.java

@ -6,17 +6,9 @@ import android.content.pm.PackageInfo;
6 6
import android.content.pm.PackageManager;
7 7
import android.graphics.Color;
8 8
import android.graphics.drawable.BitmapDrawable;
9
import android.os.Bundle;
9 10
import android.os.Handler;
10 11
import android.os.Message;
11
12
import androidx.constraintlayout.widget.ConstraintLayout;
13
import androidx.appcompat.app.AppCompatActivity;
14
15
import android.os.Bundle;
16
17
import androidx.recyclerview.widget.LinearLayoutManager;
18
import androidx.recyclerview.widget.RecyclerView;
19
20 12
import android.view.Gravity;
21 13
import android.view.LayoutInflater;
22 14
import android.view.View;
@ -28,22 +20,21 @@ import android.widget.PopupWindow;
28 20
import android.widget.TextView;
29 21
import android.widget.Toast;
30 22
23
import androidx.appcompat.app.AppCompatActivity;
24
import androidx.recyclerview.widget.LinearLayoutManager;
25
import androidx.recyclerview.widget.RecyclerView;
26
31 27
import com.amap.api.maps.AMapUtils;
32 28
import com.amap.api.maps.model.LatLng;
33 29
import com.blankj.utilcode.util.LogUtils;
34
import com.electric.chargingpile.BuildConfig;
35 30
import com.electric.chargingpile.R;
36
import com.electric.chargingpile.application.MainApplication;
37 31
import com.electric.chargingpile.data.PileData;
38 32
import com.electric.chargingpile.data.RecommendZhan;
39 33
import com.electric.chargingpile.util.BarColorUtil;
40 34
import com.electric.chargingpile.util.JsonUtils;
41 35
import com.electric.chargingpile.util.LoadingDialog;
42
import com.electric.chargingpile.util.ToastUtil;
43 36
import com.electric.chargingpile.util.Util;
44 37
import com.umeng.analytics.MobclickAgent;
45
import com.zhy.http.okhttp.OkHttpUtils;
46
import com.zhy.http.okhttp.callback.StringCallback;
47 38
48 39
import java.io.BufferedReader;
49 40
import java.io.BufferedWriter;
@ -59,13 +50,10 @@ import java.util.Comparator;
59 50
import java.util.HashMap;
60 51
import java.util.List;
61 52
62
import okhttp3.Call;
63
64 53
import static com.electric.chargingpile.activity.MainMapActivity.getMD5;
65 54
66 55
public class RecommendChargingStationActivity extends AppCompatActivity implements View.OnClickListener {
67 56
    private static final String TAG = "RecommendChargingStationActivity";
68
    List<RecommendZhan> recommendZhanList;
69 57
    List<RecommendZhan> zhanList;
70 58
    private LoadingDialog loadingDialog;
71 59
    private View popupWindowView;
@ -78,26 +66,12 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
78 66
    private LatLng center;
79 67
    private RecommendChargingStationActivity activity;
80 68
81
    private LinearLayout first_condition;
82
    private TextView first_condition_text;
83
    private ImageView first_condition_image;
84
85
    private int firstCondition = 3;
86
    private TextView first_can_charging;
87
    private TextView first_free_parking;
88
    private TextView first_quick_charging;
89
    private TextView first_slow_charging;
90
91
    private Boolean firstCanCharging = false;
92
    private Boolean firstFreeParking = false;
93
    private Boolean firstQuickCharging = false;
94
    private Boolean firstSlowCharging = false;
95
    private ConstraintLayout condition_second_bar;
96
    private Button second_1;
97
    private Button second_2;
98
    private Button second_3;
99
    private Button second_4;
100
    private Button second_5;
69
    private int condition = 1;
70
    private TextView first_condition;
71
    private TextView second_condition;
72
    private TextView third_condition;
73
    private TextView forth_condition;
74
101 75
102 76
    private RecyclerView recyclerView;
103 77
    private RecommendChargingStationAdapter recommendChargingStationAdapter;
@ -120,7 +94,6 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
120 94
    }
121 95
122 96
    private void initView() {
123
        recommendZhanList = new ArrayList<>();
124 97
        zhanList = new ArrayList<>();
125 98
        activity = this;
126 99
        loadingDialog = new LoadingDialog(this);
@ -131,39 +104,17 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
131 104
        center_wei = getIntent().getStringExtra("center_wei");
132 105
133 106
        center = new LatLng(Double.parseDouble(center_wei), Double.parseDouble(center_jing));
134
135 107
        findViewById(R.id.iv_back).setOnClickListener(this);
136 108
137 109
        first_condition = findViewById(R.id.first_condition);
138
        first_condition.setOnClickListener(this);
139
        first_condition_text = findViewById(R.id.first_condition_text);
140
        first_condition_image = findViewById(R.id.first_condition_image);
110
        second_condition = findViewById(R.id.second_condition);
111
        third_condition = findViewById(R.id.third_condition);
112
        forth_condition = findViewById(R.id.forth_condition);
141 113
142
        first_can_charging = findViewById(R.id.first_can_charging);
143
        first_can_charging.setOnClickListener(this);
144
145
        first_free_parking = findViewById(R.id.first_free_parking);
146
        first_free_parking.setOnClickListener(this);
147
148
        first_quick_charging = findViewById(R.id.first_quick_charging);
149
        first_quick_charging.setOnClickListener(this);
150
151
        first_slow_charging = findViewById(R.id.first_slow_charging);
152
        first_slow_charging.setOnClickListener(this);
153
154
        condition_second_bar = findViewById(R.id.condition_second_bar);
155
        condition_second_bar.setOnClickListener(this);
156
157
        second_1 = findViewById(R.id.second_1);
158
        second_2 = findViewById(R.id.second_2);
159
        second_3 = findViewById(R.id.second_3);
160
        second_4 = findViewById(R.id.second_4);
161
        second_5 = findViewById(R.id.second_5);
162
        second_1.setOnClickListener(this);
163
        second_2.setOnClickListener(this);
164
        second_3.setOnClickListener(this);
165
        second_4.setOnClickListener(this);
166
        second_5.setOnClickListener(this);
114
        first_condition.setOnClickListener(this::onClick);
115
        second_condition.setOnClickListener(this::onClick);
116
        third_condition.setOnClickListener(this::onClick);
117
        forth_condition.setOnClickListener(this::onClick);
167 118
168 119
        recyclerView = findViewById(R.id.recyclerView);
169 120
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
@ -179,235 +130,53 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
179 130
                finish();
180 131
                break;
181 132
            case R.id.first_condition:
182
                if (condition_second_bar.getVisibility() == View.VISIBLE) {
183
                    foldSecondCondition();
184
                } else {
185
                    unfoldSecondCondition();
186
                }
187
                break;
188
            case R.id.first_can_charging:
189
                firstCanCharging = !firstCanCharging;
190
                first_can_charging.setTextColor(firstCanCharging ? Color.parseColor("#2FC45B") : Color.parseColor("#222222"));
191
                foldSecondCondition();
192
                filterChargingStation();
193
                if (firstCanCharging) {
194
                    MobclickAgent.onEvent(getApplicationContext(), "1141");
195
                }
196
                break;
197
            case R.id.first_free_parking:
198
                firstFreeParking = !firstFreeParking;
199
                first_free_parking.setTextColor(firstFreeParking ? Color.parseColor("#2FC45B") : Color.parseColor("#222222"));
200
                foldSecondCondition();
201
                filterChargingStation();
202
                if (firstFreeParking) {
203
                    MobclickAgent.onEvent(getApplicationContext(), "1143");
204
                }
205
                break;
206
            case R.id.first_quick_charging:
207
                firstQuickCharging = !firstQuickCharging;
208
                first_quick_charging.setTextColor(firstQuickCharging ? Color.parseColor("#2FC45B") : Color.parseColor("#222222"));
209
                foldSecondCondition();
210
                filterChargingStation();
211
                if (firstQuickCharging) {
212
                    MobclickAgent.onEvent(getApplicationContext(), "1142");
213
                }
214
                break;
215
            case R.id.first_slow_charging:
216
                firstSlowCharging = !firstSlowCharging;
217
                first_slow_charging.setTextColor(firstSlowCharging ? Color.parseColor("#2FC45B") : Color.parseColor("#222222"));
218
                foldSecondCondition();
219
                filterChargingStation();
220
                if (firstSlowCharging) {
221
                    MobclickAgent.onEvent(getApplicationContext(), "1144");
222
                }
223
                break;
224
            case R.id.second_1:
225
            case R.id.second_2:
226
            case R.id.second_3:
227
            case R.id.second_4:
228
            case R.id.second_5:
229
                chooseSecondCondition(v.getId());
230
                break;
231
            case R.id.condition_second_bar:
232
                foldSecondCondition();
133
            case R.id.second_condition:
134
            case R.id.third_condition:
135
            case R.id.forth_condition:
136
                chooseCondition(v.getId());
233 137
                break;
234 138
        }
235 139
    }
236 140
237
    // 折叠
238
    private void foldSecondCondition() {
239
        condition_second_bar.setVisibility(View.GONE);
240
        first_condition_image.setImageDrawable(getResources().getDrawable(R.drawable.recommend_fold));
241
    }
242
243
    // 打开
244
    private void unfoldSecondCondition() {
245
        condition_second_bar.setVisibility(View.VISIBLE);
246
        first_condition_image.setImageDrawable(getResources().getDrawable(R.drawable.recommend_unfold));
247
    }
141
    private void chooseCondition(int id) {
248 142
249
    private void chooseSecondCondition(int id) {
250
        resetFirstCondition();
251
        foldSecondCondition();
252
253
        second_1.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
254
        second_2.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
255
        second_3.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
256
        second_4.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
257
        second_5.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
258
        second_1.setTextColor(Color.parseColor("#2FC45B"));
259
        second_2.setTextColor(Color.parseColor("#2FC45B"));
260
        second_3.setTextColor(Color.parseColor("#2FC45B"));
261
        second_4.setTextColor(Color.parseColor("#2FC45B"));
262
        second_5.setTextColor(Color.parseColor("#2FC45B"));
143
        first_condition.setTextColor(Color.parseColor("#222222"));
144
        second_condition.setTextColor(Color.parseColor("#222222"));
145
        third_condition.setTextColor(Color.parseColor("#222222"));
146
        forth_condition.setTextColor(Color.parseColor("#222222"));
263 147
264 148
        switch (id) {
265
            case R.id.second_1:
266
                firstCondition = 1;
267
                second_1.setBackground(getResources().getDrawable(R.drawable.recommend_btn_selected));
268
                second_1.setTextColor(Color.parseColor("#FFFFFF"));
269
                first_condition_text.setText("智能推荐");
270
                if (recommendZhanList.size() == 0) {
271
                    recommendChargingStationFunc();
272
                } else {
273
                    filterChargingStation();
274
                }
275
                MobclickAgent.onEvent(getApplicationContext(), "1136");
149
            case R.id.first_condition:
150
                condition = 1;
151
                first_condition.setTextColor(Color.parseColor("#1BB637"));
152
                MobclickAgent.onEvent(getApplicationContext(), "1139");
276 153
                break;
277
            case R.id.second_2:
278
                firstCondition = 2;
279
                second_2.setBackground(getResources().getDrawable(R.drawable.recommend_btn_selected));
280
                second_2.setTextColor(Color.parseColor("#FFFFFF"));
281
                first_condition_text.setText("价格最低");
282
                if (zhanList.size() == 0 && socket != null && socket.isClosed()) {
283
                    loadingDialog.show();
284
                    ete("{\"fun\":\"timer\"}");
285
                } else {
286
                    filterChargingStation();
287
                }
288
154
            case R.id.second_condition:
155
                condition = 2;
156
                second_condition.setTextColor(Color.parseColor("#1BB637"));
289 157
                MobclickAgent.onEvent(getApplicationContext(), "1138");
290 158
                break;
291
            case R.id.second_3:
292
                firstCondition = 3;
293
                second_3.setBackground(getResources().getDrawable(R.drawable.recommend_btn_selected));
294
                second_3.setTextColor(Color.parseColor("#FFFFFF"));
295
                first_condition_text.setText("距离最近");
296
                if (zhanList.size() == 0 && socket != null && socket.isClosed()) {
297
                    loadingDialog.show();
298
                    ete("{\"fun\":\"timer\"}");
299
                } else {
300
                    filterChargingStation();
301
                }
302
                MobclickAgent.onEvent(getApplicationContext(), "1139");
303
                break;
304
            case R.id.second_4:
305
                firstCondition = 4;
306
                second_4.setBackground(getResources().getDrawable(R.drawable.recommend_btn_selected));
307
                second_4.setTextColor(Color.parseColor("#FFFFFF"));
308
                first_condition_text.setText("空闲最多");
309
                if (zhanList.size() == 0 && socket != null && socket.isClosed()) {
310
                    loadingDialog.show();
311
                    ete("{\"fun\":\"timer\"}");
312
                } else {
313
                    filterChargingStation();
314
                }
159
            case R.id.third_condition:
160
                condition = 3;
161
                third_condition.setTextColor(Color.parseColor("#1BB637"));
315 162
                MobclickAgent.onEvent(getApplicationContext(), "1140");
316 163
                break;
317
            case R.id.second_5:
318
                firstCondition = 5;
319
                second_5.setBackground(getResources().getDrawable(R.drawable.recommend_btn_selected));
320
                second_5.setTextColor(Color.parseColor("#FFFFFF"));
321
                first_condition_text.setText("评分最高");
322
                if (zhanList.size() == 0 && socket != null && socket.isClosed()) {
323
                    loadingDialog.show();
324
                    ete("{\"fun\":\"timer\"}");
325
                } else {
326
                    filterChargingStation();
327
                }
164
            case R.id.forth_condition:
165
                condition = 4;
166
                forth_condition.setTextColor(Color.parseColor("#1BB637"));
328 167
                MobclickAgent.onEvent(getApplicationContext(), "1137");
329 168
                break;
330 169
        }
331
    }
332
333
    private void resetFirstCondition() {
334
        firstCanCharging = false;
335
        first_can_charging.setTextColor(Color.parseColor("#222222"));
336
337
        firstFreeParking = false;
338
        first_free_parking.setTextColor(Color.parseColor("#222222"));
339
340
        firstQuickCharging = false;
341
        first_quick_charging.setTextColor(Color.parseColor("#222222"));
342
343
        firstSlowCharging = false;
344
        first_slow_charging.setTextColor(Color.parseColor("#222222"));
345
346
    }
347
348
    private void recommendChargingStationFunc() {
349
        loadingDialog.show();
350
        no_result.setVisibility(View.GONE);
351
352
        String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanlist/recommend?longitude=" + center_jing + "&latitude=" + center_wei + "&version_name=" + BuildConfig.VERSION_NAME + "&version_code=" + BuildConfig.VERSION_CODE + "&pg=30";
353
354
        OkHttpUtils.get().url(url).build().readTimeOut(10000).connTimeOut(10000).execute(new StringCallback() {
355 170
356
            @Override
357
            public void onError(Call call, Exception e) {
358
                if (activity != null && !activity.isFinishing()) {
359
                    loadingDialog.dismiss();
360
                }
361
                ToastUtil.showToast(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT);
362
            }
363
364
            @Override
365
            public void onResponse(String response) {
366
                if (activity != null && !activity.isFinishing()) {
367
                    loadingDialog.dismiss();
368
                } else {
369
                    return;
370
                }
371
372
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
373
                if (rtnCode.equals("01")) {
374
                    String data = JsonUtils.getKeyResult(response, "data");
375
                    List<RecommendZhan> list = JsonUtils.parseToObjectList(data, RecommendZhan.class);
376
                    if (list != null) {
377
                        for (int i = 0; i < list.size(); i++) {
378
                            String wei = list.get(i).getPoi_wei().trim();
379
                            String jing = list.get(i).getPoi_jing().trim();
380
381
                            int position_jing = jing.length() - jing.indexOf(".") - 1;
382
                            int position_wei = wei.length() - wei.indexOf(".") - 1;
383
384
385
                            LatLng ll;
386
                            if (position_jing > 13 || position_wei > 13) {
387
                                ll = new LatLng(Double.parseDouble(wei), Double.parseDouble(jing));
388
                            } else {
389
                                double dwei = Double.parseDouble(wei);
390
                                double djing = Double.parseDouble(jing);
391
                                getGaode(djing, dwei);
392
                                ll = new LatLng(Double.parseDouble(gd_wei), Double.parseDouble(gd_jing));
393
                            }
394
395
                            double d = AMapUtils.calculateLineDistance(center, ll);
396
                            list.get(i).setDistanceNum(d);
397
                            list.get(i).setDistance(Util.getDistance(d));
171
        if (zhanList.size() == 0 && socket != null && socket.isClosed()) {
172
            loadingDialog.show();
173
            ete("{\"fun\":\"timer\"}");
174
        } else {
175
            filterChargingStation();
176
        }
398 177
399
                            list.get(i).setZhan_id(list.get(i).getId()); // 呵呵...
400
                        }
401
                        recommendZhanList = list;
402
                        filterChargingStation();
403
                    }
404
                }
405
                ete("{\"fun\":\"timer\"}");
406
            }
407
        });
408 178
    }
409 179
410
411 180
    public class RecommendChargingStationAdapter extends RecyclerView.Adapter<RecommendChargingStationAdapter.ViewHolder> {
412 181
        private List<RecommendZhan> mList;
413 182
@ -835,28 +604,21 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
835 604
836 605
    private void filterChargingStation() {
837 606
        no_result.setVisibility(View.GONE);
607
        List<RecommendZhan> list = new ArrayList<RecommendZhan>();
838 608
839
        List<RecommendZhan> list;
840
        if (firstCondition == 1) {
841
            list = recommendZhanList;
842
        } else {
843
            list = zhanList;
844
        }
845
846
        if (firstCondition == 2) { // 价格最低
609
        if (condition == 2) { // 价格最低
847 610
            List<RecommendZhan> priceList1 = new ArrayList<>();
848 611
            List<RecommendZhan> priceList2 = new ArrayList<>();
849 612
850
            for (RecommendZhan zhan : list) {
851
                if (zhan.getZongjia() > 0) {
852
                    priceList1.add(zhan);
613
            for (RecommendZhan point : zhanList) {
614
                if (point.getZongjia() > 0) {
615
                    priceList1.add(point);
853 616
                } else {
854
                    priceList2.add(zhan);
617
                    priceList2.add(point);
855 618
                }
856 619
            }
857 620
858
            list = priceList1;
859
621
            list.addAll(priceList1);
860 622
            Collections.sort(list, new Comparator<RecommendZhan>() {
861 623
                @Override
862 624
                public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -876,7 +638,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
876 638
            list.addAll(priceList2);
877 639
        }
878 640
879
        if (firstCondition == 3) { // 距离最近
641
        if (condition == 1) { // 距离最近
642
            list.addAll(zhanList);
880 643
            Collections.sort(list, new Comparator<RecommendZhan>() {
881 644
                @Override
882 645
                public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -891,7 +654,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
891 654
            });
892 655
        }
893 656
894
        if (firstCondition == 4) { // 空闲最多
657
        if (condition == 3) { // 空闲最多
658
            list.addAll(zhanList);
895 659
            Collections.sort(list, new Comparator<RecommendZhan>() {
896 660
                @Override
897 661
                public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -942,7 +706,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
942 706
            });
943 707
        }
944 708
945
        if (firstCondition == 5) { // 评分最高
709
        if (condition == 4) { // 评分最高
710
            list.addAll(zhanList);
946 711
            Collections.sort(list, new Comparator<RecommendZhan>() {
947 712
                @Override
948 713
                public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -975,75 +740,9 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
975 740
            list = list.subList(0, 30);
976 741
        }
977 742
743
        recommendChargingStationAdapter.setData(list);
978 744
979
        List<RecommendZhan> list1 = new ArrayList<>();
980
        if (firstCanCharging) {
981
            for (RecommendZhan item : list) {
982
                if ("1".equals(item.getOwn_pay())) {
983
                    list1.add(item);
984
                }
985
            }
986
        } else {
987
            for (RecommendZhan item : list) {
988
                list1.add(item);
989
            }
990
        }
991
992
        List<RecommendZhan> list2 = new ArrayList<>();
993
        if (firstFreeParking) {
994
            for (RecommendZhan item : list1) {
995
                if (item.getStop_cost().contains("免费")) {
996
                    list2.add(item);
997
                }
998
            }
999
        } else {
1000
            for (RecommendZhan item : list1) {
1001
                list2.add(item);
1002
            }
1003
        }
1004
1005
        List<RecommendZhan> list3 = new ArrayList<>();
1006
        if (firstQuickCharging) {
1007
            for (RecommendZhan item : list2) {
1008
                int fastNum;
1009
                if ("".equals(item.getFast_num())) {
1010
                    fastNum = 0;
1011
                } else {
1012
                    fastNum = Integer.parseInt(item.getFast_num());
1013
                }
1014
1015
                if (fastNum > 0) {
1016
                    list3.add(item);
1017
                }
1018
            }
1019
        } else {
1020
            for (RecommendZhan item : list2) {
1021
                list3.add(item);
1022
            }
1023
        }
1024
1025
        List<RecommendZhan> list4 = new ArrayList<>();
1026
        if (firstSlowCharging) {
1027
            for (RecommendZhan item : list3) {
1028
                int slowNum;
1029
                if ("".equals(item.getSlow_num())) {
1030
                    slowNum = 0;
1031
                } else {
1032
                    slowNum = Integer.parseInt(item.getSlow_num());
1033
                }
1034
                if (slowNum > 0) {
1035
                    list4.add(item);
1036
                }
1037
            }
1038
        } else {
1039
            for (RecommendZhan item : list3) {
1040
                list4.add(item);
1041
            }
1042
        }
1043
1044
        recommendChargingStationAdapter.setData(list4);
1045
1046
        if (list4.size() == 0) {
745
        if (list.size() == 0) {
1047 746
            if (socket != null && !socket.isClosed()) {
1048 747
                no_result.setText("数据加载中,请稍后...");
1049 748
            } else {
@ -1137,8 +836,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
1137 836
                            new OutputStreamWriter(socket.getOutputStream())), true);
1138 837
                    out.println(params);
1139 838
                    // 接收来自服务器的消息
1140
                    BufferedReader br = new BufferedReader(new InputStreamReader(
1141
                            socket.getInputStream()));
839
                    BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
1142 840
                    String msg = br.readLine();
1143 841
                    int time = (int) (System.currentTimeMillis() / 1000);
1144 842
                    int cha = time - Integer.parseInt(msg);
@ -1181,8 +879,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
1181 879
                    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
1182 880
                    out.println(params);
1183 881
                    // 接收来自服务器的消息
1184
                    BufferedReader br = new BufferedReader(new InputStreamReader(
1185
                            socket.getInputStream()));
882
                    BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
1186 883
                    String msg = br.readLine();
1187 884
                    if (msg != null) {
1188 885
                        Message mes = new Message();
@ -1205,8 +902,6 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
1205 902
                }
1206 903
            }
1207 904
        }).start();
1208
1209 905
    }
1210 906
1211
1212 907
}

+ 71 - 232
app/src/main/res/layout/activity_recommend_charging_station.xml

@ -44,265 +44,104 @@
44 44
            app:layout_constraintRight_toRightOf="parent" />
45 45
    </androidx.constraintlayout.widget.ConstraintLayout>
46 46
47
    <androidx.constraintlayout.widget.ConstraintLayout
48
        android:id="@+id/condition_first_bar"
47
    <LinearLayout
48
        android:id="@+id/condition_bar"
49 49
        android:layout_width="match_parent"
50 50
        android:layout_height="40dp"
51
        android:gravity="center_vertical"
52
        android:orientation="horizontal"
51 53
        app:layout_constraintLeft_toLeftOf="parent"
52 54
        app:layout_constraintRight_toRightOf="parent"
53 55
        app:layout_constraintTop_toBottomOf="@+id/nav_bar">
54 56
55
        <LinearLayout
56
            android:layout_width="match_parent"
57
        <TextView
58
            android:id="@+id/first_condition"
59
            android:layout_width="0dp"
57 60
            android:layout_height="match_parent"
61
            android:layout_weight="1"
58 62
            android:gravity="center"
59
            android:orientation="horizontal">
60
61
            <LinearLayout
62
                android:id="@+id/first_condition"
63
                android:layout_width="0dp"
64
                android:layout_height="match_parent"
65
                android:layout_weight="0.224"
66
                android:gravity="center"
67
                android:orientation="horizontal">
68
69
                <TextView
70
                    android:id="@+id/first_condition_text"
71
                    android:layout_width="wrap_content"
72
                    android:layout_height="wrap_content"
73
                    android:gravity="center"
74
                    android:text="距离最近"
75
                    android:textColor="#2fc45b"
76
                    android:textSize="12sp" />
63
            android:text="距离最近"
64
            android:textColor="#1BB637"
65
            android:textSize="12sp"
66
            android:textStyle="bold" />
77 67
78
                <ImageView
79
                    android:id="@+id/first_condition_image"
80
                    android:layout_width="wrap_content"
81
                    android:layout_height="wrap_content"
82
                    android:layout_marginLeft="5dp"
83
                    android:src="@drawable/recommend_fold" />
84
            </LinearLayout>
85
86
            <View
87
                android:layout_width="1dp"
88
                android:layout_height="10dp"
89
                android:background="#d8d8d8" />
90
91
            <TextView
92
                android:id="@+id/first_can_charging"
93
                android:layout_width="0dp"
94
                android:layout_height="match_parent"
95
                android:layout_weight="0.272"
96
                android:gravity="center"
97
                android:text="本APP可充电"
98
                android:textColor="#222222"
99
                android:textSize="12sp" />
100
101
            <View
102
                android:layout_width="1dp"
103
                android:layout_height="10dp"
104
                android:background="#d8d8d8" />
68
        <View
69
            android:layout_width="1dp"
70
            android:layout_height="10dp"
71
            android:background="#d8d8d8" />
105 72
106
            <TextView
107
                android:id="@+id/first_free_parking"
108
                android:layout_width="0dp"
109
                android:layout_height="match_parent"
110
                android:layout_weight="0.211"
111
                android:gravity="center"
112
                android:text="免费停车"
113
                android:textColor="#222222"
114
                android:textSize="12sp" />
73
        <TextView
74
            android:id="@+id/second_condition"
75
            android:layout_width="0dp"
76
            android:layout_height="match_parent"
77
            android:layout_weight="1"
78
            android:gravity="center"
79
            android:text="价格最低"
80
            android:textColor="#222222"
81
            android:textSize="12sp"
82
            android:textStyle="bold" />
115 83
116
            <View
117
                android:layout_width="1dp"
118
                android:layout_height="10dp"
119
                android:background="#d8d8d8" />
84
        <View
85
            android:layout_width="1dp"
86
            android:layout_height="10dp"
87
            android:background="#d8d8d8" />
120 88
121
            <TextView
122
                android:id="@+id/first_quick_charging"
123
                android:layout_width="0dp"
124
                android:layout_height="match_parent"
125
                android:layout_weight="0.147"
126
                android:gravity="center"
127
                android:text="快充"
128
                android:textColor="#222222"
129
                android:textSize="12sp" />
89
        <TextView
90
            android:id="@+id/third_condition"
91
            android:layout_width="0dp"
92
            android:layout_height="match_parent"
93
            android:layout_weight="1"
94
            android:gravity="center"
95
            android:text="空闲最多"
96
            android:textColor="#222222"
97
            android:textSize="12sp"
98
            android:textStyle="bold" />
130 99
131
            <View
132
                android:layout_width="1dp"
133
                android:layout_height="10dp"
134
                android:background="#d8d8d8" />
100
        <View
101
            android:layout_width="1dp"
102
            android:layout_height="10dp"
103
            android:background="#d8d8d8" />
135 104
136
            <TextView
137
                android:id="@+id/first_slow_charging"
138
                android:layout_width="0dp"
139
                android:layout_height="match_parent"
140
                android:layout_weight="0.147"
141
                android:gravity="center"
142
                android:text="慢充"
143
                android:textColor="#222222"
144
                android:textSize="12sp" />
145
        </LinearLayout>
105
        <TextView
106
            android:id="@+id/forth_condition"
107
            android:layout_width="0dp"
108
            android:layout_height="match_parent"
109
            android:layout_weight="1"
110
            android:gravity="center"
111
            android:text="评分最高"
112
            android:textColor="#222222"
113
            android:textSize="12sp"
114
            android:textStyle="bold" />
146 115
147
        <View
148
            android:layout_width="match_parent"
149
            android:layout_height="0.5dp"
150
            android:background="#dddddd"
151
            app:layout_constraintBottom_toBottomOf="parent"
152
            app:layout_constraintLeft_toLeftOf="parent"
153
            app:layout_constraintRight_toRightOf="parent" />
116
    </LinearLayout>
154 117
155
    </androidx.constraintlayout.widget.ConstraintLayout>
118
    <View
119
        android:id="@+id/condition_line"
120
        app:layout_constraintLeft_toLeftOf="parent"
121
        app:layout_constraintRight_toRightOf="parent"
122
        app:layout_constraintTop_toBottomOf="@+id/condition_bar"
123
        android:layout_width="match_parent"
124
        android:layout_height="0.5dp"
125
        android:background="#dddddd" />
156 126
157 127
    <androidx.recyclerview.widget.RecyclerView
158 128
        android:id="@+id/recyclerView"
159 129
        android:layout_width="match_parent"
160 130
        android:layout_height="0dp"
161 131
        app:layout_constraintBottom_toBottomOf="parent"
162
        app:layout_constraintTop_toBottomOf="@+id/condition_first_bar" />
163
    <androidx.constraintlayout.widget.ConstraintLayout
164
        android:id="@+id/condition_second_bar"
165
        android:layout_width="match_parent"
166
        android:layout_height="0dp"
167
        android:visibility="gone"
168
        app:layout_constraintBottom_toBottomOf="parent"
169
        app:layout_constraintTop_toBottomOf="@+id/condition_first_bar"
170
        tools:visibility="visible">
171
172
        <View
173
            android:layout_width="match_parent"
174
            android:layout_height="match_parent"
175
            android:alpha="0.29"
176
            android:background="#000000" />
177
178
        <LinearLayout
179
            android:layout_width="match_parent"
180
            android:layout_height="120dp"
181
            android:background="#ffffff"
182
            android:orientation="vertical"
183
            android:paddingLeft="22dp"
184
            android:paddingTop="21dp"
185
            android:paddingRight="23dp"
186
            app:layout_constraintTop_toTopOf="parent">
187
188
            <LinearLayout
189
                android:layout_width="match_parent"
190
                android:layout_height="30dp"
191
                android:orientation="horizontal">
192
193
                <Button
194
                    android:id="@+id/second_3"
195
                    android:layout_width="0dp"
196
                    android:layout_height="match_parent"
197
                    android:layout_weight="1"
198
                    android:background="@drawable/recommend_btn_selected"
199
                    android:text="距离最近"
200
                    android:textColor="#ffffff"
201
                    android:textSize="12sp" />
202
203
                <View
204
                    android:layout_width="10dp"
205
                    android:layout_height="match_parent" />
206
207
                <Button
208
                    android:id="@+id/second_2"
209
                    android:layout_width="0dp"
210
                    android:layout_height="match_parent"
211
                    android:layout_weight="1"
212
                    android:background="@drawable/recommend_btn_normal"
213
                    android:text="价格最低"
214
                    android:textColor="#2FC45B"
215
                    android:textSize="12sp" />
216
217
                <View
218
                    android:layout_width="10dp"
219
                    android:layout_height="match_parent" />
220
221
                <Button
222
                    android:id="@+id/second_1"
223
                    android:layout_width="0dp"
224
                    android:layout_height="match_parent"
225
                    android:layout_weight="1"
226
                    android:background="@drawable/recommend_btn_normal"
227
                    android:text="智能推荐"
228
                    android:textColor="#2FC45B"
229
                    android:textSize="12sp" />
230
231
                <View
232
                    android:layout_width="10dp"
233
                    android:layout_height="match_parent" />
234
235
                <Button
236
                    android:id="@+id/second_4"
237
                    android:layout_width="0dp"
238
                    android:layout_height="match_parent"
239
                    android:layout_weight="1"
240
                    android:background="@drawable/recommend_btn_normal"
241
                    android:text="空闲最多"
242
                    android:textColor="#2FC45B"
243
                    android:textSize="12sp" />
244
            </LinearLayout>
245
246
            <LinearLayout
247
                android:layout_width="match_parent"
248
                android:layout_height="30dp"
249
                android:layout_marginTop="15dp">
250
251
                <Button
252
                    android:id="@+id/second_5"
253
                    android:layout_width="0dp"
254
                    android:layout_height="match_parent"
255
                    android:layout_weight="1"
256
                    android:background="@drawable/recommend_btn_normal"
257
                    android:text="评分最高"
258
                    android:textColor="#2FC45B"
259
                    android:textSize="12sp" />
260
261
                <View
262
                    android:layout_width="10dp"
263
                    android:layout_height="match_parent" />
264
265
                <View
266
                    android:layout_width="0dp"
267
                    android:layout_height="match_parent"
268
                    android:layout_weight="1" />
269
270
                <View
271
                    android:layout_width="10dp"
272
                    android:layout_height="match_parent" />
273
274
                <View
275
                    android:layout_width="0dp"
276
                    android:layout_height="match_parent"
277
                    android:layout_weight="1" />
278
279
                <View
280
                    android:layout_width="10dp"
281
                    android:layout_height="match_parent" />
282
283
                <View
284
                    android:layout_width="0dp"
285
                    android:layout_height="match_parent"
286
                    android:layout_weight="1" />
287
            </LinearLayout>
288
289
290
        </LinearLayout>
291
292
293
    </androidx.constraintlayout.widget.ConstraintLayout>
132
        app:layout_constraintTop_toBottomOf="@+id/condition_line" />
294 133
295 134
    <TextView
296 135
        android:id="@+id/no_result"
297
        android:visibility="gone"
298
        tools:visibility="visible"
299
        android:gravity="center"
300
        android:textSize="14sp"
301
        android:textColor="#666666"
302
        android:text="周边没有符合筛选条件的站点,请检查您的筛选项"
303 136
        android:layout_width="match_parent"
304 137
        android:layout_height="0dp"
138
        android:gravity="center"
139
        android:text="周边没有符合筛选条件的站点,请检查您的筛选项"
140
        android:textColor="#666666"
141
        android:textSize="14sp"
142
        android:visibility="gone"
305 143
        app:layout_constraintBottom_toBottomOf="parent"
306
        app:layout_constraintTop_toBottomOf="@+id/condition_first_bar"/>
144
        app:layout_constraintTop_toBottomOf="@+id/condition_line"
145
        tools:visibility="visible" />
307 146
308 147
</androidx.constraintlayout.widget.ConstraintLayout>