ElectronicCardLookInfoActivity.java
6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package com.hjx.personalcenter.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.hjx.personalcenter.R;
import com.hjx.personalcenter.db.Content;
import com.hjx.personalcenter.db.SaveParam;
import com.hjx.personalcenter.http.HttpCode;
import com.hjx.personalcenter.http.HttpManager;
import com.hjx.personalcenter.model.CardInfo;
import com.hjx.personalcenter.util.AlertUtils;
import com.hjx.personalcenter.util.GetDevicesUtil;
import java.util.ArrayList;
/**
* Created by h on 2017/8/11.
*/
public class ElectronicCardLookInfoActivity extends FragmentActivity implements View.OnClickListener {
private ImageView iv_last_step;
private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber,
shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change;
private ArrayList<CardInfo.DataBean> data = new ArrayList<>();
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case HttpCode.SUCHCARDINFO:
CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj;
if (cardinfoBean != null) {
//获取设备信息
deviceModel.setText(cardinfoBean.getProductModel());
deviceNumber.setText(cardinfoBean.getDeviceNumber());
mac_adress.setText(cardinfoBean.getMacAddress());
//获取保卡信息
usename.setText(cardinfoBean.getCustomerName());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CUNSTEMNAME, cardinfoBean.getCustomerName());
customer_address.setText(cardinfoBean.getCustomerAddress());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.ADRESSCUNSTEM, cardinfoBean.getCustomerAddress());
shoptime.setText(cardinfoBean.getBuyTime());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTIME, cardinfoBean.getBuyTime());
shopadress.setText(cardinfoBean.getBuyAddress());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPADRESS, cardinfoBean.getBuyAddress());
tlePhone.setText(cardinfoBean.getAlterSaleCall());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTLEPHONE, cardinfoBean.getMobilePhone());
phone.setText(cardinfoBean.getMobilePhone());
SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CARDPHONE, cardinfoBean.getMobilePhone() );
initData();
}else {
AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录");
}
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_electronic_look_cardinfo);
initView();
initData();
initLister();
}
@Override
protected void onResume() {
super.onResume();
String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber();
HttpManager.getInstance().getcardinfo(this, deviceNumber, handler);
}
private void initView() {
usename = (TextView) findViewById(R.id.iv_card_username);
iv_last_step = (ImageView) findViewById(R.id.cancel);
deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel);
customer_address = (TextView) findViewById(R.id.tv_card_adress);
mac_adress = (TextView) findViewById(R.id.tv_card_mac);
shoptime = (TextView) findViewById(R.id.tv_card_time);
deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber);
shopadress = (TextView) findViewById(R.id.tv_card_shopAdress);
phone = (TextView) findViewById(R.id.tv_card_phone);
tlePhone = (TextView) findViewById(R.id.tv_card_tleNember);
tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change);
tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change);
}
private void initData() {
// //获取设备信息
// deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel());
// deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber());
// mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac());
// //获取保卡信息
// usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME));
// customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM));
// shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME));
// shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS));
// tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE));
// phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE));
}
private void initLister() {
tv_card_adress_change.setOnClickListener(this);
tv_card_phone_change.setOnClickListener(this);
iv_last_step.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_card_adress_change:
Intent intent = new Intent();
intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case R.id.tv_card_phone_change:
Content.authcodeflag = 2;
Intent intent1 = new Intent();
intent1.setClass(this, ElectronicCardValidationActivity.class);
startActivity(intent1);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case R.id.cancel:
finish();
break;
}
}
}