Commit d9f4ba632f498a49bc6985d54b382a3c3f06c1a1

Authored by xiongwei
1 parent a41324295d
Exists in master

电子保卡接口的调试

PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent;
3 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler;
6 import android.os.Message;
4 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
5 import android.view.View; 8 import android.view.View;
6 import android.widget.Button; 9 import android.widget.Button;
7 import android.widget.GridView; 10 import android.widget.GridView;
8 import android.widget.SimpleAdapter; 11 import android.widget.SimpleAdapter;
9 12
10 import com.hjx.personalcenter.R; 13 import com.hjx.personalcenter.R;
11 import com.hjx.personalcenter.customdialog.ElectronicCardDialog; 14 import com.hjx.personalcenter.customdialog.ElectronicCardDialog;
15 import com.hjx.personalcenter.http.HttpCode;
16 import com.hjx.personalcenter.http.HttpManager;
17
18 import org.json.JSONException;
19 import org.json.JSONObject;
12 20
13 import java.util.ArrayList; 21 import java.util.ArrayList;
14 import java.util.HashMap; 22 import java.util.HashMap;
15 import java.util.List; 23 import java.util.List;
16 import java.util.Map; 24 import java.util.Map;
17 25
18 /**选择教材 26 /**选择教材
19 * Created by h on 2017/8/10. 27 * Created by h on 2017/8/10.
20 */ 28 */
21 29
22 public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { 30 public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener {
23 private GridView gridView; 31 private GridView gridView;
24 private Button btn_ok; 32 private Button btn_ok;
25 private List<Map<String, Object>> data_list; 33 private List<Map<String, Object>> data_list;
26 private SimpleAdapter sim_adapter; 34 private SimpleAdapter sim_adapter;
27 // 图片封装为一个数组 35 // 图片封装为一个数组
28 private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, 36 private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher,
29 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, 37 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher,
30 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, 38 R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher,
31 R.mipmap.ic_launcher}; 39 R.mipmap.ic_launcher};
32 private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", 40 private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治",
33 "历史", "地理" }; 41 "历史", "地理" };
34 private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", 42 private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社",
35 "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", 43 "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社",
36 "人民教育出版社", "人民教育出版社" }; 44 "人民教育出版社", "人民教育出版社" };
45
46
47 Handler handler = new Handler(){
48 @Override
49 public void handleMessage(Message msg) {
50 super.handleMessage(msg);
51 JSONObject jsonObject;
52 String status;
53 switch (msg.what){
54 case HttpCode.CHECKCARD:
55 try {
56 jsonObject = new JSONObject( (String) msg.obj);
57 status = jsonObject.optString("status");
58 if (status.equals("1")){
59 Intent intent = new Intent();
60 intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class);
61 ChoiseTextBookActivity.this.startActivity(intent);
62 overridePendingTransition(R.anim.rightin, R.anim.rightout);
63 finish();
64 }else if(status.equals("0")){
65 ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog");
66 }
67
68 } catch (JSONException e) {
69 e.printStackTrace();
70 }
71
72 break;
73
74 }
75
76 }
77 };
78
37 @Override 79 @Override
38 protected void onCreate(Bundle savedInstanceState) { 80 protected void onCreate(Bundle savedInstanceState) {
39 super.onCreate(savedInstanceState); 81 super.onCreate(savedInstanceState);
40 setContentView(R.layout.activity_choisetextbook); 82 setContentView(R.layout.activity_choisetextbook);
41 initView(); 83 initView();
42 initData(); 84 initData();
43 initLister(); 85 initLister();
44 } 86 }
45 87
46 private void initView() { 88 private void initView() {
47 gridView = (GridView) findViewById(R.id.grideview); 89 gridView = (GridView) findViewById(R.id.grideview);
48 btn_ok = (Button) findViewById(R.id.btn_ok); 90 btn_ok = (Button) findViewById(R.id.btn_ok);
49 } 91 }
50 92
51 private void initData() { 93 private void initData() {
52 data_list = new ArrayList<Map<String, Object>>(); 94 data_list = new ArrayList<Map<String, Object>>();
53 getData(); 95 getData();
54 String [] from ={"image","text","text1"}; 96 String [] from ={"image","text","text1"};
55 int [] to = {R.id.image,R.id.text}; 97 int [] to = {R.id.image,R.id.text};
56 sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to); 98 sim_adapter = new SimpleAdapter(this, data_list, R.layout.activity_choisetextbook_items, from, to);
57 //配置适配器 99 //配置适配器
58 gridView.setAdapter(sim_adapter); 100 gridView.setAdapter(sim_adapter);
59 101
60 } 102 }
61 103
62 private void initLister() { 104 private void initLister() {
63 btn_ok.setOnClickListener(this); 105 btn_ok.setOnClickListener(this);
64 106
65 } 107 }
66 public List<Map<String, Object>> getData(){ 108 public List<Map<String, Object>> getData(){
67 //cion和iconName的长度是相同的,这里任选其一都可以 109 //cion和iconName的长度是相同的,这里任选其一都可以
68 for(int i=0;i<icon.length;i++){ 110 for(int i=0;i<icon.length;i++){
69 Map<String, Object> map = new HashMap<String, Object>(); 111 Map<String, Object> map = new HashMap<String, Object>();
70 map.put("image", icon[i]); 112 map.put("image", icon[i]);
71 map.put("text", subject[i]); 113 map.put("text", subject[i]);
72 map.put("text1", publish[i]); 114 map.put("text1", publish[i]);
73 data_list.add(map); 115 data_list.add(map);
74 } 116 }
75 117
76 return data_list; 118 return data_list;
77 } 119 }
78 120
79 @Override 121 @Override
80 public void onClick(View v) { 122 public void onClick(View v) {
81 switch (v.getId()){ 123 switch (v.getId()){
82 case R.id.btn_ok: 124 case R.id.btn_ok:
83 ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); 125 HttpManager.getInstance().cardinfocheck(this,836,handler);
84 break; 126 break;
85 } 127 }
86 128
87 } 129 }
88 } 130 }
89 131
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.view.View; 5 import android.view.View;
6 import android.widget.Button; 6 import android.widget.Button;
7 import android.widget.ImageView; 7 import android.widget.ImageView;
8 import android.widget.TextView; 8 import android.widget.TextView;
9 9
10 import com.hjx.personalcenter.R; 10 import com.hjx.personalcenter.R;
11 import com.hjx.personalcenter.db.SaveParam; 11 import com.hjx.personalcenter.db.SaveParam;
12 import com.hjx.personalcenter.http.HttpManager; 12 import com.hjx.personalcenter.http.HttpManager;
13 import com.hjx.personalcenter.util.GetDevicesUtil; 13 import com.hjx.personalcenter.util.GetDevicesUtil;
14 14
15 /**确认保卡信息 15 /**确认保卡信息
16 * Created by h on 2017/8/11. 16 * Created by h on 2017/8/11.
17 */ 17 */
18 18
19 public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { 19 public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener {
20 private Button btn_finish; 20 private Button btn_finish;
21 private ImageView iv_last_step; 21 private ImageView iv_last_step;
22 private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; 22 private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone;
23 @Override 23 @Override
24 protected void onCreate(Bundle savedInstanceState) { 24 protected void onCreate(Bundle savedInstanceState) {
25 super.onCreate(savedInstanceState); 25 super.onCreate(savedInstanceState);
26 setContentView(R.layout.activity_ok_cardinfo); 26 setContentView(R.layout.activity_ok_cardinfo);
27 initView(); 27 initView();
28 initData(); 28 initData();
29 initLister(); 29 initLister();
30 } 30 }
31 private void initView() { 31 private void initView() {
32 btn_finish = (Button) findViewById(R.id.btn_finish); 32 btn_finish = (Button) findViewById(R.id.btn_finish);
33 iv_last_step = (ImageView) findViewById(R.id.cancel); 33 iv_last_step = (ImageView) findViewById(R.id.cancel);
34 usename = (TextView) findViewById(R.id.iv_card_username); 34 usename = (TextView) findViewById(R.id.iv_card_username);
35 deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); 35 deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel);
36 customer_address = (TextView) findViewById(R.id.tv_card_adress); 36 customer_address = (TextView) findViewById(R.id.tv_card_adress);
37 mac_adress = (TextView) findViewById(R.id.tv_card_mac); 37 mac_adress = (TextView) findViewById(R.id.tv_card_mac);
38 shoptime = (TextView) findViewById(R.id.tv_card_time); 38 shoptime = (TextView) findViewById(R.id.tv_card_time);
39 deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); 39 deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber);
40 shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); 40 shopadress = (TextView) findViewById(R.id.tv_card_shopAdress);
41 phone = (TextView) findViewById(R.id.tv_card_phone); 41 phone = (TextView) findViewById(R.id.tv_card_phone);
42 tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); 42 tlePhone = (TextView) findViewById(R.id.tv_card_tleNember);
43 } 43 }
44 44
45 private void initData() { 45 private void initData() {
46 //获取设备信息 46 //获取设备信息
47 deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); 47 deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel());
48 deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); 48 deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber());
49 mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); 49 mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac());
50 //获取保卡信息 50 //获取保卡信息
51 usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); 51 usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME));
52 customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); 52 customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM));
53 shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); 53 shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME));
54 shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); 54 shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS));
55 tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); 55 tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE));
56 phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); 56 phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE));
57 57
58 58
59 } 59 }
60 60
61 private void initLister() { 61 private void initLister() {
62 iv_last_step.setOnClickListener(this); 62 iv_last_step.setOnClickListener(this);
63 btn_finish.setOnClickListener(this); 63 btn_finish.setOnClickListener(this);
64 } 64 }
65 65
66 @Override 66 @Override
67 public void onClick(View v) { 67 public void onClick(View v) {
68 switch (v.getId()){ 68 switch (v.getId()){
69 case R.id.btn_finish: 69 case R.id.btn_finish:
70 HttpManager.getInstance().subcardinfo(this,636,usename.getText().toString().trim(), 70 HttpManager.getInstance().subcardinfo(this,736,usename.getText().toString().trim(),
71 customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), 71 customer_address.getText().toString().trim(),shopadress.getText().toString().trim(),
72 shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), 72 shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(),
73 deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), 73 deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(),
74 mac_adress.getText().toString().trim(),phone.getText().toString().trim()); 74 mac_adress.getText().toString().trim(),phone.getText().toString().trim());
75 break; 75 break;
76 case R.id.cancel: 76 case R.id.cancel:
77 finish(); 77 finish();
78 break; 78 break;
79 } 79 }
80 } 80 }
81 81
82 82
83 } 83 }
84 84
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler;
6 import android.os.Message;
5 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
6 import android.view.View; 8 import android.view.View;
7 import android.widget.ImageView; 9 import android.widget.ImageView;
8 import android.widget.TextView; 10 import android.widget.TextView;
9 11
10 import com.hjx.personalcenter.R; 12 import com.hjx.personalcenter.R;
11 import com.hjx.personalcenter.db.Content; 13 import com.hjx.personalcenter.db.Content;
12 import com.hjx.personalcenter.db.SaveParam; 14 import com.hjx.personalcenter.db.SaveParam;
15 import com.hjx.personalcenter.http.HttpCode;
16 import com.hjx.personalcenter.http.HttpManager;
17 import com.hjx.personalcenter.util.AlertUtils;
13 import com.hjx.personalcenter.util.GetDevicesUtil; 18 import com.hjx.personalcenter.util.GetDevicesUtil;
14 19
20 import org.json.JSONException;
21 import org.json.JSONObject;
22
15 /** 23 /**
16 * Created by h on 2017/8/11. 24 * Created by h on 2017/8/11.
17 */ 25 */
18 26
19 public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ 27 public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{
20 private ImageView iv_last_step; 28 private ImageView iv_last_step;
21 private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, 29 private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,
22 shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; 30 shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change;
23 31
32 Handler handler = new Handler(){
33 @Override
34 public void handleMessage(Message msg) {
35 super.handleMessage(msg);
36 JSONObject jsonObject;
37 String status;
38 switch (msg.what){
39 case HttpCode.SUCHCARDINFO:
40 try {
41 jsonObject = new JSONObject( (String) msg.obj);
42 status = jsonObject.optString("status");
43 if (status.equals("1")){
44 AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"显示电子保卡信息");
45 }else {
46 AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"保卡信息查询失败");
47 }
48
49 } catch (JSONException e) {
50 e.printStackTrace();
51 }
52
53 break;
54
55 }
56
57 }
58 };
59
24 @Override 60 @Override
25 protected void onCreate(Bundle savedInstanceState) { 61 protected void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState); 62 super.onCreate(savedInstanceState);
27 setContentView(R.layout.activity_electronic_look_cardinfo); 63 setContentView(R.layout.activity_electronic_look_cardinfo);
28 initView(); 64 initView();
29 initData(); 65 initData();
30 initLister(); 66 initLister();
31 } 67 }
32 private void initView() { 68 private void initView() {
33 usename = (TextView) findViewById(R.id.iv_card_username); 69 usename = (TextView) findViewById(R.id.iv_card_username);
34 iv_last_step = (ImageView) findViewById(R.id.cancel); 70 iv_last_step = (ImageView) findViewById(R.id.cancel);
35 deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); 71 deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel);
36 customer_address = (TextView) findViewById(R.id.tv_card_adress); 72 customer_address = (TextView) findViewById(R.id.tv_card_adress);
37 mac_adress = (TextView) findViewById(R.id.tv_card_mac); 73 mac_adress = (TextView) findViewById(R.id.tv_card_mac);
38 shoptime = (TextView) findViewById(R.id.tv_card_time); 74 shoptime = (TextView) findViewById(R.id.tv_card_time);
39 deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); 75 deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber);
40 shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); 76 shopadress = (TextView) findViewById(R.id.tv_card_shopAdress);
41 phone = (TextView) findViewById(R.id.tv_card_phone); 77 phone = (TextView) findViewById(R.id.tv_card_phone);
42 tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); 78 tlePhone = (TextView) findViewById(R.id.tv_card_tleNember);
43 tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); 79 tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change);
44 tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); 80 tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change);
45 } 81 }
46 private void initData() { 82 private void initData() {
83 HttpManager.getInstance().getcardinfo(this,736,handler);
47 //获取设备信息 84 //获取设备信息
48 deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); 85 deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel());
49 deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); 86 deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber());
50 mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); 87 mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac());
51 //获取保卡信息 88 //获取保卡信息
52 usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); 89 usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME));
53 customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); 90 customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM));
54 shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); 91 shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME));
55 shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); 92 shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS));
56 tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); 93 tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE));
57 phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); 94 phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE));
58 95
59 96
60 } 97 }
61 private void initLister() { 98 private void initLister() {
62 tv_card_adress_change.setOnClickListener(this); 99 tv_card_adress_change.setOnClickListener(this);
63 tv_card_phone_change.setOnClickListener(this); 100 tv_card_phone_change.setOnClickListener(this);
64 iv_last_step.setOnClickListener(this); 101 iv_last_step.setOnClickListener(this);
65 } 102 }
66 @Override 103 @Override
67 public void onClick(View v) { 104 public void onClick(View v) {
68 switch (v.getId()){ 105 switch (v.getId()){
69 case R.id.tv_card_adress_change: 106 case R.id.tv_card_adress_change:
70 Intent intent = new Intent(); 107 Intent intent = new Intent();
71 intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); 108 intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class);
72 startActivity(intent); 109 startActivity(intent);
73 overridePendingTransition(R.anim.rightin, R.anim.rightout); 110 overridePendingTransition(R.anim.rightin, R.anim.rightout);
74 111
75 break; 112 break;
76 case R.id.tv_card_phone_change: 113 case R.id.tv_card_phone_change:
77 Content.authcodeflag =2; 114 Content.authcodeflag =2;
78 Intent intent1 = new Intent(); 115 Intent intent1 = new Intent();
79 intent1.setClass(this,ElectronicCardValidationActivity.class); 116 intent1.setClass(this,ElectronicCardValidationActivity.class);
80 startActivity(intent1); 117 startActivity(intent1);
81 overridePendingTransition(R.anim.rightin, R.anim.rightout); 118 overridePendingTransition(R.anim.rightin, R.anim.rightout);
82 119
83 120
84 break; 121 break;
85 case R.id.cancel: 122 case R.id.cancel:
86 finish(); 123 finish();
87 break; 124 break;
88 } 125 }
89 } 126 }
90 127
91 } 128 }
92 129
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.os.Handler; 6 import android.os.Handler;
7 import android.os.Message; 7 import android.os.Message;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 import android.view.View; 9 import android.view.View;
10 import android.widget.Button; 10 import android.widget.Button;
11 import android.widget.EditText; 11 import android.widget.EditText;
12 import android.widget.TextView; 12 import android.widget.TextView;
13 13
14 import com.hjx.personalcenter.R; 14 import com.hjx.personalcenter.R;
15 import com.hjx.personalcenter.db.Content; 15 import com.hjx.personalcenter.db.Content;
16 import com.hjx.personalcenter.db.SaveParam; 16 import com.hjx.personalcenter.db.SaveParam;
17 import com.hjx.personalcenter.http.HttpCode; 17 import com.hjx.personalcenter.http.HttpCode;
18 import com.hjx.personalcenter.http.HttpManager; 18 import com.hjx.personalcenter.http.HttpManager;
19 import com.hjx.personalcenter.util.AlertUtils; 19 import com.hjx.personalcenter.util.AlertUtils;
20 import com.hjx.personalcenter.util.PhoneNumCheckUtils; 20 import com.hjx.personalcenter.util.PhoneNumCheckUtils;
21 21
22 import org.json.JSONObject; 22 import org.json.JSONObject;
23 23
24 /** 24 /**
25 * Created by h on 2017/8/9. 25 * Created by h on 2017/8/9.
26 */ 26 */
27 27
28 public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener { 28 public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener {
29 private Button btn_card_valiyanzhen,get_authcode; 29 private Button btn_card_valiyanzhen,get_authcode;
30 private EditText phonenumber,anth_6num;//;//密码 30 private EditText phonenumber,anth_6num;//;//密码
31 private TextView menu_title; 31 private TextView menu_title;
32 private int i = 0; 32 private int i = 0;
33 private Thread thread; 33 private Thread thread;
34 private String sourceStr ="android"; 34 private String sourceStr ="android";
35 private String typeStr = "register"; 35 private String typeStr = "register";
36 String authcode = ""; 36 String authcode = "";
37 Handler handler = new Handler() { 37 Handler handler = new Handler() {
38 @Override 38 @Override
39 public void handleMessage(Message msg) { 39 public void handleMessage(Message msg) {
40 super.handleMessage(msg); 40 super.handleMessage(msg);
41 JSONObject jsonObject; 41 JSONObject jsonObject;
42 String status; 42 String status;
43 switch (msg.what) { 43 switch (msg.what) {
44 case HttpCode.AUTHCODE_SUCESS: 44 case HttpCode.AUTHCODE_SUCESS:
45 jsonObject = (JSONObject) msg.obj; 45 jsonObject = (JSONObject) msg.obj;
46 status = jsonObject.optString("status"); 46 status = jsonObject.optString("status");
47 authcode = jsonObject.optString("jsessionid"); 47 authcode = jsonObject.optString("jsessionid");
48 if (status.equals("100")) { 48 if (status.equals("100")) {
49 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); 49 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功");
50 } 50 }
51 51
52 break; 52 break;
53 case HttpCode.AUTHCODE_FAIL: 53 case HttpCode.AUTHCODE_FAIL:
54 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); 54 AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败");
55 break; 55 break;
56 case 1: 56 case 1:
57 get_authcode.setEnabled(false); 57 get_authcode.setEnabled(false);
58 get_authcode.setClickable(false); 58 get_authcode.setClickable(false);
59 get_authcode.setText(Integer.toString(i--)+" s"); 59 get_authcode.setText(Integer.toString(i--)+" s");
60 if (i<=0){ 60 if (i<=0){
61 get_authcode.setEnabled(true); 61 get_authcode.setEnabled(true);
62 get_authcode.setClickable(true); 62 get_authcode.setClickable(true);
63 get_authcode.setText("获取验证码"); 63 get_authcode.setText("获取验证码");
64 } 64 }
65 break; 65 break;
66 } 66 }
67 } 67 }
68 }; 68 };
69 @Override 69 @Override
70 protected void onCreate(Bundle savedInstanceState) { 70 protected void onCreate(Bundle savedInstanceState) {
71 super.onCreate(savedInstanceState); 71 super.onCreate(savedInstanceState);
72 setContentView(R.layout.activity_electroniccard_validation); 72 setContentView(R.layout.activity_electroniccard_validation);
73 initView(); 73 initView();
74 initData(); 74 initData();
75 initLister(); 75 initLister();
76 } 76 }
77 77
78 private void initView() { 78 private void initView() {
79 btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); 79 btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen);
80 get_authcode = (Button) findViewById(R.id.btn_authcode); 80 get_authcode = (Button) findViewById(R.id.btn_authcode);
81 anth_6num = (EditText) findViewById(R.id.et_authcode); 81 anth_6num = (EditText) findViewById(R.id.et_authcode);
82 phonenumber = (EditText) findViewById(R.id.et_phonenumber); 82 phonenumber = (EditText) findViewById(R.id.et_phonenumber);
83 menu_title = (TextView) findViewById(R.id.menu_title); 83 menu_title = (TextView) findViewById(R.id.menu_title);
84 } 84 }
85 85
86 private void initData() { 86 private void initData() {
87 if (Content.authcodeflag==1){ 87 if (Content.authcodeflag==1){
88 menu_title.setText("填写保卡信息"); 88 menu_title.setText("填写保卡信息");
89 btn_card_valiyanzhen.setText("下一步");
89 90
90 }else if (Content.authcodeflag==2){ 91 }else if (Content.authcodeflag==2){
91 menu_title.setText("修改保卡信息"); 92 menu_title.setText("修改保卡信息");
93 btn_card_valiyanzhen.setText("确定");
94
92 }else { 95 }else {
93 menu_title.setText("更换绑定"); 96 menu_title.setText("更换绑定");
97 btn_card_valiyanzhen.setText("确定");
94 } 98 }
95 99
96 100
97 101
98 } 102 }
99 103
100 private void initLister() { 104 private void initLister() {
101 get_authcode.setOnClickListener(this); 105 get_authcode.setOnClickListener(this);
102 btn_card_valiyanzhen.setOnClickListener(this); 106 btn_card_valiyanzhen.setOnClickListener(this);
103 107
104 } 108 }
105 109
106 @Override 110 @Override
107 public void onClick(View v) { 111 public void onClick(View v) {
108 switch (v.getId()){ 112 switch (v.getId()){
109 case R.id.btn_card_valiyanzhen: 113 case R.id.btn_card_valiyanzhen:
110 SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim());
111 Intent intent = new Intent();
112 intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class);
113 startActivity(intent);
114 overridePendingTransition(R.anim.rightin, R.anim.rightout);
115 114
116 String usernameStr = phonenumber.getText().toString().trim(); 115 String usernameStr = phonenumber.getText().toString().trim();
117 String authcodeStr = anth_6num.getText().toString().trim(); 116 String authcodeStr = anth_6num.getText().toString().trim();
118 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { 117 if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) {
119 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); 118 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空");
120 return; 119 return;
121 } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ 120 } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){
122 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); 121 AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误");
123 122
124 }else if (!authcode.equals(authcodeStr)){ 123 }else if (!authcode.equals(authcodeStr)){
125 AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); 124 AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确");
126 }else { 125 }else {
127 if (Content.authcodeflag==1){ 126 if (Content.authcodeflag==1){
128 menu_title.setText("填写保卡信息"); 127 SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim());
128 Intent intent = new Intent();
129 intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class);
130 startActivity(intent);
131 overridePendingTransition(R.anim.rightin, R.anim.rightout);
129 132
130 }else if (Content.authcodeflag==2){ 133 }else if (Content.authcodeflag==2){
131 //调用接口 134 //修改保卡手机号
132 menu_title.setText("修改保卡信息"); 135 HttpManager.getInstance().changecardinfophone(this,
136 736,usernameStr,authcodeStr);
133 }else { 137 }else {
134 //修改手机号 138 //修改手机号
135 menu_title.setText("更换绑定"); 139 menu_title.setText("更换绑定");
136 } 140 }
137 // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); 141 // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim());
138 // Intent intent = new Intent(); 142 // Intent intent = new Intent();
139 // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); 143 // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class);
140 // startActivity(intent); 144 // startActivity(intent);
141 // overridePendingTransition(R.anim.rightin, R.anim.rightout); 145 // overridePendingTransition(R.anim.rightin, R.anim.rightout);
142 } 146 }
143 break; 147 break;
144 case R.id.btn_authcode: 148 case R.id.btn_authcode:
145 String usernameStr1 = phonenumber.getText().toString().trim(); 149 String usernameStr1 = phonenumber.getText().toString().trim();
146 if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ 150 if (!PhoneNumCheckUtils.isPhone(usernameStr1)){
147 AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); 151 AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号");
148 }else { 152 }else {
149 anth_6num.requestFocus(); 153 anth_6num.requestFocus();
150 HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); 154 HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this);
151 i = 60; 155 i = 60;
152 if(thread == null){ 156 if(thread == null){
153 thread = new Thread( new ThreadShow()); 157 thread = new Thread( new ThreadShow());
154 thread.start(); 158 thread.start();
155 } 159 }
156 160
157 } 161 }
158 162
159 break; 163 break;
160 } 164 }
161 } 165 }
162 // 线程类 定时器 166 // 线程类 定时器
163 class ThreadShow implements Runnable { 167 class ThreadShow implements Runnable {
164 168
165 @Override 169 @Override
166 public void run() { 170 public void run() {
167 // TODO Auto-generated method stub 171 // TODO Auto-generated method stub
168 while (true) { 172 while (true) {
169 try { 173 try {
170 Thread.sleep(1000); 174 Thread.sleep(1000);
171 Message msg = new Message(); 175 Message msg = new Message();
172 msg.what = 1; 176 msg.what = 1;
173 handler.sendMessage(msg); 177 handler.sendMessage(msg);
174 System.out.println("send..."); 178 System.out.println("send...");
175 } catch (Exception e) { 179 } catch (Exception e) {
176 // TODO Auto-generated catch block 180 // TODO Auto-generated catch block
177 e.printStackTrace(); 181 e.printStackTrace();
178 System.out.println("thread error..."); 182 System.out.println("thread error...");
179 } 183 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 package com.hjx.personalcenter.activity; 1 package com.hjx.personalcenter.activity;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
6 import android.view.View; 6 import android.view.View;
7 import android.widget.ImageView; 7 import android.widget.ImageView;
8 import android.widget.TextView; 8 import android.widget.TextView;
9 9
10 import com.hjx.personalcenter.R; 10 import com.hjx.personalcenter.R;
11 import com.mylhyl.circledialog.CircleDialog;
12 import com.mylhyl.circledialog.callback.ConfigInput;
13 import com.mylhyl.circledialog.params.InputParams;
14 import com.mylhyl.circledialog.view.listener.OnInputClickListener;
11 15
12 public class MainActivity extends AppCompatActivity implements View.OnClickListener { 16 public class MainActivity extends AppCompatActivity implements View.OnClickListener {
13 private ImageView iv_imformatioan,iv_look_card,iv_setting; 17 private ImageView iv_imformatioan,iv_look_card,iv_setting,iv_sign;
14 private TextView tv_edit_presoninfo; 18 private TextView tv_edit_presoninfo,tv_sign;
15 @Override 19 @Override
16 protected void onCreate(Bundle savedInstanceState) { 20 protected void onCreate(Bundle savedInstanceState) {
17 super.onCreate(savedInstanceState); 21 super.onCreate(savedInstanceState);
18 setContentView(R.layout.activity_main); 22 setContentView(R.layout.activity_main);
19 initView(); 23 initView();
20 initData(); 24 initData();
21 initLister(); 25 initLister();
22 } 26 }
23 27
24 private void initView() { 28 private void initView() {
25 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); 29 iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan);
26 iv_look_card = (ImageView) findViewById(R.id.iv_look_card); 30 iv_look_card = (ImageView) findViewById(R.id.iv_look_card);
27 tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); 31 tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo);
28 iv_setting = (ImageView) findViewById(R.id.iv_setting); 32 iv_setting = (ImageView) findViewById(R.id.iv_setting);
33 iv_sign = (ImageView) findViewById(R.id.iv_sign);
34 tv_sign = (TextView) findViewById(R.id.tv_sign);
29 } 35 }
30 36
31 private void initData() { 37 private void initData() {
32 38
33 } 39 }
34 40
35 private void initLister() { 41 private void initLister() {
36 iv_imformatioan.setOnClickListener(this); 42 iv_imformatioan.setOnClickListener(this);
37 iv_look_card.setOnClickListener(this); 43 iv_look_card.setOnClickListener(this);
38 tv_edit_presoninfo.setOnClickListener(this); 44 tv_edit_presoninfo.setOnClickListener(this);
39 iv_setting.setOnClickListener(this); 45 iv_setting.setOnClickListener(this);
46 iv_sign.setOnClickListener(this);
40 47
41 } 48 }
42 49
43 @Override 50 @Override
44 public void onClick(View v) { 51 public void onClick(View v) {
45 switch (v.getId()){ 52 switch (v.getId()){
46 case R.id.iv_imformatioan: 53 case R.id.iv_imformatioan:
47 Intent intent = new Intent(); 54 Intent intent = new Intent();
48 intent.setClass(MainActivity.this,FeedBackActivity.class); 55 intent.setClass(MainActivity.this,FeedBackActivity.class);
49 startActivity(intent); 56 startActivity(intent);
50 overridePendingTransition(R.anim.rightin, R.anim.rightout); 57 overridePendingTransition(R.anim.rightin, R.anim.rightout);
51 break; 58 break;
52 case R.id.iv_look_card: 59 case R.id.iv_look_card:
53 Intent lookintent = new Intent(); 60 Intent lookintent = new Intent();
54 lookintent.setClass(MainActivity.this,ElectronicCardLookInfoActivity.class); 61 lookintent.setClass(MainActivity.this,ElectronicCardLookInfoActivity.class);
55 startActivity(lookintent); 62 startActivity(lookintent);
56 overridePendingTransition(R.anim.rightin, R.anim.rightout); 63 overridePendingTransition(R.anim.rightin, R.anim.rightout);
57 break; 64 break;
58 case R.id.tv_edit_presoninfo: 65 case R.id.tv_edit_presoninfo:
59 Intent editintent = new Intent(); 66 Intent editintent = new Intent();
60 editintent.setClass(MainActivity.this,ChangePresonalInfoActivity.class); 67 editintent.setClass(MainActivity.this,ChangePresonalInfoActivity.class);
61 startActivity(editintent); 68 startActivity(editintent);
62 overridePendingTransition(R.anim.rightin, R.anim.rightout); 69 overridePendingTransition(R.anim.rightin, R.anim.rightout);
63 break; 70 break;
64 case R.id.iv_setting: 71 case R.id.iv_setting:
65 Intent settingintent = new Intent(); 72 Intent settingintent = new Intent();
66 settingintent.setClass(MainActivity.this,LoginAndRegisterActivity.class); 73 settingintent.setClass(MainActivity.this,LoginAndRegisterActivity.class);
67 startActivity(settingintent); 74 startActivity(settingintent);
68 overridePendingTransition(R.anim.rightin, R.anim.rightout); 75 overridePendingTransition(R.anim.rightin, R.anim.rightout);
69 break; 76 break;
77 case R.id.iv_sign:
78 new CircleDialog.Builder(this)
79 .setCanceledOnTouchOutside(false)
80 .setCancelable(true)
81 .setTitle("个性签名")
82 .setInputHint("请输入个性签名")
83 .setWidth(0.5f)
84 .configInput(new ConfigInput() {
85 @Override
86 public void onConfig(InputParams params) {
87 // params.inputBackgroundResourceId = R.drawable.bg_input;
88 }
89 })
90 .setNegative("取消", null)
91 .setPositiveInput("确定", new OnInputClickListener() {
92 @Override
93 public void onClick(String text, View v) {
94 tv_sign.setText(text);
95 }
96 })
97 .show();
98 break;
99
70 } 100 }
71 101
72 } 102 }
73 } 103 }
74 104
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/CitysAdapter.java
File was created 1 package com.hjx.personalcenter.adapter;
2
3 import android.content.Context;
4 import android.view.View;
5 import android.view.ViewGroup;
6 import android.widget.BaseAdapter;
7 import android.widget.TextView;
8
9 import com.hjx.personalcenter.R;
10 import com.hjx.personalcenter.model.CityInfo;
11
12 import java.util.ArrayList;
13
14 /**
15 * Created by h on 2017/8/18.
16 */
17
18 public class CitysAdapter extends BaseAdapter {
19 ArrayList<CityInfo.CitiesBean> objects;
20 private Context context;
21
22 public CitysAdapter(ArrayList<CityInfo.CitiesBean> objects, Context context) {
23 this.objects = objects;
24 this.context = context;
25 }
26
27 @Override
28 public int getCount() {
29 return objects.size();
30 }
31
32 @Override
33 public Object getItem(int position) {
34 return position;
35 }
36
37 @Override
38 public long getItemId(int position) {
39 return position;
40 }
41
42 @Override
43 public View getView(final int position, View convertView, ViewGroup parent) {
44
45 ProvincesAdapter.ViewHolder holder = null;
46
47 if (convertView == null) {
48 convertView = View.inflate(context, R.layout.custom_adilog_list_item, null);
49 holder = new ProvincesAdapter.ViewHolder();
50 holder.nameText = (TextView) convertView.findViewById(R.id.list_items);
51 convertView.setTag(holder);
52 } else {
53 holder = (ProvincesAdapter.ViewHolder) convertView.getTag();
54 }
55
56 holder.nameText.setText(objects.get(position).getRegionName());
57
58 return convertView;
59 }
60
61
62 static class ViewHolder {
63 TextView nameText;
64 }
65 }
66
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.java
1 package com.hjx.personalcenter.customdialog; 1 package com.hjx.personalcenter.customdialog;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.graphics.Color; 4 import android.graphics.Color;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.view.Gravity; 6 import android.view.Gravity;
7 import android.view.LayoutInflater; 7 import android.view.LayoutInflater;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 import android.widget.AdapterView; 10 import android.widget.AdapterView;
11 import android.widget.ArrayAdapter;
12 import android.widget.ListView; 11 import android.widget.ListView;
13 12
14 import com.hjx.personalcenter.R; 13 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.adapter.CitysAdapter;
15 import com.hjx.personalcenter.db.SaveParam; 15 import com.hjx.personalcenter.db.SaveParam;
16 import com.hjx.personalcenter.http.HttpManager; 16 import com.hjx.personalcenter.interfaces.DialogCallBack;
17 import com.hjx.personalcenter.model.CityInfo;
17 import com.mylhyl.circledialog.BaseCircleDialog; 18 import com.mylhyl.circledialog.BaseCircleDialog;
18 import com.mylhyl.circledialog.res.values.CircleDimen; 19 import com.mylhyl.circledialog.res.values.CircleDimen;
19 20
20 import java.util.ArrayList; 21 import java.util.ArrayList;
21 22
22 /** 23 /**
23 * 自定义年级列表对话框 24 * 自定义市级列表对话框
24 * Created by h on 2017/8/10. 25 * Created by h on 2017/8/10.
25 */ 26 */
26 27
27 public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { 28 public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener {
28 ArrayAdapter listadapter; 29 private CitysAdapter listadapter;
29 ListView listView; 30 private ListView listView;
30 ArrayList<String> data = new ArrayList<>(); 31 private DialogCallBack.CallBack mCallBack;
31 32 private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>();
32 public static CitysListDialog getInstance() { 33 public static CitysListDialog getInstance() {
33 CitysListDialog dialogFragment = new CitysListDialog(); 34 CitysListDialog dialogFragment = new CitysListDialog();
34 dialogFragment.setCanceledBack(true); 35 dialogFragment.setCanceledBack(true);
35 dialogFragment.setCanceledOnTouchOutside(true); 36 dialogFragment.setCanceledOnTouchOutside(true);
36 dialogFragment.setRadius(CircleDimen.RADIUS); 37 dialogFragment.setRadius(CircleDimen.RADIUS);
37 dialogFragment.setWidth(0.5f); 38 dialogFragment.setWidth(0.5f);
38 dialogFragment.setGravity(Gravity.CENTER); 39 dialogFragment.setGravity(Gravity.CENTER);
39 dialogFragment.setBackgroundColor(Color.WHITE); 40 dialogFragment.setBackgroundColor(Color.WHITE);
40 return dialogFragment; 41 return dialogFragment;
41 } 42 }
42 43
43 @Override 44 @Override
44 public View createView(Context context, LayoutInflater inflater, ViewGroup container) { 45 public View createView(Context context, LayoutInflater inflater, ViewGroup container) {
45 return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); 46 return inflater.inflate(R.layout.custom_adilog_provicelist, container, false);
46 } 47 }
47 48
48 @Override 49 @Override
49 public void onActivityCreated(Bundle savedInstanceState) { 50 public void onActivityCreated(Bundle savedInstanceState) {
50 super.onActivityCreated(savedInstanceState); 51 super.onActivityCreated(savedInstanceState);
51 listView = (ListView) getView().findViewById(R.id.listadapter); 52 listView = (ListView) getView().findViewById(R.id.listadapter);
52 String provinces = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); 53 String provinces = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS);
53 if (provinces != null) { 54 // if (provinces != null) {
54 55 //
55 for (int i = 0; i < provinces.split(",").length; i++) { 56 // for (int i = 0; i < provinces.split(",").length; i++) {
56 String[] itmt = provinces.split(","); 57 // String[] itmt = provinces.split(",");
57 data.add(itmt[i] + "区"); 58 // data.add(itmt[i] + "区");
58 //data.add(i,provinces.replaceAll(",","省")); 59 // //data.add(i,provinces.replaceAll(",","省"));
59 60 //
60 } 61 // }
61 } else { 62 // } else {
62 HttpManager.getInstance().provices(getActivity()); 63 // HttpManager.getInstance().provices(getActivity());
63 } 64 // }
64 65
65 listadapter = new ArrayAdapter(getActivity(), R.layout.custom_adilog_list_item, R.id.list_items, data); 66 listadapter = new CitysAdapter(data,getActivity());
66 listView.setAdapter(listadapter); 67 listView.setAdapter(listadapter);
67 listView.setOnItemClickListener(this); 68 listView.setOnItemClickListener(this);
68 69
69 } 70 }
70 71
71 @Override 72 @Override
72 public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 73 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
73 //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); 74 //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show();
74 switch (position){ 75 switch (position){
75 76
76 77
77 78
78 } 79 }
79 80
80 81
81 82
82 dismiss(); 83 dismiss();
83 84
84 } 85 }
85 } 86 }
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
1 package com.hjx.personalcenter.db; 1 package com.hjx.personalcenter.db;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.SharedPreferences; 5 import android.content.SharedPreferences;
6 6
7 public class SaveParam { 7 public class SaveParam {
8 8
9 private static SaveParam instance; 9 private static SaveParam instance;
10 public static SaveParam getInstance(){ 10 public static SaveParam getInstance(){
11 if (instance==null){ 11 if (instance==null){
12 instance = new SaveParam(); 12 instance = new SaveParam();
13 } 13 }
14 return instance; 14 return instance;
15 } 15 }
16 //个人信息 16 //个人信息
17 //电子保卡信息 17 //电子保卡信息
18 public static String CARDPHONE = "cardphone";//保卡手机号 18 public static String CARDPHONE = "cardphone";//保卡手机号
19 public static String CUNSTEMNAME = "cunstemname";//客户姓名 19 public static String CUNSTEMNAME = "cunstemname";//客户姓名
20 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 20 public static String ADRESSCUNSTEM = "adresscunstem";//客户地址
21 public static String SHOPTIME = "shoptime";//购买时间 21 public static String SHOPTIME = "shoptime";//购买时间
22 public static String SHOPADRESS = "shopadress";//购买地址 22 public static String SHOPADRESS = "shopadress";//购买地址
23 public static String SHOPTLEPHONE = "shoptlephone";//售后电话 23 public static String SHOPTLEPHONE = "shoptlephone";//售后电话
24 24
25 //省市区参数 25 //省市区参数
26 public static String PROVINCES = "provinces";//省 26 public static String PROVINCES = "provinces";//省
27 public static String CITYS = "citys"; 27 public static String CITYS = "citys";
28 28
29 29
30 public void saveLoginParam(Context context,String spname, String spstr) { 30 public void saveLoginParam(Context context,String spname, String spstr) {
31 SharedPreferences sp = context.getSharedPreferences("loginparam", 31 SharedPreferences sp = context.getSharedPreferences("loginparam",
32 Activity.MODE_PRIVATE); 32 Activity.MODE_PRIVATE);
33 33
34 sp.edit().putString(spname, spstr).commit(); 34 sp.edit().putString(spname, spstr).commit();
35 } 35 }
36 36
37
37 public String getLoginParam(Context context,String spname) { 38 public String getLoginParam(Context context,String spname) {
38 SharedPreferences sp = context.getSharedPreferences("loginparam", 39 SharedPreferences sp = context.getSharedPreferences("loginparam",
39 Activity.MODE_PRIVATE); 40 Activity.MODE_PRIVATE);
40 String param = sp.getString(spname, null); 41 String param = sp.getString(spname, null);
41 return param; 42 return param;
42 } 43 }
43 public void clearData(Context context) { 44 public void clearData(Context context) {
44 SharedPreferences sp = context.getSharedPreferences("loginparam", 45 SharedPreferences sp = context.getSharedPreferences("loginparam",
45 Activity.MODE_PRIVATE); 46 Activity.MODE_PRIVATE);
46 sp.edit().clear().commit(); 47 sp.edit().clear().commit();
47 } 48 }
48 49
49 public void saveCustomizeParam(Context context,String spname, String spstr) { 50 public void saveCustomizeParam(Context context,String spname, String spstr) {
50 SharedPreferences sp = context.getSharedPreferences("presoninfo", 51 SharedPreferences sp = context.getSharedPreferences("presoninfo",
51 Activity.MODE_PRIVATE); 52 Activity.MODE_PRIVATE);
52 53
53 sp.edit().putString(spname, spstr).commit(); 54 sp.edit().putString(spname, spstr).commit();
54 55
55 } 56 }
56 57
57 public String getCustomizeParam(Context context,String spname) { 58 public String getCustomizeParam(Context context,String spname) {
58 SharedPreferences sp = context.getSharedPreferences("presoninfo", 59 SharedPreferences sp = context.getSharedPreferences("presoninfo",
59 Activity.MODE_PRIVATE); 60 Activity.MODE_PRIVATE);
60 String param = sp.getString(spname, null); 61 String param = sp.getString(spname, null);
61 return param; 62 return param;
62 } 63 }
63 64
64 public void clearCustomizeParam(Context context ){ 65 public void clearCustomizeParam(Context context ){
65 SharedPreferences sp = context.getSharedPreferences("presoninfo", 66 SharedPreferences sp = context.getSharedPreferences("presoninfo",
66 Activity.MODE_PRIVATE); 67 Activity.MODE_PRIVATE);
67 sp.edit().clear().commit(); 68 sp.edit().clear().commit();
68 } 69 }
69 } 70 }
70 71
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by wei on 2017/6/21. 4 * Created by wei on 2017/6/21.
5 */ 5 */
6 6
7 public class HttpCode { 7 public class HttpCode {
8 //登录 8 //查询保卡信息
9 public static final int LONGIN_SUCESS = 1; 9 public static final int SUCHCARDINFO = 1;
10 public static final int LONGIN_FAIL = 0; 10 //是否填写保卡信息
11 public static final int CHECKCARD = 1;
11 //注册 12 //注册
12 public static final int REGISTERED_SUCESS = 2; 13 public static final int REGISTERED_SUCESS = 2;
13 public static final int REGISTERED_FAIL = 3; 14 public static final int REGISTERED_FAIL = 3;
14 //注册验证码 15 //注册验证码
15 public static final int AUTHCODE_SUCESS = 4; 16 public static final int AUTHCODE_SUCESS = 4;
16 public static final int AUTHCODE_FAIL = 5; 17 public static final int AUTHCODE_FAIL = 5;
17 //忘记密码验证码 18 //忘记密码验证码
18 public static final int AUTHCODE_SUCESS1 = 6; 19 public static final int AUTHCODE_SUCESS1 = 6;
19 public static final int AUTHCODE_FAIL1 = 7; 20 public static final int AUTHCODE_FAIL1 = 7;
20 //是否已经注册 21 //是否已经注册
21 public static final int IS_REFISTER = 8; 22 public static final int IS_REFISTER = 8;
22 //忘记密码 23 //忘记密码
23 public static final int PASSWORD_SUCESS = 9; 24 public static final int PASSWORD_SUCESS = 9;
24 public static final int PASSWORD_FAIL = 10; 25 public static final int PASSWORD_FAIL = 10;
25 //s省 26 //s省
26 public static final int PROVICES = 11; 27 public static final int PROVICES = 11;
27 //姓名 28 //姓名
28 public static final int CHANGENAME_SUCESS = 12; 29 public static final int CHANGENAME_SUCESS = 12;
29 //获取个人信息 30 //获取个人信息
30 public static final int STUDENTINFO_SUCESS = 13; 31 public static final int STUDENTINFO_SUCESS = 13;
31 //意见反馈 32 //意见反馈
32 public static final int FEEDBACL_SUCESS = 14; 33 public static final int FEEDBACL_SUCESS = 14;
33 //私人订制查询 34 //私人订制查询
34 public static final int PRIVATEDZ = 15; 35 public static final int PRIVATEDZ = 15;
35 36
36 37
37 38
38 } 39 }
39 40
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.app.ProgressDialog; 4 import android.app.ProgressDialog;
5 import android.content.Context; 5 import android.content.Context;
6 import android.content.Intent; 6 import android.content.Intent;
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.os.Message; 8 import android.os.Message;
9 import android.util.Log; 9 import android.util.Log;
10 import android.widget.Toast; 10 import android.widget.Toast;
11 11
12 import com.google.gson.Gson; 12 import com.google.gson.Gson;
13 import com.hjx.personalcenter.R; 13 import com.hjx.personalcenter.R;
14 import com.hjx.personalcenter.activity.LoginAndRegisterActivity; 14 import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
15 import com.hjx.personalcenter.activity.TheStartPageActivity; 15 import com.hjx.personalcenter.activity.TheStartPageActivity;
16 import com.hjx.personalcenter.db.SaveParam; 16 import com.hjx.personalcenter.db.SaveParam;
17 import com.hjx.personalcenter.gson.GsonTool; 17 import com.hjx.personalcenter.gson.GsonTool;
18 import com.hjx.personalcenter.model.CityInfo; 18 import com.hjx.personalcenter.model.CityInfo;
19 import com.hjx.personalcenter.model.CountyInfo; 19 import com.hjx.personalcenter.model.CountyInfo;
20 import com.hjx.personalcenter.model.ProvinceInfo; 20 import com.hjx.personalcenter.model.ProvinceInfo;
21 import com.hjx.personalcenter.util.DialogPermission; 21 import com.hjx.personalcenter.util.DialogPermission;
22 import com.loopj.android.http.AsyncHttpResponseHandler; 22 import com.loopj.android.http.AsyncHttpResponseHandler;
23 import com.loopj.android.http.JsonHttpResponseHandler; 23 import com.loopj.android.http.JsonHttpResponseHandler;
24 import com.loopj.android.http.RequestParams; 24 import com.loopj.android.http.RequestParams;
25 25
26 import org.apache.http.Header; 26 import org.apache.http.Header;
27 import org.apache.http.entity.ByteArrayEntity; 27 import org.apache.http.entity.ByteArrayEntity;
28 import org.apache.http.message.BasicHeader; 28 import org.apache.http.message.BasicHeader;
29 import org.apache.http.protocol.HTTP; 29 import org.apache.http.protocol.HTTP;
30 import org.json.JSONException; 30 import org.json.JSONException;
31 import org.json.JSONObject; 31 import org.json.JSONObject;
32 32
33 import java.io.UnsupportedEncodingException; 33 import java.io.UnsupportedEncodingException;
34 34
35 public class HttpManager { 35 public class HttpManager {
36 private static HttpManager instance; 36 private static HttpManager instance;
37 private ProgressDialog mProgress = null; 37 private ProgressDialog mProgress = null;
38
38 public static HttpManager getInstance() { 39 public static HttpManager getInstance() {
39 if (instance == null) { 40 if (instance == null) {
40 instance = new HttpManager(); 41 instance = new HttpManager();
41 } 42 }
42 return instance; 43 return instance;
43 } 44 }
44 45
45 46
46 //登录接口 47 //登录接口
47 48
48 public void login(final String username, final String password, final Context mContext) { 49 public void login(final String username, final String password, final Context mContext) {
49 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", 50 mProgress = DialogPermission.showProgress(mContext, null, "正在登录...",
50 false, true, null); 51 false, true, null);
51 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 52 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
52 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { 53 HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() {
53 @Override 54 @Override
54 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 55 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
55 56
56 String str = new String(arg2); 57 String str = new String(arg2);
57 JSONObject jsonObject = null; 58 JSONObject jsonObject = null;
58 try { 59 try {
59 jsonObject = new JSONObject(new String(arg2)); 60 jsonObject = new JSONObject(new String(arg2));
60 String status = jsonObject.getString("status"); 61 String status = jsonObject.getString("status");
61 if (status.equals("100")) { 62 if (status.equals("100")) {
62 String access_token = jsonObject.getString("access_token"); 63 String access_token = jsonObject.getString("access_token");
63 String userId = jsonObject.getString("userId"); 64 String userId = jsonObject.getString("userId");
64 // //登录成功,保存登录数据并且获取个人信息 65 // //登录成功,保存登录数据并且获取个人信息
65 saveLoginInfo(mContext,username, password, access_token, "true", userId); 66 saveLoginInfo(mContext, username, password, access_token, "true", userId);
66 //HttpManager.getInstance().getuserinfo(username,mContext); 67 //HttpManager.getInstance().getuserinfo(username,mContext);
67 68
68 }else if (status.equals("200")) { 69 } else if (status.equals("200")) {
69 closeProgress(); 70 closeProgress();
70 Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); 71 Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show();
71 return; 72 return;
72 } else if(status.equals("204")){ 73 } else if (status.equals("204")) {
73 closeProgress(); 74 closeProgress();
74 Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); 75 Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show();
75 }else{ 76 } else {
76 closeProgress(); 77 closeProgress();
77 Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); 78 Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show();
78 79
79 80
80
81 } 81 }
82 } catch (JSONException e) { 82 } catch (JSONException e) {
83 e.printStackTrace(); 83 e.printStackTrace();
84 } 84 }
85 85
86 86
87 } 87 }
88 88
89 @Override 89 @Override
90 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 90 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
91 closeProgress(); 91 closeProgress();
92 Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); 92 Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
93 } 93 }
94 }); 94 });
95 } 95 }
96 96
97 //注册接口 97 //注册接口
98 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { 98 public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) {
99 mProgress = DialogPermission.showProgress(context, null, "正在注册...", 99 mProgress = DialogPermission.showProgress(context, null, "正在注册...",
100 false, true, null); 100 false, true, null);
101 JSONObject jsonObject = new JSONObject(); 101 JSONObject jsonObject = new JSONObject();
102 ByteArrayEntity entity = null; 102 ByteArrayEntity entity = null;
103 try { 103 try {
104 jsonObject.put(HttpKey.USERNAME, username); 104 jsonObject.put(HttpKey.USERNAME, username);
105 jsonObject.put(HttpKey.PASSWORD, password); 105 jsonObject.put(HttpKey.PASSWORD, password);
106 jsonObject.put(HttpKey.SMSCODE, smscode); 106 jsonObject.put(HttpKey.SMSCODE, smscode);
107 jsonObject.put(HttpKey.SOURCE, source); 107 jsonObject.put(HttpKey.SOURCE, source);
108 Log.e("test", "jsonObject" + jsonObject); 108 Log.e("test", "jsonObject" + jsonObject);
109 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); 109 entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8"));
110 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); 110 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
111 } catch (JSONException e) { 111 } catch (JSONException e) {
112 e.printStackTrace(); 112 e.printStackTrace();
113 } catch (UnsupportedEncodingException e) { 113 } catch (UnsupportedEncodingException e) {
114 e.printStackTrace(); 114 e.printStackTrace();
115 } 115 }
116 HttpClient.getInstance().addHeader("Accept", "*/*"); 116 HttpClient.getInstance().addHeader("Accept", "*/*");
117 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { 117 HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() {
118 @Override 118 @Override
119 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 119 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
120 super.onSuccess(statusCode, headers, response); 120 super.onSuccess(statusCode, headers, response);
121 closeProgress(); 121 closeProgress();
122 Log.e("test", "onSuccess" + response); 122 Log.e("test", "onSuccess" + response);
123 Message msg = Message.obtain(); 123 Message msg = Message.obtain();
124 msg.what = HttpCode.REGISTERED_SUCESS; 124 msg.what = HttpCode.REGISTERED_SUCESS;
125 msg.obj = response; 125 msg.obj = response;
126 handler.sendMessage(msg); 126 handler.sendMessage(msg);
127 127
128 } 128 }
129 129
130 @Override 130 @Override
131 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 131 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
132 super.onFailure(statusCode, headers, throwable, errorResponse); 132 super.onFailure(statusCode, headers, throwable, errorResponse);
133 closeProgress(); 133 closeProgress();
134 Log.e("test", "onFailure" + errorResponse); 134 Log.e("test", "onFailure" + errorResponse);
135 Toast.makeText(context, "请检查网络。。", Toast.LENGTH_LONG).show(); 135 Toast.makeText(context, "请检查网络。。", Toast.LENGTH_LONG).show();
136 } 136 }
137 137
138 }); 138 });
139 } 139 }
140 140
141 //注册验证码 141 //注册验证码
142 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { 142 public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) {
143 RequestParams params = new RequestParams(); 143 RequestParams params = new RequestParams();
144 params.put(HttpKey.TYPE, type); 144 params.put(HttpKey.TYPE, type);
145 params.put(HttpKey.MOBIL, mobile); 145 params.put(HttpKey.MOBIL, mobile);
146 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 146 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
147 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { 147 HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() {
148 148
149 @Override 149 @Override
150 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 150 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
151 Log.e("test", "onSuccess-----" + response); 151 Log.e("test", "onSuccess-----" + response);
152 Message msg = Message.obtain(); 152 Message msg = Message.obtain();
153 msg.what = HttpCode.AUTHCODE_SUCESS; 153 msg.what = HttpCode.AUTHCODE_SUCESS;
154 msg.obj = response; 154 msg.obj = response;
155 handler.sendMessage(msg); 155 handler.sendMessage(msg);
156 } 156 }
157 157
158 @Override 158 @Override
159 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 159 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
160 Toast.makeText(mContext, "请检查网络。。" + errorResponse, Toast.LENGTH_LONG).show(); 160 Toast.makeText(mContext, "请检查网络。。" + errorResponse, Toast.LENGTH_LONG).show();
161 } 161 }
162 }); 162 });
163 } 163 }
164 164
165 165
166 //手机号是否注册 166 //手机号是否注册
167 public void isregistered(final String mobile, final Handler handler, final Context mContext) { 167 public void isregistered(final String mobile, final Handler handler, final Context mContext) {
168 RequestParams params = new RequestParams(); 168 RequestParams params = new RequestParams();
169 params.put(HttpKey.USERNAME, mobile); 169 params.put(HttpKey.USERNAME, mobile);
170 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { 170 HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() {
171 @Override 171 @Override
172 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 172 public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
173 Log.e("test", "isregistered" + response.toString()); 173 Log.e("test", "isregistered" + response.toString());
174 Message msg = Message.obtain(); 174 Message msg = Message.obtain();
175 msg.what = HttpCode.IS_REFISTER; 175 msg.what = HttpCode.IS_REFISTER;
176 msg.obj = response; 176 msg.obj = response;
177 handler.sendMessage(msg); 177 handler.sendMessage(msg);
178 178
179 } 179 }
180 180
181 @Override 181 @Override
182 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 182 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
183 Toast.makeText(mContext, "失敗" + errorResponse, Toast.LENGTH_LONG).show(); 183 Toast.makeText(mContext, "失敗" + errorResponse, Toast.LENGTH_LONG).show();
184 184
185 } 185 }
186 }); 186 });
187 } 187 }
188 188
189 //修改密码 189 //修改密码
190 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { 190 public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) {
191 RequestParams params = new RequestParams(); 191 RequestParams params = new RequestParams();
192 params.put(HttpKey.USERNAME, username); 192 params.put(HttpKey.USERNAME, username);
193 params.put(HttpKey.OLDPASS, old_pwd1); 193 params.put(HttpKey.OLDPASS, old_pwd1);
194 params.put(HttpKey.NEWPASS, newpassword3); 194 params.put(HttpKey.NEWPASS, newpassword3);
195 HttpClient.getInstance().addHeader("Accept", "*/*"); 195 HttpClient.getInstance().addHeader("Accept", "*/*");
196 HttpClient.getInstance().setTimeout(10 * 1000); 196 HttpClient.getInstance().setTimeout(10 * 1000);
197 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { 197 HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() {
198 @Override 198 @Override
199 public void onSuccess(int i, Header[] headers, byte[] bytes) { 199 public void onSuccess(int i, Header[] headers, byte[] bytes) {
200 try { 200 try {
201 JSONObject jsonObject = new JSONObject(new String(bytes)); 201 JSONObject jsonObject = new JSONObject(new String(bytes));
202 String status = jsonObject.optString("status"); 202 String status = jsonObject.optString("status");
203 if (status.equals("100")) { 203 if (status.equals("100")) {
204 Log.e("test", "onSuccess" + new String(bytes)); 204 Log.e("test", "onSuccess" + new String(bytes));
205 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 205 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
206 SaveParam.getInstance().clearData((Activity) context); 206 SaveParam.getInstance().clearData((Activity) context);
207 Intent intent = new Intent(); 207 Intent intent = new Intent();
208 intent.setClass(context, LoginAndRegisterActivity.class); 208 intent.setClass(context, LoginAndRegisterActivity.class);
209 ((Activity) context).startActivity(intent); 209 ((Activity) context).startActivity(intent);
210 ((Activity) context).finish(); 210 ((Activity) context).finish();
211 } 211 }
212 } catch (JSONException e) { 212 } catch (JSONException e) {
213 e.printStackTrace(); 213 e.printStackTrace();
214 } 214 }
215 } 215 }
216 216
217 @Override 217 @Override
218 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 218 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
219 Log.e("test", "onFailure" + new String(bytes)); 219 Log.e("test", "onFailure" + new String(bytes));
220 Toast.makeText(context, "密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); 220 Toast.makeText(context, "密码修改失败,请检查网络!", Toast.LENGTH_LONG).show();
221 onFinish(); 221 onFinish();
222 } 222 }
223 }); 223 });
224 224
225 } 225 }
226 226
227 //忘记密码 227 //忘记密码
228 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { 228 public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) {
229 RequestParams params = new RequestParams(); 229 RequestParams params = new RequestParams();
230 params.put(HttpKey.USERNAME, forot_pwd_phone1); 230 params.put(HttpKey.USERNAME, forot_pwd_phone1);
231 params.put(HttpKey.PASSWORD, forot_pwd_pwd3); 231 params.put(HttpKey.PASSWORD, forot_pwd_pwd3);
232 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); 232 params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1);
233 HttpClient.getInstance().addHeader("Accept", "*/*"); 233 HttpClient.getInstance().addHeader("Accept", "*/*");
234 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { 234 HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() {
235 @Override 235 @Override
236 public void onSuccess(int i, Header[] headers, byte[] bytes) { 236 public void onSuccess(int i, Header[] headers, byte[] bytes) {
237 try { 237 try {
238 JSONObject jsonObject = new JSONObject(new String(bytes)); 238 JSONObject jsonObject = new JSONObject(new String(bytes));
239 String status = jsonObject.optString("status"); 239 String status = jsonObject.optString("status");
240 if (status.equals("100")) { 240 if (status.equals("100")) {
241 Log.e("test", "onSuccess" + new String(bytes)); 241 Log.e("test", "onSuccess" + new String(bytes));
242 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); 242 Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show();
243 ((Activity) context).finish(); 243 ((Activity) context).finish();
244 } 244 }
245 } catch (JSONException e) { 245 } catch (JSONException e) {
246 e.printStackTrace(); 246 e.printStackTrace();
247 } 247 }
248 } 248 }
249 249
250 @Override 250 @Override
251 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { 251 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
252 Log.e("test", "onFailure" + new String(bytes)); 252 Log.e("test", "onFailure" + new String(bytes));
253 Toast.makeText(context, "忘记密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); 253 Toast.makeText(context, "忘记密码修改失败,请检查网络!", Toast.LENGTH_LONG).show();
254 } 254 }
255 }); 255 });
256 256
257 } 257 }
258 258
259 //保存用户登录信息 259 //保存用户登录信息
260 public void saveLoginInfo(Context context,String username, String password, String access_token, String loginStatus, String userId) { 260 public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) {
261 SaveParam.getInstance().saveLoginParam(context,"username", username); 261 SaveParam.getInstance().saveLoginParam(context, "username", username);
262 SaveParam.getInstance().saveLoginParam(context,"password", password); 262 SaveParam.getInstance().saveLoginParam(context, "password", password);
263 SaveParam.getInstance().saveLoginParam(context,"access_token", access_token); 263 SaveParam.getInstance().saveLoginParam(context, "access_token", access_token);
264 SaveParam.getInstance().saveLoginParam(context,"login", loginStatus); 264 SaveParam.getInstance().saveLoginParam(context, "login", loginStatus);
265 SaveParam.getInstance().saveLoginParam(context,"userId", userId); 265 SaveParam.getInstance().saveLoginParam(context, "userId", userId);
266 266
267 267
268 } 268 }
269 269
270 //保存用户个人信息 270 //保存用户个人信息
271 public void savePresonInfo(Context context,String lastname, String gender, String mobilePortrait) { 271 public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) {
272 SaveParam.getInstance().saveLoginParam(context,"lastname", lastname); 272 SaveParam.getInstance().saveLoginParam(context, "lastname", lastname);
273 SaveParam.getInstance().saveLoginParam(context,"gender", gender); 273 SaveParam.getInstance().saveLoginParam(context, "gender", gender);
274 SaveParam.getInstance().saveLoginParam(context,"mobilePortrait", mobilePortrait); 274 SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait);
275 } 275 }
276
276 //提交保卡信息 277 //提交保卡信息
277 public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, 278 public void subcardinfo(final Context context, int userId, String customerName, String customerAddress,
278 String buyAddress,String buyTime,String alterSaleCall, 279 String buyAddress, String buyTime, String alterSaleCall,
279 String productModel,String deviceNumber,String macAddress, 280 String productModel, String deviceNumber, String macAddress,
280 String mobilePhone) { 281 String mobilePhone) {
281 JSONObject params = new JSONObject(); 282 mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...",
282 ByteArrayEntity entity = null; 283 false, true, null);
283 try { 284 RequestParams params = new RequestParams();
284 params.put(HttpKey.USEID, userId); 285
285 params.put(HttpKey.CUSTOMENAME, customerName); 286 params.put(HttpKey.USEID, userId);
286 params.put(HttpKey.CUSTOMADRESS, customerAddress); 287 params.put(HttpKey.CUSTOMENAME, customerName);
287 params.put(HttpKey.BUYADREES, buyAddress); 288 params.put(HttpKey.CUSTOMADRESS, customerAddress);
288 params.put(HttpKey.BUYTIME, buyTime); 289 params.put(HttpKey.BUYADREES, buyAddress);
289 params.put(HttpKey.ALTERSALECALL, alterSaleCall); 290 params.put(HttpKey.BUYTIME, buyTime);
290 params.put(HttpKey.PRODUCTMODEL, productModel); 291 params.put(HttpKey.ALTERSALECALL, alterSaleCall);
291 params.put(HttpKey.DEVICENUMBER, deviceNumber); 292 params.put(HttpKey.PRODUCTMODEL, productModel);
292 params.put(HttpKey.MACADRESS, macAddress); 293 params.put(HttpKey.DEVICENUMBER, deviceNumber);
293 params.put(HttpKey.MOBILPHONE, mobilePhone); 294 params.put(HttpKey.MACADRESS, macAddress);
294 entity = new ByteArrayEntity(params.toString().getBytes("UTF-8")); 295 params.put(HttpKey.MOBILPHONE, mobilePhone);
295 entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
296 } catch (Exception e) {
297 e.printStackTrace();
298 }
299 296
300 HttpClient.getInstance().addHeader("Accept", "*/*"); 297 HttpClient.getInstance().addHeader("Accept", "*/*");
301 298
302 Log.e("test", "params" + params); 299 Log.e("test", "params" + params);
303 HttpClient.getInstance().post(context,HttpUrl.subcardinfo, entity, "application/json", new JsonHttpResponseHandler() { 300 HttpClient.getInstance().setTimeout(5 * 1000);
301 HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() {
304 @Override 302 @Override
305 public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 303 public void onSuccess(int i, Header[] headers, byte[] bytes) {
306 super.onSuccess(statusCode, headers, response); 304 JSONObject jsonObject = null;
307 String status = response.optString("status"); 305 closeProgress();
306 try {
307 jsonObject = new JSONObject(new String(bytes));
308 String status = jsonObject.optString("status");
308 if (status.equals("1")) { 309 if (status.equals("1")) {
309 Log.e("test", "onSuccess" +response); 310 Log.e("test", "onSuccess" + jsonObject);
310 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); 311 Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show();
311 Intent intent = new Intent(); 312 Intent intent = new Intent();
312 intent.setClass((Activity) context,TheStartPageActivity.class); 313 intent.setClass((Activity) context, TheStartPageActivity.class);
313 ((Activity) context).startActivity(intent); 314 ((Activity) context).startActivity(intent);
314 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); 315 ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout);
315 ((Activity) context).finish(); 316 ((Activity) context).finish();
316 } 317 }
318 } catch (JSONException e) {
319 e.printStackTrace();
320 }
321
317 322
318 } 323 }
319 324
320 @Override 325 @Override
321 public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 326 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
322 super.onFailure(statusCode, headers, throwable, errorResponse); 327 Log.e("test", "onFailure" + (throwable));
323 Log.e("test", "onFailure" + (errorResponse)); 328 closeProgress();
324 Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); 329 Toast.makeText(context, "保卡绑定失败!,请检查网络", Toast.LENGTH_LONG).show();
330
325 } 331 }
326 }); 332 });
327 333
328 } 334 }
335 //获取保卡信息
336 public void getcardinfo(final Context mContext, int userId , final Handler handler) {
337 mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...",
338 false, true, null);
339 HttpClient.getInstance().setTimeout(5 * 1000);
340 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
341 HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() {
342 @Override
343 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
344 closeProgress();
345 Log.e("test", "省" + new String(arg2));
346 Message msg = Message.obtain();
347 msg.what = HttpCode.SUCHCARDINFO;
348 msg.obj = new String(arg2);
349 handler.sendMessage(msg);
350 }
351
352 @Override
353 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
354 closeProgress();
355 Toast.makeText(mContext, "请检查网络。。" , Toast.LENGTH_LONG).show();
356 }
357 });
358 }
359 //修改保卡信息电话
360 public void changecardinfophone(final Context mContext, int userId, final String customerPhone, String authCode) {
361 RequestParams params = new RequestParams();
362 params.put("userId", userId);
363 params.put("customerPhone", customerPhone);
364 params.put("authCode", authCode);
365 HttpClient.getInstance().addHeader("Accept", "*/*");
366 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
367 @Override
368 public void onSuccess(int i, Header[] headers, byte[] bytes) {
369 try {
370 JSONObject jsonObject = new JSONObject(new String(bytes));
371 String status = jsonObject.optString("status");
372 if (status.equals("1")) {
373 Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show();
374 SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone);
375 ((Activity) mContext).finish();
376 }else if (status.equals("1001")){
377 Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show();
378 }
379 } catch (JSONException e) {
380 e.printStackTrace();
381 }
382 }
329 383
384 @Override
385 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
386 Log.e("test", "onFailure" + new String(bytes));
387 Toast.makeText(mContext, "请检查网络。。" + new String(bytes), Toast.LENGTH_LONG).show();
388 }
389 });
390 }
391 //修改保卡信息地址
392 public void changecardinfo(final Context mContext,int userId,String customerPhone,String authCode,String customerAddress) {
393 RequestParams params = new RequestParams();
394 params.put("userId", userId);
395 params.put("customerPhone", customerPhone);
396 params.put("authCode", authCode);
397 params.put("customerAddress", customerAddress);
398 HttpClient.getInstance().addHeader("Accept", "*/*");
399 HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() {
400 @Override
401 public void onSuccess(int i, Header[] headers, byte[] bytes) {
402 try {
403 JSONObject jsonObject = new JSONObject(new String(bytes));
404 String status = jsonObject.optString("status");
405 if (status.equals("1")) {
406 Log.e("test", "省" + jsonObject);
407 Toast.makeText(mContext, "成功。。" + jsonObject, Toast.LENGTH_LONG).show();
408 }
409 } catch (JSONException e) {
410 e.printStackTrace();
411 }
412 }
330 413
414 @Override
415 public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
416 Log.e("test", "onFailure" + new String(bytes));
417 Toast.makeText(mContext, "请检查网络。。" + new String(bytes), Toast.LENGTH_LONG).show();
418 }
419 });
420 }
421 //验证是否保卡信息
422 public void cardinfocheck(final Context mContext, int userId, final Handler handler) {
423 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
424 HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() {
425 @Override
426 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
427 Log.e("test", "省" + new String(arg2));
428 Message msg = Message.obtain();
429 msg.what = HttpCode.CHECKCARD;
430 msg.obj = new String(arg2);
431 handler.sendMessage(msg);
432 }
331 433
434 @Override
435 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
436 Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
437 }
438 });
439 }
332 440
333 441
334 442
335 443
336 ///省级接口 444 ///省级接口
337 public void provices(final Context mContext) { 445 public void provices(final Context mContext) {
338 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 446 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
339 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { 447 HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() {
340 @Override 448 @Override
341 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 449 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
342 Log.e("test", "省" + new String(arg2)); 450 Log.e("test", "省" + new String(arg2));
343 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 451 ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据
344 Log.e("test", "状态码" +provinceInfo.getStatus()); 452 Log.e("test", "状态码" + provinceInfo.getStatus());
345 StringBuffer sb = new StringBuffer(); 453 StringBuffer sb = new StringBuffer();
346 StringBuffer sb1 = new StringBuffer(); 454 for (int i = 0; i < provinceInfo.getProvinces().size(); i++) {
347 for (int i =0 ; i<provinceInfo.getProvinces().size();i++){ 455 sb.append(provinceInfo.getProvinces().get(i).getRegionName() + ",");
348 sb.append(provinceInfo.getProvinces().get(i).getRegionName()+",");
349 sb1.append(provinceInfo.getProvinces().get(i).getRegionId()+",");
350 456
351 } 457 }
352 Log.e("test", "省" +sb.toString()); 458 Log.e("test", "省" + sb.toString());
353 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PROVINCES, "" + sb.toString()); 459 SaveParam.getInstance().saveLoginParam(mContext, SaveParam.PROVINCES, "" + sb.toString());
354 SaveParam.getInstance().saveLoginParam(mContext,SaveParam.CITYS, sb1.toString());
355 460
356 461
357 } 462 }
358 463
359 @Override 464 @Override
360 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 465 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
361 Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); 466 Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
362 } 467 }
363 }); 468 });
364 } 469 }
470
365 //市级接口 471 //市级接口
366 public void cityinfo(final Context mContext,int regionId) { 472 public void cityinfo(final Context mContext, int regionId) {
367 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 473 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
368 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { 474 HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() {
369 @Override 475 @Override
370 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 476 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
371 Log.e("test", "市" + new String(arg2)); 477 Log.e("test", "市" + new String(arg2));
372 Gson gson = new Gson(); 478 Gson gson = new Gson();
373 CityInfo cityInfo = gson.fromJson(new String(arg2),CityInfo.class); 479 CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class);
374 for (int i =0 ; i<cityInfo.getCities().size();i++){ 480 for (int i = 0; i < cityInfo.getCities().size(); i++) {
375 Log.e("test", "市" +cityInfo.getCities().get(i) 481 Log.e("test", "市" + cityInfo.getCities().get(i)
376 .getParentId()); 482 .getParentId());
377 Log.e("test", "市" +cityInfo.getCities().get(i) 483 Log.e("test", "市" + cityInfo.getCities().get(i)
378 .getRegionId()); 484 .getRegionId());
379 Log.e("test", "市" +cityInfo.getCities().get(i).getRegionName()+""); 485 Log.e("test", "市" + cityInfo.getCities().get(i).getRegionName() + "");
380 486
381 } 487 }
382 488
383 489
384 } 490 }
385 491
386 @Override 492 @Override
387 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 493 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
388 Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); 494 Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
389 } 495 }
390 }); 496 });
391 } 497 }
498
392 //区县级接口 499 //区县级接口
393 public void countyinfo(final Context mContext,int parentId) { 500 public void countyinfo(final Context mContext, int parentId) {
394 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 501 HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
395 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { 502 HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() {
396 @Override 503 @Override
397 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { 504 public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
398 Log.e("test", "区" + new String(arg2)); 505 Log.e("test", "区" + new String(arg2));
399 Gson gson = new Gson(); 506 Gson gson = new Gson();
400 CountyInfo countyInfo = gson.fromJson(new String(arg2),CountyInfo.class); 507 CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class);
401 for (int i =0 ; i<countyInfo.getCounties().size();i++){ 508 for (int i = 0; i < countyInfo.getCounties().size(); i++) {
402 Log.e("test", "区" +countyInfo.getCounties().get(i) 509 Log.e("test", "区" + countyInfo.getCounties().get(i)
403 .getParentId()); 510 .getParentId());
404 Log.e("test", "区" +countyInfo.getCounties().get(i) 511 Log.e("test", "区" + countyInfo.getCounties().get(i)
405 .getRegionId()); 512 .getRegionId());
406 Log.e("test", "区" +countyInfo.getCounties().get(i).getRegionName()+""); 513 Log.e("test", "区" + countyInfo.getCounties().get(i).getRegionName() + "");
407 514
408 } 515 }
409 516
410 517
411 } 518 }
412 519
413 @Override 520 @Override
414 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { 521 public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
415 Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); 522 Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show();
416 } 523 }
417 }); 524 });
418 } 525 }
419 526
420 527
421 private void closeProgress() { 528 private void closeProgress() {
422 try { 529 try {
423 if (mProgress != null) { 530 if (mProgress != null) {
424 mProgress.dismiss(); 531 mProgress.dismiss();
425 mProgress = null; 532 mProgress = null;
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
1 package com.hjx.personalcenter.http; 1 package com.hjx.personalcenter.http;
2 2
3 /** 3 /**
4 * Created by h on 2017/8/15. 4 * Created by h on 2017/8/15.
5 */ 5 */
6 6
7 public class HttpUrl { 7 public class HttpUrl {
8 private final static String Enviroment = "DEVELOPMENT"; 8 private final static String Enviroment = "DEVELOPMENT";
9 9
10 public static String GetDomain(){ 10 public static String GetDomain(){
11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; 11 return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com";
12 } 12 }
13 13
14 public static String loginUrl = GetDomain()+"/user/access_token";//登录 14 public static String loginUrl = GetDomain()+"/user/access_token";//登录
15 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 15 public static String provinceUrl = GetDomain()+"/ozing/provinces";//省
16 public static String cityUrl = GetDomain()+"/ozing/cities";//市 16 public static String cityUrl = GetDomain()+"/ozing/cities";//市
17 public static String countyUrl = GetDomain()+"/ozing/counties";//区县 17 public static String countyUrl = GetDomain()+"/ozing/counties";//区县
18 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ 18 public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/
19 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 19 public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册
20 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 20 public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码
21 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 21 public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册
22 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 22 public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码
23 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 23 public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息
24 public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息
25 public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息
26 public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写
24 27
25 } 28 }
26 29
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/CardInfo.java
File was created 1 package com.hjx.personalcenter.model;
2
3 /**
4 * Created by h on 2017/8/18.
5 */
6
7 public class CardInfo {
8
9 /**
10 * customerName : FuQiang
11 * createTime : 2017-08-01 13:21:00
12 * mobilePhone : 13162530008
13 * buyTime : 2017-08-01 12:23:50
14 * productModel : GT-N7100
15 * buyAddress : HaojixingZhengZhou
16 * customerAddress : HeNamZhengSheng
17 * alterSaleCall : 4022210201
18 * macAddress : 00:22:F4:93:7A:B
19
20 * deviceNumber : A909A90997011012
21 */
22
23 private String customerName;
24 private String createTime;
25 private String mobilePhone;
26 private String buyTime;
27 private String productModel;
28 private String buyAddress;
29 private String customerAddress;
30 private String alterSaleCall;
31 private String macAddress;
32 private String deviceNumber;
33
34 public String getCustomerName() {
35 return customerName;
36 }
37
38 public void setCustomerName(String customerName) {
39 this.customerName = customerName;
40 }
41
42 public String getCreateTime() {
43 return createTime;
44 }
45
46 public void setCreateTime(String createTime) {
47 this.createTime = createTime;
48 }
49
50 public String getMobilePhone() {
51 return mobilePhone;
52 }
53
54 public void setMobilePhone(String mobilePhone) {
55 this.mobilePhone = mobilePhone;
56 }
57
58 public String getBuyTime() {
59 return buyTime;
60 }
61
62 public void setBuyTime(String buyTime) {
63 this.buyTime = buyTime;
64 }
65
66 public String getProductModel() {
67 return productModel;
68 }
69
70 public void setProductModel(String productModel) {
71 this.productModel = productModel;
72 }
73
74 public String getBuyAddress() {
75 return buyAddress;
76 }
77
78 public void setBuyAddress(String buyAddress) {
79 this.buyAddress = buyAddress;
80 }
81
82 public String getCustomerAddress() {
83 return customerAddress;
84 }
85
86 public void setCustomerAddress(String customerAddress) {
87 this.customerAddress = customerAddress;
88 }
89
90 public String getAlterSaleCall() {
91 return alterSaleCall;
92 }
93
94 public void setAlterSaleCall(String alterSaleCall) {
95 this.alterSaleCall = alterSaleCall;
96 }
97
98 public String getMacAddress() {
99 return macAddress;
100 }
101
102 public void setMacAddress(String macAddress) {
103 this.macAddress = macAddress;
104 }
105
106 public String getDeviceNumber() {
107 return deviceNumber;
108 }
109
110 public void setDeviceNumber(String deviceNumber) {
111 this.deviceNumber = deviceNumber;
112 }
113 }
114
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:orientation="vertical"> 5 android:orientation="vertical">
6 6
7 <RelativeLayout 7 <RelativeLayout
8 android:id="@+id/title" 8 android:id="@+id/title"
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="50dp" 10 android:layout_height="50dp"
11 android:background="@color/login_text_blue"> 11 android:background="@color/login_text_blue">
12 12
13 <ImageView 13 <ImageView
14 android:id="@+id/cancel" 14 android:id="@+id/cancel"
15 android:layout_width="wrap_content" 15 android:layout_width="wrap_content"
16 android:layout_height="match_parent" 16 android:layout_height="match_parent"
17 android:paddingLeft="20dp" 17 android:paddingLeft="20dp"
18 android:paddingRight="20dp" 18 android:paddingRight="20dp"
19 android:src="@mipmap/title_back" /> 19 android:src="@mipmap/title_back" />
20 20
21 <TextView 21 <TextView
22 android:id="@+id/menu_title" 22 android:id="@+id/menu_title"
23 android:layout_width="wrap_content" 23 android:layout_width="wrap_content"
24 android:layout_height="match_parent" 24 android:layout_height="match_parent"
25 android:layout_centerInParent="true" 25 android:layout_centerInParent="true"
26 android:gravity="center_vertical" 26 android:gravity="center_vertical"
27 android:text="@string/titel_preson" 27 android:text="@string/titel_preson"
28 android:textColor="@android:color/white" 28 android:textColor="@android:color/white"
29 android:textSize="22sp" /> 29 android:textSize="22sp" />
30 30
31 <ImageView 31 <ImageView
32 android:id="@+id/iv_setting" 32 android:id="@+id/iv_setting"
33 android:layout_width="wrap_content" 33 android:layout_width="wrap_content"
34 android:layout_height="match_parent" 34 android:layout_height="match_parent"
35 android:layout_marginRight="10dp" 35 android:layout_marginRight="10dp"
36 android:layout_toLeftOf="@+id/iv_skin" 36 android:layout_toLeftOf="@+id/iv_skin"
37 android:gravity="center_vertical" 37 android:gravity="center_vertical"
38 android:padding="10dp" 38 android:padding="10dp"
39 android:src="@mipmap/shezhi" 39 android:src="@mipmap/shezhi"
40 android:textColor="@android:color/white" 40 android:textColor="@android:color/white"
41 android:textSize="22sp" /> 41 android:textSize="22sp" />
42 42
43 <ImageView 43 <ImageView
44 android:id="@+id/iv_skin" 44 android:id="@+id/iv_skin"
45 android:layout_width="wrap_content" 45 android:layout_width="wrap_content"
46 android:layout_height="match_parent" 46 android:layout_height="match_parent"
47 android:layout_marginRight="10dp" 47 android:layout_marginRight="10dp"
48 android:layout_toLeftOf="@+id/iv_imformatioan" 48 android:layout_toLeftOf="@+id/iv_imformatioan"
49 android:gravity="center_vertical" 49 android:gravity="center_vertical"
50 android:padding="10dp" 50 android:padding="10dp"
51 android:src="@mipmap/pifu" 51 android:src="@mipmap/pifu"
52 android:textColor="@android:color/white" 52 android:textColor="@android:color/white"
53 android:textSize="22sp" /> 53 android:textSize="22sp" />
54 54
55 <ImageView 55 <ImageView
56 android:id="@+id/iv_imformatioan" 56 android:id="@+id/iv_imformatioan"
57 android:layout_width="wrap_content" 57 android:layout_width="wrap_content"
58 android:layout_height="match_parent" 58 android:layout_height="match_parent"
59 android:layout_alignParentRight="true" 59 android:layout_alignParentRight="true"
60 android:layout_marginRight="10dp" 60 android:layout_marginRight="10dp"
61 android:gravity="center_vertical" 61 android:gravity="center_vertical"
62 android:padding="10dp" 62 android:padding="10dp"
63 android:src="@mipmap/fankui" 63 android:src="@mipmap/fankui"
64 android:textColor="@android:color/white" 64 android:textColor="@android:color/white"
65 android:textSize="22sp" /> 65 android:textSize="22sp" />
66 66
67 67
68 </RelativeLayout> 68 </RelativeLayout>
69 69
70 <LinearLayout 70 <LinearLayout
71 android:layout_width="match_parent" 71 android:layout_width="match_parent"
72 android:layout_height="match_parent"> 72 android:layout_height="match_parent">
73 73
74 <LinearLayout 74 <LinearLayout
75 android:layout_width="0dp" 75 android:layout_width="0dp"
76 android:layout_height="match_parent" 76 android:layout_height="match_parent"
77 android:layout_weight="1" 77 android:layout_weight="1"
78 android:orientation="vertical"> 78 android:orientation="vertical">
79 79
80 <LinearLayout 80 <LinearLayout
81 android:layout_width="match_parent" 81 android:layout_width="match_parent"
82 android:layout_height="wrap_content" 82 android:layout_height="wrap_content"
83 android:layout_marginTop="20dp" 83 android:layout_marginTop="20dp"
84 android:orientation="horizontal"> 84 android:orientation="horizontal">
85 <ImageView 85 <ImageView
86 android:id="@+id/iv_look_card" 86 android:id="@+id/iv_look_card"
87 android:layout_width="wrap_content" 87 android:layout_width="wrap_content"
88 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
89 android:padding="10dp" 89 android:padding="10dp"
90 android:layout_marginLeft="20dp" 90 android:layout_marginLeft="20dp"
91 android:src="@mipmap/card_icoc" /> 91 android:src="@mipmap/card_icoc" />
92 92
93 <ImageView 93 <ImageView
94 android:layout_width="wrap_content" 94 android:layout_width="wrap_content"
95 android:layout_height="wrap_content" 95 android:layout_height="wrap_content"
96 android:layout_marginLeft="60dp" 96 android:layout_marginLeft="60dp"
97 android:src="@mipmap/header_default" /> 97 android:src="@mipmap/header_default" />
98 98
99 <TextView 99 <TextView
100 android:layout_width="wrap_content" 100 android:layout_width="wrap_content"
101 android:layout_height="wrap_content" 101 android:layout_height="wrap_content"
102 android:layout_marginLeft="18dp" 102 android:layout_marginLeft="18dp"
103 android:layout_marginTop="20dp" 103 android:layout_marginTop="20dp"
104 android:background="@drawable/corcle_blue_bg" 104 android:background="@drawable/corcle_blue_bg"
105 android:paddingLeft="5dp" 105 android:paddingLeft="5dp"
106 android:paddingRight="5dp" 106 android:paddingRight="5dp"
107 android:gravity="center_vertical" 107 android:gravity="center_vertical"
108 android:text="签到" 108 android:text="签到"
109 android:textColor="@color/login_text_blue" 109 android:textColor="@color/login_text_blue"
110 android:textSize="18sp" /> 110 android:textSize="18sp" />
111 111
112 </LinearLayout> 112 </LinearLayout>
113 113
114 <LinearLayout 114 <LinearLayout
115 android:layout_width="match_parent" 115 android:layout_width="match_parent"
116 android:layout_height="wrap_content" 116 android:layout_height="wrap_content"
117 android:layout_marginLeft="20dp" 117 android:layout_marginLeft="20dp"
118 android:layout_marginTop="20dp" 118 android:layout_marginTop="20dp"
119 android:orientation="horizontal"> 119 android:orientation="horizontal">
120 120
121 <TextView 121 <TextView
122 android:layout_width="wrap_content" 122 android:layout_width="wrap_content"
123 android:layout_height="wrap_content" 123 android:layout_height="wrap_content"
124 android:text="熊巍" 124 android:text="熊巍"
125 android:textSize="20dp" /> 125 android:textSize="20dp" />
126 126
127 <ImageView 127 <ImageView
128 android:layout_width="wrap_content" 128 android:layout_width="wrap_content"
129 android:layout_height="wrap_content" 129 android:layout_height="wrap_content"
130 android:layout_marginLeft="50dp" 130 android:layout_marginLeft="50dp"
131 android:src="@mipmap/men" /> 131 android:src="@mipmap/men" />
132 132
133 </LinearLayout> 133 </LinearLayout>
134 134
135 <LinearLayout 135 <LinearLayout
136 android:layout_width="match_parent" 136 android:layout_width="match_parent"
137 android:layout_height="wrap_content" 137 android:layout_height="wrap_content"
138 android:layout_marginLeft="20dp" 138 android:layout_marginLeft="20dp"
139 android:layout_marginTop="20dp" 139 android:layout_marginTop="20dp"
140 android:gravity="center" 140 android:gravity="center"
141 android:orientation="horizontal"> 141 android:orientation="horizontal">
142 142
143 <TextView 143 <TextView
144 android:id="@+id/tv_sign"
144 android:layout_width="0dp" 145 android:layout_width="0dp"
145 android:layout_height="wrap_content" 146 android:layout_height="wrap_content"
146 android:layout_weight="5" 147 android:layout_weight="5"
147 android:text="阿士大夫撒打发士大夫士大夫撒的范德萨" 148 android:text="阿士大夫撒打发士大夫士大夫撒的范德萨"
148 android:textSize="18sp" /> 149 android:textSize="18sp" />
149 150
150 <ImageView 151 <ImageView
152 android:id="@+id/iv_sign"
151 android:layout_width="0dp" 153 android:layout_width="0dp"
152 android:layout_height="wrap_content" 154 android:layout_height="wrap_content"
153 android:layout_weight="1" 155 android:layout_weight="1"
154 android:padding="10dp" 156 android:padding="10dp"
155 android:src="@mipmap/pencil" /> 157 android:src="@mipmap/pencil" />
156 158
157 159
158 </LinearLayout> 160 </LinearLayout>
159 161
160 <View 162 <View
161 android:layout_width="match_parent" 163 android:layout_width="match_parent"
162 android:layout_height="0.7dp" 164 android:layout_height="0.7dp"
163 android:layout_marginTop="20dp" 165 android:layout_marginTop="20dp"
164 android:background="@color/cutoff_line"> 166 android:background="@color/cutoff_line">
165 167
166 </View> 168 </View>
167 169
168 <LinearLayout 170 <LinearLayout
169 android:layout_width="match_parent" 171 android:layout_width="match_parent"
170 android:layout_height="wrap_content" 172 android:layout_height="wrap_content"
171 android:layout_marginTop="30dp" 173 android:layout_marginTop="30dp"
172 android:orientation="vertical"> 174 android:orientation="vertical">
173 175
174 <LinearLayout 176 <LinearLayout
175 android:layout_width="match_parent" 177 android:layout_width="match_parent"
176 android:layout_height="wrap_content" 178 android:layout_height="wrap_content"
177 android:gravity="center_vertical" 179 android:gravity="center_vertical"
178 android:orientation="horizontal"> 180 android:orientation="horizontal">
179 181
180 <ImageView 182 <ImageView
181 android:layout_width="0dp" 183 android:layout_width="0dp"
182 android:layout_height="wrap_content" 184 android:layout_height="wrap_content"
183 android:layout_weight="1" 185 android:layout_weight="1"
184 android:src="@mipmap/wodecuoti" /> 186 android:src="@mipmap/wodecuoti" />
185 187
186 <TextView 188 <TextView
187 android:layout_width="0dp" 189 android:layout_width="0dp"
188 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
189 android:layout_weight="5" 191 android:layout_weight="5"
190 android:text="我的错题" 192 android:text="我的错题"
191 android:textSize="20sp" /> 193 android:textSize="20sp" />
192 194
193 <ImageView 195 <ImageView
194 android:layout_width="0dp" 196 android:layout_width="0dp"
195 android:layout_height="wrap_content" 197 android:layout_height="wrap_content"
196 android:layout_weight="1" 198 android:layout_weight="1"
197 android:src="@mipmap/youjiantou" /> 199 android:src="@mipmap/youjiantou" />
198 200
199 </LinearLayout> 201 </LinearLayout>
200 202
201 <LinearLayout 203 <LinearLayout
202 android:layout_width="match_parent" 204 android:layout_width="match_parent"
203 android:layout_height="wrap_content" 205 android:layout_height="wrap_content"
204 android:layout_marginTop="35dp" 206 android:layout_marginTop="35dp"
205 android:gravity="center_vertical" 207 android:gravity="center_vertical"
206 android:orientation="horizontal"> 208 android:orientation="horizontal">
207 209
208 <ImageView 210 <ImageView
209 android:layout_width="0dp" 211 android:layout_width="0dp"
210 android:layout_height="wrap_content" 212 android:layout_height="wrap_content"
211 android:layout_weight="1" 213 android:layout_weight="1"
212 android:src="@mipmap/wodebiji" /> 214 android:src="@mipmap/wodebiji" />
213 215
214 <TextView 216 <TextView
215 android:layout_width="0dp" 217 android:layout_width="0dp"
216 android:layout_height="wrap_content" 218 android:layout_height="wrap_content"
217 android:layout_weight="5" 219 android:layout_weight="5"
218 android:text="我的笔记" 220 android:text="我的笔记"
219 android:textSize="20sp" /> 221 android:textSize="20sp" />
220 222
221 <ImageView 223 <ImageView
222 android:layout_width="0dp" 224 android:layout_width="0dp"
223 android:layout_height="wrap_content" 225 android:layout_height="wrap_content"
224 android:layout_weight="1" 226 android:layout_weight="1"
225 android:src="@mipmap/youjiantou" /> 227 android:src="@mipmap/youjiantou" />
226 228
227 </LinearLayout> 229 </LinearLayout>
228 230
229 <LinearLayout 231 <LinearLayout
230 android:layout_width="match_parent" 232 android:layout_width="match_parent"
231 android:layout_height="wrap_content" 233 android:layout_height="wrap_content"
232 android:layout_marginTop="35dp" 234 android:layout_marginTop="35dp"
233 android:gravity="center_vertical" 235 android:gravity="center_vertical"
234 android:orientation="horizontal"> 236 android:orientation="horizontal">
235 237
236 <ImageView 238 <ImageView
237 android:layout_width="0dp" 239 android:layout_width="0dp"
238 android:layout_height="wrap_content" 240 android:layout_height="wrap_content"
239 android:layout_weight="1" 241 android:layout_weight="1"
240 android:src="@mipmap/wodeshoucang" /> 242 android:src="@mipmap/wodeshoucang" />
241 243
242 <TextView 244 <TextView
243 android:layout_width="0dp" 245 android:layout_width="0dp"
244 android:layout_height="wrap_content" 246 android:layout_height="wrap_content"
245 android:layout_weight="5" 247 android:layout_weight="5"
246 android:text="我的收藏" 248 android:text="我的收藏"
247 android:textSize="20sp" /> 249 android:textSize="20sp" />
248 250
249 <ImageView 251 <ImageView
250 android:layout_width="0dp" 252 android:layout_width="0dp"
251 android:layout_height="wrap_content" 253 android:layout_height="wrap_content"
252 android:layout_weight="1" 254 android:layout_weight="1"
253 android:src="@mipmap/youjiantou" /> 255 android:src="@mipmap/youjiantou" />
254 256
255 </LinearLayout> 257 </LinearLayout>
256 258
257 <LinearLayout 259 <LinearLayout
258 android:layout_width="match_parent" 260 android:layout_width="match_parent"
259 android:layout_height="wrap_content" 261 android:layout_height="wrap_content"
260 android:layout_marginTop="35dp" 262 android:layout_marginTop="35dp"
261 android:gravity="center_vertical" 263 android:gravity="center_vertical"
262 android:orientation="horizontal"> 264 android:orientation="horizontal">
263 265
264 <ImageView 266 <ImageView
265 android:layout_width="0dp" 267 android:layout_width="0dp"
266 android:layout_height="wrap_content" 268 android:layout_height="wrap_content"
267 android:layout_weight="1" 269 android:layout_weight="1"
268 android:src="@mipmap/wodebanji" /> 270 android:src="@mipmap/wodebanji" />
269 271
270 <TextView 272 <TextView
271 android:layout_width="0dp" 273 android:layout_width="0dp"
272 android:layout_height="wrap_content" 274 android:layout_height="wrap_content"
273 android:layout_weight="5" 275 android:layout_weight="5"
274 android:text="我的班级" 276 android:text="我的班级"
275 android:textSize="20sp" /> 277 android:textSize="20sp" />
276 278
277 <ImageView 279 <ImageView
278 android:layout_width="0dp" 280 android:layout_width="0dp"
279 android:layout_height="wrap_content" 281 android:layout_height="wrap_content"
280 android:layout_weight="1" 282 android:layout_weight="1"
281 android:src="@mipmap/youjiantou" /> 283 android:src="@mipmap/youjiantou" />
282 284
283 </LinearLayout> 285 </LinearLayout>
284 286
285 287
286 </LinearLayout> 288 </LinearLayout>
287 289
288 <LinearLayout 290 <LinearLayout
289 android:layout_width="match_parent" 291 android:layout_width="match_parent"
290 android:layout_height="match_parent" 292 android:layout_height="match_parent"
291 android:layout_marginTop="120dp" 293 android:layout_marginTop="120dp"
292 android:background="@mipmap/xiaoguanggao"> 294 android:background="@mipmap/xiaoguanggao">
293 295
294 </LinearLayout> 296 </LinearLayout>
295 297
296 298
297 </LinearLayout> 299 </LinearLayout>
298 300
299 301
300 <View 302 <View
301 android:layout_width="0.7dp" 303 android:layout_width="0.7dp"
302 android:layout_height="match_parent" 304 android:layout_height="match_parent"
303 android:background="@color/cutoff_line"> 305 android:background="@color/cutoff_line">
304 306
305 </View> 307 </View>
306 308
307 <LinearLayout 309 <LinearLayout
308 android:layout_width="0dp" 310 android:layout_width="0dp"
309 android:layout_height="match_parent" 311 android:layout_height="match_parent"
310 android:layout_weight="2.5" 312 android:layout_weight="2.5"
311 android:orientation="vertical"> 313 android:orientation="vertical">
312 314
313 <LinearLayout 315 <LinearLayout
314 android:layout_width="match_parent" 316 android:layout_width="match_parent"
315 android:layout_height="wrap_content" 317 android:layout_height="wrap_content"
316 android:layout_margin="20dp" 318 android:layout_margin="20dp"
317 android:gravity="center_vertical" 319 android:gravity="center_vertical"
318 android:orientation="horizontal"> 320 android:orientation="horizontal">
319 321
320 <View 322 <View
321 android:layout_width="5dp" 323 android:layout_width="5dp"
322 android:layout_height="20dp" 324 android:layout_height="20dp"
323 android:background="@color/login_text_blue"> 325 android:background="@color/login_text_blue">
324 326
325 </View> 327 </View>
326 328
327 <TextView 329 <TextView
328 android:layout_width="wrap_content" 330 android:layout_width="wrap_content"
329 android:layout_height="wrap_content" 331 android:layout_height="wrap_content"
330 android:layout_marginLeft="5dp" 332 android:layout_marginLeft="5dp"
331 android:text="最近学习" 333 android:text="最近学习"
332 android:textSize="22sp" /> 334 android:textSize="22sp" />
333 335
334 </LinearLayout> 336 </LinearLayout>
335 337
336 <LinearLayout 338 <LinearLayout
337 android:layout_width="match_parent" 339 android:layout_width="match_parent"
338 android:layout_height="wrap_content"> 340 android:layout_height="wrap_content">
339 341
340 <TextView 342 <TextView
341 android:id="@+id/list_item_study" 343 android:id="@+id/list_item_study"
342 android:layout_width="match_parent" 344 android:layout_width="match_parent"
343 android:layout_height="100dp" 345 android:layout_height="100dp"
344 android:layout_marginLeft="20dp" 346 android:layout_marginLeft="20dp"
345 android:layout_marginTop="10dp" 347 android:layout_marginTop="10dp"
346 android:gravity="center" 348 android:gravity="center"
347 android:text="这里需要显示水平滑动的" /> 349 android:text="这里需要显示水平滑动的" />
348 </LinearLayout> 350 </LinearLayout>
349 351
350 <View 352 <View
351 android:layout_width="match_parent" 353 android:layout_width="match_parent"
352 android:layout_height="0.7dp" 354 android:layout_height="0.7dp"
353 android:background="@color/cutoff_line"> 355 android:background="@color/cutoff_line">
354 356
355 </View> 357 </View>
356 358
357 <LinearLayout 359 <LinearLayout
358 android:layout_width="match_parent" 360 android:layout_width="match_parent"
359 android:layout_height="wrap_content" 361 android:layout_height="wrap_content"
360 android:layout_margin="20dp" 362 android:layout_margin="20dp"
361 android:gravity="center_vertical" 363 android:gravity="center_vertical"
362 android:orientation="horizontal"> 364 android:orientation="horizontal">
363 365
364 <View 366 <View
365 android:layout_width="5dp" 367 android:layout_width="5dp"
366 android:layout_height="20dp" 368 android:layout_height="20dp"
367 android:background="@color/login_text_blue"> 369 android:background="@color/login_text_blue">
368 370
369 </View> 371 </View>
370 372
371 <TextView 373 <TextView
372 android:layout_width="0dp" 374 android:layout_width="0dp"
373 android:layout_height="wrap_content" 375 android:layout_height="wrap_content"
374 android:layout_marginLeft="5dp" 376 android:layout_marginLeft="5dp"
375 android:layout_weight="2" 377 android:layout_weight="2"
376 android:text="个人信息" 378 android:text="个人信息"
377 android:textSize="22sp" /> 379 android:textSize="22sp" />
378 380
379 <TextView 381 <TextView
380 android:id="@+id/tv_edit_presoninfo" 382 android:id="@+id/tv_edit_presoninfo"
381 android:padding="5dp" 383 android:padding="5dp"
382 android:layout_width="0dp" 384 android:layout_width="0dp"
383 android:layout_height="wrap_content" 385 android:layout_height="wrap_content"
384 android:layout_marginLeft="10dp" 386 android:layout_marginLeft="10dp"
385 android:layout_weight="0.2" 387 android:layout_weight="0.2"
386 android:text="编辑" 388 android:text="编辑"
387 android:textSize="18sp" /> 389 android:textSize="18sp" />
388 390
389 <ImageView 391 <ImageView
390 android:layout_width="0dp" 392 android:layout_width="0dp"
391 android:layout_height="wrap_content" 393 android:layout_height="wrap_content"
392 android:layout_weight="0.1" 394 android:layout_weight="0.1"
393 395
394 android:src="@mipmap/youjiantou" /> 396 android:src="@mipmap/youjiantou" />
395 397
396 398
397 </LinearLayout> 399 </LinearLayout>
398 400
399 <LinearLayout 401 <LinearLayout
400 android:layout_width="match_parent" 402 android:layout_width="match_parent"
401 android:layout_height="wrap_content" 403 android:layout_height="wrap_content"
402 android:layout_marginLeft="50dp" 404 android:layout_marginLeft="50dp"
403 android:layout_marginTop="10dp" 405 android:layout_marginTop="10dp"
404 android:orientation="vertical"> 406 android:orientation="vertical">
405 407
406 <LinearLayout 408 <LinearLayout
407 android:layout_width="match_parent" 409 android:layout_width="match_parent"
408 android:layout_height="wrap_content" 410 android:layout_height="wrap_content"
409 android:gravity="center_vertical" 411 android:gravity="center_vertical"
410 android:orientation="horizontal"> 412 android:orientation="horizontal">
411 413
412 <TextView 414 <TextView
413 android:layout_width="0dp" 415 android:layout_width="0dp"
414 android:layout_height="wrap_content" 416 android:layout_height="wrap_content"
415 android:layout_weight="1" 417 android:layout_weight="1"
416 android:text="我的错题" 418 android:text="我的错题"
417 android:textSize="20sp" /> 419 android:textSize="20sp" />
418 420
419 <TextView 421 <TextView
420 android:layout_width="0dp" 422 android:layout_width="0dp"
421 android:layout_height="wrap_content" 423 android:layout_height="wrap_content"
422 android:layout_weight="2" 424 android:layout_weight="2"
423 android:text="我的错题" 425 android:text="我的错题"
424 android:textSize="20sp" /> 426 android:textSize="20sp" />
425 427
426 <TextView 428 <TextView
427 android:layout_width="1dp" 429 android:layout_width="1dp"
428 android:layout_height="wrap_content" 430 android:layout_height="wrap_content"
429 android:layout_weight="1" 431 android:layout_weight="1"
430 android:text="我的错题" 432 android:text="我的错题"
431 android:textSize="20sp" /> 433 android:textSize="20sp" />
432 434
433 <TextView 435 <TextView
434 android:layout_width="0dp" 436 android:layout_width="0dp"
435 android:layout_height="wrap_content" 437 android:layout_height="wrap_content"
436 android:layout_weight="2" 438 android:layout_weight="2"
437 android:text="我的错题" 439 android:text="我的错题"
438 android:textSize="20sp" /> 440 android:textSize="20sp" />
439 </LinearLayout> 441 </LinearLayout>
440 442
441 <LinearLayout 443 <LinearLayout
442 android:layout_width="match_parent" 444 android:layout_width="match_parent"
443 android:layout_height="wrap_content" 445 android:layout_height="wrap_content"
444 android:layout_marginTop="20dp" 446 android:layout_marginTop="20dp"
445 android:gravity="center_vertical" 447 android:gravity="center_vertical"
446 android:orientation="horizontal"> 448 android:orientation="horizontal">
447 449
448 <TextView 450 <TextView
449 android:layout_width="0dp" 451 android:layout_width="0dp"
450 android:layout_height="wrap_content" 452 android:layout_height="wrap_content"
451 android:layout_weight="1" 453 android:layout_weight="1"
452 android:text="我的错题" 454 android:text="我的错题"
453 android:textSize="20sp" /> 455 android:textSize="20sp" />
454 456
455 <TextView 457 <TextView
456 android:layout_width="0dp" 458 android:layout_width="0dp"
457 android:layout_height="wrap_content" 459 android:layout_height="wrap_content"
458 android:layout_weight="2" 460 android:layout_weight="2"
459 android:text="我的错题" 461 android:text="我的错题"
460 android:textSize="20sp" /> 462 android:textSize="20sp" />
461 463
462 <TextView 464 <TextView
463 android:layout_width="1dp" 465 android:layout_width="1dp"
464 android:layout_height="wrap_content" 466 android:layout_height="wrap_content"
465 android:layout_weight="1" 467 android:layout_weight="1"
466 android:text="我的错题" 468 android:text="我的错题"
467 android:textSize="20sp" /> 469 android:textSize="20sp" />
468 470
469 <TextView 471 <TextView
470 android:layout_width="0dp" 472 android:layout_width="0dp"
471 android:layout_height="wrap_content" 473 android:layout_height="wrap_content"
472 android:layout_weight="2" 474 android:layout_weight="2"
473 android:text="我的错题" 475 android:text="我的错题"
474 android:textSize="20sp" /> 476 android:textSize="20sp" />
475 </LinearLayout> 477 </LinearLayout>
476 478
477 <LinearLayout 479 <LinearLayout
478 android:layout_width="match_parent" 480 android:layout_width="match_parent"
479 android:layout_height="wrap_content" 481 android:layout_height="wrap_content"
480 android:layout_marginTop="20dp" 482 android:layout_marginTop="20dp"
481 android:gravity="center_vertical" 483 android:gravity="center_vertical"
482 android:orientation="horizontal"> 484 android:orientation="horizontal">
483 485
484 <TextView 486 <TextView
485 android:layout_width="0dp" 487 android:layout_width="0dp"
486 android:layout_height="wrap_content" 488 android:layout_height="wrap_content"
487 android:layout_weight="1" 489 android:layout_weight="1"
488 android:text="我的错题" 490 android:text="我的错题"
489 android:textSize="20sp" /> 491 android:textSize="20sp" />
490 492
491 <TextView 493 <TextView
492 android:layout_width="0dp" 494 android:layout_width="0dp"
493 android:layout_height="wrap_content" 495 android:layout_height="wrap_content"
494 android:layout_weight="2" 496 android:layout_weight="2"
495 android:text="我的错题" 497 android:text="我的错题"
496 android:textSize="20sp" /> 498 android:textSize="20sp" />
497 499
498 <TextView 500 <TextView
499 android:layout_width="1dp" 501 android:layout_width="1dp"
500 android:layout_height="wrap_content" 502 android:layout_height="wrap_content"
501 android:layout_weight="1" 503 android:layout_weight="1"
502 android:text="我的错题" 504 android:text="我的错题"
503 android:textSize="20sp" /> 505 android:textSize="20sp" />
504 506
505 <TextView 507 <TextView
506 android:layout_width="0dp" 508 android:layout_width="0dp"
507 android:layout_height="wrap_content" 509 android:layout_height="wrap_content"
508 android:layout_weight="2" 510 android:layout_weight="2"
509 android:text="我的错题" 511 android:text="我的错题"
510 android:textSize="20sp" /> 512 android:textSize="20sp" />
511 </LinearLayout> 513 </LinearLayout>
512 514
513 <LinearLayout 515 <LinearLayout
514 android:layout_width="match_parent" 516 android:layout_width="match_parent"
515 android:layout_height="wrap_content" 517 android:layout_height="wrap_content"
516 android:layout_marginTop="20dp" 518 android:layout_marginTop="20dp"
517 android:gravity="center_vertical" 519 android:gravity="center_vertical"
518 android:orientation="horizontal"> 520 android:orientation="horizontal">
519 521
520 <TextView 522 <TextView
521 android:layout_width="0dp" 523 android:layout_width="0dp"
522 android:layout_height="wrap_content" 524 android:layout_height="wrap_content"
523 android:layout_weight="1" 525 android:layout_weight="1"
524 android:text="我的错题" 526 android:text="我的错题"
525 android:textSize="20sp" /> 527 android:textSize="20sp" />
526 528
527 <TextView 529 <TextView
528 android:layout_width="0dp" 530 android:layout_width="0dp"
529 android:layout_height="wrap_content" 531 android:layout_height="wrap_content"
530 android:layout_weight="2" 532 android:layout_weight="2"
531 android:text="我的错题" 533 android:text="我的错题"
532 android:textSize="20sp" /> 534 android:textSize="20sp" />
533 535
534 <TextView 536 <TextView
535 android:layout_width="1dp" 537 android:layout_width="1dp"
536 android:layout_height="wrap_content" 538 android:layout_height="wrap_content"
537 android:layout_weight="1" 539 android:layout_weight="1"
538 android:text="我的错题" 540 android:text="我的错题"
539 android:textSize="20sp" /> 541 android:textSize="20sp" />
540 542
541 <TextView 543 <TextView
542 android:layout_width="0dp" 544 android:layout_width="0dp"
543 android:layout_height="wrap_content" 545 android:layout_height="wrap_content"
544 android:layout_weight="2" 546 android:layout_weight="2"
545 android:text="我的错题" 547 android:text="我的错题"
546 android:textSize="20sp" /> 548 android:textSize="20sp" />
547 </LinearLayout> 549 </LinearLayout>
548 550
549 551
550 </LinearLayout> 552 </LinearLayout>
551 <View 553 <View
552 android:layout_width="match_parent" 554 android:layout_width="match_parent"
553 android:layout_height="0.7dp" 555 android:layout_height="0.7dp"
554 android:layout_marginTop="20dp" 556 android:layout_marginTop="20dp"
555 android:background="@color/cutoff_line"> 557 android:background="@color/cutoff_line">
556 558
557 </View> 559 </View>
558 <LinearLayout 560 <LinearLayout
559 android:layout_width="match_parent" 561 android:layout_width="match_parent"
560 android:layout_height="wrap_content" 562 android:layout_height="wrap_content"
561 android:layout_margin="20dp" 563 android:layout_margin="20dp"
562 android:gravity="center_vertical" 564 android:gravity="center_vertical"
563 android:orientation="horizontal"> 565 android:orientation="horizontal">
564 566
565 <View 567 <View
566 android:layout_width="5dp" 568 android:layout_width="5dp"
567 android:layout_height="20dp" 569 android:layout_height="20dp"
568 android:background="@color/login_text_blue"> 570 android:background="@color/login_text_blue">
569 571
570 </View> 572 </View>
571 573
572 <TextView 574 <TextView
573 android:layout_width="wrap_content" 575 android:layout_width="wrap_content"
574 android:layout_height="wrap_content" 576 android:layout_height="wrap_content"
575 android:layout_marginLeft="5dp" 577 android:layout_marginLeft="5dp"
576 android:text="版本信息" 578 android:text="版本信息"
577 android:textSize="22sp" /> 579 android:textSize="22sp" />
578 580
579 </LinearLayout> 581 </LinearLayout>
580 582
581 <LinearLayout 583 <LinearLayout
582 android:layout_width="match_parent" 584 android:layout_width="match_parent"
583 android:layout_height="wrap_content" 585 android:layout_height="wrap_content"
584 android:layout_marginTop="20dp"> 586 android:layout_marginTop="20dp">
585 587
586 <TextView 588 <TextView
587 android:layout_width="match_parent" 589 android:layout_width="match_parent"
588 android:layout_height="100dp" 590 android:layout_height="100dp"
589 android:layout_marginLeft="20dp" 591 android:layout_marginLeft="20dp"
590 android:layout_marginTop="10dp" 592 android:layout_marginTop="10dp"
591 android:gravity="center" 593 android:gravity="center"
592 android:text="这里需要显示水平滑动的" /> 594 android:text="这里需要显示水平滑动的" />
593 </LinearLayout> 595 </LinearLayout>
594 596
595 597
596 </LinearLayout> 598 </LinearLayout>
597 599
598 600
599 </LinearLayout> 601 </LinearLayout>
600 602
601 603
602 </LinearLayout> 604 </LinearLayout>
603 605