|
@ -11,7 +11,9 @@ import android.os.Build;
|
11
|
11
|
import android.os.Bundle;
|
12
|
12
|
import android.os.Handler;
|
13
|
13
|
import android.os.Message;
|
|
14
|
|
14
|
15
|
import androidx.fragment.app.Fragment;
|
|
16
|
|
15
|
17
|
import android.text.SpannableString;
|
16
|
18
|
import android.text.Spanned;
|
17
|
19
|
import android.text.style.ForegroundColorSpan;
|
|
@ -39,6 +41,7 @@ import com.electric.chargingpile.activity.PriceDetailsActivity;
|
39
|
41
|
import com.electric.chargingpile.application.MainApplication;
|
40
|
42
|
import com.electric.chargingpile.data.ChartData;
|
41
|
43
|
import com.electric.chargingpile.data.MyOtto;
|
|
44
|
import com.electric.chargingpile.data.PileData;
|
42
|
45
|
import com.electric.chargingpile.data.RankinglistRefreshEvent;
|
43
|
46
|
import com.electric.chargingpile.data.Zhan;
|
44
|
47
|
import com.electric.chargingpile.util.CommonParams;
|
|
@ -93,6 +96,7 @@ import java.net.URLEncoder;
|
93
|
96
|
import java.security.MessageDigest;
|
94
|
97
|
import java.text.SimpleDateFormat;
|
95
|
98
|
import java.util.ArrayList;
|
|
99
|
import java.util.Calendar;
|
96
|
100
|
import java.util.Date;
|
97
|
101
|
import java.util.HashMap;
|
98
|
102
|
import java.util.List;
|
|
@ -126,7 +130,8 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
126
|
130
|
private TextView tv_claimer, tv_grade;
|
127
|
131
|
private View view_789;
|
128
|
132
|
String zhan_name, zhan_id, tid, zhan_address, supplier, total_num, fast_num, slow_num, stop_cost, charge_cost, telephone, remarks, suit_car, claimer, belong_attribute, poi_jing, poi_wei, charge_cost_way, other_cost, work_open, work_close;
|
129
|
|
private TextView tv_cost_info, tv_current_charging, tv_detail_charging_enter;
|
|
133
|
private TextView current_time_slot, tv_detail_charging_enter;
|
|
134
|
private LinearLayout tv_cost_info;
|
130
|
135
|
private LinearLayout ll_no_fenshi, ll_yes_fenshi;
|
131
|
136
|
private TextView tv_today_num;
|
132
|
137
|
|
|
@ -258,7 +263,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
258
|
263
|
other_cost = JsonUtils.getKeyResult(info_decode, "other_cost");
|
259
|
264
|
work_open = JsonUtils.getKeyResult(info_decode, "work_open");
|
260
|
265
|
work_close = JsonUtils.getKeyResult(info_decode, "work_close");
|
261
|
|
|
|
266
|
zongjia = JsonUtils.getKeyResult(info_decode, "zongjia");
|
262
|
267
|
String park_location = JsonUtils.getKeyResult(info_decode, "park_location");
|
263
|
268
|
String own_pay = JsonUtils.getKeyResult(info_decode, "own_pay");
|
264
|
269
|
if (detailsFragmentListener != null) {
|
|
@ -293,23 +298,20 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
293
|
298
|
} else {
|
294
|
299
|
ll_no_fenshi.setVisibility(View.GONE);
|
295
|
300
|
ll_yes_fenshi.setVisibility(View.VISIBLE);
|
296
|
|
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
|
297
|
|
Date curDate = new Date(System.currentTimeMillis());
|
298
|
|
String token = formatter.format(curDate);
|
299
|
|
|
300
|
|
String t = String.valueOf(DateUtils.getShortStringToDate(token));
|
301
|
|
for (int i = 0; i < datas.size(); i++) {
|
302
|
|
if (Integer.parseInt(String.valueOf(DateUtils.getShortStringToDate(datas.get(i).getString("start")))) < Integer.parseInt(t)
|
303
|
|
&& Integer.parseInt(String.valueOf(DateUtils.getShortStringToDate(datas.get(i).getString("end")))) > Integer.parseInt(t)) {
|
304
|
|
double c = Double.parseDouble(datas.get(i).getString("charge_free"));
|
305
|
|
BigDecimal bd = new BigDecimal(c);
|
306
|
|
double d = bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
307
|
|
double d_service = Double.parseDouble(datas.get(i).getString("service_free"));
|
308
|
|
tv_current_charging.setText(d + "元/度");
|
309
|
|
detail_serve_cost_two.setText(d_service + "元/度");
|
|
301
|
|
|
302
|
Calendar calendar = Calendar.getInstance();
|
|
303
|
int hours = calendar.get(Calendar.HOUR_OF_DAY);
|
|
304
|
int minutes = calendar.get(Calendar.MINUTE);
|
|
305
|
int totalMinutes = hours * 60 + minutes;
|
|
306
|
|
|
307
|
for (JSONObject obj : DetailsFragment.datas) {
|
|
308
|
PileData.FenshiInfoBean bean = JsonUtils.parseToObjectBean(obj.toString(), PileData.FenshiInfoBean.class);
|
|
309
|
if (totalMinutes >= bean.getStartTotalMinutes() && totalMinutes <= bean.getEndTotalMinutes()) {
|
|
310
|
current_time_slot.setText("当前时间段 " + bean.getStart() + "-" + bean.getEnd());
|
310
|
311
|
break;
|
311
|
312
|
}
|
312
|
313
|
}
|
|
314
|
total_price.setText(zongjia);
|
313
|
315
|
}
|
314
|
316
|
} else {
|
315
|
317
|
ll_no_fenshi.setVisibility(View.VISIBLE);
|
|
@ -332,15 +334,12 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
332
|
334
|
acableNum = JsonUtils.getKeyResult(info_decode, "acableNum");
|
333
|
335
|
dcableNum = JsonUtils.getKeyResult(info_decode, "dcableNum");
|
334
|
336
|
freeStatus = "1"; // 有状态的站点
|
335
|
|
// Log.e("dcableNum",dcableNum);
|
336
|
337
|
} else {
|
337
|
338
|
freeStatus = "0"; // 无状态的站点
|
338
|
339
|
}
|
339
|
340
|
|
340
|
|
|
341
|
341
|
detail_zhan_name.setText(zhan_name);
|
342
|
342
|
|
343
|
|
|
344
|
343
|
if (supplier.equals("")) {
|
345
|
344
|
detail_supplier.setText("暂无");
|
346
|
345
|
} else {
|
|
@ -791,6 +790,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
791
|
790
|
}
|
792
|
791
|
};
|
793
|
792
|
private ImageView parking_icon;
|
|
793
|
private String zongjia;
|
794
|
794
|
|
795
|
795
|
@Override
|
796
|
796
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
@ -855,7 +855,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
855
|
855
|
|
856
|
856
|
private TextView detail_address, detail_grade, detail_picnum, detail_zhan_distance,
|
857
|
857
|
window_tv_fast_total_num, window_tv_fast_free_label, window_tv_fast_free_num, window_tv_slow_total_num, window_tv_slow_free_label, window_tv_slow_free_num,
|
858
|
|
detail_supplier, detail_cost, detail_serve_cost, detail_serve_cost_two,
|
|
858
|
detail_supplier, detail_cost, detail_serve_cost, total_price,
|
859
|
859
|
details_claimer;
|
860
|
860
|
private AlignTextView detail_charge_cost;
|
861
|
861
|
private AlignTextView detail_park_cost;
|
|
@ -878,11 +878,10 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
878
|
878
|
ll_no_fenshi = (LinearLayout) v.findViewById(R.id.ll_no_fenshi);
|
879
|
879
|
ll_yes_fenshi = (LinearLayout) v.findViewById(R.id.ll_yes_fenshi);
|
880
|
880
|
|
881
|
|
tv_cost_info = (TextView) v.findViewById(R.id.tv_cost_info);
|
882
|
|
if (tv_cost_info != null) {
|
883
|
|
tv_cost_info.setOnClickListener(this);
|
884
|
|
}
|
885
|
|
tv_current_charging = (TextView) v.findViewById(R.id.tv_current_charging);
|
|
881
|
tv_cost_info = v.findViewById(R.id.tv_cost_info);
|
|
882
|
tv_cost_info.setOnClickListener(this);
|
|
883
|
|
|
884
|
current_time_slot = (TextView) v.findViewById(R.id.current_time_slot);
|
886
|
885
|
iv_level_img = (ImageView) v.findViewById(R.id.iv_level_img);
|
887
|
886
|
detail_view = v.findViewById(R.id.detail_view);
|
888
|
887
|
detail_claimer_remark = (LinearLayout) v.findViewById(R.id.detail_claimer_remark);
|
|
@ -911,7 +910,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
911
|
910
|
detail_cost = (TextView) v.findViewById(R.id.detail_cost);
|
912
|
911
|
detail_charge_cost = (AlignTextView) v.findViewById(R.id.detail_charge_cost);
|
913
|
912
|
detail_serve_cost = (TextView) v.findViewById(R.id.detail_serve_cost);
|
914
|
|
detail_serve_cost_two = (TextView) v.findViewById(R.id.detail_serve_cost_two);
|
|
913
|
total_price = (TextView) v.findViewById(R.id.total_price);
|
915
|
914
|
detail_park_cost = (AlignTextView) v.findViewById(R.id.detail_park_cost);
|
916
|
915
|
detail_time = (AlignTextView) v.findViewById(R.id.detail_time);
|
917
|
916
|
detail_list_num = (TextView) v.findViewById(R.id.detail_list_num);
|
|
@ -985,7 +984,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
985
|
984
|
if ("1".equals(freeStatus)) { // 有状态的站点
|
986
|
985
|
if ("0".equals(acableNum) && "0".equals(dcableNum)) { // 无空闲桩
|
987
|
986
|
ReportParkingDialogFragment reportParkingDialogFragment = ReportParkingDialogFragment.newInstance(ReportParkingDialogFragment.TYPE_THIRD);
|
988
|
|
reportParkingDialogFragment.show(getFragmentManager(),"没有充电车位");
|
|
987
|
reportParkingDialogFragment.show(getFragmentManager(), "没有充电车位");
|
989
|
988
|
MobclickAgent.onEvent(getContext(), "1127");
|
990
|
989
|
} else {
|
991
|
990
|
if (MainApplication.center == null) {
|
|
@ -994,7 +993,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
994
|
993
|
double distance = AMapUtils.calculateLineDistance(MainApplication.center, latLng);
|
995
|
994
|
if (distance > 100) {
|
996
|
995
|
ReportParkingDialogFragment reportParkingDialogFragment = ReportParkingDialogFragment.newInstance(ReportParkingDialogFragment.TYPE_FIRST);
|
997
|
|
reportParkingDialogFragment.show(getFragmentManager(),"超过100米,无法上报充电车位");
|
|
996
|
reportParkingDialogFragment.show(getFragmentManager(), "超过100米,无法上报充电车位");
|
998
|
997
|
} else {
|
999
|
998
|
ReportParkingDialogFragment reportParkingDialogFragment = ReportParkingDialogFragment.newInstance(ReportParkingDialogFragment.TYPE_SECOND);
|
1000
|
999
|
reportParkingDialogFragment.setOnReportParkingDialogFragmentListener(new ReportParkingDialogFragment.OnReportParkingDialogFragmentListener() {
|
|
@ -1003,7 +1002,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
1003
|
1002
|
addVacancy();
|
1004
|
1003
|
}
|
1005
|
1004
|
});
|
1006
|
|
reportParkingDialogFragment.show(getFragmentManager(),"上报车位");
|
|
1005
|
reportParkingDialogFragment.show(getFragmentManager(), "上报车位");
|
1007
|
1006
|
}
|
1008
|
1007
|
MobclickAgent.onEvent(getContext(), "1126");
|
1009
|
1008
|
}
|
|
@ -1015,7 +1014,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
1015
|
1014
|
double distance = AMapUtils.calculateLineDistance(MainApplication.center, latLng);
|
1016
|
1015
|
if (distance > 100) {
|
1017
|
1016
|
ReportParkingDialogFragment reportParkingDialogFragment = ReportParkingDialogFragment.newInstance(ReportParkingDialogFragment.TYPE_FIRST);
|
1018
|
|
reportParkingDialogFragment.show(getFragmentManager(),"超过100米,无法上报充电车位");
|
|
1017
|
reportParkingDialogFragment.show(getFragmentManager(), "超过100米,无法上报充电车位");
|
1019
|
1018
|
} else {
|
1020
|
1019
|
ReportParkingDialogFragment reportParkingDialogFragment = ReportParkingDialogFragment.newInstance(ReportParkingDialogFragment.TYPE_SECOND);
|
1021
|
1020
|
reportParkingDialogFragment.setOnReportParkingDialogFragmentListener(new ReportParkingDialogFragment.OnReportParkingDialogFragmentListener() {
|
|
@ -1024,7 +1023,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
1024
|
1023
|
addVacancy();
|
1025
|
1024
|
}
|
1026
|
1025
|
});
|
1027
|
|
reportParkingDialogFragment.show(getFragmentManager(),"上报车位");
|
|
1026
|
reportParkingDialogFragment.show(getFragmentManager(), "上报车位");
|
1028
|
1027
|
}
|
1029
|
1028
|
MobclickAgent.onEvent(getContext(), "1126");
|
1030
|
1029
|
}
|
|
@ -1622,7 +1621,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
1622
|
1621
|
*/
|
1623
|
1622
|
|
1624
|
1623
|
private void addVacancy() {
|
1625
|
|
if (!MainApplication.isLogin()){
|
|
1624
|
if (!MainApplication.isLogin()) {
|
1626
|
1625
|
startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
|
1627
|
1626
|
ToastUtil.showToast(getActivity().getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
|
1628
|
1627
|
return;
|