|
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
|
}
|
|
|
@ -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>
|