ete("{\"fun\":\"timer\"}");
}
});
}
public class RecommendChargingStationAdapter extends RecyclerView.Adapter<RecommendChargingStationAdapter.ViewHolder> {
private List<RecommendZhan> mList;
@ -835,28 +604,21 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
private void filterChargingStation() {
no_result.setVisibility(View.GONE);
List<RecommendZhan> list = new ArrayList<RecommendZhan>();
List<RecommendZhan> list;
if (firstCondition == 1) {
list = recommendZhanList;
} else {
list = zhanList;
}
if (firstCondition == 2) { // 价格最低
if (condition == 2) { // 价格最低
List<RecommendZhan> priceList1 = new ArrayList<>();
List<RecommendZhan> priceList2 = new ArrayList<>();
for (RecommendZhan zhan : list) {
if (zhan.getZongjia() > 0) {
priceList1.add(zhan);
for (RecommendZhan point : zhanList) {
if (point.getZongjia() > 0) {
priceList1.add(point);
} else {
priceList2.add(zhan);
priceList2.add(point);
}
}
list = priceList1;
list.addAll(priceList1);
Collections.sort(list, new Comparator<RecommendZhan>() {
@Override
public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -876,7 +638,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
list.addAll(priceList2);
}
if (firstCondition == 3) { // 距离最近
if (condition == 1) { // 距离最近
list.addAll(zhanList);
Collections.sort(list, new Comparator<RecommendZhan>() {
@Override
public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -891,7 +654,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
});
}
if (firstCondition == 4) { // 空闲最多
if (condition == 3) { // 空闲最多
list.addAll(zhanList);
Collections.sort(list, new Comparator<RecommendZhan>() {
@Override
public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -942,7 +706,8 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
});
}
if (firstCondition == 5) { // 评分最高
if (condition == 4) { // 评分最高
list.addAll(zhanList);
Collections.sort(list, new Comparator<RecommendZhan>() {
@Override
public int compare(RecommendZhan o1, RecommendZhan o2) {
@ -975,75 +740,9 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
list = list.subList(0, 30);
}
recommendChargingStationAdapter.setData(list);
List<RecommendZhan> list1 = new ArrayList<>();
if (firstCanCharging) {
for (RecommendZhan item : list) {
if ("1".equals(item.getOwn_pay())) {
list1.add(item);
}
}
} else {
for (RecommendZhan item : list) {
list1.add(item);
}
}
List<RecommendZhan> list2 = new ArrayList<>();
if (firstFreeParking) {
for (RecommendZhan item : list1) {
if (item.getStop_cost().contains("免费")) {
list2.add(item);
}
}
} else {
for (RecommendZhan item : list1) {
list2.add(item);
}
}
List<RecommendZhan> list3 = new ArrayList<>();
if (firstQuickCharging) {
for (RecommendZhan item : list2) {
int fastNum;
if ("".equals(item.getFast_num())) {
fastNum = 0;
} else {
fastNum = Integer.parseInt(item.getFast_num());
}
if (fastNum > 0) {
list3.add(item);
}
}
} else {
for (RecommendZhan item : list2) {
list3.add(item);
}
}
List<RecommendZhan> list4 = new ArrayList<>();
if (firstSlowCharging) {
for (RecommendZhan item : list3) {
int slowNum;
if ("".equals(item.getSlow_num())) {
slowNum = 0;
} else {
slowNum = Integer.parseInt(item.getSlow_num());
}
if (slowNum > 0) {
list4.add(item);
}
}
} else {
for (RecommendZhan item : list3) {
list4.add(item);
}
}
recommendChargingStationAdapter.setData(list4);
if (list4.size() == 0) {
if (list.size() == 0) {
if (socket != null && !socket.isClosed()) {
no_result.setText("数据加载中,请稍后...");
} else {
@ -1137,8 +836,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
new OutputStreamWriter(socket.getOutputStream())), true);
out.println(params);
// 接收来自服务器的消息
BufferedReader br = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String msg = br.readLine();
int time = (int) (System.currentTimeMillis() / 1000);
int cha = time - Integer.parseInt(msg);
@ -1181,8 +879,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
out.println(params);
// 接收来自服务器的消息
BufferedReader br = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String msg = br.readLine();
if (msg != null) {
Message mes = new Message();
@ -1205,8 +902,6 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
}
}
}).start();
}
}
|
||
| 44 | 44 |
|
| 45 | 45 |
|
| 46 | 46 |
|
| 47 |
|
|
| 48 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 | 49 |
|
| 50 | 50 |
|
| 51 |
|
|
| 52 |
|
|
| 51 | 53 |
|
| 52 | 54 |
|
| 53 | 55 |
|
| 54 | 56 |
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 57 | 60 |
|
| 61 |
|
|
| 58 | 62 |
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 77 | 67 |
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
|
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 105 | 72 |
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 115 | 83 |
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 120 | 88 |
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
|
| 98 |
|
|
| 130 | 99 |
|
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 135 | 104 |
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 146 | 115 |
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
|
| 116 |
|
|
| 154 | 117 |
|
| 155 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 156 | 126 |
|
| 157 | 127 |
|
| 158 | 128 |
|
| 159 | 129 |
|
| 160 | 130 |
|
| 161 | 131 |
|
| 162 |
|
|
| 163 |
|
|
| 164 |
|
|
| 165 |
|
|
| 166 |
|
|
| 167 |
|
|
| 168 |
|
|
| 169 |
|
|
| 170 |
|
|
| 171 |
|
|
| 172 |
|
|
| 173 |
|
|
| 174 |
|
|
| 175 |
|
|
| 176 |
|
|
| 177 |
|
|
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
| 183 |
|
|
| 184 |
|
|
| 185 |
|
|
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
|
|
| 220 |
|
|
| 221 |
|
|
| 222 |
|
|
| 223 |
|
|
| 224 |
|
|
| 225 |
|
|
| 226 |
|
|
| 227 |
|
|
| 228 |
|
|
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| 235 |
|
|
| 236 |
|
|
| 237 |
|
|
| 238 |
|
|
| 239 |
|
|
| 240 |
|
|
| 241 |
|
|
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| 248 |
|
|
| 249 |
|
|
| 250 |
|
|
| 251 |
|
|
| 252 |
|
|
| 253 |
|
|
| 254 |
|
|
| 255 |
|
|
| 256 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
|
| 282 |
|
|
| 283 |
|
|
| 284 |
|
|
| 285 |
|
|
| 286 |
|
|
| 287 |
|
|
| 288 |
|
|
| 289 |
|
|
| 290 |
|
|
| 291 |
|
|
| 292 |
|
|
| 293 |
|
|
| 132 |
|
|
| 294 | 133 |
|
| 295 | 134 |
|
| 296 | 135 |
|
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
| 301 |
|
|
| 302 |
|
|
| 303 | 136 |
|
| 304 | 137 |
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 305 | 143 |
|
| 306 |
|
|
| 144 |
|
|
| 145 |
|
|
| 307 | 146 |
|
| 308 | 147 |
|