Skip to content

Commit

Permalink
添加设备选择时的备注
Browse files Browse the repository at this point in the history
  • Loading branch information
taowenyin committed Mar 17, 2018
1 parent 08081df commit 231248b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/cn/edu/siso/rlxapf/DeviceListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.widget.ImageButton;
import android.widget.SimpleAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.alibaba.fastjson.JSON;
Expand Down Expand Up @@ -84,6 +85,8 @@ public static enum HTTP_REQ_TYPE {
private List<Map<String, String>> deviceListGprsData = null;
private int currGprsIndex = 0;

private TextView deviceListComment = null;

private Button deviceConnectBtn = null;

// 当前HTTP请求类型
Expand Down Expand Up @@ -180,6 +183,8 @@ protected void onCreate(Bundle savedInstanceState) {
deviceListGprs.setAdapter(deviceListGprsAdapter);
deviceListGprs.setOnItemSelectedListener(this);

deviceListComment = (TextView) findViewById(R.id.device_list_comment);

deviceConnectBtn = (Button) findViewById(R.id.device_connect_btn);

httpHandler = new HttpHandler();
Expand Down Expand Up @@ -609,6 +614,7 @@ public void handleMessage(Message msg) {

if (currHttpReqType == HTTP_REQ_TYPE.REQ_DEVICE) {
deviceData = JSON.parseArray(resultData, DeviceBean.class);
deviceListComment.setText(deviceData.get(0).getComment());
}

}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/cn/edu/siso/rlxapf/bean/DeviceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class DeviceBean {
private String authority = StringUtils.EMPTY;
private String onoff = StringUtils.EMPTY;
private String deleted = StringUtils.EMPTY;
private String comment = StringUtils.EMPTY;
private String address = StringUtils.EMPTY;
private String contact = StringUtils.EMPTY;
private String phone = StringUtils.EMPTY;
Expand Down Expand Up @@ -172,6 +173,14 @@ public void setDeleted(String deleted) {
this.deleted = deleted;
}

public String getComment() {
return comment;
}

public void setComment(String comment) {
this.comment = comment;
}

public String getAddress() {
return address;
}
Expand Down
29 changes: 29 additions & 0 deletions app/src/main/res/layout/activity_device_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,35 @@

</LinearLayout>

<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/device_list_item_split_size"
android:background="@color/split_line_color"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="@dimen/device_list_item_vertical_padding"
android:paddingBottom="@dimen/device_list_item_vertical_padding"
android:orientation="horizontal">

<TextView
android:layout_width="@dimen/device_list_item_label_width"
android:layout_height="wrap_content"
android:textColor="@color/label_color"
android:text="@string/device_list_label_comment"
android:textSize="@dimen/device_list_item_font_size"/>

<TextView
android:id="@+id/device_list_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="@dimen/device_list_item_font_size"/>

</LinearLayout>

</LinearLayout>

<Button
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<string name="device_list_label_company">公司</string>
<string name="device_list_label_type">类型</string>
<string name="device_list_label_gprs">GPRS</string>
<string name="device_list_label_comment">备注</string>
<string name="device_list_label_connect">连接</string>

<string name="device_search_ok">确认</string>
Expand Down

0 comments on commit 231248b

Please sign in to comment.