ElectronicCardInfoOKActivity.java
6.18 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
package com.hjx.personalcenter.activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.hjx.personalcenter.R;
import com.hjx.personalcenter.db.Content;
import com.hjx.personalcenter.db.SaveParam;
import com.hjx.personalcenter.http.HttpManager;
import com.hjx.personalcenter.util.GetDevicesUtil;
/**确认保卡信息
* Created by h on 2017/8/11.
*/
public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener {
private Button btn_finish,btn_bangding;
private ImageView iv_last_step;
private TextView usename,deviceModel,customer_address,mac_adress,deviceNumber,shopadress,phone,tlePhone,tv_salesperson_phone;
private LinearLayout salesperson_phone_layout;
private String salesId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ok_cardinfo);
SysApplication.getInstance().addActivity(this);
initView();
initData();
initLister();
}
private void initView() {
btn_finish = (Button) findViewById(R.id.btn_finish);
iv_last_step = (ImageView) findViewById(R.id.cancel);
usename = (TextView) findViewById(R.id.iv_card_username);
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);
btn_bangding = (Button) findViewById(R.id.btn_bangding);
tv_salesperson_phone = (TextView) findViewById(R.id.tv_salesperson_phone);
salesperson_phone_layout = (LinearLayout) findViewById(R.id.salesperson_phone_layout);
}
private void initData() {
salesId=getIntent().getStringExtra(SaveParam.SALES_ID);
//获取设备信息
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(getIntent().getStringExtra(SaveParam.CARDPHONE));
if (salesId != null && !salesId.isEmpty()) {
tv_salesperson_phone.setText(getIntent().getStringExtra(SaveParam.SALES_PHONE));
}else{
salesperson_phone_layout.setVisibility(View.INVISIBLE);
}
}
private void initLister() {
iv_last_step.setOnClickListener(this);
btn_finish.setOnClickListener(this);
btn_bangding.setOnClickListener(this);
}
@Override
public void onClick(View v) {
String userID = SaveParam.getInstance().getLoginParam(this,"userId");
long auserID = 0;
switch (v.getId()){
case R.id.btn_finish:
Content.cardintentflag =1;
try {
auserID = Long.parseLong(userID);
} catch (NumberFormatException e) {
e.printStackTrace();
}
HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(),
customer_address.getText().toString().trim(),shopadress.getText().toString().trim(),
tlePhone.getText().toString().trim(),
deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(),
mac_adress.getText().toString().trim(),phone.getText().toString().trim(),
SaveParam.getInstance().getsaveCityParam(this,SaveParam.COUNTRY), salesId);
break;
case R.id.btn_bangding:
Content.cardintentflag =2;
try {
auserID = Long.parseLong(userID);
} catch (NumberFormatException e) {
e.printStackTrace();
}
HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(),
customer_address.getText().toString().trim(),shopadress.getText().toString().trim(),
tlePhone.getText().toString().trim(),
deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(),
mac_adress.getText().toString().trim(),phone.getText().toString().trim(),
SaveParam.getInstance().getsaveCityParam(this,SaveParam.COUNTRY),salesId);
break;
case R.id.cancel:
finish();
break;
}
}
// @Override
// public boolean onKeyDown(int keyCode, KeyEvent event) {
// if (keyCode == KeyEvent.KEYCODE_BACK) {
// SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,"");
// return false;//return true;拦截事件传递,从而屏蔽back键。
// }
// if (KeyEvent.KEYCODE_HOME == keyCode) {
// SaveParam.getInstance().saveCustomizeParam(ElectronicCardInfoOKActivity.this,SaveParam.CARDPHONE,"");
// return false;//同理
// }
// return super.onKeyDown(keyCode, event);
// }
}