浏览代码

修改直流桩可显示电压,交流只显示功率

hy 3 年之前
父节点
当前提交
f3a4f0f7f4

+ 28 - 21
app/src/main/java/com/electric/chargingpile/adapter/ZhuangStatusadapter.java

@ -167,32 +167,16 @@ public class ZhuangStatusadapter extends BaseAdapter {
167 167
            }
168 168
169 169
            holder.llZhuangControl.setVisibility(View.GONE);
170
            if ("0".equals(status.getNationalStandard())) {
171
                holder.tvType.setVisibility(View.GONE);
172
            } else {
173
                holder.tvType.setVisibility(View.VISIBLE);
174
                switch (status.getNationalStandard()) {
175
                    case "1":
176
                        holder.tvType.setText("国标2011");
177
                        break;
178
                    case "2":
179
                        holder.tvType.setText("国标2015");
180
                        break;
181
                    case "3":
182
                        holder.tvType.setText("国标2015,国标2011");
183
                }
184
            }
170
185 171
            String type, power, have_gun;
186 172
            if ("1".equals(status.getEleType())) {
187 173
                type = "直流快充";
174
                power= status.getPower()+ "kw"+"/"+ status.getWattmeter()+"V";
188 175
            } else {
189 176
                type = "交流慢充";
177
                power= status.getPower()+ "kw";
190 178
            }
191
            if ("0".equals(status.getPower())) {
192
                power = "";
193
            } else {
194
                power = " | " + status.getPower() + "kw";
195
            }
179
            holder.tvType.setText(power);
196 180
            //"has_gun": "0",//1有枪,2没有枪,0 没有这个桩的信息
197 181
            switch (status.getHas_gun()) {
198 182
                case "1":
@ -205,7 +189,30 @@ public class ZhuangStatusadapter extends BaseAdapter {
205 189
                    have_gun = "";
206 190
                    break;
207 191
            }
208
            holder.tvInfo.setText(type + power + have_gun);
192
193
            String gbFormat="";
194
            switch (status.getNationalStandard()) {
195
                case "1":
196
                    gbFormat=" | 国标2011";
197
                    break;
198
                case "2":
199
                    gbFormat=(" | 国标2015");
200
                    break;
201
                case "3":
202
                    gbFormat=(" | 国标2015,国标2011");
203
            }
204
            StringBuilder builderStr = new StringBuilder();
205
            if (gbFormat==""){
206
                builderStr.append(type)
207
                        .append(have_gun);
208
            }else{
209
                builderStr.append(type)
210
                        .append(gbFormat)
211
                        .append(have_gun);
212
213
            }
214
            holder.tvInfo.setText(builderStr);
215
209 216
        } catch (Exception e) {
210 217
            e.printStackTrace();
211 218
        }

+ 10 - 0
app/src/main/java/com/electric/chargingpile/data/ZhuangStatus.java

@ -20,6 +20,7 @@ public class ZhuangStatus {
20 20
     * soc : 0
21 21
     * nationalStandard : 1
22 22
     * order : 1
23
     * wattmeter :177   功率
23 24
     */
24 25
25 26
    private String pile_id;
@ -34,8 +35,17 @@ public class ZhuangStatus {
34 35
    private String status;
35 36
    private String soc;
36 37
    private String nationalStandard;
38
    private String wattmeter;
37 39
    private int order;
38 40
41
    public String getWattmeter() {
42
        return wattmeter;
43
    }
44
45
    public void setWattmeter(String wattmeter) {
46
        this.wattmeter = wattmeter;
47
    }
48
39 49
    public String getPile_id() {
40 50
        return pile_id;
41 51
    }

+ 11 - 3
app/src/main/res/layout/item_zhuang_status.xml

@ -1,6 +1,7 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    xmlns:app="http://schemas.android.com/apk/res-auto"
4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:id="@+id/rl_layout"
5 6
    android:orientation="vertical"
6 7
    android:layout_width="match_parent"
@ -8,6 +9,8 @@
8 9
    android:minHeight="96dp">
9 10
10 11
    <TextView
12
        tools:textColor="#f1f1"
13
        tools:text="空闲"
11 14
        android:id="@+id/tv_zhuang_staus"
12 15
        android:layout_width="wrap_content"
13 16
        android:layout_height="wrap_content"
@ -70,22 +73,26 @@
70 73
        android:layout_marginRight="15dp">
71 74
72 75
        <TextView
76
            android:textStyle="bold"
77
            tools:text="桩编码:1101050408103"
73 78
            android:id="@+id/tv_pile_id"
74 79
            android:layout_width="wrap_content"
75 80
            android:layout_height="wrap_content"
76 81
            android:singleLine="true"
77 82
            android:ellipsize="end"
78
            android:textColor="@color/ui_62"
83
            android:textColor="@color/color_text"
79 84
            android:textSize="14sp"
80 85
            android:layout_marginBottom="6dp"/>
81 86
82 87
        <TextView
88
89
            tools:text="90w"
83 90
            android:id="@+id/tv_zhuang_type"
84 91
            android:layout_width="wrap_content"
85 92
            android:layout_height="wrap_content"
86 93
            android:singleLine="true"
87 94
            android:ellipsize="end"
88
            android:textColor="@color/ui_65"
95
            android:textColor="@color/color_text"
89 96
            android:textSize="12sp"
90 97
            android:layout_marginBottom="4dp"/>
91 98
@ -127,10 +134,11 @@
127 134
        </LinearLayout>
128 135
129 136
        <TextView
137
            tools:text="直流快充 | 国标2015 | 有枪 "
130 138
            android:id="@+id/tv_zhuang_info"
131 139
            android:layout_width="wrap_content"
132 140
            android:layout_height="wrap_content"
133
            android:textColor="@color/ui_65"
141
            android:textColor="@color/color_text"
134 142
            android:textSize="12sp"
135 143
            android:layout_marginBottom="15dp"/>
136 144

+ 1 - 0
app/src/main/res/values/color.xml

@ -203,6 +203,7 @@
203 203
    <color name="color_e32727">#ffe32727</color>
204 204
    <color name="color_707070">#ff707070</color>
205 205
    <color name="color_f5f6f7">#F5F6F7</color>
206
    <color name="color_text">#1A1B1F</color>
206 207

207 208

208 209