|
@ -243,6 +243,9 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
243
|
243
|
}
|
244
|
244
|
|
245
|
245
|
private void chooseSecondCondition(int id) {
|
|
246
|
resetFirstCondition();
|
|
247
|
foldSecondCondition();
|
|
248
|
|
246
|
249
|
second_1.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
|
247
|
250
|
second_2.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
|
248
|
251
|
second_3.setBackground(getResources().getDrawable(R.drawable.recommend_btn_normal));
|
|
@ -321,8 +324,6 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
321
|
324
|
MobclickAgent.onEvent(getApplicationContext(), "1137");
|
322
|
325
|
break;
|
323
|
326
|
}
|
324
|
|
foldSecondCondition();
|
325
|
|
resetFirstCondition();
|
326
|
327
|
}
|
327
|
328
|
|
328
|
329
|
private void resetFirstCondition() {
|
|
@ -593,11 +594,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
593
|
594
|
|
594
|
595
|
@Override
|
595
|
596
|
public int getItemCount() {
|
596
|
|
if (mList.size() > 30) {
|
597
|
|
return 30;
|
598
|
|
} else {
|
599
|
|
return mList.size();
|
600
|
|
}
|
|
597
|
return mList.size();
|
601
|
598
|
}
|
602
|
599
|
|
603
|
600
|
private void showStarInfoView(ViewHolder holder, RecommendZhan recommendZhan) {
|
|
@ -802,76 +799,11 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
802
|
799
|
list = zhanList;
|
803
|
800
|
}
|
804
|
801
|
|
805
|
|
List<RecommendZhan> list1 = new ArrayList<>();
|
806
|
|
if (firstCanCharging) {
|
807
|
|
for (RecommendZhan item : list) {
|
808
|
|
if ("1".equals(item.getOwn_pay())) {
|
809
|
|
list1.add(item);
|
810
|
|
}
|
811
|
|
}
|
812
|
|
} else {
|
813
|
|
for (RecommendZhan item : list) {
|
814
|
|
list1.add(item);
|
815
|
|
}
|
816
|
|
}
|
817
|
|
|
818
|
|
List<RecommendZhan> list2 = new ArrayList<>();
|
819
|
|
if (firstFreeParking) {
|
820
|
|
for (RecommendZhan item : list1) {
|
821
|
|
if (item.getStop_cost().contains("免费")) {
|
822
|
|
list2.add(item);
|
823
|
|
}
|
824
|
|
}
|
825
|
|
} else {
|
826
|
|
for (RecommendZhan item : list1) {
|
827
|
|
list2.add(item);
|
828
|
|
}
|
829
|
|
}
|
830
|
|
|
831
|
|
List<RecommendZhan> list3 = new ArrayList<>();
|
832
|
|
if (firstQuickCharging) {
|
833
|
|
for (RecommendZhan item : list2) {
|
834
|
|
int fastNum;
|
835
|
|
if ("".equals(item.getFast_num())) {
|
836
|
|
fastNum = 0;
|
837
|
|
} else {
|
838
|
|
fastNum = Integer.parseInt(item.getFast_num());
|
839
|
|
}
|
840
|
|
|
841
|
|
if (fastNum > 0) {
|
842
|
|
list3.add(item);
|
843
|
|
}
|
844
|
|
}
|
845
|
|
} else {
|
846
|
|
for (RecommendZhan item : list2) {
|
847
|
|
list3.add(item);
|
848
|
|
}
|
849
|
|
}
|
850
|
|
|
851
|
|
List<RecommendZhan> list4 = new ArrayList<>();
|
852
|
|
if (firstSlowCharging) {
|
853
|
|
for (RecommendZhan item : list3) {
|
854
|
|
int slowNum;
|
855
|
|
if ("".equals(item.getSlow_num())) {
|
856
|
|
slowNum = 0;
|
857
|
|
} else {
|
858
|
|
slowNum = Integer.parseInt(item.getSlow_num());
|
859
|
|
}
|
860
|
|
if (slowNum > 0) {
|
861
|
|
list4.add(item);
|
862
|
|
}
|
863
|
|
}
|
864
|
|
} else {
|
865
|
|
for (RecommendZhan item : list3) {
|
866
|
|
list4.add(item);
|
867
|
|
}
|
868
|
|
}
|
869
|
|
|
870
|
802
|
if (firstCondition == 2) { // 价格最低
|
871
|
803
|
List<RecommendZhan> priceList1 = new ArrayList<>();
|
872
|
804
|
List<RecommendZhan> priceList2 = new ArrayList<>();
|
873
|
805
|
|
874
|
|
for (RecommendZhan zhan : list4) {
|
|
806
|
for (RecommendZhan zhan : list) {
|
875
|
807
|
if (zhan.getZongjia() > 0) {
|
876
|
808
|
priceList1.add(zhan);
|
877
|
809
|
} else {
|
|
@ -879,9 +811,9 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
879
|
811
|
}
|
880
|
812
|
}
|
881
|
813
|
|
882
|
|
list4 = priceList1;
|
|
814
|
list = priceList1;
|
883
|
815
|
|
884
|
|
Collections.sort(list4, new Comparator<RecommendZhan>() {
|
|
816
|
Collections.sort(list, new Comparator<RecommendZhan>() {
|
885
|
817
|
@Override
|
886
|
818
|
public int compare(RecommendZhan o1, RecommendZhan o2) {
|
887
|
819
|
double diff = o1.getZongjia() - o2.getZongjia();
|
|
@ -897,11 +829,11 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
897
|
829
|
}
|
898
|
830
|
});
|
899
|
831
|
|
900
|
|
list4.addAll(priceList2);
|
|
832
|
list.addAll(priceList2);
|
901
|
833
|
}
|
902
|
834
|
|
903
|
835
|
if (firstCondition == 3) { // 距离最近
|
904
|
|
Collections.sort(list4, new Comparator<RecommendZhan>() {
|
|
836
|
Collections.sort(list, new Comparator<RecommendZhan>() {
|
905
|
837
|
@Override
|
906
|
838
|
public int compare(RecommendZhan o1, RecommendZhan o2) {
|
907
|
839
|
double diff = o1.getDistanceNum() - o2.getDistanceNum();
|
|
@ -916,7 +848,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
916
|
848
|
}
|
917
|
849
|
|
918
|
850
|
if (firstCondition == 4) { // 空闲最多
|
919
|
|
Collections.sort(list4, new Comparator<RecommendZhan>() {
|
|
851
|
Collections.sort(list, new Comparator<RecommendZhan>() {
|
920
|
852
|
@Override
|
921
|
853
|
public int compare(RecommendZhan o1, RecommendZhan o2) {
|
922
|
854
|
int fast_able_num1;
|
|
@ -967,7 +899,7 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
967
|
899
|
}
|
968
|
900
|
|
969
|
901
|
if (firstCondition == 5) { // 评分最高
|
970
|
|
Collections.sort(list4, new Comparator<RecommendZhan>() {
|
|
902
|
Collections.sort(list, new Comparator<RecommendZhan>() {
|
971
|
903
|
@Override
|
972
|
904
|
public int compare(RecommendZhan o1, RecommendZhan o2) {
|
973
|
905
|
double star1;
|
|
@ -995,6 +927,76 @@ public class RecommendChargingStationActivity extends AppCompatActivity implemen
|
995
|
927
|
});
|
996
|
928
|
}
|
997
|
929
|
|
|
930
|
if (list.size() > 30) {
|
|
931
|
list = list.subList(0, 30);
|
|
932
|
}
|
|
933
|
|
|
934
|
|
|
935
|
List<RecommendZhan> list1 = new ArrayList<>();
|
|
936
|
if (firstCanCharging) {
|
|
937
|
for (RecommendZhan item : list) {
|
|
938
|
if ("1".equals(item.getOwn_pay())) {
|
|
939
|
list1.add(item);
|
|
940
|
}
|
|
941
|
}
|
|
942
|
} else {
|
|
943
|
for (RecommendZhan item : list) {
|
|
944
|
list1.add(item);
|
|
945
|
}
|
|
946
|
}
|
|
947
|
|
|
948
|
List<RecommendZhan> list2 = new ArrayList<>();
|
|
949
|
if (firstFreeParking) {
|
|
950
|
for (RecommendZhan item : list1) {
|
|
951
|
if (item.getStop_cost().contains("免费")) {
|
|
952
|
list2.add(item);
|
|
953
|
}
|
|
954
|
}
|
|
955
|
} else {
|
|
956
|
for (RecommendZhan item : list1) {
|
|
957
|
list2.add(item);
|
|
958
|
}
|
|
959
|
}
|
|
960
|
|
|
961
|
List<RecommendZhan> list3 = new ArrayList<>();
|
|
962
|
if (firstQuickCharging) {
|
|
963
|
for (RecommendZhan item : list2) {
|
|
964
|
int fastNum;
|
|
965
|
if ("".equals(item.getFast_num())) {
|
|
966
|
fastNum = 0;
|
|
967
|
} else {
|
|
968
|
fastNum = Integer.parseInt(item.getFast_num());
|
|
969
|
}
|
|
970
|
|
|
971
|
if (fastNum > 0) {
|
|
972
|
list3.add(item);
|
|
973
|
}
|
|
974
|
}
|
|
975
|
} else {
|
|
976
|
for (RecommendZhan item : list2) {
|
|
977
|
list3.add(item);
|
|
978
|
}
|
|
979
|
}
|
|
980
|
|
|
981
|
List<RecommendZhan> list4 = new ArrayList<>();
|
|
982
|
if (firstSlowCharging) {
|
|
983
|
for (RecommendZhan item : list3) {
|
|
984
|
int slowNum;
|
|
985
|
if ("".equals(item.getSlow_num())) {
|
|
986
|
slowNum = 0;
|
|
987
|
} else {
|
|
988
|
slowNum = Integer.parseInt(item.getSlow_num());
|
|
989
|
}
|
|
990
|
if (slowNum > 0) {
|
|
991
|
list4.add(item);
|
|
992
|
}
|
|
993
|
}
|
|
994
|
} else {
|
|
995
|
for (RecommendZhan item : list3) {
|
|
996
|
list4.add(item);
|
|
997
|
}
|
|
998
|
}
|
|
999
|
|
998
|
1000
|
recommendChargingStationAdapter.setData(list4);
|
999
|
1001
|
|
1000
|
1002
|
if (list4.size() == 0) {
|