"lines-code">
}
|
783
|
798
|
|
|
|
@ -817,38 +832,19 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
|
817
|
832
|
|
|
818
|
833
|
try {
|
|
819
|
834
|
String acNum = JsonUtils.getKeyResult(json, "acNum");
|
|
820
|
|
// tvacNum.setText(acNum);
|
|
821
|
835
|
|
|
822
|
836
|
String dcNum = JsonUtils.getKeyResult(json, "dcNum");
|
|
823
|
837
|
String acableNum = JsonUtils.getKeyResult(json, "acableNum");
|
|
824
|
838
|
String dcableNum = JsonUtils.getKeyResult(json, "dcableNum");
|
|
825
|
|
// if (zhan.getSupplier().equals("特来电")){
|
|
826
|
839
|
fast.setText("空闲" + acableNum + "/共" + acNum + "个");
|
|
827
|
840
|
slow.setText("空闲" + dcableNum + "/共" + dcNum + "个");
|
|
828
|
841
|
} catch (Exception e) {
|
|
829
|
842
|
e.printStackTrace();
|
|
830
|
843
|
}
|
|
831
|
844
|
|
|
832
|
|
// }else{
|
|
833
|
|
// fast.setText(zhan.getFast_num() + "个");
|
|
834
|
|
// if (fast.getText().toString().equals(""+"个")){
|
|
835
|
|
// fast.setText("0个");
|
|
836
|
|
// }
|
|
837
|
|
// }
|
|
838
|
845
|
|
|
839
|
846
|
}
|
|
840
|
847
|
|
|
841
|
|
// private void getCreate(){
|
|
842
|
|
// new Thread(new Runnable() {
|
|
843
|
|
// @Override
|
|
844
|
|
// public void run() {
|
|
845
|
|
// createDialog();
|
|
846
|
|
// }
|
|
847
|
|
// }).start();
|
|
848
|
|
//
|
|
849
|
|
// }
|
|
850
|
|
|
|
851
|
|
|
|
852
|
848
|
private TextView detail_address, detail_grade, detail_picnum, detail_zhan_distance,
|
|
853
|
849
|
detail_fast_num, detail_fastable, detail_fastable_num, detail_slow_num, detail_slowable, detail_slowable_num,
|
|
854
|
850
|
detail_supplier, detail_cost, detail_serve_cost, detail_serve_cost_two,
|
|
|
@ -857,7 +853,7 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
|
857
|
853
|
private AlignTextView detail_park_cost;
|
|
858
|
854
|
private AlignTextView detail_remark;
|
|
859
|
855
|
private AlignTextView detail_zhan_name;
|
|
860
|
|
private ImageView chat_share_bar;
|
|
|
856
|
private ImageView chat_share_bar;
|
|
861
|
857
|
private LinearLayout red_paper_bag_top;
|
|
862
|
858
|
private AlignTextView detail_time;
|
|
863
|
859
|
public static TextView detail_list_num;
|
|
|
@ -931,6 +927,8 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
|
931
|
927
|
iv_new_icon = (CircleImageView) v.findViewById(R.id.iv_new_icon);
|
|
932
|
928
|
ll_yunyingshang = (LinearLayout) v.findViewById(R.id.ll_yunyingshang);
|
|
933
|
929
|
view_789 = v.findViewById(R.id.view_789);
|
|
|
930
|
parking_icon = v.findViewById(R.id.parking_icon);
|
|
|
931
|
parking_icon.setOnClickListener(this);
|
|
934
|
932
|
}
|
|
935
|
933
|
|
|
936
|
934
|
@Override
|
|
|
@ -975,6 +973,29 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
|
975
|
973
|
i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
|
976
|
974
|
startActivity(i);
|
|
977
|
975
|
break;
|
|
|
976
|
case R.id.parking_icon: // 停车位相关操作
|
|
|
977
|
if ("1".equals(freeStatus)) { // 有状态的站点
|
|
|
978
|
if ("0".equals(acableNum) && "0".equals(dcableNum)) { // 无空闲桩
|
|
|
979
|
// todo alert
|
|
|
980
|
} else {
|
|
|
981
|
if ("1002".equals(vacancyCode)) { // 无有空闲桩
|
|
|
982
|
// todo alert
|
|
|
983
|
addVacancy();
|
|
|
984
|
} else { // 有空闲桩
|
|
|
985
|
// todo alert
|
|
|
986
|
addVacancy();
|
|
|
987
|
}
|
|
|
988
|
}
|
|
|
989
|
} else {
|
|
|
990
|
if ("1002".equals(vacancyCode)) { // 无有空闲桩
|
|
|
991
|
// todo alert
|
|
|
992
|
addVacancy();
|
|
|
993
|
} else { // 有空闲桩
|
|
|
994
|
// todo alert
|
|
|
995
|
addVacancy();
|
|
|
996
|
}
|
|
|
997
|
}
|
|
|
998
|
break;
|
|
978
|
999
|
}
|
|
979
|
1000
|
}
|
|
980
|
1001
|
|
|
|
@ -1535,4 +1556,144 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
|
|
1535
|
1556
|
public void setOnUpdateScanChargeFragmentListener(OnDetailsFragmentListener listener) {
|
|
1536
|
1557
|
this.detailsFragmentListener = listener;
|
|
1537
|
1558
|
}
|
|
|
1559
|
|
|
|
1560
|
/**
|
|
|
1561
|
* 获取站空位
|
|
|
1562
|
*/
|
|
|
1563
|
private void getVacancy() {
|
|
|
1564
|
Map<String, String> map = new HashMap<>();
|
|
|
1565
|
map.put("zhanid", NewZhanDetailsActivity.zhan_id + "");
|
|
|
1566
|
CommonParams.addCommonParams(map);
|
|
|
1567
|
String query = Util.convertMap2Query(map);
|
|
|
1568
|
|
|
|
1569
|
String url = MainApplication.url + ":9080/get_vacancy?" + query;
|
|
|
1570
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
|
|
1571
|
@Override
|
|
|
1572
|
public void onError(Call call, Exception e) {
|
|
|
1573
|
loadingDialog.dismiss();
|
|
|
1574
|
parking_icon.setVisibility(View.GONE);
|
|
|
1575
|
}
|
|
|
1576
|
|
|
|
1577
|
@Override
|
|
|
1578
|
public void onResponse(String response) {
|
|
|
1579
|
loadingDialog.dismiss();
|
|
|
1580
|
vacancyCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
|
1581
|
updateParkingIcon();
|
|
|
1582
|
}
|
|
|
1583
|
});
|
|
|
1584
|
}
|
|
|
1585
|
|
|
|
1586
|
/**
|
|
|
1587
|
* 上传空车位
|
|
|
1588
|
*/
|
|
|
1589
|
|
|
|
1590
|
private void addVacancy() {
|
|
|
1591
|
if (!MainApplication.isLogin()){
|
|
|
1592
|
startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
|
|
|
1593
|
ToastUtil.showToast(getActivity().getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
|
|
|
1594
|
return;
|
|
|
1595
|
}
|
|
|
1596
|
|
|
|
1597
|
loadingDialog.show();
|
|
|
1598
|
|
|
|
1599
|
Map<String, String> map = new HashMap<>();
|
|
|
1600
|
map.put("zhanid", NewZhanDetailsActivity.zhan_id + "");
|
|
|
1601
|
map.put("userid", MainApplication.userId);
|
|
|
1602
|
String timer = getMD5(String.valueOf((System.currentTimeMillis() / 1000 - MainMapActivity.cha) / 10) + "qwerty");
|
|
|
1603
|
map.put("timer", timer);
|
|
|
1604
|
CommonParams.addCommonParams(map);
|
|
|
1605
|
String query = Util.convertMap2Query(map);
|
|
|
1606
|
String url = MainApplication.url + ":9080/add_vacancy?" + query;
|
|
|
1607
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
|
|
1608
|
@Override
|
|
|
1609
|
public void onError(Call call, Exception e) {
|
|
|
1610
|
loadingDialog.dismiss();
|
|
|
1611
|
}
|
|
|
1612
|
|
|
|
1613
|
@Override
|
|
|
1614
|
public void onResponse(String response) {
|
|
|
1615
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
|
1616
|
String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
|
|
|
1617
|
if ("0".equals(rtnCode)) {
|
|
|
1618
|
ToastUtil.showToast(getContext(), rtnMsg, Toast.LENGTH_SHORT);
|
|
|
1619
|
getVacancy();
|
|
|
1620
|
} else {
|
|
|
1621
|
loadingDialog.dismiss();
|
|
|
1622
|
ToastUtil.showToast(getContext(), rtnMsg, Toast.LENGTH_SHORT);
|
|
|
1623
|
}
|
|
|
1624
|
|
|
|
1625
|
}
|
|
|
1626
|
});
|
|
|
1627
|
}
|
|
|
1628
|
|
|
|
1629
|
private void updateParkingIcon() {
|
|
|
1630
|
if ("2000".equals(vacancyCode)) {
|
|
|
1631
|
parking_icon.setVisibility(View.GONE);
|
|
|
1632
|
} else {
|
|
|
1633
|
parking_icon.setVisibility(View.VISIBLE);
|
|
|
1634
|
if ("1".equals(freeStatus)) { // 有状态的站点
|
|
|
1635
|
if ("0".equals(acableNum) && "0".equals(dcableNum)) { // 无空闲桩
|
|
|
1636
|
parking_icon.setImageDrawable(getResources().getDrawable(R.drawable.detail_no_parking));
|
|
|
1637
|
} else {
|
|
|
1638
|
if ("1002".equals(vacancyCode)) { // 无有空闲桩
|
|
|
1639
|
parking_icon.setImageDrawable(getResources().getDrawable(R.drawable.detail_report_parking));
|
|
|
1640
|
} else { // 有空闲桩
|
|
|
1641
|
parking_icon.setImageDrawable(getResources().getDrawable(R.drawable.detail_parking));
|
|
|
1642
|
}
|
|
|
1643
|
}
|
|
|
1644
|
} else {
|
|
|
1645
|
if ("1002".equals(vacancyCode)) { // 无有空闲桩
|
|
|
1646
|
parking_icon.setImageDrawable(getResources().getDrawable(R.drawable.detail_report_parking));
|
|
|
1647
|
} else { // 有空闲桩
|
|
|
1648
|
parking_icon.setImageDrawable(getResources().getDrawable(R.drawable.detail_parking));
|
|
|
1649
|
}
|
|
|
1650
|
}
|
|
|
1651
|
}
|
|
|
1652
|
}
|
|
|
1653
|
|
|
|
1654
|
@Override
|
|
|
1655
|
public void onDestroyView() {
|
|
|
1656
|
try {
|
|
|
1657
|
loadingDialog.dismiss();
|
|
|
1658
|
} catch (Exception e) {
|
|
|
1659
|
e.printStackTrace();
|
|
|
1660
|
}
|
|
|
1661
|
super.onDestroyView();
|
|
|
1662
|
}
|
|
|
1663
|
|
|
|
1664
|
public static String getMD5(String content) {
|
|
|
1665
|
|
|
|
1666
|
try {
|
|
|
1667
|
|
|
|
1668
|
MessageDigest digest = MessageDigest.getInstance("MD5");
|
|
|
1669
|
|
|
|
1670
|
digest.update(content.getBytes());
|
|
|
1671
|
|
|
|
1672
|
return getHashString(digest);
|
|
|
1673
|
|
|
|
1674
|
|
|
|
1675
|
} catch (Exception e) {
|
|
|
1676
|
|
|
|
1677
|
}
|
|
|
1678
|
|
|
|
1679
|
return null;
|
|
|
1680
|
|
|
|
1681
|
}
|
|
|
1682
|
|
|
|
1683
|
private static String getHashString(MessageDigest digest) {
|
|
|
1684
|
|
|
|
1685
|
StringBuilder builder = new StringBuilder();
|
|
|
1686
|
|
|
|
1687
|
for (byte b : digest.digest()) {
|
|
|
1688
|
|
|
|
1689
|
builder.append(Integer.toHexString((b >> 4) & 0xf));
|
|
|
1690
|
|
|
|
1691
|
builder.append(Integer.toHexString(b & 0xf));
|
|
|
1692
|
|
|
|
1693
|
}
|
|
|
1694
|
|
|
|
1695
|
|
|
|
1696
|
return builder.toString().toLowerCase();
|
|
|
1697
|
|
|
|
1698
|
}
|
|
1538
|
1699
|
}
|
|
|
@ -12,6 +12,7 @@ import android.view.View;
|
|
12
|
12
|
import android.view.WindowManager;
|
|
13
|
13
|
|
|
14
|
14
|
import com.amap.api.maps.AMap;
|
|
|
15
|
import com.blankj.utilcode.util.StringUtils;
|
|
15
|
16
|
import com.electric.chargingpile.activity.MainMapActivity;
|
|
16
|
17
|
import com.electric.chargingpile.data.Zhan;
|
|
17
|
18
|
import com.electric.chargingpile.data.Zhuang;
|
|
|
@ -21,6 +22,8 @@ import java.io.File;
|
|
21
|
22
|
import java.io.FileOutputStream;
|
|
22
|
23
|
import java.io.IOException;
|
|
23
|
24
|
import java.io.InputStream;
|
|
|
25
|
import java.io.UnsupportedEncodingException;
|
|
|
26
|
import java.net.URLEncoder;
|
|
24
|
27
|
import java.text.DecimalFormat;
|
|
25
|
28
|
import java.util.ArrayList;
|
|
26
|
29
|
import java.util.HashMap;
|
|
|
@ -55,6 +58,28 @@ public class Util {
|
|
55
|
58
|
|
|
56
|
59
|
}
|
|
57
|
60
|
|
|
|
61
|
public static String convertMap2Query(Map<String, String>map) {
|
|
|
62
|
StringBuffer sb = new StringBuffer();
|
|
|
63
|
if (map.size() > 0) {
|
|
|
64
|
for (String key: map.keySet()) {
|
|
|
65
|
sb.append(key + "=");
|
|
|
66
|
String value = map.get(key);
|
|
|
67
|
if (StringUtils.isEmpty(value)) {
|
|
|
68
|
sb.append("&");
|
|
|
69
|
} else {
|
|
|
70
|
try {
|
|
|
71
|
value = URLEncoder.encode(value, "UTF-8");
|
|
|
72
|
} catch (UnsupportedEncodingException e) {
|
|
|
73
|
e.printStackTrace();
|
|
|
74
|
}
|
|
|
75
|
sb.append(value + "&");
|
|
|
76
|
}
|
|
|
77
|
}
|
|
|
78
|
}
|
|
|
79
|
return sb.toString();
|
|
|
80
|
}
|
|
|
81
|
|
|
|
82
|
|
|
58
|
83
|
public static String getRandom(int length) {
|
|
59
|
84
|
String val = "";
|
|
60
|
85
|
Random random = new Random();
|
|
|
@ -1,12 +1,10 @@
|
|
1
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
|
xmlns:cb="http://schemas.android.com/apk/res-auto"
|
|
5
|
|
xmlns:zhy="http://schemas.android.com/tools"
|
|
|
4
|
xmlns:tools="http://schemas.android.com/tools"
|
|
6
|
5
|
android:layout_width="match_parent"
|
|
7
|
6
|
android:layout_height="match_parent"
|
|
8
|
|
android:background="@color/white"
|
|
9
|
|
android:orientation="vertical">
|
|
|
7
|
android:background="@color/white">
|
|
10
|
8
|
|
|
11
|
9
|
<com.electric.chargingpile.view.CustomScrollView
|
|
12
|
10
|
android:layout_width="match_parent"
|
|
|
@ -17,16 +15,17 @@
|
|
17
|
15
|
android:layout_height="match_parent"
|
|
18
|
16
|
android:orientation="vertical">
|
|
19
|
17
|
|
|
20
|
|
<LinearLayout android:id="@+id/red_paper_bag_top"
|
|
|
18
|
<LinearLayout
|
|
|
19
|
android:id="@+id/red_paper_bag_top"
|
|
21
|
20
|
android:layout_width="match_parent"
|
|
22
|
|
android:visibility="gone"
|
|
23
|
|
zhy:visibility="visible"
|
|
24
|
21
|
android:layout_height="30dp"
|
|
25
|
22
|
android:layout_marginLeft="15dp"
|
|
26
|
23
|
android:layout_marginTop="15dp"
|
|
27
|
24
|
android:layout_marginRight="15dp"
|
|
28
|
25
|
android:background="@drawable/red_paper_bag_shape"
|
|
29
|
|
android:gravity="center_vertical">
|
|
|
26
|
android:gravity="center_vertical"
|
|
|
27
|
android:visibility="gone"
|
|
|
28
|
tools:visibility="visible">
|
|
30
|
29
|
|
|
31
|
30
|
<ImageView
|
|
32
|
31
|
android:layout_width="wrap_content"
|
|
|
@ -291,10 +290,13 @@
|
|
291
|
290
|
android:layout_width="match_parent"
|
|
292
|
291
|
android:layout_height="10dp"
|
|
293
|
292
|
android:background="@color/ui_f4" />
|
|
294
|
|
<ImageView android:id="@+id/chat_share_bar"
|
|
295
|
|
android:src="@drawable/chat_share_bar"
|
|
|
293
|
|
|
|
294
|
<ImageView
|
|
|
295
|
android:id="@+id/chat_share_bar"
|
|
296
|
296
|
android:layout_width="match_parent"
|
|
297
|
|
android:layout_height="wrap_content" />
|
|
|
297
|
android:layout_height="wrap_content"
|
|
|
298
|
android:src="@drawable/chat_share_bar" />
|
|
|
299
|
|
|
298
|
300
|
<View
|
|
299
|
301
|
android:layout_width="match_parent"
|
|
300
|
302
|
android:layout_height="10dp"
|
|
|
@ -395,7 +397,7 @@
|
|
395
|
397
|
android:text=""
|
|
396
|
398
|
android:textColor="@color/ui_65"
|
|
397
|
399
|
android:textSize="14sp"
|
|
398
|
|
cb:align="right" />
|
|
|
400
|
app:align="right" />
|
|
399
|
401
|
|
|
400
|
402
|
</RelativeLayout>
|
|
401
|
403
|
|
|
|
@ -533,7 +535,7 @@
|
|
533
|
535
|
android:text=""
|
|
534
|
536
|
android:textColor="@color/ui_65"
|
|
535
|
537
|
android:textSize="14sp"
|
|
536
|
|
cb:align="right" />
|
|
|
538
|
app:align="right" />
|
|
537
|
539
|
|
|
538
|
540
|
</RelativeLayout>
|
|
539
|
541
|
|
|
|
@ -563,7 +565,7 @@
|
|
563
|
565
|
android:text=""
|
|
564
|
566
|
android:textColor="@color/ui_65"
|
|
565
|
567
|
android:textSize="14sp"
|
|
566
|
|
cb:align="right" />
|
|
|
568
|
app:align="right" />
|
|
567
|
569
|
|
|
568
|
570
|
</RelativeLayout>
|
|
569
|
571
|
|
|
|
@ -796,7 +798,7 @@
|
|
796
|
798
|
android:layout_below="@+id/tv_new_comment"
|
|
797
|
799
|
android:layout_alignLeft="@+id/tv_new_comment"
|
|
798
|
800
|
android:layout_marginTop="10dp"
|
|
799
|
|
zhy:max_select="-1">
|
|
|
801
|
tools:max_select="-1">
|
|
800
|
802
|
|
|
801
|
803
|
</com.zhy.view.flowlayout.TagFlowLayout>
|
|
802
|
804
|
|
|
|
@ -830,4 +832,16 @@
|
|
830
|
832
|
|
|
831
|
833
|
</com.electric.chargingpile.view.CustomScrollView>
|
|
832
|
834
|
|
|
833
|
|
</LinearLayout>
|
|
|
835
|
<ImageView
|
|
|
836
|
android:id="@+id/parking_icon"
|
|
|
837
|
android:layout_width="wrap_content"
|
|
|
838
|
android:layout_height="wrap_content"
|
|
|
839
|
android:layout_marginRight="15dp"
|
|
|
840
|
android:layout_marginBottom="15dp"
|
|
|
841
|
android:src="@drawable/detail_report_parking"
|
|
|
842
|
android:visibility="gone"
|
|
|
843
|
tools:visibility="visible"
|
|
|
844
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
|
845
|
app:layout_constraintRight_toRightOf="parent" />
|
|
|
846
|
|
|
|
847
|
</android.support.constraint.ConstraintLayout>
|