Commit 70733fe33cdf5a7f10c2e82666f8f456d8b78098
1 parent
865951b7d0
Exists in
master
获取个人信息,修改个人信息,获取个性签名,修改个性签名接口的调试以及省市区的逻辑处理
Showing
19 changed files
with
731 additions
and
40 deletions
Show diff stats
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.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.GridView; | 10 | import android.widget.GridView; |
11 | import android.widget.SimpleAdapter; | 11 | import android.widget.SimpleAdapter; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 14 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
15 | import com.hjx.personalcenter.http.HttpCode; | 15 | import com.hjx.personalcenter.http.HttpCode; |
16 | import com.hjx.personalcenter.http.HttpManager; | 16 | import com.hjx.personalcenter.http.HttpManager; |
17 | 17 | ||
18 | import org.json.JSONException; | 18 | import org.json.JSONException; |
19 | import org.json.JSONObject; | 19 | import org.json.JSONObject; |
20 | 20 | ||
21 | import java.util.ArrayList; | 21 | import java.util.ArrayList; |
22 | import java.util.HashMap; | 22 | import java.util.HashMap; |
23 | import java.util.List; | 23 | import java.util.List; |
24 | import java.util.Map; | 24 | import java.util.Map; |
25 | 25 | ||
26 | /**选择教材 | 26 | /**选择教材 |
27 | * Created by h on 2017/8/10. | 27 | * Created by h on 2017/8/10. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { | 30 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { |
31 | private GridView gridView; | 31 | private GridView gridView; |
32 | private Button btn_ok; | 32 | private Button btn_ok; |
33 | private List<Map<String, Object>> data_list; | 33 | private List<Map<String, Object>> data_list; |
34 | private SimpleAdapter sim_adapter; | 34 | private SimpleAdapter sim_adapter; |
35 | // 图片封装为一个数组 | 35 | // 图片封装为一个数组 |
36 | private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, | 36 | private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, |
37 | 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, |
38 | 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, |
39 | R.mipmap.ic_launcher}; | 39 | R.mipmap.ic_launcher}; |
40 | private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", | 40 | private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", |
41 | "历史", "地理" }; | 41 | "历史", "地理" }; |
42 | private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", | 42 | private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", |
43 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", | 43 | "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", |
44 | "人民教育出版社", "人民教育出版社" }; | 44 | "人民教育出版社", "人民教育出版社" }; |
45 | 45 | ||
46 | 46 | ||
47 | Handler handler = new Handler(){ | 47 | Handler handler = new Handler(){ |
48 | @Override | 48 | @Override |
49 | public void handleMessage(Message msg) { | 49 | public void handleMessage(Message msg) { |
50 | super.handleMessage(msg); | 50 | super.handleMessage(msg); |
51 | JSONObject jsonObject; | 51 | JSONObject jsonObject; |
52 | String status; | 52 | String status; |
53 | switch (msg.what){ | 53 | switch (msg.what){ |
54 | case HttpCode.CHECKCARD: | 54 | case HttpCode.CHECKCARD: |
55 | try { | 55 | try { |
56 | jsonObject = new JSONObject( (String) msg.obj); | 56 | jsonObject = new JSONObject( (String) msg.obj); |
57 | status = jsonObject.optString("status"); | 57 | status = jsonObject.optString("status"); |
58 | if (status.equals("1")){ | 58 | if (status.equals("1")){ |
59 | Intent intent = new Intent(); | 59 | Intent intent = new Intent(); |
60 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 60 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
61 | ChoiseTextBookActivity.this.startActivity(intent); | 61 | ChoiseTextBookActivity.this.startActivity(intent); |
62 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 62 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
63 | finish(); | 63 | finish(); |
64 | }else if(status.equals("0")){ | 64 | }else if(status.equals("2001")){ |
65 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 65 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
66 | } | 66 | } |
67 | 67 | ||
68 | } catch (JSONException e) { | 68 | } catch (JSONException e) { |
69 | e.printStackTrace(); | 69 | e.printStackTrace(); |
70 | } | 70 | } |
71 | 71 | ||
72 | break; | 72 | break; |
73 | 73 | ||
74 | } | 74 | } |
75 | 75 | ||
76 | } | 76 | } |
77 | }; | 77 | }; |
78 | 78 | ||
79 | @Override | 79 | @Override |
80 | protected void onCreate(Bundle savedInstanceState) { | 80 | protected void onCreate(Bundle savedInstanceState) { |
81 | super.onCreate(savedInstanceState); | 81 | super.onCreate(savedInstanceState); |
82 | setContentView(R.layout.activity_choisetextbook); | 82 | setContentView(R.layout.activity_choisetextbook); |
83 | initView(); | 83 | initView(); |
84 | initData(); | 84 | initData(); |
85 | initLister(); | 85 | initLister(); |
86 | } | 86 | } |
87 | 87 | ||
88 | private void initView() { | 88 | private void initView() { |
89 | gridView = (GridView) findViewById(R.id.grideview); | 89 | gridView = (GridView) findViewById(R.id.grideview); |
90 | btn_ok = (Button) findViewById(R.id.btn_ok); | 90 | btn_ok = (Button) findViewById(R.id.btn_ok); |
91 | } | 91 | } |
92 | 92 | ||
93 | private void initData() { | 93 | private void initData() { |
94 | data_list = new ArrayList<Map<String, Object>>(); | 94 | data_list = new ArrayList<Map<String, Object>>(); |
95 | getData(); | 95 | getData(); |
96 | String [] from ={"image","text","text1"}; | 96 | String [] from ={"image","text","text1"}; |
97 | int [] to = {R.id.image,R.id.text}; | 97 | int [] to = {R.id.image,R.id.text}; |
98 | 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); |
99 | //配置适配器 | 99 | //配置适配器 |
100 | gridView.setAdapter(sim_adapter); | 100 | gridView.setAdapter(sim_adapter); |
101 | 101 | ||
102 | } | 102 | } |
103 | 103 | ||
104 | private void initLister() { | 104 | private void initLister() { |
105 | btn_ok.setOnClickListener(this); | 105 | btn_ok.setOnClickListener(this); |
106 | 106 | ||
107 | } | 107 | } |
108 | public List<Map<String, Object>> getData(){ | 108 | public List<Map<String, Object>> getData(){ |
109 | //cion和iconName的长度是相同的,这里任选其一都可以 | 109 | //cion和iconName的长度是相同的,这里任选其一都可以 |
110 | for(int i=0;i<icon.length;i++){ | 110 | for(int i=0;i<icon.length;i++){ |
111 | Map<String, Object> map = new HashMap<String, Object>(); | 111 | Map<String, Object> map = new HashMap<String, Object>(); |
112 | map.put("image", icon[i]); | 112 | map.put("image", icon[i]); |
113 | map.put("text", subject[i]); | 113 | map.put("text", subject[i]); |
114 | map.put("text1", publish[i]); | 114 | map.put("text1", publish[i]); |
115 | data_list.add(map); | 115 | data_list.add(map); |
116 | } | 116 | } |
117 | 117 | ||
118 | return data_list; | 118 | return data_list; |
119 | } | 119 | } |
120 | 120 | ||
121 | @Override | 121 | @Override |
122 | public void onClick(View v) { | 122 | public void onClick(View v) { |
123 | switch (v.getId()){ | 123 | switch (v.getId()){ |
124 | case R.id.btn_ok: | 124 | case R.id.btn_ok: |
125 | HttpManager.getInstance().cardinfocheck(this,836,handler); | 125 | HttpManager.getInstance().cardinfocheck(this,836,handler); |
126 | break; | 126 | break; |
127 | } | 127 | } |
128 | 128 | ||
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 |
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; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
10 | import android.widget.TextView; | 10 | import android.widget.TextView; |
11 | 11 | ||
12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.db.Content; | 13 | import com.hjx.personalcenter.db.Content; |
14 | import com.hjx.personalcenter.db.SaveParam; | 14 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.http.HttpCode; | 15 | import com.hjx.personalcenter.http.HttpCode; |
16 | import com.hjx.personalcenter.http.HttpManager; | 16 | import com.hjx.personalcenter.http.HttpManager; |
17 | import com.hjx.personalcenter.model.CardInfo; | 17 | import com.hjx.personalcenter.model.CardInfo; |
18 | import com.hjx.personalcenter.util.AlertUtils; | ||
19 | 18 | ||
20 | import java.util.ArrayList; | 19 | import java.util.ArrayList; |
21 | 20 | ||
22 | /** | 21 | /** |
23 | * Created by h on 2017/8/11. | 22 | * Created by h on 2017/8/11. |
24 | */ | 23 | */ |
25 | 24 | ||
26 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ | 25 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ |
27 | private ImageView iv_last_step; | 26 | private ImageView iv_last_step; |
28 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, | 27 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, |
29 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; | 28 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; |
30 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | 29 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); |
31 | 30 | ||
32 | Handler handler = new Handler(){ | 31 | Handler handler = new Handler(){ |
33 | @Override | 32 | @Override |
34 | public void handleMessage(Message msg) { | 33 | public void handleMessage(Message msg) { |
35 | super.handleMessage(msg); | 34 | super.handleMessage(msg); |
36 | switch (msg.what){ | 35 | switch (msg.what){ |
37 | 36 | ||
38 | case HttpCode.SUCHCARDINFO: | 37 | case HttpCode.SUCHCARDINFO: |
39 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"显示电子保卡信息"); | ||
40 | CardInfo.DataBean cardinfoBean =(CardInfo.DataBean)msg.obj; | 38 | CardInfo.DataBean cardinfoBean =(CardInfo.DataBean)msg.obj; |
41 | //获取设备信息 | 39 | //获取设备信息 |
42 | deviceModel.setText(cardinfoBean.getProductModel()); | 40 | deviceModel.setText(cardinfoBean.getProductModel()); |
43 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); | 41 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); |
44 | mac_adress.setText(cardinfoBean.getMacAddress()); | 42 | mac_adress.setText(cardinfoBean.getMacAddress()); |
45 | //获取保卡信息 | 43 | //获取保卡信息 |
46 | usename.setText(cardinfoBean.getCustomerName()); | 44 | usename.setText(cardinfoBean.getCustomerName()); |
47 | customer_address.setText(cardinfoBean.getCustomerAddress()); | 45 | customer_address.setText(cardinfoBean.getCustomerAddress()); |
48 | shoptime.setText(cardinfoBean.getBuyTime()); | 46 | shoptime.setText(cardinfoBean.getBuyTime()); |
49 | shopadress.setText(cardinfoBean.getBuyAddress()); | 47 | shopadress.setText(cardinfoBean.getBuyAddress()); |
50 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); | 48 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); |
51 | phone.setText(cardinfoBean.getMobilePhone()); | 49 | phone.setText(cardinfoBean.getMobilePhone()); |
52 | 50 | ||
53 | 51 | ||
54 | break; | 52 | break; |
55 | 53 | ||
56 | } | 54 | } |
57 | 55 | ||
58 | } | 56 | } |
59 | }; | 57 | }; |
60 | 58 | ||
61 | @Override | 59 | @Override |
62 | protected void onCreate(Bundle savedInstanceState) { | 60 | protected void onCreate(Bundle savedInstanceState) { |
63 | super.onCreate(savedInstanceState); | 61 | super.onCreate(savedInstanceState); |
64 | setContentView(R.layout.activity_electronic_look_cardinfo); | 62 | setContentView(R.layout.activity_electronic_look_cardinfo); |
65 | initView(); | 63 | initView(); |
66 | initData(); | 64 | initData(); |
67 | initLister(); | 65 | initLister(); |
68 | } | 66 | } |
69 | private void initView() { | 67 | private void initView() { |
70 | usename = (TextView) findViewById(R.id.iv_card_username); | 68 | usename = (TextView) findViewById(R.id.iv_card_username); |
71 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 69 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
72 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 70 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
73 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 71 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
74 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 72 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
75 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 73 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
76 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 74 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
77 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 75 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
78 | phone = (TextView) findViewById(R.id.tv_card_phone); | 76 | phone = (TextView) findViewById(R.id.tv_card_phone); |
79 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 77 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
80 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | 78 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); |
81 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | 79 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
82 | } | 80 | } |
83 | private void initData() { | 81 | private void initData() { |
84 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 82 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
85 | try { | 83 | try { |
86 | int a = Integer.parseInt(userID); | 84 | int a = Integer.parseInt(userID); |
87 | HttpManager.getInstance().getcardinfo(this,a,handler); | 85 | HttpManager.getInstance().getcardinfo(this,a,handler); |
88 | } catch (NumberFormatException e) { | 86 | } catch (NumberFormatException e) { |
89 | e.printStackTrace(); | 87 | e.printStackTrace(); |
90 | } | 88 | } |
91 | 89 | ||
92 | // //获取设备信息 | 90 | // //获取设备信息 |
93 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 91 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
94 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 92 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
95 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 93 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
96 | // //获取保卡信息 | 94 | // //获取保卡信息 |
97 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 95 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
98 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 96 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
99 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 97 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
100 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 98 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
101 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 99 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
102 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 100 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
103 | 101 | ||
104 | 102 | ||
105 | } | 103 | } |
106 | private void initLister() { | 104 | private void initLister() { |
107 | tv_card_adress_change.setOnClickListener(this); | 105 | tv_card_adress_change.setOnClickListener(this); |
108 | tv_card_phone_change.setOnClickListener(this); | 106 | tv_card_phone_change.setOnClickListener(this); |
109 | iv_last_step.setOnClickListener(this); | 107 | iv_last_step.setOnClickListener(this); |
110 | } | 108 | } |
111 | @Override | 109 | @Override |
112 | public void onClick(View v) { | 110 | public void onClick(View v) { |
113 | switch (v.getId()){ | 111 | switch (v.getId()){ |
114 | case R.id.tv_card_adress_change: | 112 | case R.id.tv_card_adress_change: |
115 | Intent intent = new Intent(); | 113 | Intent intent = new Intent(); |
116 | intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); | 114 | intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); |
117 | startActivity(intent); | 115 | startActivity(intent); |
118 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 116 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
119 | 117 | ||
120 | break; | 118 | break; |
121 | case R.id.tv_card_phone_change: | 119 | case R.id.tv_card_phone_change: |
122 | Content.authcodeflag =2; | 120 | Content.authcodeflag =2; |
123 | Intent intent1 = new Intent(); | 121 | Intent intent1 = new Intent(); |
124 | intent1.setClass(this,ElectronicCardValidationActivity.class); | 122 | intent1.setClass(this,ElectronicCardValidationActivity.class); |
125 | startActivity(intent1); | 123 | startActivity(intent1); |
126 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 124 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
127 | 125 | ||
128 | 126 | ||
129 | break; | 127 | break; |
130 | case R.id.cancel: | 128 | case R.id.cancel: |
131 | finish(); | 129 | finish(); |
132 | break; | 130 | break; |
133 | } | 131 | } |
134 | } | 132 | } |
135 | 133 | ||
136 | } | 134 | } |
137 | 135 |
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.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.os.Handler; | ||
10 | import android.os.Message; | ||
9 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
10 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
11 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
12 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
13 | import android.view.View; | 15 | import android.view.View; |
14 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
15 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
16 | import android.widget.TextView; | 18 | import android.widget.TextView; |
17 | import android.widget.Toast; | 19 | import android.widget.Toast; |
18 | 20 | ||
19 | import com.facebook.drawee.backends.pipeline.Fresco; | 21 | import com.facebook.drawee.backends.pipeline.Fresco; |
20 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 22 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
21 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 23 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
22 | import com.facebook.drawee.generic.RoundingParams; | 24 | import com.facebook.drawee.generic.RoundingParams; |
23 | import com.facebook.drawee.interfaces.DraweeController; | 25 | import com.facebook.drawee.interfaces.DraweeController; |
24 | import com.facebook.drawee.view.SimpleDraweeView; | 26 | import com.facebook.drawee.view.SimpleDraweeView; |
25 | import com.hjx.personalcenter.R; | 27 | import com.hjx.personalcenter.R; |
26 | import com.hjx.personalcenter.customdialog.HeadDialog; | 28 | import com.hjx.personalcenter.customdialog.HeadDialog; |
29 | import com.hjx.personalcenter.db.SaveParam; | ||
30 | import com.hjx.personalcenter.http.HttpCode; | ||
31 | import com.hjx.personalcenter.http.HttpManager; | ||
27 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 32 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
33 | import com.hjx.personalcenter.model.PesonalInfo; | ||
34 | import com.hjx.personalcenter.model.SignInfo; | ||
28 | import com.hjx.personalcenter.util.AlertUtils; | 35 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.CropUtils; | 36 | import com.hjx.personalcenter.util.CropUtils; |
30 | import com.hjx.personalcenter.util.DialogPermission; | 37 | import com.hjx.personalcenter.util.DialogPermission; |
31 | import com.hjx.personalcenter.util.FileUtil; | 38 | import com.hjx.personalcenter.util.FileUtil; |
32 | import com.hjx.personalcenter.util.PermissionUtil; | 39 | import com.hjx.personalcenter.util.PermissionUtil; |
33 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 40 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
34 | import com.mylhyl.circledialog.CircleDialog; | 41 | import com.mylhyl.circledialog.CircleDialog; |
35 | import com.mylhyl.circledialog.callback.ConfigInput; | 42 | import com.mylhyl.circledialog.callback.ConfigInput; |
36 | import com.mylhyl.circledialog.params.InputParams; | 43 | import com.mylhyl.circledialog.params.InputParams; |
37 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 44 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
38 | import com.zaaach.toprightmenu.MenuItem; | 45 | import com.zaaach.toprightmenu.MenuItem; |
39 | import com.zaaach.toprightmenu.TopRightMenu; | 46 | import com.zaaach.toprightmenu.TopRightMenu; |
40 | 47 | ||
41 | import java.io.File; | 48 | import java.io.File; |
42 | import java.util.ArrayList; | 49 | import java.util.ArrayList; |
43 | import java.util.List; | 50 | import java.util.List; |
44 | 51 | ||
45 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 52 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
46 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 53 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
47 | private TextView tv_edit_presoninfo, tv_sign, | 54 | private TextView tv_edit_presoninfo, tv_sign, |
48 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 55 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
49 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 56 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
50 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 57 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
51 | private TopRightMenu mTopRightMenu; | 58 | private TopRightMenu mTopRightMenu; |
52 | private boolean showIcon = true; | 59 | private boolean showIcon = true; |
53 | private boolean dimBg = true; | 60 | private boolean dimBg = true; |
54 | private boolean needAnim = true; | 61 | private boolean needAnim = true; |
55 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 62 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
56 | private static final int REQUEST_CODE_ALBUM = 2; | 63 | private static final int REQUEST_CODE_ALBUM = 2; |
57 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 64 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
58 | SimpleDraweeView mSimpleDraweeView; | 65 | SimpleDraweeView mSimpleDraweeView; |
59 | private File file; | 66 | private File file; |
60 | private Uri uri; | 67 | private Uri uri; |
68 | Handler handler = new Handler(){ | ||
69 | @Override | ||
70 | public void handleMessage(Message msg) { | ||
71 | super.handleMessage(msg); | ||
72 | switch (msg.what){ | ||
73 | case HttpCode.GETINFO: | ||
74 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | ||
75 | tv_username.setText(cardinfoBean.getNickName()); | ||
76 | tv_username1.setText(cardinfoBean.getNickName()); | ||
77 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | ||
78 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | ||
79 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | ||
80 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | ||
81 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | ||
82 | String sex = cardinfoBean.getGender(); | ||
83 | if ("0".equals(sex)){ | ||
84 | tv_sex.setText("男"); | ||
85 | iv_sex.setImageResource(R.mipmap.men); | ||
86 | }else { | ||
87 | tv_sex.setText("女"); | ||
88 | iv_sex.setImageResource(R.mipmap.women); | ||
89 | } | ||
90 | break; | ||
91 | case HttpCode.SIGN: | ||
92 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | ||
93 | tv_sign.setText(dataBean.getSignature()); | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | }; | ||
61 | 98 | ||
62 | @Override | 99 | @Override |
63 | protected void onCreate(Bundle savedInstanceState) { | 100 | protected void onCreate(Bundle savedInstanceState) { |
64 | super.onCreate(savedInstanceState); | 101 | super.onCreate(savedInstanceState); |
65 | Fresco.initialize(this); | 102 | Fresco.initialize(this); |
66 | setContentView(R.layout.activity_main); | 103 | setContentView(R.layout.activity_main); |
67 | initView(); | 104 | initView(); |
68 | initData(); | 105 | initData(); |
69 | initLister(); | 106 | initLister(); |
70 | } | 107 | } |
71 | 108 | ||
72 | private void initView() { | 109 | private void initView() { |
73 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 110 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
74 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 111 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
75 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 112 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
76 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 113 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
77 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 114 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
78 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 115 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
79 | //头像 | 116 | //头像 |
80 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 117 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
81 | //初始化个人信息 | 118 | //初始化个人信息 |
82 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 119 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
83 | tv_username = (TextView) findViewById(R.id.tv_username); | 120 | tv_username = (TextView) findViewById(R.id.tv_username); |
84 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 121 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
85 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 122 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
86 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 123 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
87 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 124 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
88 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 125 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
89 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 126 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
90 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 127 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
91 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 128 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
92 | //跳转其他应用 | 129 | //跳转其他应用 |
93 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 130 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
94 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 131 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
95 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 132 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
96 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 133 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
97 | 134 | ||
98 | } | 135 | } |
99 | 136 | ||
137 | @Override | ||
138 | protected void onResume() { | ||
139 | super.onResume(); | ||
140 | //获取个人信息 | ||
141 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,688,handler); | ||
142 | //获取个性签名 | ||
143 | HttpManager.getInstance().getsignatures(MainActivity.this,688,handler); | ||
144 | } | ||
145 | |||
100 | private void initData() { | 146 | private void initData() { |
101 | //加载个人信息 | 147 | //加载个人信息 |
148 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | ||
149 | if (xiongzuo==null){ | ||
150 | tv_mygad.setText(""); | ||
151 | }else { | ||
152 | tv_mygad.setText(xiongzuo); | ||
153 | } | ||
154 | //HttpManager.getInstance().getpresonalinfo(MainActivity.this,688,handler); | ||
102 | 155 | ||
103 | // //初始化图片 | 156 | |
104 | // file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 157 | //初始化图片 |
105 | // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 158 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
106 | // uri = Uri.fromFile(file); | 159 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
107 | // } else { | 160 | uri = Uri.fromFile(file); |
108 | // //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 161 | } else { |
109 | // uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 162 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
110 | // } | 163 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
164 | } | ||
111 | 165 | ||
112 | } | 166 | } |
113 | 167 | ||
114 | private void initLister() { | 168 | private void initLister() { |
115 | iv_imformatioan.setOnClickListener(this); | 169 | iv_imformatioan.setOnClickListener(this); |
116 | iv_look_card.setOnClickListener(this); | 170 | iv_look_card.setOnClickListener(this); |
117 | tv_edit_presoninfo.setOnClickListener(this); | 171 | tv_edit_presoninfo.setOnClickListener(this); |
118 | iv_setting.setOnClickListener(this); | 172 | iv_setting.setOnClickListener(this); |
119 | iv_sign.setOnClickListener(this); | 173 | iv_sign.setOnClickListener(this); |
120 | mSimpleDraweeView.setOnClickListener(this); | 174 | mSimpleDraweeView.setOnClickListener(this); |
121 | linel_mycuoti.setOnClickListener(this); | 175 | linel_mycuoti.setOnClickListener(this); |
122 | linel_mynote.setOnClickListener(this); | 176 | linel_mynote.setOnClickListener(this); |
123 | linel_mycollege.setOnClickListener(this); | 177 | linel_mycollege.setOnClickListener(this); |
124 | linel_myclass.setOnClickListener(this); | 178 | linel_myclass.setOnClickListener(this); |
125 | 179 | ||
126 | } | 180 | } |
127 | 181 | ||
128 | @Override | 182 | @Override |
129 | public void onClick(View v) { | 183 | public void onClick(View v) { |
130 | switch (v.getId()) { | 184 | switch (v.getId()) { |
131 | case R.id.iv_imformatioan: | 185 | case R.id.iv_imformatioan: |
132 | Intent intent = new Intent(); | 186 | Intent intent = new Intent(); |
133 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 187 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
134 | startActivity(intent); | 188 | startActivity(intent); |
135 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 189 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
136 | break; | 190 | break; |
137 | case R.id.iv_look_card: | 191 | case R.id.iv_look_card: |
138 | Intent lookintent = new Intent(); | 192 | Intent lookintent = new Intent(); |
139 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 193 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
140 | startActivity(lookintent); | 194 | startActivity(lookintent); |
141 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 195 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
142 | break; | 196 | break; |
143 | case R.id.tv_edit_presoninfo: | 197 | case R.id.tv_edit_presoninfo: |
144 | Intent editintent = new Intent(); | 198 | Intent editintent = new Intent(); |
145 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 199 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
146 | startActivity(editintent); | 200 | startActivity(editintent); |
147 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 201 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
148 | break; | 202 | break; |
149 | case R.id.iv_head: | 203 | case R.id.iv_head: |
150 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 204 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
151 | break; | 205 | break; |
152 | case R.id.iv_setting: | 206 | case R.id.iv_setting: |
153 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 207 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
154 | List<MenuItem> menuItems = new ArrayList<>(); | 208 | List<MenuItem> menuItems = new ArrayList<>(); |
155 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 209 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
156 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 210 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
157 | mTopRightMenu | 211 | mTopRightMenu |
158 | .setHeight(150) //默认高度480 | 212 | .setHeight(150) //默认高度480 |
159 | .setWidth(320) //默认宽度wrap_content | 213 | .setWidth(320) //默认宽度wrap_content |
160 | .showIcon(showIcon) //显示菜单图标,默认为true | 214 | .showIcon(showIcon) //显示菜单图标,默认为true |
161 | .dimBackground(dimBg) //背景变暗,默认为true | 215 | .dimBackground(dimBg) //背景变暗,默认为true |
162 | .needAnimationStyle(needAnim) //显示动画,默认为true | 216 | .needAnimationStyle(needAnim) //显示动画,默认为true |
163 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 217 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
164 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 218 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
165 | @Override | 219 | @Override |
166 | public void onMenuItemClick(int position) { | 220 | public void onMenuItemClick(int position) { |
167 | switch (position) { | 221 | switch (position) { |
168 | case 0: | 222 | case 0: |
169 | //清除数据 | 223 | //清除数据 |
170 | Intent settingintent = new Intent(); | 224 | Intent settingintent = new Intent(); |
171 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
172 | startActivity(settingintent); | 226 | startActivity(settingintent); |
173 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
174 | break; | 228 | break; |
175 | case 1: | 229 | case 1: |
176 | Intent accontMintent = new Intent(); | 230 | Intent accontMintent = new Intent(); |
177 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 231 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
178 | startActivity(accontMintent); | 232 | startActivity(accontMintent); |
179 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 233 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
180 | break; | 234 | break; |
181 | } | 235 | } |
182 | } | 236 | } |
183 | }) | 237 | }) |
184 | .addMenuList(menuItems) | 238 | .addMenuList(menuItems) |
185 | .showAsDropDown(iv_setting, -250, 0); | 239 | .showAsDropDown(iv_setting, -250, 0); |
186 | break; | 240 | break; |
187 | case R.id.iv_sign: | 241 | case R.id.iv_sign: |
188 | new CircleDialog.Builder(this) | 242 | new CircleDialog.Builder(this) |
189 | .setCanceledOnTouchOutside(false) | 243 | .setCanceledOnTouchOutside(false) |
190 | .setCancelable(true) | 244 | .setCancelable(true) |
191 | .setTitle("个性签名") | 245 | .setTitle("个性签名") |
192 | .setInputHint("请输入个性签名") | 246 | .setInputHint("请输入个性签名") |
193 | .setWidth(0.5f) | 247 | .setWidth(0.5f) |
194 | .configInput(new ConfigInput() { | 248 | .configInput(new ConfigInput() { |
195 | @Override | 249 | @Override |
196 | public void onConfig(InputParams params) { | 250 | public void onConfig(InputParams params) { |
197 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 251 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
198 | } | 252 | } |
199 | }) | 253 | }) |
200 | .setNegative("取消", null) | 254 | .setNegative("取消", null) |
201 | .setPositiveInput("确定", new OnInputClickListener() { | 255 | .setPositiveInput("确定", new OnInputClickListener() { |
202 | @Override | 256 | @Override |
203 | public void onClick(String text, View v) { | 257 | public void onClick(String text, View v) { |
204 | if (text.equals("")) { | 258 | if (text.equals("")) { |
205 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 259 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
206 | } else { | 260 | } else { |
261 | HttpManager.getInstance().changsignature(MainActivity.this,688,text); | ||
207 | tv_sign.setText(text); | 262 | tv_sign.setText(text); |
208 | } | 263 | } |
209 | 264 | ||
210 | } | 265 | } |
211 | }) | 266 | }) |
212 | .show(); | 267 | .show(); |
213 | break; | 268 | break; |
214 | case R.id.linel_mycuoti: | 269 | case R.id.linel_mycuoti: |
215 | AlertUtils.showToast(this, "hhahahah "); | 270 | AlertUtils.showToast(this, "hhahahah "); |
216 | break; | 271 | break; |
217 | case R.id.linel_mynote: | 272 | case R.id.linel_mynote: |
218 | AlertUtils.showToast(this, "hhahahah "); | 273 | AlertUtils.showToast(this, "hhahahah "); |
219 | break; | 274 | break; |
220 | case R.id.linel_mycollege: | 275 | case R.id.linel_mycollege: |
221 | AlertUtils.showToast(this, "hhahahah "); | 276 | AlertUtils.showToast(this, "hhahahah "); |
222 | break; | 277 | break; |
223 | case R.id.linel_myclass: | 278 | case R.id.linel_myclass: |
224 | AlertUtils.showToast(this, "hhahahah "); | 279 | AlertUtils.showToast(this, "hhahahah "); |
225 | break; | 280 | break; |
226 | } | 281 | } |
227 | 282 | ||
228 | } | 283 | } |
229 | //回调头像监听 | 284 | //回调头像监听 |
230 | @Override | 285 | @Override |
231 | public void heard(Context context, View v) { | 286 | public void heard(Context context, View v) { |
232 | switch (v.getId()){ | 287 | switch (v.getId()){ |
233 | //选择默认图片 | 288 | //选择默认图片 |
234 | case R.id.oktakephone: | 289 | case R.id.oktakephone: |
235 | AlertUtils.showToast(this, "您选择了默认图片 "); | 290 | AlertUtils.showToast(this, "您选择了默认图片 "); |
236 | break; | 291 | break; |
237 | case R.id.canceltakephone: | 292 | case R.id.canceltakephone: |
238 | 293 | ||
239 | break; | 294 | break; |
240 | //拍摄和相册 | 295 | //拍摄和相册 |
241 | case R.id.take_pic: | 296 | case R.id.take_pic: |
242 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 297 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
243 | uploadAvatarFromPhotoRequest(); | 298 | uploadAvatarFromPhotoRequest(); |
244 | } | 299 | } |
245 | 300 | ||
246 | break; | 301 | break; |
247 | case R.id.xiangce: | 302 | case R.id.xiangce: |
248 | uploadAvatarFromAlbumRequest(); | 303 | uploadAvatarFromAlbumRequest(); |
249 | break; | 304 | break; |
250 | 305 | ||
251 | } | 306 | } |
252 | 307 | ||
253 | } | 308 | } |
254 | 309 | ||
255 | //照相 | 310 | //照相 |
256 | private void uploadAvatarFromPhotoRequest() { | 311 | private void uploadAvatarFromPhotoRequest() { |
257 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 312 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 313 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
259 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 314 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
260 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 315 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
261 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 316 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
262 | } | 317 | } |
263 | 318 | ||
264 | //选择图库 | 319 | //选择图库 |
265 | private void uploadAvatarFromAlbumRequest() { | 320 | private void uploadAvatarFromAlbumRequest() { |
266 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 321 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
267 | photoPickerIntent.setType("image/*"); | 322 | photoPickerIntent.setType("image/*"); |
268 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 323 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
269 | } | 324 | } |
270 | //回掉 | 325 | //回掉 |
271 | @Override | 326 | @Override |
272 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 327 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
273 | super.onActivityResult(requestCode, resultCode, data); | 328 | super.onActivityResult(requestCode, resultCode, data); |
274 | if (resultCode != -1) { | 329 | if (resultCode != -1) { |
275 | return; | 330 | return; |
276 | } | 331 | } |
277 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 332 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
278 | Uri newUri; | 333 | Uri newUri; |
279 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 334 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
280 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 335 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
281 | } else { | 336 | } else { |
282 | newUri = data.getData(); | 337 | newUri = data.getData(); |
283 | } | 338 | } |
284 | if (newUri != null) { | 339 | if (newUri != null) { |
285 | startPhotoZoom(newUri); | 340 | startPhotoZoom(newUri); |
286 | } else { | 341 | } else { |
287 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 342 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
288 | } | 343 | } |
289 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 344 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
290 | startPhotoZoom(uri); | 345 | startPhotoZoom(uri); |
291 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 346 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
292 | uploadAvatarFromPhoto(); | 347 | uploadAvatarFromPhoto(); |
293 | } | 348 | } |
294 | } | 349 | } |
295 | 350 | ||
296 | private void uploadAvatarFromPhoto() { | 351 | private void uploadAvatarFromPhoto() { |
297 | compressAndUploadAvatar(file.getPath()); | 352 | compressAndUploadAvatar(file.getPath()); |
298 | 353 | ||
299 | } | 354 | } |
300 | private void compressAndUploadAvatar(String fileSrc) { | 355 | private void compressAndUploadAvatar(String fileSrc) { |
301 | 356 | ||
302 | 357 | ||
303 | //上传到服务器 | 358 | //上传到服务器 |
304 | 359 | ||
305 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 360 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
306 | String mimeType = "image/*"; | 361 | String mimeType = "image/*"; |
307 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 362 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
308 | //String fileName = cover.getName(); | 363 | //String fileName = cover.getName(); |
309 | //HttpManager.getInstance().header(this, fileSrc); | 364 | //HttpManager.getInstance().header(this, fileSrc); |
310 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 365 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
311 | //Fresco设置圆形头像 | 366 | //Fresco设置圆形头像 |
312 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 367 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
313 | GenericDraweeHierarchy hierarchy = builder | 368 | GenericDraweeHierarchy hierarchy = builder |
314 | .setDesiredAspectRatio(1f) | 369 | .setDesiredAspectRatio(1f) |
315 | .setFailureImage(R.mipmap.blank) | 370 | .setFailureImage(R.mipmap.blank) |
316 | //圆形头像 | 371 | //圆形头像 |
317 | .setRoundingParams(RoundingParams.asCircle()) | 372 | .setRoundingParams(RoundingParams.asCircle()) |
318 | .build(); | 373 | .build(); |
319 | 374 | ||
320 | //加载本地图片 | 375 | //加载本地图片 |
321 | Uri uri = Uri.fromFile(cover); | 376 | Uri uri = Uri.fromFile(cover); |
322 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 377 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
323 | .setOldController(mSimpleDraweeView.getController()) | 378 | .setOldController(mSimpleDraweeView.getController()) |
324 | .setUri(uri) | 379 | .setUri(uri) |
325 | .build(); | 380 | .build(); |
326 | mSimpleDraweeView.setHierarchy(hierarchy); | 381 | mSimpleDraweeView.setHierarchy(hierarchy); |
327 | mSimpleDraweeView.setController(controller); | 382 | mSimpleDraweeView.setController(controller); |
328 | 383 | ||
329 | } | 384 | } |
330 | 385 | ||
331 | public void startPhotoZoom(Uri uri) { | 386 | public void startPhotoZoom(Uri uri) { |
332 | Intent intent = new Intent("com.android.camera.action.CROP"); | 387 | Intent intent = new Intent("com.android.camera.action.CROP"); |
333 | intent.setDataAndType(uri, "image/*"); | 388 | intent.setDataAndType(uri, "image/*"); |
334 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 389 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
335 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 390 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
336 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 391 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
337 | intent.putExtra("aspectY", 1);// x:y=1:1 | 392 | intent.putExtra("aspectY", 1);// x:y=1:1 |
338 | // intent.putExtra("outputX", 400);//图片输出大小 | 393 | // intent.putExtra("outputX", 400);//图片输出大小 |
339 | // intent.putExtra("outputY", 400); | 394 | // intent.putExtra("outputY", 400); |
340 | intent.putExtra("output", Uri.fromFile(file)); | 395 | intent.putExtra("output", Uri.fromFile(file)); |
341 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 396 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
342 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 397 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
343 | } | 398 | } |
344 | 399 | ||
345 | @Override | 400 | @Override |
346 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 401 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
347 | switch (requestCode) { | 402 | switch (requestCode) { |
348 | 403 | ||
349 | case PermissionUtil.REQUEST_SHOWCAMERA: | 404 | case PermissionUtil.REQUEST_SHOWCAMERA: |
350 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 405 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
351 | // Permission Granted | 406 | // Permission Granted |
352 | uploadAvatarFromPhotoRequest(); | 407 | uploadAvatarFromPhotoRequest(); |
353 | 408 | ||
354 | } else { | 409 | } else { |
355 | if (!SharedPreferenceMark.getHasShowCamera()) { | 410 | if (!SharedPreferenceMark.getHasShowCamera()) { |
356 | SharedPreferenceMark.setHasShowCamera(true); | 411 | SharedPreferenceMark.setHasShowCamera(true); |
357 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 412 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
358 | 413 | ||
359 | } else { | 414 | } else { |
360 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 415 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
361 | .show(); | 416 | .show(); |
362 | } | 417 | } |
363 | } | 418 | } |
364 | break; | 419 | break; |
365 | default: | 420 | default: |
366 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 421 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
367 | } | 422 | } |
368 | } | 423 | } |
369 | } | 424 | } |
370 | 425 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.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.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.AdapterView; | ||
10 | import android.widget.Button; | 9 | import android.widget.Button; |
11 | import android.widget.EditText; | 10 | import android.widget.EditText; |
12 | import android.widget.TextView; | 11 | import android.widget.TextView; |
13 | 12 | ||
14 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
16 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
17 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
19 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
20 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 21 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 22 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.GradeInfo; | 23 | import com.hjx.personalcenter.model.GradeInfo; |
25 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
26 | import com.hjx.personalcenter.model.SchoolInfo; | 25 | import com.hjx.personalcenter.model.SchoolInfo; |
27 | import com.hjx.personalcenter.util.AlertUtils; | 26 | import com.hjx.personalcenter.util.AlertUtils; |
28 | 27 | ||
29 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
30 | 29 | ||
31 | /**填写注册信息 熊巍 | 30 | /**填写注册信息 熊巍 |
32 | * Created by h on 2017/8/9. | 31 | * Created by h on 2017/8/9. |
33 | */ | 32 | */ |
34 | 33 | ||
35 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack | 34 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack |
36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ | 35 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ |
37 | private EditText et_username; | 36 | private EditText et_username; |
38 | private TextView et_region,et_grade,et_school; | 37 | private TextView et_region,et_grade,et_school; |
39 | private Button btn_ok; | 38 | private Button btn_ok; |
40 | 39 | ||
41 | @Override | 40 | @Override |
42 | protected void onCreate(Bundle savedInstanceState) { | 41 | protected void onCreate(Bundle savedInstanceState) { |
43 | super.onCreate(savedInstanceState); | 42 | super.onCreate(savedInstanceState); |
44 | setContentView(R.layout.activity_registerinfo); | 43 | setContentView(R.layout.activity_registerinfo); |
45 | initView(); | 44 | initView(); |
46 | initData(); | 45 | initData(); |
47 | initLister(); | 46 | initLister(); |
48 | } | 47 | } |
49 | 48 | ||
50 | private void initView() { | 49 | private void initView() { |
51 | et_username = (EditText) findViewById(R.id.et_username); | 50 | et_username = (EditText) findViewById(R.id.et_username); |
52 | et_region = (TextView) findViewById(R.id.et_region); | 51 | et_region = (TextView) findViewById(R.id.et_region); |
53 | et_grade = (TextView) findViewById(R.id.et_grade); | 52 | et_grade = (TextView) findViewById(R.id.et_grade); |
54 | et_school = (TextView) findViewById(R.id.et_school); | 53 | et_school = (TextView) findViewById(R.id.et_school); |
55 | btn_ok = (Button) findViewById(R.id.btn_ok); | 54 | btn_ok = (Button) findViewById(R.id.btn_ok); |
56 | 55 | ||
57 | 56 | ||
58 | } | 57 | } |
59 | 58 | ||
60 | private void initData() { | 59 | private void initData() { |
61 | 60 | ||
62 | } | 61 | } |
63 | 62 | ||
64 | private void initLister() { | 63 | private void initLister() { |
65 | et_region.setOnClickListener(this); | 64 | et_region.setOnClickListener(this); |
66 | et_grade.setOnClickListener(this); | 65 | et_grade.setOnClickListener(this); |
67 | et_school.setOnClickListener(this); | 66 | et_school.setOnClickListener(this); |
68 | btn_ok.setOnClickListener(this); | 67 | btn_ok.setOnClickListener(this); |
69 | 68 | ||
70 | 69 | ||
71 | } | 70 | } |
72 | 71 | ||
73 | @Override | 72 | @Override |
74 | public void onClick(View v) { | 73 | public void onClick(View v) { |
75 | String register1 = et_username.getText().toString().trim(); | 74 | String register1 = et_username.getText().toString().trim(); |
76 | String register2 = et_region.getText().toString().trim(); | 75 | String register2 = et_region.getText().toString().trim(); |
77 | String register3 = et_grade.getText().toString().trim(); | 76 | String register3 = et_grade.getText().toString().trim(); |
78 | String register4 = et_school.getText().toString().trim(); | 77 | String register4 = et_school.getText().toString().trim(); |
79 | switch (v.getId()){ | 78 | switch (v.getId()){ |
80 | case R.id.et_region: | 79 | case R.id.et_region: |
81 | choiseregion(); | 80 | choiseregion(); |
82 | break; | 81 | break; |
83 | case R.id.et_grade: | 82 | case R.id.et_grade: |
84 | choisegrade(); | 83 | choisegrade(); |
85 | break; | 84 | break; |
86 | case R.id.et_school: | 85 | case R.id.et_school: |
87 | // if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 86 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
88 | // AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 87 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
89 | // return; | 88 | return; |
90 | // }else { | 89 | }else { |
91 | choiseschool(); | 90 | choiseschool(); |
92 | // } | 91 | } |
93 | 92 | ||
94 | break; | 93 | break; |
95 | case R.id.btn_ok: | 94 | case R.id.btn_ok: |
96 | if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || | 95 | if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || |
97 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 96 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
98 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 97 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
99 | return; | 98 | return; |
100 | }else{ | 99 | }else{ |
100 | saveinfo(); | ||
101 | Intent intent = new Intent(); | 101 | Intent intent = new Intent(); |
102 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); | 102 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); |
103 | startActivity(intent); | 103 | startActivity(intent); |
104 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 104 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
105 | } | 105 | } |
106 | 106 | ||
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | 109 | ||
110 | } | 110 | } |
111 | //保存个人信息 | ||
112 | private void saveinfo() { | ||
113 | String register1 = et_username.getText().toString().trim(); | ||
114 | String register2 = et_region.getText().toString().trim(); | ||
115 | String register3 = et_grade.getText().toString().trim(); | ||
116 | String register4 = et_school.getText().toString().trim(); | ||
117 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); | ||
118 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); | ||
119 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); | ||
120 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); | ||
121 | |||
122 | } | ||
111 | 123 | ||
112 | //选择地区 | 124 | //选择地区 |
113 | private void choiseregion() { | 125 | private void choiseregion() { |
114 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 126 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
115 | 127 | ||
116 | } | 128 | } |
117 | //选择年级 | 129 | //选择年级 |
118 | private void choisegrade() { | 130 | private void choisegrade() { |
119 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 131 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
120 | 132 | ||
121 | } | 133 | } |
122 | //选择学校 | 134 | //选择学校 |
123 | private void choiseschool() { | 135 | private void choiseschool() { |
124 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 136 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
125 | 137 | ||
126 | } | 138 | } |
127 | 139 | ||
128 | 140 | ||
129 | @Override | 141 | @Override |
130 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 142 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
131 | String regionName = data.get(position).getRegionName(); | 143 | String regionName = data.get(position).getRegionName(); |
132 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 144 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
133 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 145 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
134 | 146 | ||
135 | 147 | ||
136 | } | 148 | } |
137 | @Override | 149 | @Override |
138 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 150 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
139 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 151 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
140 | finish(); | 152 | finish(); |
141 | 153 | ||
142 | } | 154 | } |
143 | return super.onKeyUp(keyCode, event); | 155 | return super.onKeyUp(keyCode, event); |
144 | } | 156 | } |
145 | 157 | ||
146 | @Override | 158 | @Override |
147 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 159 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
148 | String regionName = data.get(position).getName(); | 160 | String regionName = data.get(position).getName(); |
149 | et_grade.setText(regionName); | 161 | et_grade.setText(regionName); |
150 | 162 | ||
151 | } | 163 | } |
152 | 164 | ||
153 | @Override | 165 | @Override |
154 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 166 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
155 | String regionName = data.get(position).getRegionName(); | 167 | String regionName = data.get(position).getRegionName(); |
156 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 168 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
157 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 169 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
158 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 170 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
159 | et_region.setText(""); | 171 | et_region.setText(""); |
160 | et_region.setText(provice+regionName); | 172 | et_region.setText(provice+regionName); |
161 | 173 | ||
162 | } | 174 | } |
163 | 175 | ||
164 | @Override | 176 | @Override |
165 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 177 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
166 | String regionName = data.get(position).getRegionName(); | 178 | String regionName = data.get(position).getRegionName(); |
167 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 179 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
168 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 180 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
169 | et_region.setText(""); | 181 | et_region.setText(""); |
170 | et_region.setText(provices+citys+regionName); | 182 | et_region.setText(provices+citys+regionName); |
171 | 183 | ||
172 | } | 184 | } |
173 | 185 | ||
174 | @Override | 186 | @Override |
175 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 187 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
176 | String regionName = data.get(position).getSchoolName(); | 188 | String regionName = data.get(position).getSchoolName(); |
177 | et_school.setText(regionName); | 189 | et_school.setText(regionName); |
178 | 190 | ||
179 | } | 191 | } |
180 | } | 192 | } |
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.os.Handler; | 6 | import android.os.Handler; |
7 | import android.os.Message; | 7 | import android.os.Message; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.ImageView; | ||
13 | import android.widget.ListView; | 14 | import android.widget.ListView; |
14 | 15 | ||
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.CitysAdapter; | 17 | import com.hjx.personalcenter.adapter.CitysAdapter; |
17 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
21 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
22 | import com.mylhyl.circledialog.BaseCircleDialog; | 23 | import com.mylhyl.circledialog.BaseCircleDialog; |
23 | import com.mylhyl.circledialog.res.values.CircleDimen; | 24 | import com.mylhyl.circledialog.res.values.CircleDimen; |
24 | 25 | ||
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
26 | import java.util.List; | 27 | import java.util.List; |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * 自定义市级列表对话框 | 30 | * 自定义市级列表对话框 |
30 | * Created by h on 2017/8/10. | 31 | * Created by h on 2017/8/10. |
31 | */ | 32 | */ |
32 | 33 | ||
33 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 34 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
34 | private CitysAdapter listadapter; | 35 | private CitysAdapter listadapter; |
35 | private ListView listView; | 36 | private ListView listView; |
37 | private ImageView cance; | ||
36 | private DialogCallBack.CitysCallBack mCallBack; | 38 | private DialogCallBack.CitysCallBack mCallBack; |
37 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); | 39 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); |
38 | public CitysListDialog(DialogCallBack.CitysCallBack callBack) { | 40 | public CitysListDialog(DialogCallBack.CitysCallBack callBack) { |
39 | this.mCallBack = callBack; | 41 | this.mCallBack = callBack; |
40 | } | 42 | } |
41 | public static CitysListDialog getInstance(DialogCallBack.CitysCallBack callBack) { | 43 | public static CitysListDialog getInstance(DialogCallBack.CitysCallBack callBack) { |
42 | CitysListDialog dialogFragment = new CitysListDialog(callBack); | 44 | CitysListDialog dialogFragment = new CitysListDialog(callBack); |
43 | dialogFragment.setCanceledBack(true); | 45 | dialogFragment.setCanceledBack(true); |
44 | dialogFragment.setCanceledOnTouchOutside(true); | 46 | dialogFragment.setCanceledOnTouchOutside(false); |
45 | dialogFragment.setRadius(CircleDimen.RADIUS); | 47 | dialogFragment.setRadius(CircleDimen.RADIUS); |
46 | dialogFragment.setWidth(0.5f); | 48 | dialogFragment.setWidth(0.5f); |
47 | dialogFragment.setGravity(Gravity.CENTER); | 49 | dialogFragment.setGravity(Gravity.CENTER); |
48 | dialogFragment.setBackgroundColor(Color.WHITE); | 50 | dialogFragment.setBackgroundColor(Color.WHITE); |
49 | return dialogFragment; | 51 | return dialogFragment; |
50 | } | 52 | } |
51 | Handler handler = new Handler(){ | 53 | Handler handler = new Handler(){ |
52 | @Override | 54 | @Override |
53 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
54 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
55 | switch (msg.what){ | 57 | switch (msg.what){ |
56 | case HttpCode.CITYS: | 58 | case HttpCode.CITYS: |
57 | data.clear(); | 59 | data.clear(); |
58 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); | 60 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); |
59 | listadapter.notifyDataSetChanged(); | 61 | listadapter.notifyDataSetChanged(); |
60 | break; | 62 | break; |
61 | } | 63 | } |
62 | } | 64 | } |
63 | }; | 65 | }; |
64 | 66 | ||
65 | @Override | 67 | @Override |
66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 68 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
67 | return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); | 69 | return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); |
68 | } | 70 | } |
69 | 71 | ||
70 | @Override | 72 | @Override |
71 | public void onActivityCreated(Bundle savedInstanceState) { | 73 | public void onActivityCreated(Bundle savedInstanceState) { |
72 | super.onActivityCreated(savedInstanceState); | 74 | super.onActivityCreated(savedInstanceState); |
73 | listView = (ListView) getView().findViewById(R.id.listadapter); | 75 | listView = (ListView) getView().findViewById(R.id.listadapter); |
76 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
74 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); | 77 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); |
75 | listadapter = new CitysAdapter(data,getActivity()); | 78 | listadapter = new CitysAdapter(data,getActivity()); |
76 | listView.setAdapter(listadapter); | 79 | listView.setAdapter(listadapter); |
77 | listView.setOnItemClickListener(this); | 80 | listView.setOnItemClickListener(this); |
81 | cance.setOnClickListener(new View.OnClickListener() { | ||
82 | @Override | ||
83 | public void onClick(View v) { | ||
84 | dismiss(); | ||
85 | } | ||
86 | }); | ||
78 | try { | 87 | try { |
79 | long a = Long.parseLong(citys); | 88 | long a = Long.parseLong(citys); |
80 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); | 89 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); |
81 | } catch (NumberFormatException e) { | 90 | } catch (NumberFormatException e) { |
82 | e.printStackTrace(); | 91 | e.printStackTrace(); |
83 | } | 92 | } |
84 | 93 | ||
85 | 94 | ||
86 | } | 95 | } |
87 | 96 | ||
88 | @Override | 97 | @Override |
89 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 98 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
90 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); | 99 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); |
91 | mCallBack.province1OnItemClick(data,position,2); | 100 | mCallBack.province1OnItemClick(data,position,2); |
92 | dismiss(); | 101 | dismiss(); |
93 | 102 | ||
94 | } | 103 | } |
95 | } | 104 | } |
96 | 105 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.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.os.Handler; | 6 | import android.os.Handler; |
7 | import android.os.Message; | 7 | import android.os.Message; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.ImageView; | ||
13 | import android.widget.ListView; | 14 | import android.widget.ListView; |
14 | 15 | ||
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.CountryAdapter; | 17 | import com.hjx.personalcenter.adapter.CountryAdapter; |
17 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
21 | import com.hjx.personalcenter.model.CountyInfo; | 22 | import com.hjx.personalcenter.model.CountyInfo; |
22 | import com.mylhyl.circledialog.BaseCircleDialog; | 23 | import com.mylhyl.circledialog.BaseCircleDialog; |
23 | import com.mylhyl.circledialog.res.values.CircleDimen; | 24 | import com.mylhyl.circledialog.res.values.CircleDimen; |
24 | 25 | ||
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
26 | import java.util.List; | 27 | import java.util.List; |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * Created by wei on 2017/8/21. | 30 | * Created by wei on 2017/8/21. |
30 | */ | 31 | */ |
31 | 32 | ||
32 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 33 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
33 | private CountryAdapter listadapter; | 34 | private CountryAdapter listadapter; |
34 | private ListView listView; | 35 | private ListView listView; |
36 | private ImageView cance; | ||
35 | private DialogCallBack.CountryCallBack mCallBack; | 37 | private DialogCallBack.CountryCallBack mCallBack; |
36 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); | 38 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); |
37 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { | 39 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { |
38 | this.mCallBack = callBack; | 40 | this.mCallBack = callBack; |
39 | } | 41 | } |
40 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { | 42 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { |
41 | CountryDialog dialogFragment = new CountryDialog(callBack); | 43 | CountryDialog dialogFragment = new CountryDialog(callBack); |
42 | dialogFragment.setCanceledBack(true); | 44 | dialogFragment.setCanceledBack(true); |
43 | dialogFragment.setCanceledOnTouchOutside(true); | 45 | dialogFragment.setCanceledOnTouchOutside(true); |
44 | dialogFragment.setRadius(CircleDimen.RADIUS); | 46 | dialogFragment.setRadius(CircleDimen.RADIUS); |
45 | dialogFragment.setWidth(0.5f); | 47 | dialogFragment.setWidth(0.5f); |
46 | dialogFragment.setGravity(Gravity.CENTER); | 48 | dialogFragment.setGravity(Gravity.CENTER); |
47 | dialogFragment.setBackgroundColor(Color.WHITE); | 49 | dialogFragment.setBackgroundColor(Color.WHITE); |
48 | return dialogFragment; | 50 | return dialogFragment; |
49 | } | 51 | } |
50 | Handler handler = new Handler(){ | 52 | Handler handler = new Handler(){ |
51 | @Override | 53 | @Override |
52 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
53 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
54 | switch (msg.what){ | 56 | switch (msg.what){ |
55 | case HttpCode.COUNTRY: | 57 | case HttpCode.COUNTRY: |
56 | 58 | ||
57 | data.clear(); | 59 | data.clear(); |
58 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); | 60 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); |
59 | listadapter.notifyDataSetChanged(); | 61 | listadapter.notifyDataSetChanged(); |
60 | break; | 62 | break; |
61 | } | 63 | } |
62 | } | 64 | } |
63 | }; | 65 | }; |
64 | 66 | ||
65 | @Override | 67 | @Override |
66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 68 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
67 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); | 69 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); |
68 | } | 70 | } |
69 | 71 | ||
70 | @Override | 72 | @Override |
71 | public void onActivityCreated(Bundle savedInstanceState) { | 73 | public void onActivityCreated(Bundle savedInstanceState) { |
72 | super.onActivityCreated(savedInstanceState); | 74 | super.onActivityCreated(savedInstanceState); |
73 | listView = (ListView) getView().findViewById(R.id.listadapter); | 75 | listView = (ListView) getView().findViewById(R.id.listadapter); |
76 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
74 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 77 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
75 | listadapter = new CountryAdapter(data,getActivity()); | 78 | listadapter = new CountryAdapter(data,getActivity()); |
76 | listView.setAdapter(listadapter); | 79 | listView.setAdapter(listadapter); |
77 | listView.setOnItemClickListener(this); | 80 | listView.setOnItemClickListener(this); |
81 | cance.setOnClickListener(new View.OnClickListener() { | ||
82 | @Override | ||
83 | public void onClick(View v) { | ||
84 | dismiss(); | ||
85 | } | ||
86 | }); | ||
78 | try { | 87 | try { |
79 | int a = Integer.parseInt(citys); | 88 | int a = Integer.parseInt(citys); |
80 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); | 89 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); |
81 | } catch (NumberFormatException e) { | 90 | } catch (NumberFormatException e) { |
82 | e.printStackTrace(); | 91 | e.printStackTrace(); |
83 | } | 92 | } |
84 | 93 | ||
85 | 94 | ||
86 | } | 95 | } |
87 | 96 | ||
88 | @Override | 97 | @Override |
89 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 98 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
90 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); | 99 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.COUNTRY, ""+data.get(position).getRegionId()); |
91 | mCallBack.province2OnItemClick(data,position,3); | 100 | mCallBack.province2OnItemClick(data,position,3); |
92 | dismiss(); | 101 | dismiss(); |
93 | 102 | ||
94 | } | 103 | } |
95 | } | 104 | } |
96 | 105 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.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.os.Handler; | 6 | import android.os.Handler; |
7 | import android.os.Message; | 7 | import android.os.Message; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.ImageView; | ||
13 | import android.widget.ListView; | 14 | import android.widget.ListView; |
14 | 15 | ||
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.GrandeAdapter; | 17 | import com.hjx.personalcenter.adapter.GrandeAdapter; |
17 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
21 | import com.hjx.personalcenter.model.GradeInfo; | 22 | import com.hjx.personalcenter.model.GradeInfo; |
22 | import com.mylhyl.circledialog.BaseCircleDialog; | 23 | import com.mylhyl.circledialog.BaseCircleDialog; |
23 | import com.mylhyl.circledialog.res.values.CircleDimen; | 24 | import com.mylhyl.circledialog.res.values.CircleDimen; |
24 | 25 | ||
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
26 | import java.util.List; | 27 | import java.util.List; |
27 | 28 | ||
28 | /**自定义年级列表对话框 | 29 | /**自定义年级列表对话框 |
29 | * Created by h on 2017/8/10. | 30 | * Created by h on 2017/8/10. |
30 | */ | 31 | */ |
31 | 32 | ||
32 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 33 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
33 | private GrandeAdapter listadapter; | 34 | private GrandeAdapter listadapter; |
34 | private ListView listView; | 35 | private ListView listView; |
36 | private ImageView cance; | ||
35 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); | 37 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); |
36 | private DialogCallBack.GradeCallBack mCallBack; | 38 | private DialogCallBack.GradeCallBack mCallBack; |
37 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { | 39 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { |
38 | this.mCallBack = callBack; | 40 | this.mCallBack = callBack; |
39 | } | 41 | } |
40 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { | 42 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { |
41 | GradeListDialog dialogFragment = new GradeListDialog(callBack); | 43 | GradeListDialog dialogFragment = new GradeListDialog(callBack); |
42 | dialogFragment.setCanceledBack(true); | 44 | dialogFragment.setCanceledBack(true); |
43 | dialogFragment.setCanceledOnTouchOutside(true); | 45 | dialogFragment.setCanceledOnTouchOutside(true); |
44 | dialogFragment.setRadius(CircleDimen.RADIUS); | 46 | dialogFragment.setRadius(CircleDimen.RADIUS); |
45 | dialogFragment.setWidth(0.5f); | 47 | dialogFragment.setWidth(0.5f); |
46 | dialogFragment.setGravity(Gravity.CENTER); | 48 | dialogFragment.setGravity(Gravity.CENTER); |
47 | dialogFragment.setBackgroundColor(Color.WHITE); | 49 | dialogFragment.setBackgroundColor(Color.WHITE); |
48 | return dialogFragment; | 50 | return dialogFragment; |
49 | } | 51 | } |
50 | Handler handler = new Handler(){ | 52 | Handler handler = new Handler(){ |
51 | @Override | 53 | @Override |
52 | public void handleMessage(Message msg) { | 54 | public void handleMessage(Message msg) { |
53 | super.handleMessage(msg); | 55 | super.handleMessage(msg); |
54 | switch (msg.what){ | 56 | switch (msg.what){ |
55 | case HttpCode.GRADER: | 57 | case HttpCode.GRADER: |
56 | data.clear(); | 58 | data.clear(); |
57 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); | 59 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); |
58 | listadapter.notifyDataSetChanged(); | 60 | listadapter.notifyDataSetChanged(); |
59 | break; | 61 | break; |
60 | } | 62 | } |
61 | } | 63 | } |
62 | }; | 64 | }; |
63 | @Override | 65 | @Override |
64 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 66 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
65 | 67 | ||
66 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); | 68 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); |
67 | } | 69 | } |
68 | @Override | 70 | @Override |
69 | public void onActivityCreated(Bundle savedInstanceState) { | 71 | public void onActivityCreated(Bundle savedInstanceState) { |
70 | super.onActivityCreated(savedInstanceState); | 72 | super.onActivityCreated(savedInstanceState); |
71 | listView = (ListView) getView().findViewById(R.id.listadapter); | 73 | listView = (ListView) getView().findViewById(R.id.listadapter); |
74 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
72 | listadapter = new GrandeAdapter(data,getActivity()); | 75 | listadapter = new GrandeAdapter(data,getActivity()); |
73 | listView.setAdapter(listadapter); | 76 | listView.setAdapter(listadapter); |
74 | listView.setOnItemClickListener(this); | 77 | listView.setOnItemClickListener(this); |
78 | cance.setOnClickListener(new View.OnClickListener() { | ||
79 | @Override | ||
80 | public void onClick(View v) { | ||
81 | dismiss(); | ||
82 | } | ||
83 | }); | ||
75 | HttpManager.getInstance().getgrade(getActivity(),handler); | 84 | HttpManager.getInstance().getgrade(getActivity(),handler); |
76 | 85 | ||
77 | } | 86 | } |
78 | 87 | ||
79 | @Override | 88 | @Override |
80 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 89 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
81 | 90 | ||
82 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); | 91 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); |
83 | mCallBack.province3OnItemClick(data,position,5); | 92 | mCallBack.province3OnItemClick(data,position,5); |
84 | dismiss(); | 93 | dismiss(); |
85 | 94 | ||
86 | 95 | ||
87 | } | 96 | } |
88 | } | 97 | } |
89 | 98 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ProvinceListDialog.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.os.Handler; | 6 | import android.os.Handler; |
7 | import android.os.Message; | 7 | import android.os.Message; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.ImageView; | ||
13 | import android.widget.ListView; | 14 | import android.widget.ListView; |
14 | 15 | ||
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.adapter.ProvincesAdapter; | 17 | import com.hjx.personalcenter.adapter.ProvincesAdapter; |
17 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
21 | import com.hjx.personalcenter.model.ProvinceInfo; | 22 | import com.hjx.personalcenter.model.ProvinceInfo; |
22 | import com.mylhyl.circledialog.BaseCircleDialog; | 23 | import com.mylhyl.circledialog.BaseCircleDialog; |
23 | import com.mylhyl.circledialog.res.values.CircleDimen; | 24 | import com.mylhyl.circledialog.res.values.CircleDimen; |
24 | 25 | ||
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
26 | import java.util.List; | 27 | import java.util.List; |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * 自定义年级列表对话框 | 30 | * 自定义年级列表对话框 |
30 | * Created by h on 2017/8/10. | 31 | * Created by h on 2017/8/10. |
31 | */ | 32 | */ |
32 | 33 | ||
33 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 34 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
34 | private ProvincesAdapter listadapter; | 35 | private ProvincesAdapter listadapter; |
36 | private ImageView cance; | ||
35 | private ListView listView; | 37 | private ListView listView; |
36 | private ArrayList<ProvinceInfo.ProvincesBean> data = new ArrayList<>(); | 38 | private ArrayList<ProvinceInfo.ProvincesBean> data = new ArrayList<>(); |
37 | 39 | ||
38 | private DialogCallBack.ProvincesCallBack mCallBack; | 40 | private DialogCallBack.ProvincesCallBack mCallBack; |
39 | 41 | ||
40 | Handler handler = new Handler(){ | 42 | Handler handler = new Handler(){ |
41 | @Override | 43 | @Override |
42 | public void handleMessage(Message msg) { | 44 | public void handleMessage(Message msg) { |
43 | super.handleMessage(msg); | 45 | super.handleMessage(msg); |
44 | switch (msg.what){ | 46 | switch (msg.what){ |
45 | case HttpCode.PROVICES: | 47 | case HttpCode.PROVICES: |
46 | data.clear(); | 48 | data.clear(); |
47 | data.addAll( (List<ProvinceInfo.ProvincesBean>)msg.obj); | 49 | data.addAll( (List<ProvinceInfo.ProvincesBean>)msg.obj); |
48 | listadapter.notifyDataSetChanged(); | 50 | listadapter.notifyDataSetChanged(); |
49 | 51 | ||
50 | break; | 52 | break; |
51 | } | 53 | } |
52 | } | 54 | } |
53 | }; | 55 | }; |
54 | public ProvinceListDialog(DialogCallBack.ProvincesCallBack callBack) { | 56 | public ProvinceListDialog(DialogCallBack.ProvincesCallBack callBack) { |
55 | this.mCallBack = callBack; | 57 | this.mCallBack = callBack; |
56 | } | 58 | } |
57 | 59 | ||
58 | public static ProvinceListDialog getInstance(DialogCallBack.ProvincesCallBack callBack) { | 60 | public static ProvinceListDialog getInstance(DialogCallBack.ProvincesCallBack callBack) { |
59 | ProvinceListDialog dialogFragment = new ProvinceListDialog(callBack); | 61 | ProvinceListDialog dialogFragment = new ProvinceListDialog(callBack); |
60 | dialogFragment.setCanceledBack(true); | 62 | dialogFragment.setCanceledBack(true); |
61 | dialogFragment.setCanceledOnTouchOutside(true); | 63 | dialogFragment.setCanceledOnTouchOutside(true); |
62 | dialogFragment.setRadius(CircleDimen.RADIUS); | 64 | dialogFragment.setRadius(CircleDimen.RADIUS); |
63 | dialogFragment.setWidth(0.5f); | 65 | dialogFragment.setWidth(0.5f); |
64 | dialogFragment.setGravity(Gravity.CENTER); | 66 | dialogFragment.setGravity(Gravity.CENTER); |
65 | dialogFragment.setBackgroundColor(Color.WHITE); | 67 | dialogFragment.setBackgroundColor(Color.WHITE); |
66 | return dialogFragment; | 68 | return dialogFragment; |
67 | } | 69 | } |
68 | 70 | ||
69 | @Override | 71 | @Override |
70 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 72 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
71 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | 73 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); |
72 | } | 74 | } |
73 | 75 | ||
74 | @Override | 76 | @Override |
75 | public void onActivityCreated(Bundle savedInstanceState) { | 77 | public void onActivityCreated(Bundle savedInstanceState) { |
76 | super.onActivityCreated(savedInstanceState); | 78 | super.onActivityCreated(savedInstanceState); |
77 | listView = (ListView) getView().findViewById(R.id.listadapter); | 79 | listView = (ListView) getView().findViewById(R.id.listadapter); |
80 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
78 | listadapter = new ProvincesAdapter(data,getActivity()); | 81 | listadapter = new ProvincesAdapter(data,getActivity()); |
79 | listView.setAdapter(listadapter); | 82 | listView.setAdapter(listadapter); |
80 | listView.setOnItemClickListener(this); | 83 | listView.setOnItemClickListener(this); |
84 | cance.setOnClickListener(new View.OnClickListener() { | ||
85 | @Override | ||
86 | public void onClick(View v) { | ||
87 | dismiss(); | ||
88 | } | ||
89 | }); | ||
81 | HttpManager.getInstance().provices(getActivity(),handler); | 90 | HttpManager.getInstance().provices(getActivity(),handler); |
82 | 91 | ||
83 | } | 92 | } |
84 | 93 | ||
85 | @Override | 94 | @Override |
86 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 95 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
87 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); | 96 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); |
88 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); | 97 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.PROVINCES, ""+data.get(position).getRegionId()); |
89 | mCallBack.provinceOnItemClick(data,position,1); | 98 | mCallBack.provinceOnItemClick(data,position,1); |
90 | dismiss(); | 99 | dismiss(); |
91 | 100 | ||
92 | } | 101 | } |
93 | } | 102 | } |
94 | 103 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.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.os.Handler; | 6 | import android.os.Handler; |
7 | import android.os.Message; | 7 | import android.os.Message; |
8 | import android.text.Editable; | 8 | import android.text.Editable; |
9 | import android.text.TextWatcher; | 9 | import android.text.TextWatcher; |
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
12 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
15 | import android.widget.EditText; | 15 | import android.widget.EditText; |
16 | import android.widget.ImageView; | ||
16 | import android.widget.ListView; | 17 | import android.widget.ListView; |
17 | 18 | ||
18 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.adapter.SchoolAdapter; | 20 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
20 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 24 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
24 | import com.hjx.personalcenter.model.SchoolInfo; | 25 | import com.hjx.personalcenter.model.SchoolInfo; |
25 | import com.mylhyl.circledialog.BaseCircleDialog; | 26 | import com.mylhyl.circledialog.BaseCircleDialog; |
26 | import com.mylhyl.circledialog.res.values.CircleDimen; | 27 | import com.mylhyl.circledialog.res.values.CircleDimen; |
27 | 28 | ||
28 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
29 | import java.util.List; | 30 | import java.util.List; |
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Created by h on 2017/8/21. | 33 | * Created by h on 2017/8/21. |
33 | */ | 34 | */ |
34 | 35 | ||
35 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 36 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
36 | private ListView school_list; | 37 | private ListView school_list; |
37 | private EditText school_sech; | 38 | private EditText school_sech; |
38 | private SchoolAdapter listadapter; | 39 | private SchoolAdapter listadapter; |
40 | private ImageView cance; | ||
39 | private View mView; | 41 | private View mView; |
40 | boolean isFilter; | 42 | boolean isFilter; |
41 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); | 43 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
42 | private DialogCallBack.SchoolCallBack mCallBack; | 44 | private DialogCallBack.SchoolCallBack mCallBack; |
43 | 45 | ||
44 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { | 46 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
45 | // this.mCallBack = callBack; | 47 | // this.mCallBack = callBack; |
46 | // } | 48 | // } |
47 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { | 49 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { |
48 | this.mCallBack = callBack; | 50 | this.mCallBack = callBack; |
49 | } | 51 | } |
50 | 52 | ||
51 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { | 53 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { |
52 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); | 54 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); |
53 | dialogFragment.setCanceledBack(true); | 55 | dialogFragment.setCanceledBack(true); |
54 | dialogFragment.setCanceledOnTouchOutside(true); | 56 | dialogFragment.setCanceledOnTouchOutside(true); |
55 | dialogFragment.setRadius(CircleDimen.RADIUS); | 57 | dialogFragment.setRadius(CircleDimen.RADIUS); |
56 | dialogFragment.setWidth(0.5f); | 58 | dialogFragment.setWidth(0.5f); |
57 | dialogFragment.setGravity(Gravity.CENTER); | 59 | dialogFragment.setGravity(Gravity.CENTER); |
58 | dialogFragment.setBackgroundColor(Color.WHITE); | 60 | dialogFragment.setBackgroundColor(Color.WHITE); |
59 | return dialogFragment; | 61 | return dialogFragment; |
60 | } | 62 | } |
61 | 63 | ||
62 | Handler handler = new Handler(){ | 64 | Handler handler = new Handler(){ |
63 | @Override | 65 | @Override |
64 | public void handleMessage(Message msg) { | 66 | public void handleMessage(Message msg) { |
65 | super.handleMessage(msg); | 67 | super.handleMessage(msg); |
66 | switch (msg.what){ | 68 | switch (msg.what){ |
67 | case HttpCode.SCHOOL: | 69 | case HttpCode.SCHOOL: |
68 | data.clear(); | 70 | data.clear(); |
69 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); | 71 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); |
70 | listadapter.notifyDataSetChanged(); | 72 | listadapter.notifyDataSetChanged(); |
71 | break; | 73 | break; |
72 | } | 74 | } |
73 | } | 75 | } |
74 | }; | 76 | }; |
75 | 77 | ||
76 | 78 | ||
77 | @Override | 79 | @Override |
78 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 80 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
79 | 81 | ||
80 | if (mView == null) { | 82 | if (mView == null) { |
81 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); | 83 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); |
82 | //mCallBack.provinceOnItemClick(context, inflater, container); | 84 | //mCallBack.provinceOnItemClick(context, inflater, container); |
83 | } | 85 | } |
84 | return mView; | 86 | return mView; |
85 | } | 87 | } |
86 | 88 | ||
87 | @Override | 89 | @Override |
88 | public void onActivityCreated(Bundle savedInstanceState) { | 90 | public void onActivityCreated(Bundle savedInstanceState) { |
89 | super.onActivityCreated(savedInstanceState); | 91 | super.onActivityCreated(savedInstanceState); |
90 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); | 92 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
91 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); | 93 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
94 | cance = (ImageView) getView().findViewById(R.id.cancel); | ||
92 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 95 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
93 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 96 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
94 | listadapter = new SchoolAdapter(data, getActivity()); | 97 | listadapter = new SchoolAdapter(data, getActivity()); |
95 | school_list.setAdapter(listadapter); | 98 | school_list.setAdapter(listadapter); |
96 | school_list.setOnItemClickListener(this); | 99 | school_list.setOnItemClickListener(this); |
100 | cance.setOnClickListener(new View.OnClickListener() { | ||
101 | @Override | ||
102 | public void onClick(View v) { | ||
103 | dismiss(); | ||
104 | } | ||
105 | }); | ||
97 | try { | 106 | try { |
98 | int a = Integer.parseInt(citys); | 107 | int a = Integer.parseInt(citys); |
99 | int b = Integer.parseInt(grade); | 108 | int b = Integer.parseInt(grade); |
100 | HttpManager.getInstance().getschool(getActivity(),130102,14,handler); | 109 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); |
101 | } catch (NumberFormatException e) { | 110 | } catch (NumberFormatException e) { |
102 | e.printStackTrace(); | 111 | e.printStackTrace(); |
103 | } | 112 | } |
104 | intiEditView(); | 113 | intiEditView(); |
105 | 114 | ||
106 | 115 | ||
107 | } | 116 | } |
108 | private void intiEditView() { | 117 | private void intiEditView() { |
109 | school_sech.addTextChangedListener(new TextWatcher() { | 118 | school_sech.addTextChangedListener(new TextWatcher() { |
110 | @Override | 119 | @Override |
111 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 120 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
112 | 121 | ||
113 | } | 122 | } |
114 | 123 | ||
115 | @Override | 124 | @Override |
116 | public void onTextChanged(CharSequence s, int start, int before, int count) { | 125 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
117 | // mAdapter.getFilter().filter(s); | 126 | // mAdapter.getFilter().filter(s); |
118 | 127 | ||
119 | listadapter.getFilter().filter(s); | 128 | listadapter.getFilter().filter(s); |
120 | } | 129 | } |
121 | 130 | ||
122 | @Override | 131 | @Override |
123 | public void afterTextChanged(Editable s) { | 132 | public void afterTextChanged(Editable s) { |
124 | 133 | ||
125 | } | 134 | } |
126 | }); | 135 | }); |
127 | } | 136 | } |
128 | 137 | ||
129 | @Override | 138 | @Override |
130 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 139 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
140 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); | ||
131 | mCallBack.provinceO4nItemClick(data,position,4); | 141 | mCallBack.provinceO4nItemClick(data,position,4); |
132 | dismiss(); | 142 | dismiss(); |
133 | 143 | ||
134 | } | 144 | } |
135 | } | 145 | } |
136 | 146 |
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 | |||
17 | public static String GRADENS = "gradens";//年级id | ||
18 | public static String SCHOOOlID = "schoolid";//年级id | ||
16 | //个人信息 | 19 | //个人信息 |
17 | public static String GRADENS = "gradens";//年级 | 20 | public static String USERNAME = "username";//昵称 |
21 | public static String ADRESS = "adress";//地址 | ||
22 | public static String GRADES = "gadens";//年级 | ||
18 | public static String SCHOOL = "school";//学校 | 23 | public static String SCHOOL = "school";//学校 |
24 | public static String CONSTELLATION = "constellations";//星座 | ||
19 | 25 | ||
20 | //电子保卡信息 | 26 | //电子保卡信息 |
21 | public static String CARDPHONE = "cardphone";//保卡手机号 | 27 | public static String CARDPHONE = "cardphone";//保卡手机号 |
22 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 28 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
23 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 29 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
24 | public static String SHOPTIME = "shoptime";//购买时间 | 30 | public static String SHOPTIME = "shoptime";//购买时间 |
25 | public static String SHOPADRESS = "shopadress";//购买地址 | 31 | public static String SHOPADRESS = "shopadress";//购买地址 |
26 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 32 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
27 | 33 | ||
28 | //省市区参数、 | 34 | //省市区参数、 |
29 | public static String PROVINCES = "provinces";//省 | 35 | public static String PROVINCES = "provinces";//省 |
30 | public static String CITYS = "citys";//市 | 36 | public static String CITYS = "citys";//市 |
31 | public static String COUNTRY = "country";//区 | 37 | public static String COUNTRY = "country";//区 |
32 | 38 | ||
33 | 39 | ||
34 | public void saveLoginParam(Context context,String spname, String spstr) { | 40 | public void saveLoginParam(Context context,String spname, String spstr) { |
35 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 41 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
36 | Activity.MODE_PRIVATE); | 42 | Activity.MODE_PRIVATE); |
37 | 43 | ||
38 | sp.edit().putString(spname, spstr).commit(); | 44 | sp.edit().putString(spname, spstr).commit(); |
39 | } | 45 | } |
40 | 46 | ||
41 | 47 | ||
42 | public String getLoginParam(Context context,String spname) { | 48 | public String getLoginParam(Context context,String spname) { |
43 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 49 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
44 | Activity.MODE_PRIVATE); | 50 | Activity.MODE_PRIVATE); |
45 | String param = sp.getString(spname, null); | 51 | String param = sp.getString(spname, null); |
46 | return param; | 52 | return param; |
47 | } | 53 | } |
48 | public void clearData(Context context) { | 54 | public void clearData(Context context) { |
49 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 55 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
50 | Activity.MODE_PRIVATE); | 56 | Activity.MODE_PRIVATE); |
51 | sp.edit().clear().commit(); | 57 | sp.edit().clear().commit(); |
52 | } | 58 | } |
53 | 59 | ||
54 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 60 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
55 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 61 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
56 | Activity.MODE_PRIVATE); | 62 | Activity.MODE_PRIVATE); |
57 | 63 | ||
58 | sp.edit().putString(spname, spstr).commit(); | 64 | sp.edit().putString(spname, spstr).commit(); |
59 | 65 | ||
60 | } | 66 | } |
61 | 67 | ||
62 | public String getCustomizeParam(Context context,String spname) { | 68 | public String getCustomizeParam(Context context,String spname) { |
63 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 69 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
64 | Activity.MODE_PRIVATE); | 70 | Activity.MODE_PRIVATE); |
65 | String param = sp.getString(spname, null); | 71 | String param = sp.getString(spname, null); |
66 | return param; | 72 | return param; |
67 | } | 73 | } |
68 | 74 | ||
69 | public void clearCustomizeParam(Context context ){ | 75 | public void clearCustomizeParam(Context context ){ |
70 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 76 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
71 | Activity.MODE_PRIVATE); | 77 | Activity.MODE_PRIVATE); |
72 | sp.edit().clear().commit(); | 78 | sp.edit().clear().commit(); |
73 | } | 79 | } |
74 | } | 80 | } |
75 | 81 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
13 | import android.widget.EditText; | 13 | import android.widget.EditText; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | 15 | ||
16 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | ||
19 | import com.hjx.personalcenter.customdialog.CountryDialog; | ||
20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | ||
21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | ||
22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | ||
23 | import com.hjx.personalcenter.db.SaveParam; | ||
24 | import com.hjx.personalcenter.http.HttpManager; | ||
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | ||
26 | import com.hjx.personalcenter.model.ChangeInfo; | ||
27 | import com.hjx.personalcenter.model.CityInfo; | ||
28 | import com.hjx.personalcenter.model.CountyInfo; | ||
29 | import com.hjx.personalcenter.model.GradeInfo; | ||
30 | import com.hjx.personalcenter.model.ProvinceInfo; | ||
31 | import com.hjx.personalcenter.model.SchoolInfo; | ||
18 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
33 | import com.hjx.personalcenter.util.BrithdayStar; | ||
19 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
20 | import com.mylhyl.circledialog.callback.ConfigButton; | 35 | import com.mylhyl.circledialog.callback.ConfigButton; |
21 | import com.mylhyl.circledialog.callback.ConfigDialog; | 36 | import com.mylhyl.circledialog.callback.ConfigDialog; |
22 | import com.mylhyl.circledialog.params.ButtonParams; | 37 | import com.mylhyl.circledialog.params.ButtonParams; |
23 | import com.mylhyl.circledialog.params.DialogParams; | 38 | import com.mylhyl.circledialog.params.DialogParams; |
24 | 39 | ||
40 | import org.apache.http.util.TextUtils; | ||
41 | |||
42 | import java.io.UnsupportedEncodingException; | ||
25 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
44 | import java.util.ArrayList; | ||
26 | import java.util.Date; | 45 | import java.util.Date; |
27 | 46 | ||
28 | /** | 47 | /** |
29 | * Created by h on 2017/8/12. | 48 | * Created by h on 2017/8/12. |
30 | */ | 49 | */ |
31 | 50 | ||
32 | public class PresonInfoFragment extends Fragment implements View.OnClickListener { | 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | ||
33 | private View mView; | 53 | private View mView; |
34 | private int type; | 54 | private int type; |
35 | private TimePickerView pvTime; | 55 | private TimePickerView pvTime; |
36 | private EditText tv_username1,tv_useinfo_adress1,tv_useinfo_qq; | 56 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
37 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 57 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
38 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 58 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
39 | 59 | ||
40 | public static PresonInfoFragment newInstance(int type) { | 60 | public static PresonInfoFragment newInstance(int type) { |
41 | PresonInfoFragment fragment = new PresonInfoFragment(); | 61 | PresonInfoFragment fragment = new PresonInfoFragment(); |
42 | Bundle bundle = new Bundle(); | 62 | Bundle bundle = new Bundle(); |
43 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 63 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
44 | fragment.setArguments(bundle); | 64 | fragment.setArguments(bundle); |
45 | return fragment; | 65 | return fragment; |
46 | 66 | ||
47 | } | 67 | } |
68 | |||
48 | @Override | 69 | @Override |
49 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 70 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
50 | if (mView == null) { | 71 | if (mView == null) { |
51 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 72 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
52 | initView(mView); | 73 | initView(mView); |
53 | initData(); | 74 | initData(); |
54 | setLister(); | 75 | setLister(); |
55 | initTimePicker(); | 76 | initTimePicker(); |
56 | 77 | ||
57 | 78 | ||
58 | } | 79 | } |
59 | return mView; | 80 | return mView; |
60 | } | 81 | } |
82 | |||
61 | //初始化 | 83 | //初始化 |
62 | private void initView(View mView) { | 84 | private void initView(View mView) { |
63 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 85 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
64 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 86 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
65 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 87 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
66 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 88 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
67 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 89 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
68 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 90 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
69 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 91 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
70 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 92 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
71 | 93 | ||
72 | 94 | ||
73 | |||
74 | } | 95 | } |
96 | |||
75 | private void initData() { | 97 | private void initData() { |
76 | } | 98 | } |
99 | |||
77 | private void setLister() { | 100 | private void setLister() { |
78 | tv_sex.setOnClickListener(this); | 101 | tv_sex.setOnClickListener(this); |
79 | tv_useinfo_adress.setOnClickListener(this); | 102 | tv_useinfo_adress.setOnClickListener(this); |
80 | tv_useinfo_birthday.setOnClickListener(this); | 103 | tv_useinfo_birthday.setOnClickListener(this); |
81 | tv_useinfo_school.setOnClickListener(this); | 104 | tv_useinfo_school.setOnClickListener(this); |
82 | tv_useinfo_gender.setOnClickListener(this); | 105 | tv_useinfo_gender.setOnClickListener(this); |
83 | } | 106 | } |
84 | 107 | ||
85 | @Override | 108 | @Override |
86 | public void onClick(View v) { | 109 | public void onClick(View v) { |
87 | switch (v.getId()){ | 110 | String presonal1 = tv_username1.getText().toString().trim(); |
111 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | ||
112 | String presonal3 = tv_sex.getText().toString().trim(); | ||
113 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | ||
114 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | ||
115 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | ||
116 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | ||
117 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | ||
118 | switch (v.getId()) { | ||
88 | case R.id.tv_sex: | 119 | case R.id.tv_sex: |
89 | final String[] items = {"男", "女"}; | 120 | final String[] items = {"男", "女"}; |
90 | new CircleDialog.Builder(getActivity()) | 121 | new CircleDialog.Builder(getActivity()) |
91 | .configDialog(new ConfigDialog() { | 122 | .configDialog(new ConfigDialog() { |
92 | @Override | 123 | @Override |
93 | public void onConfig(DialogParams params) { | 124 | public void onConfig(DialogParams params) { |
94 | //增加弹出动画 | 125 | //增加弹出动画 |
95 | params.gravity = Gravity.CENTER; | 126 | params.gravity = Gravity.CENTER; |
96 | } | 127 | } |
97 | }) | 128 | }) |
98 | .setTitle("请选择性别") | 129 | .setTitle("请选择性别") |
99 | .setWidth(0.5f) | 130 | .setWidth(0.5f) |
100 | .setItems(items, new AdapterView.OnItemClickListener() { | 131 | .setItems(items, new AdapterView.OnItemClickListener() { |
101 | @Override | 132 | @Override |
102 | public void onItemClick(AdapterView<?> parent, View view, int | 133 | public void onItemClick(AdapterView<?> parent, View view, int |
103 | position, long id) { | 134 | position, long id) { |
104 | switch (position){ | 135 | switch (position) { |
105 | case 0: | 136 | case 0: |
106 | tv_sex.setText("男"); | 137 | tv_sex.setText("男"); |
107 | break; | 138 | break; |
108 | case 1: | 139 | case 1: |
109 | tv_sex.setText("女"); | 140 | tv_sex.setText("女"); |
110 | break; | 141 | break; |
111 | } | 142 | } |
112 | 143 | ||
113 | } | 144 | } |
114 | }) | 145 | }) |
115 | .setNegative("取消", null) | 146 | .setNegative("取消", null) |
116 | .configNegative(new ConfigButton() { | 147 | .configNegative(new ConfigButton() { |
117 | @Override | 148 | @Override |
118 | public void onConfig(ButtonParams params) { | 149 | public void onConfig(ButtonParams params) { |
119 | //取消按钮字体颜色 | 150 | //取消按钮字体颜色 |
120 | params.textColor = Color.RED; | 151 | params.textColor = Color.RED; |
121 | } | 152 | } |
122 | }) | 153 | }) |
123 | .show(); | 154 | .show(); |
124 | break; | 155 | break; |
125 | case R.id.tv_useinfo_adress: | 156 | case R.id.tv_useinfo_adress: |
126 | //ProvinceListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "ProvinceListDialog"); | 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
127 | break; | 158 | break; |
128 | case R.id.tv_useinfo_birthday: | 159 | case R.id.tv_useinfo_birthday: |
129 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 160 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
130 | break; | 161 | break; |
131 | case R.id.tv_useinfo_school: | 162 | case R.id.tv_useinfo_school: |
132 | //SchoolListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "SchoolListDialog"); | 163 | if (TextUtils.isEmpty(presonal4) || |
164 | TextUtils.isEmpty(presonal7)) { | ||
165 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | ||
166 | return; | ||
167 | } else { | ||
168 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | ||
169 | } | ||
170 | |||
133 | 171 | ||
134 | break; | 172 | break; |
135 | case R.id.tv_useinfo_gender: | 173 | case R.id.tv_useinfo_gender: |
136 | //GradeListDialog.getInstance(getActivity()).show(getSupportFragmentManager(), "GradeListDialog"); | 174 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
137 | break; | 175 | break; |
138 | case R.id.presonal_sub: | 176 | case R.id.presonal_sub: |
139 | AlertUtils.showToast(getActivity(),"你点击了提交"); | 177 | |
178 | int a = 0, b = 0; | ||
179 | long c = 0; | ||
140 | //保存星座 | 180 | //保存星座 |
141 | // BrithdayStar brithdayStar = new BrithdayStar(); | 181 | if (!TextUtils.isEmpty(presonal5)) { |
142 | // String s =brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 182 | BrithdayStar brithdayStar = new BrithdayStar(); |
183 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | ||
184 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | ||
185 | } | ||
186 | ChangeInfo changeinfo = new ChangeInfo(); | ||
187 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | ||
188 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | ||
189 | if (regionId == null) { | ||
190 | regionId = regionId1; | ||
191 | } | ||
192 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
193 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | ||
194 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); | ||
195 | try { | ||
196 | a = Integer.parseInt(regionId); | ||
197 | b = Integer.parseInt(grade); | ||
198 | c = Long.parseLong(schoolid); | ||
199 | } catch (NumberFormatException e) { | ||
200 | e.printStackTrace(); | ||
201 | } | ||
202 | changeinfo.setId("688"); | ||
203 | changeinfo.setNickname(presonal1); | ||
204 | changeinfo.setRegionId(a); | ||
205 | changeinfo.setGradeId(b); | ||
206 | changeinfo2.setSchoolId(c); | ||
207 | if ("男".equals(presonal3)) { | ||
208 | changeinfo.setGender("0"); | ||
209 | } else { | ||
210 | changeinfo.setGender("1"); | ||
211 | } | ||
212 | changeinfo.setBirthday(presonal5); | ||
213 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); | ||
214 | changeinfo1.setQq(presonal8); | ||
215 | changeinfo.setRegionName(presonal4 + presonal2); | ||
216 | changeinfo.setSchool(changeinfo2); | ||
217 | changeinfo.setContact(changeinfo1); | ||
218 | |||
219 | try { | ||
220 | //提交个人信息 | ||
221 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); | ||
222 | } catch (UnsupportedEncodingException e) { | ||
223 | e.printStackTrace(); | ||
224 | } | ||
225 | |||
226 | |||
143 | break; | 227 | break; |
144 | } | 228 | } |
145 | } | 229 | } |
230 | |||
146 | //自定义时间选择器 | 231 | //自定义时间选择器 |
147 | private void initTimePicker() { | 232 | private void initTimePicker() { |
148 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 233 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
149 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 234 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
150 | // Calendar selectedDate = Calendar.getInstance(); | 235 | // Calendar selectedDate = Calendar.getInstance(); |
151 | // Calendar startDate = Calendar.getInstance(); | 236 | // Calendar startDate = Calendar.getInstance(); |
152 | // startDate.set(1900, 1, 1); | 237 | // startDate.set(1900, 1, 1); |
153 | // Calendar endDate = Calendar.getInstance(); | 238 | // Calendar endDate = Calendar.getInstance(); |
154 | // endDate.set(2100, 1, 1); | 239 | // endDate.set(2100, 1, 1); |
155 | //时间选择器 | 240 | //时间选择器 |
156 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 241 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
157 | @Override | 242 | @Override |
158 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 243 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
159 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 244 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
160 | /*btn_Time.setText(getTime(date));*/ | 245 | /*btn_Time.setText(getTime(date));*/ |
161 | TextView btn = (TextView) v; | 246 | TextView btn = (TextView) v; |
162 | btn.setText(getTime(date)); | 247 | btn.setText(getTime(date)); |
163 | } | 248 | } |
164 | }) | 249 | }) |
165 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 250 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
166 | .setType(new boolean[]{true, true, true, false, false, false}) | 251 | .setType(new boolean[]{true, true, true, false, false, false}) |
167 | .setLabel("", "", "", "", "", "") | 252 | .setLabel("", "", "", "", "", "") |
168 | .isCenterLabel(false) | 253 | .isCenterLabel(false) |
169 | .setDividerColor(Color.DKGRAY) | 254 | .setDividerColor(Color.DKGRAY) |
170 | .setContentSize(21) | 255 | .setContentSize(21) |
171 | // .setDate(selectedDate) | 256 | // .setDate(selectedDate) |
172 | // .setRangDate(startDate, endDate) | 257 | // .setRangDate(startDate, endDate) |
173 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 258 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
174 | .setDecorView(null) | 259 | .setDecorView(null) |
175 | .setTitleText("购买日期") | 260 | .setTitleText("购买日期") |
176 | .setTitleSize(22) | 261 | .setTitleSize(22) |
177 | .setCancelColor(Color.GRAY) | 262 | .setCancelColor(Color.GRAY) |
178 | .setSubCalSize(22) | 263 | .setSubCalSize(22) |
179 | .setDividerColor(Color.GRAY) | 264 | .setDividerColor(Color.GRAY) |
180 | .setSubmitColor(Color.GRAY) | 265 | .setSubmitColor(Color.GRAY) |
181 | .build(); | 266 | .build(); |
182 | } | 267 | } |
268 | |||
183 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 269 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
184 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 270 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
185 | return format.format(date); | 271 | return format.format(date); |
186 | } | 272 | } |
187 | 273 | ||
188 | @Override | 274 | @Override |
189 | public void onAttach(Activity activity) { | 275 | public void onAttach(Activity activity) { |
190 | super.onAttach(activity); | 276 | super.onAttach(activity); |
191 | View rootView = activity.getWindow().getDecorView(); | 277 | View rootView = activity.getWindow().getDecorView(); |
192 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 278 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
193 | sub.setOnClickListener(this); | 279 | sub.setOnClickListener(this); |
194 | } | 280 | } |
281 | |||
282 | @Override | ||
283 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | ||
284 | String regionName = data.get(position).getRegionName(); | ||
285 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | ||
286 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | ||
287 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | ||
288 | tv_useinfo_adress.setText(""); | ||
289 | tv_useinfo_adress.setText(provice + regionName); | ||
290 | |||
291 | |||
292 | } | ||
293 | |||
294 | @Override | ||
295 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | ||
296 | String regionName = data.get(position).getRegionName(); | ||
297 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | ||
298 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | ||
299 | tv_useinfo_adress.setText(""); | ||
300 | tv_useinfo_adress.setText(provices + citys + regionName); | ||
301 | |||
302 | } | ||
303 | |||
304 | @Override | ||
305 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | ||
306 | String regionName = data.get(position).getName(); | ||
307 | tv_useinfo_gender.setText(regionName); | ||
308 | } | ||
309 | |||
310 | @Override | ||
311 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | ||
312 | String regionName = data.get(position).getRegionName(); | ||
313 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | ||
314 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | ||
315 | |||
316 | } | ||
317 | |||
318 | @Override | ||
319 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | ||
320 | String regionName = data.get(position).getSchoolName(); | ||
321 | tv_useinfo_school.setText(regionName); | ||
322 | |||
323 | |||
324 | } | ||
195 | } | 325 | } |
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 SUCHCARDINFO = 1; | 9 | public static final int SUCHCARDINFO = 1; |
10 | //是否填写保卡信息 | 10 | //是否填写保卡信息 |
11 | public static final int CHECKCARD = 1; | 11 | public static final int CHECKCARD = 1; |
12 | //注册 | 12 | //注册 |
13 | public static final int REGISTERED_SUCESS = 2; | 13 | public static final int REGISTERED_SUCESS = 2; |
14 | public static final int REGISTERED_FAIL = 3; | 14 | public static final int REGISTERED_FAIL = 3; |
15 | //注册验证码 | 15 | //注册验证码 |
16 | public static final int AUTHCODE_SUCESS = 4; | 16 | public static final int AUTHCODE_SUCESS = 4; |
17 | public static final int AUTHCODE_FAIL = 5; | 17 | public static final int AUTHCODE_FAIL = 5; |
18 | //忘记密码验证码 | 18 | //忘记密码验证码 |
19 | public static final int AUTHCODE_SUCESS1 = 6; | 19 | public static final int AUTHCODE_SUCESS1 = 6; |
20 | public static final int AUTHCODE_FAIL1 = 7; | 20 | public static final int AUTHCODE_FAIL1 = 7; |
21 | //是否已经注册 | 21 | //是否已经注册 |
22 | public static final int IS_REFISTER = 8; | 22 | public static final int IS_REFISTER = 8; |
23 | //忘记密码 | 23 | //忘记密码 |
24 | public static final int PASSWORD_SUCESS = 9; | 24 | public static final int PASSWORD_SUCESS = 9; |
25 | public static final int PASSWORD_FAIL = 10; | 25 | public static final int PASSWORD_FAIL = 10; |
26 | //s省 | 26 | //s省 |
27 | public static final int PROVICES = 11; | 27 | public static final int PROVICES = 11; |
28 | //市 | 28 | //市 |
29 | public static final int CITYS = 12; | 29 | public static final int CITYS = 12; |
30 | //区 | 30 | //区 |
31 | public static final int COUNTRY = 13; | 31 | public static final int COUNTRY = 13; |
32 | //学校 | 32 | //学校 |
33 | public static final int SCHOOL = 14; | 33 | public static final int SCHOOL = 14; |
34 | //年级 | 34 | //年级 |
35 | public static final int GRADER = 15; | 35 | public static final int GRADER = 15; |
36 | //获取个人信息 | ||
37 | public static final int GETINFO = 16; | ||
38 | //获取个性签名 | ||
39 | public static final int SIGN = 17; | ||
36 | 40 | ||
37 | 41 | ||
38 | 42 | ||
39 | } | 43 | } |
40 | 44 |
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.ComponentName; | 5 | import android.content.ComponentName; |
6 | import android.content.Context; | 6 | import android.content.Context; |
7 | import android.content.Intent; | 7 | import android.content.Intent; |
8 | import android.os.Handler; | 8 | import android.os.Handler; |
9 | import android.os.Message; | 9 | import android.os.Message; |
10 | import android.provider.Settings; | 10 | import android.provider.Settings; |
11 | import android.support.v4.app.FragmentActivity; | 11 | import android.support.v4.app.FragmentActivity; |
12 | import android.util.Log; | 12 | import android.util.Log; |
13 | import android.view.Gravity; | 13 | import android.view.Gravity; |
14 | import android.view.View; | 14 | import android.view.View; |
15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
16 | 16 | ||
17 | import com.google.gson.Gson; | 17 | import com.google.gson.Gson; |
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
20 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
22 | import com.hjx.personalcenter.gson.GsonTool; | 22 | import com.hjx.personalcenter.gson.GsonTool; |
23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
24 | import com.hjx.personalcenter.model.CityInfo; | 24 | import com.hjx.personalcenter.model.CityInfo; |
25 | import com.hjx.personalcenter.model.CountyInfo; | 25 | import com.hjx.personalcenter.model.CountyInfo; |
26 | import com.hjx.personalcenter.model.GradeInfo; | 26 | import com.hjx.personalcenter.model.GradeInfo; |
27 | import com.hjx.personalcenter.model.PesonalInfo; | ||
27 | import com.hjx.personalcenter.model.ProvinceInfo; | 28 | import com.hjx.personalcenter.model.ProvinceInfo; |
28 | import com.hjx.personalcenter.model.SchoolInfo; | 29 | import com.hjx.personalcenter.model.SchoolInfo; |
30 | import com.hjx.personalcenter.model.SignInfo; | ||
29 | import com.hjx.personalcenter.util.DialogPermission; | 31 | import com.hjx.personalcenter.util.DialogPermission; |
30 | import com.loopj.android.http.AsyncHttpResponseHandler; | 32 | import com.loopj.android.http.AsyncHttpResponseHandler; |
31 | import com.loopj.android.http.JsonHttpResponseHandler; | 33 | import com.loopj.android.http.JsonHttpResponseHandler; |
32 | import com.loopj.android.http.RequestParams; | 34 | import com.loopj.android.http.RequestParams; |
33 | import com.mylhyl.circledialog.CircleDialog; | 35 | import com.mylhyl.circledialog.CircleDialog; |
34 | import com.mylhyl.circledialog.callback.ConfigText; | 36 | import com.mylhyl.circledialog.callback.ConfigText; |
35 | import com.mylhyl.circledialog.params.TextParams; | 37 | import com.mylhyl.circledialog.params.TextParams; |
36 | 38 | ||
37 | import org.apache.http.Header; | 39 | import org.apache.http.Header; |
38 | import org.apache.http.entity.ByteArrayEntity; | 40 | import org.apache.http.entity.ByteArrayEntity; |
39 | import org.apache.http.message.BasicHeader; | 41 | import org.apache.http.message.BasicHeader; |
40 | import org.apache.http.protocol.HTTP; | 42 | import org.apache.http.protocol.HTTP; |
41 | import org.json.JSONException; | 43 | import org.json.JSONException; |
42 | import org.json.JSONObject; | 44 | import org.json.JSONObject; |
43 | 45 | ||
44 | import java.io.UnsupportedEncodingException; | 46 | import java.io.UnsupportedEncodingException; |
45 | import java.util.ArrayList; | 47 | import java.util.ArrayList; |
46 | import java.util.List; | 48 | import java.util.List; |
47 | 49 | ||
48 | public class HttpManager { | 50 | public class HttpManager { |
49 | private static HttpManager instance; | 51 | private static HttpManager instance; |
50 | private ProgressDialog mProgress = null; | 52 | private ProgressDialog mProgress = null; |
51 | 53 | ||
52 | public static HttpManager getInstance() { | 54 | public static HttpManager getInstance() { |
53 | if (instance == null) { | 55 | if (instance == null) { |
54 | instance = new HttpManager(); | 56 | instance = new HttpManager(); |
55 | } | 57 | } |
56 | return instance; | 58 | return instance; |
57 | } | 59 | } |
58 | 60 | ||
59 | 61 | ||
60 | //登录接口 | 62 | //登录接口 |
61 | 63 | ||
62 | public void login(final String username, final String password, final Context mContext) { | 64 | public void login(final String username, final String password, final Context mContext) { |
63 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 65 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
64 | false, true, null); | 66 | false, true, null); |
65 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 67 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
66 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 68 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
67 | @Override | 69 | @Override |
68 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 70 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
69 | 71 | ||
70 | String str = new String(arg2); | 72 | String str = new String(arg2); |
71 | JSONObject jsonObject = null; | 73 | JSONObject jsonObject = null; |
72 | try { | 74 | try { |
73 | jsonObject = new JSONObject(new String(arg2)); | 75 | jsonObject = new JSONObject(new String(arg2)); |
74 | String status = jsonObject.getString("status"); | 76 | String status = jsonObject.getString("status"); |
75 | if (status.equals("100")) { | 77 | if (status.equals("100")) { |
76 | String access_token = jsonObject.getString("access_token"); | 78 | String access_token = jsonObject.getString("access_token"); |
77 | String userId = jsonObject.getString("userId"); | 79 | String userId = jsonObject.getString("userId"); |
78 | // //登录成功,保存登录数据并且获取个人信息 | 80 | // //登录成功,保存登录数据并且获取个人信息 |
79 | saveLoginInfo(mContext, username, password, access_token, "true", userId); | 81 | saveLoginInfo(mContext, username, password, access_token, "true", userId); |
80 | //HttpManager.getInstance().getuserinfo(username,mContext); | 82 | //HttpManager.getInstance().getuserinfo(username,mContext); |
81 | 83 | ||
82 | } else if (status.equals("200")) { | 84 | } else if (status.equals("200")) { |
83 | closeProgress(); | 85 | closeProgress(); |
84 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); | 86 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); |
85 | return; | 87 | return; |
86 | } else if (status.equals("204")) { | 88 | } else if (status.equals("204")) { |
87 | closeProgress(); | 89 | closeProgress(); |
88 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); | 90 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); |
89 | } else { | 91 | } else { |
90 | closeProgress(); | 92 | closeProgress(); |
91 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 93 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
92 | 94 | ||
93 | 95 | ||
94 | } | 96 | } |
95 | } catch (JSONException e) { | 97 | } catch (JSONException e) { |
96 | e.printStackTrace(); | 98 | e.printStackTrace(); |
97 | } | 99 | } |
98 | 100 | ||
99 | 101 | ||
100 | } | 102 | } |
101 | 103 | ||
102 | @Override | 104 | @Override |
103 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 105 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
104 | closeProgress(); | 106 | closeProgress(); |
105 | new CircleDialog.Builder((FragmentActivity) mContext) | 107 | new CircleDialog.Builder((FragmentActivity) mContext) |
106 | .setCanceledOnTouchOutside(false) | 108 | .setCanceledOnTouchOutside(false) |
107 | .setCancelable(false) | 109 | .setCancelable(false) |
108 | .setWidth(0.5f) | 110 | .setWidth(0.5f) |
109 | .configText(new ConfigText() { | 111 | .configText(new ConfigText() { |
110 | @Override | 112 | @Override |
111 | public void onConfig(TextParams params) { | 113 | public void onConfig(TextParams params) { |
112 | params.gravity = Gravity.CENTER; | 114 | params.gravity = Gravity.CENTER; |
113 | params.padding = new int[]{50, 50, 50, 50}; | 115 | params.padding = new int[]{50, 50, 50, 50}; |
114 | } | 116 | } |
115 | }) | 117 | }) |
116 | .setText("当前无网络,请检查网络设置") | 118 | .setText("当前无网络,请检查网络设置") |
117 | .setNegative("继续使用", null) | 119 | .setNegative("继续使用", null) |
118 | .setPositive("设置网络", new View.OnClickListener() { | 120 | .setPositive("设置网络", new View.OnClickListener() { |
119 | @Override | 121 | @Override |
120 | public void onClick(View v) { | 122 | public void onClick(View v) { |
121 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 123 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
122 | mContext.startActivity(intent); | 124 | mContext.startActivity(intent); |
123 | } | 125 | } |
124 | }) | 126 | }) |
125 | .show(); | 127 | .show(); |
126 | } | 128 | } |
127 | }); | 129 | }); |
128 | } | 130 | } |
129 | 131 | ||
130 | //注册接口 | 132 | //注册接口 |
131 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 133 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
132 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 134 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
133 | false, true, null); | 135 | false, true, null); |
134 | JSONObject jsonObject = new JSONObject(); | 136 | JSONObject jsonObject = new JSONObject(); |
135 | ByteArrayEntity entity = null; | 137 | ByteArrayEntity entity = null; |
136 | try { | 138 | try { |
137 | jsonObject.put(HttpKey.USERNAME, username); | 139 | jsonObject.put(HttpKey.USERNAME, username); |
138 | jsonObject.put(HttpKey.PASSWORD, password); | 140 | jsonObject.put(HttpKey.PASSWORD, password); |
139 | jsonObject.put(HttpKey.SMSCODE, smscode); | 141 | jsonObject.put(HttpKey.SMSCODE, smscode); |
140 | jsonObject.put(HttpKey.SOURCE, source); | 142 | jsonObject.put(HttpKey.SOURCE, source); |
141 | Log.e("test", "jsonObject" + jsonObject); | 143 | Log.e("test", "jsonObject" + jsonObject); |
142 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 144 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
143 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 145 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
144 | } catch (JSONException e) { | 146 | } catch (JSONException e) { |
145 | e.printStackTrace(); | 147 | e.printStackTrace(); |
146 | } catch (UnsupportedEncodingException e) { | 148 | } catch (UnsupportedEncodingException e) { |
147 | e.printStackTrace(); | 149 | e.printStackTrace(); |
148 | } | 150 | } |
149 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 151 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
150 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 152 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
151 | @Override | 153 | @Override |
152 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 154 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
153 | super.onSuccess(statusCode, headers, response); | 155 | super.onSuccess(statusCode, headers, response); |
154 | closeProgress(); | 156 | closeProgress(); |
155 | Log.e("test", "onSuccess" + response); | 157 | Log.e("test", "onSuccess" + response); |
156 | Message msg = Message.obtain(); | 158 | Message msg = Message.obtain(); |
157 | msg.what = HttpCode.REGISTERED_SUCESS; | 159 | msg.what = HttpCode.REGISTERED_SUCESS; |
158 | msg.obj = response; | 160 | msg.obj = response; |
159 | handler.sendMessage(msg); | 161 | handler.sendMessage(msg); |
160 | 162 | ||
161 | } | 163 | } |
162 | 164 | ||
163 | @Override | 165 | @Override |
164 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 166 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
165 | super.onFailure(statusCode, headers, throwable, errorResponse); | 167 | super.onFailure(statusCode, headers, throwable, errorResponse); |
166 | closeProgress(); | 168 | closeProgress(); |
167 | Log.e("test", "onFailure" + errorResponse); | 169 | Log.e("test", "onFailure" + errorResponse); |
168 | new CircleDialog.Builder((FragmentActivity) context) | 170 | new CircleDialog.Builder((FragmentActivity) context) |
169 | .setCanceledOnTouchOutside(false) | 171 | .setCanceledOnTouchOutside(false) |
170 | .setCancelable(false) | 172 | .setCancelable(false) |
171 | .setWidth(0.5f) | 173 | .setWidth(0.5f) |
172 | .configText(new ConfigText() { | 174 | .configText(new ConfigText() { |
173 | @Override | 175 | @Override |
174 | public void onConfig(TextParams params) { | 176 | public void onConfig(TextParams params) { |
175 | params.gravity = Gravity.CENTER; | 177 | params.gravity = Gravity.CENTER; |
176 | params.padding = new int[]{50, 50, 50, 50}; | 178 | params.padding = new int[]{50, 50, 50, 50}; |
177 | } | 179 | } |
178 | }) | 180 | }) |
179 | .setText("当前无网络,请检查网络设置") | 181 | .setText("当前无网络,请检查网络设置") |
180 | .setNegative("继续使用", null) | 182 | .setNegative("继续使用", null) |
181 | .setPositive("设置网络", new View.OnClickListener() { | 183 | .setPositive("设置网络", new View.OnClickListener() { |
182 | @Override | 184 | @Override |
183 | public void onClick(View v) { | 185 | public void onClick(View v) { |
184 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 186 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
185 | context.startActivity(intent); | 187 | context.startActivity(intent); |
186 | } | 188 | } |
187 | }) | 189 | }) |
188 | .show(); | 190 | .show(); |
189 | } | 191 | } |
190 | 192 | ||
191 | }); | 193 | }); |
192 | } | 194 | } |
193 | 195 | ||
194 | //注册验证码 | 196 | //注册验证码 |
195 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 197 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
196 | RequestParams params = new RequestParams(); | 198 | RequestParams params = new RequestParams(); |
197 | params.put(HttpKey.TYPE, type); | 199 | params.put(HttpKey.TYPE, type); |
198 | params.put(HttpKey.MOBIL, mobile); | 200 | params.put(HttpKey.MOBIL, mobile); |
199 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 201 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
200 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 202 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
201 | 203 | ||
202 | @Override | 204 | @Override |
203 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 205 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
204 | Log.e("test", "onSuccess-----" + response); | 206 | Log.e("test", "onSuccess-----" + response); |
205 | Message msg = Message.obtain(); | 207 | Message msg = Message.obtain(); |
206 | msg.what = HttpCode.AUTHCODE_SUCESS; | 208 | msg.what = HttpCode.AUTHCODE_SUCESS; |
207 | msg.obj = response; | 209 | msg.obj = response; |
208 | handler.sendMessage(msg); | 210 | handler.sendMessage(msg); |
209 | } | 211 | } |
210 | 212 | ||
211 | @Override | 213 | @Override |
212 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 214 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
213 | new CircleDialog.Builder((FragmentActivity) mContext) | 215 | new CircleDialog.Builder((FragmentActivity) mContext) |
214 | .setCanceledOnTouchOutside(false) | 216 | .setCanceledOnTouchOutside(false) |
215 | .setCancelable(false) | 217 | .setCancelable(false) |
216 | .setWidth(0.5f) | 218 | .setWidth(0.5f) |
217 | .configText(new ConfigText() { | 219 | .configText(new ConfigText() { |
218 | @Override | 220 | @Override |
219 | public void onConfig(TextParams params) { | 221 | public void onConfig(TextParams params) { |
220 | params.gravity = Gravity.CENTER; | 222 | params.gravity = Gravity.CENTER; |
221 | params.padding = new int[]{50, 50, 50, 50}; | 223 | params.padding = new int[]{50, 50, 50, 50}; |
222 | } | 224 | } |
223 | }) | 225 | }) |
224 | .setText("当前无网络,请检查网络设置") | 226 | .setText("当前无网络,请检查网络设置") |
225 | .setNegative("继续使用", null) | 227 | .setNegative("继续使用", null) |
226 | .setPositive("设置网络", new View.OnClickListener() { | 228 | .setPositive("设置网络", new View.OnClickListener() { |
227 | @Override | 229 | @Override |
228 | public void onClick(View v) { | 230 | public void onClick(View v) { |
229 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 231 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
230 | mContext.startActivity(intent); | 232 | mContext.startActivity(intent); |
231 | } | 233 | } |
232 | }) | 234 | }) |
233 | .show(); | 235 | .show(); |
234 | } | 236 | } |
235 | }); | 237 | }); |
236 | } | 238 | } |
237 | 239 | ||
238 | 240 | ||
239 | //手机号是否注册 | 241 | //手机号是否注册 |
240 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 242 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
241 | RequestParams params = new RequestParams(); | 243 | RequestParams params = new RequestParams(); |
242 | params.put(HttpKey.USERNAME, mobile); | 244 | params.put(HttpKey.USERNAME, mobile); |
243 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 245 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
244 | @Override | 246 | @Override |
245 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 247 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
246 | Log.e("test", "isregistered" + response.toString()); | 248 | Log.e("test", "isregistered" + response.toString()); |
247 | Message msg = Message.obtain(); | 249 | Message msg = Message.obtain(); |
248 | msg.what = HttpCode.IS_REFISTER; | 250 | msg.what = HttpCode.IS_REFISTER; |
249 | msg.obj = response; | 251 | msg.obj = response; |
250 | handler.sendMessage(msg); | 252 | handler.sendMessage(msg); |
251 | 253 | ||
252 | } | 254 | } |
253 | 255 | ||
254 | @Override | 256 | @Override |
255 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 257 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
256 | new CircleDialog.Builder((FragmentActivity) mContext) | 258 | new CircleDialog.Builder((FragmentActivity) mContext) |
257 | .setCanceledOnTouchOutside(false) | 259 | .setCanceledOnTouchOutside(false) |
258 | .setCancelable(false) | 260 | .setCancelable(false) |
259 | .setWidth(0.5f) | 261 | .setWidth(0.5f) |
260 | .configText(new ConfigText() { | 262 | .configText(new ConfigText() { |
261 | @Override | 263 | @Override |
262 | public void onConfig(TextParams params) { | 264 | public void onConfig(TextParams params) { |
263 | params.gravity = Gravity.CENTER; | 265 | params.gravity = Gravity.CENTER; |
264 | params.padding = new int[]{50, 50, 50, 50}; | 266 | params.padding = new int[]{50, 50, 50, 50}; |
265 | } | 267 | } |
266 | }) | 268 | }) |
267 | .setText("当前无网络,请检查网络设置") | 269 | .setText("当前无网络,请检查网络设置") |
268 | .setNegative("继续使用", null) | 270 | .setNegative("继续使用", null) |
269 | .setPositive("设置网络", new View.OnClickListener() { | 271 | .setPositive("设置网络", new View.OnClickListener() { |
270 | @Override | 272 | @Override |
271 | public void onClick(View v) { | 273 | public void onClick(View v) { |
272 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 274 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
273 | mContext.startActivity(intent); | 275 | mContext.startActivity(intent); |
274 | } | 276 | } |
275 | }) | 277 | }) |
276 | .show(); | 278 | .show(); |
277 | 279 | ||
278 | } | 280 | } |
279 | }); | 281 | }); |
280 | } | 282 | } |
281 | 283 | ||
282 | //修改密码 | 284 | //修改密码 |
283 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 285 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
284 | RequestParams params = new RequestParams(); | 286 | RequestParams params = new RequestParams(); |
285 | params.put(HttpKey.USERNAME, username); | 287 | params.put(HttpKey.USERNAME, username); |
286 | params.put(HttpKey.OLDPASS, old_pwd1); | 288 | params.put(HttpKey.OLDPASS, old_pwd1); |
287 | params.put(HttpKey.NEWPASS, newpassword3); | 289 | params.put(HttpKey.NEWPASS, newpassword3); |
288 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 290 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
289 | HttpClient.getInstance().setTimeout(10 * 1000); | 291 | HttpClient.getInstance().setTimeout(10 * 1000); |
290 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 292 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
291 | @Override | 293 | @Override |
292 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 294 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
293 | try { | 295 | try { |
294 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 296 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
295 | String status = jsonObject.optString("status"); | 297 | String status = jsonObject.optString("status"); |
296 | if (status.equals("100")) { | 298 | if (status.equals("100")) { |
297 | Log.e("test", "onSuccess" + new String(bytes)); | 299 | Log.e("test", "onSuccess" + new String(bytes)); |
298 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 300 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
299 | SaveParam.getInstance().clearData((Activity) context); | 301 | SaveParam.getInstance().clearData((Activity) context); |
300 | Intent intent = new Intent(); | 302 | Intent intent = new Intent(); |
301 | intent.setClass(context, LoginAndRegisterActivity.class); | 303 | intent.setClass(context, LoginAndRegisterActivity.class); |
302 | ((Activity) context).startActivity(intent); | 304 | ((Activity) context).startActivity(intent); |
303 | ((Activity) context).finish(); | 305 | ((Activity) context).finish(); |
304 | } | 306 | } |
305 | } catch (JSONException e) { | 307 | } catch (JSONException e) { |
306 | e.printStackTrace(); | 308 | e.printStackTrace(); |
307 | } | 309 | } |
308 | } | 310 | } |
309 | 311 | ||
310 | @Override | 312 | @Override |
311 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 313 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
312 | Log.e("test", "onFailure" + new String(bytes)); | 314 | Log.e("test", "onFailure" + new String(bytes)); |
313 | new CircleDialog.Builder((FragmentActivity) context) | 315 | new CircleDialog.Builder((FragmentActivity) context) |
314 | .setCanceledOnTouchOutside(false) | 316 | .setCanceledOnTouchOutside(false) |
315 | .setCancelable(false) | 317 | .setCancelable(false) |
316 | .setWidth(0.5f) | 318 | .setWidth(0.5f) |
317 | .configText(new ConfigText() { | 319 | .configText(new ConfigText() { |
318 | @Override | 320 | @Override |
319 | public void onConfig(TextParams params) { | 321 | public void onConfig(TextParams params) { |
320 | params.gravity = Gravity.CENTER; | 322 | params.gravity = Gravity.CENTER; |
321 | params.padding = new int[]{50, 50, 50, 50}; | 323 | params.padding = new int[]{50, 50, 50, 50}; |
322 | } | 324 | } |
323 | }) | 325 | }) |
324 | .setText("当前无网络,请检查网络设置") | 326 | .setText("当前无网络,请检查网络设置") |
325 | .setNegative("继续使用", null) | 327 | .setNegative("继续使用", null) |
326 | .setPositive("设置网络", new View.OnClickListener() { | 328 | .setPositive("设置网络", new View.OnClickListener() { |
327 | @Override | 329 | @Override |
328 | public void onClick(View v) { | 330 | public void onClick(View v) { |
329 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 331 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
330 | context.startActivity(intent); | 332 | context.startActivity(intent); |
331 | } | 333 | } |
332 | }) | 334 | }) |
333 | .show(); | 335 | .show(); |
334 | } | 336 | } |
335 | }); | 337 | }); |
336 | 338 | ||
337 | } | 339 | } |
338 | 340 | ||
339 | //忘记密码 | 341 | //忘记密码 |
340 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 342 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
341 | RequestParams params = new RequestParams(); | 343 | RequestParams params = new RequestParams(); |
342 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 344 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
343 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 345 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
344 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 346 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
345 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 347 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
346 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 348 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
347 | @Override | 349 | @Override |
348 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 350 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
349 | try { | 351 | try { |
350 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 352 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
351 | String status = jsonObject.optString("status"); | 353 | String status = jsonObject.optString("status"); |
352 | if (status.equals("100")) { | 354 | if (status.equals("100")) { |
353 | Log.e("test", "onSuccess" + new String(bytes)); | 355 | Log.e("test", "onSuccess" + new String(bytes)); |
354 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 356 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
355 | ((Activity) context).finish(); | 357 | ((Activity) context).finish(); |
356 | } | 358 | } |
357 | } catch (JSONException e) { | 359 | } catch (JSONException e) { |
358 | e.printStackTrace(); | 360 | e.printStackTrace(); |
359 | } | 361 | } |
360 | } | 362 | } |
361 | 363 | ||
362 | @Override | 364 | @Override |
363 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 365 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
364 | Log.e("test", "onFailure" + new String(bytes)); | 366 | Log.e("test", "onFailure" + new String(bytes)); |
365 | new CircleDialog.Builder((FragmentActivity) context) | 367 | new CircleDialog.Builder((FragmentActivity) context) |
366 | .setCanceledOnTouchOutside(false) | 368 | .setCanceledOnTouchOutside(false) |
367 | .setCancelable(false) | 369 | .setCancelable(false) |
368 | .setWidth(0.5f) | 370 | .setWidth(0.5f) |
369 | .configText(new ConfigText() { | 371 | .configText(new ConfigText() { |
370 | @Override | 372 | @Override |
371 | public void onConfig(TextParams params) { | 373 | public void onConfig(TextParams params) { |
372 | params.gravity = Gravity.CENTER; | 374 | params.gravity = Gravity.CENTER; |
373 | params.padding = new int[]{50, 50, 50, 50}; | 375 | params.padding = new int[]{50, 50, 50, 50}; |
374 | } | 376 | } |
375 | }) | 377 | }) |
376 | .setText("当前无网络,请检查网络设置") | 378 | .setText("当前无网络,请检查网络设置") |
377 | .setNegative("继续使用", null) | 379 | .setNegative("继续使用", null) |
378 | .setPositive("设置网络", new View.OnClickListener() { | 380 | .setPositive("设置网络", new View.OnClickListener() { |
379 | @Override | 381 | @Override |
380 | public void onClick(View v) { | 382 | public void onClick(View v) { |
381 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 383 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
382 | context.startActivity(intent); | 384 | context.startActivity(intent); |
383 | } | 385 | } |
384 | }) | 386 | }) |
385 | .show(); | 387 | .show(); |
386 | } | 388 | } |
387 | }); | 389 | }); |
388 | 390 | ||
389 | } | 391 | } |
390 | 392 | ||
391 | //保存用户登录信息 | 393 | //保存用户登录信息 |
392 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 394 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
393 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 395 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
394 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 396 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
395 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 397 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
396 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 398 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
397 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 399 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
398 | 400 | ||
399 | 401 | ||
400 | } | 402 | } |
401 | 403 | ||
402 | //保存用户个人信息 | 404 | //保存用户登录信息 |
403 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { | 405 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { |
404 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); | 406 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); |
405 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); | 407 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); |
406 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); | 408 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); |
407 | } | 409 | } |
408 | 410 | ||
409 | //提交保卡信息 | 411 | //提交保卡信息 |
410 | public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, | 412 | public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, |
411 | String buyAddress, String buyTime, String alterSaleCall, | 413 | String buyAddress, String buyTime, String alterSaleCall, |
412 | String productModel, String deviceNumber, String macAddress, | 414 | String productModel, String deviceNumber, String macAddress, |
413 | String mobilePhone) { | 415 | String mobilePhone) { |
414 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 416 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
415 | false, true, null); | 417 | false, true, null); |
416 | RequestParams params = new RequestParams(); | 418 | RequestParams params = new RequestParams(); |
417 | 419 | ||
418 | params.put(HttpKey.USEID, userId); | 420 | params.put(HttpKey.USEID, userId); |
419 | params.put(HttpKey.CUSTOMENAME, customerName); | 421 | params.put(HttpKey.CUSTOMENAME, customerName); |
420 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 422 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
421 | params.put(HttpKey.BUYADREES, buyAddress); | 423 | params.put(HttpKey.BUYADREES, buyAddress); |
422 | params.put(HttpKey.BUYTIME, buyTime); | 424 | params.put(HttpKey.BUYTIME, buyTime); |
423 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 425 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
424 | params.put(HttpKey.PRODUCTMODEL, productModel); | 426 | params.put(HttpKey.PRODUCTMODEL, productModel); |
425 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 427 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
426 | params.put(HttpKey.MACADRESS, macAddress); | 428 | params.put(HttpKey.MACADRESS, macAddress); |
427 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 429 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
428 | 430 | ||
429 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 431 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
430 | 432 | ||
431 | Log.e("test", "params" + params); | 433 | Log.e("test", "params" + params); |
432 | HttpClient.getInstance().setTimeout(5 * 1000); | 434 | HttpClient.getInstance().setTimeout(5 * 1000); |
433 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 435 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
434 | @Override | 436 | @Override |
435 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 437 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
436 | JSONObject jsonObject = null; | 438 | JSONObject jsonObject = null; |
437 | closeProgress(); | 439 | closeProgress(); |
438 | try { | 440 | try { |
439 | jsonObject = new JSONObject(new String(bytes)); | 441 | jsonObject = new JSONObject(new String(bytes)); |
440 | String status = jsonObject.optString("status"); | 442 | String status = jsonObject.optString("status"); |
441 | if (status.equals("1")) { | 443 | if (status.equals("1")) { |
442 | Log.e("test", "onSuccess" + jsonObject); | 444 | Log.e("test", "onSuccess" + jsonObject); |
443 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 445 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
444 | Intent intent = new Intent(); | 446 | Intent intent = new Intent(); |
445 | intent.setClass((Activity) context, TheStartPageActivity.class); | 447 | intent.setClass((Activity) context, TheStartPageActivity.class); |
446 | ((Activity) context).startActivity(intent); | 448 | ((Activity) context).startActivity(intent); |
447 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 449 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
448 | ((Activity) context).finish(); | 450 | ((Activity) context).finish(); |
449 | } | 451 | } |
450 | } catch (JSONException e) { | 452 | } catch (JSONException e) { |
451 | e.printStackTrace(); | 453 | e.printStackTrace(); |
452 | } | 454 | } |
453 | 455 | ||
454 | 456 | ||
455 | } | 457 | } |
456 | 458 | ||
457 | @Override | 459 | @Override |
458 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 460 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
459 | Log.e("test", "onFailure" + (throwable)); | 461 | Log.e("test", "onFailure" + (throwable)); |
460 | closeProgress(); | 462 | closeProgress(); |
461 | new CircleDialog.Builder((FragmentActivity) context) | 463 | new CircleDialog.Builder((FragmentActivity) context) |
462 | .setCanceledOnTouchOutside(false) | 464 | .setCanceledOnTouchOutside(false) |
463 | .setCancelable(false) | 465 | .setCancelable(false) |
464 | .setWidth(0.5f) | 466 | .setWidth(0.5f) |
465 | .configText(new ConfigText() { | 467 | .configText(new ConfigText() { |
466 | @Override | 468 | @Override |
467 | public void onConfig(TextParams params) { | 469 | public void onConfig(TextParams params) { |
468 | params.gravity = Gravity.CENTER; | 470 | params.gravity = Gravity.CENTER; |
469 | params.padding = new int[]{50, 50, 50, 50}; | 471 | params.padding = new int[]{50, 50, 50, 50}; |
470 | } | 472 | } |
471 | }) | 473 | }) |
472 | .setText("当前无网络,请检查网络设置") | 474 | .setText("当前无网络,请检查网络设置") |
473 | .setNegative("继续使用", null) | 475 | .setNegative("继续使用", null) |
474 | .setPositive("设置网络", new View.OnClickListener() { | 476 | .setPositive("设置网络", new View.OnClickListener() { |
475 | @Override | 477 | @Override |
476 | public void onClick(View v) { | 478 | public void onClick(View v) { |
477 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 479 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
478 | context.startActivity(intent); | 480 | context.startActivity(intent); |
479 | } | 481 | } |
480 | }) | 482 | }) |
481 | .show(); | 483 | .show(); |
482 | 484 | ||
483 | } | 485 | } |
484 | }); | 486 | }); |
485 | 487 | ||
486 | } | 488 | } |
487 | //获取保卡信息 | 489 | //获取保卡信息 |
488 | public void getcardinfo(final Context mContext, int userId , final Handler handler) { | 490 | public void getcardinfo(final Context mContext, int userId , final Handler handler) { |
489 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 491 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
490 | false, true, null); | 492 | false, true, null); |
491 | HttpClient.getInstance().setTimeout(5 * 1000); | 493 | HttpClient.getInstance().setTimeout(5 * 1000); |
492 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 494 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
493 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { | 495 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { |
494 | @Override | 496 | @Override |
495 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 497 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
496 | closeProgress(); | 498 | closeProgress(); |
497 | Log.e("test", "保卡信息" + new String(arg2)); | 499 | Log.e("test", "保卡信息" + new String(arg2)); |
498 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 500 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
499 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 501 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
500 | Message msg = Message.obtain(); | 502 | Message msg = Message.obtain(); |
501 | msg.what = HttpCode.SUCHCARDINFO; | 503 | msg.what = HttpCode.SUCHCARDINFO; |
502 | msg.obj = schoolInfoBeanList; | 504 | msg.obj = schoolInfoBeanList; |
503 | handler.sendMessage(msg); | 505 | handler.sendMessage(msg); |
504 | } | 506 | } |
505 | 507 | ||
506 | @Override | 508 | @Override |
507 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 509 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
508 | closeProgress(); | 510 | closeProgress(); |
509 | new CircleDialog.Builder((FragmentActivity) mContext) | 511 | new CircleDialog.Builder((FragmentActivity) mContext) |
510 | .setCanceledOnTouchOutside(false) | 512 | .setCanceledOnTouchOutside(false) |
511 | .setCancelable(false) | 513 | .setCancelable(false) |
512 | .setWidth(0.5f) | 514 | .setWidth(0.5f) |
513 | .configText(new ConfigText() { | 515 | .configText(new ConfigText() { |
514 | @Override | 516 | @Override |
515 | public void onConfig(TextParams params) { | 517 | public void onConfig(TextParams params) { |
516 | params.gravity = Gravity.CENTER; | 518 | params.gravity = Gravity.CENTER; |
517 | params.padding = new int[]{50, 50, 50, 50}; | 519 | params.padding = new int[]{50, 50, 50, 50}; |
518 | } | 520 | } |
519 | }) | 521 | }) |
520 | .setText("当前无网络,请检查网络设置") | 522 | .setText("当前无网络,请检查网络设置") |
521 | .setNegative("继续使用", null) | 523 | .setNegative("继续使用", null) |
522 | .setPositive("设置网络", new View.OnClickListener() { | 524 | .setPositive("设置网络", new View.OnClickListener() { |
523 | @Override | 525 | @Override |
524 | public void onClick(View v) { | 526 | public void onClick(View v) { |
525 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 527 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
526 | mContext.startActivity(intent); | 528 | mContext.startActivity(intent); |
527 | } | 529 | } |
528 | }) | 530 | }) |
529 | .show(); | 531 | .show(); |
530 | } | 532 | } |
531 | }); | 533 | }); |
532 | } | 534 | } |
533 | //修改保卡信息电话 | 535 | //修改保卡信息电话 |
534 | public void changecardinfophone(final Context mContext, int userId, final String customerPhone, String authCode) { | 536 | public void changecardinfophone(final Context mContext, int userId, final String customerPhone, String authCode) { |
535 | RequestParams params = new RequestParams(); | 537 | RequestParams params = new RequestParams(); |
536 | params.put("userId", userId); | 538 | params.put("userId", userId); |
537 | params.put("customerPhone", customerPhone); | 539 | params.put("customerPhone", customerPhone); |
538 | params.put("authCode", authCode); | 540 | params.put("authCode", authCode); |
539 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 541 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
540 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 542 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
541 | @Override | 543 | @Override |
542 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 544 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
543 | try { | 545 | try { |
544 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 546 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
545 | String status = jsonObject.optString("status"); | 547 | String status = jsonObject.optString("status"); |
546 | if (status.equals("1")) { | 548 | if (status.equals("1")) { |
547 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 549 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
548 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); | 550 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); |
549 | ((Activity) mContext).finish(); | 551 | ((Activity) mContext).finish(); |
550 | }else if (status.equals("1001")){ | 552 | }else if (status.equals("1001")){ |
551 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 553 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
552 | } | 554 | } |
553 | } catch (JSONException e) { | 555 | } catch (JSONException e) { |
554 | e.printStackTrace(); | 556 | e.printStackTrace(); |
555 | } | 557 | } |
556 | } | 558 | } |
557 | 559 | ||
558 | @Override | 560 | @Override |
559 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 561 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
560 | Log.e("test", "onFailure" + new String(bytes)); | 562 | Log.e("test", "onFailure" + new String(bytes)); |
561 | new CircleDialog.Builder((FragmentActivity) mContext) | 563 | new CircleDialog.Builder((FragmentActivity) mContext) |
562 | .setCanceledOnTouchOutside(false) | 564 | .setCanceledOnTouchOutside(false) |
563 | .setCancelable(false) | 565 | .setCancelable(false) |
564 | .setWidth(0.5f) | 566 | .setWidth(0.5f) |
565 | .configText(new ConfigText() { | 567 | .configText(new ConfigText() { |
566 | @Override | 568 | @Override |
567 | public void onConfig(TextParams params) { | 569 | public void onConfig(TextParams params) { |
568 | params.gravity = Gravity.CENTER; | 570 | params.gravity = Gravity.CENTER; |
569 | params.padding = new int[]{50, 50, 50, 50}; | 571 | params.padding = new int[]{50, 50, 50, 50}; |
570 | } | 572 | } |
571 | }) | 573 | }) |
572 | .setText("当前无网络,请检查网络设置") | 574 | .setText("当前无网络,请检查网络设置") |
573 | .setNegative("继续使用", null) | 575 | .setNegative("继续使用", null) |
574 | .setPositive("设置网络", new View.OnClickListener() { | 576 | .setPositive("设置网络", new View.OnClickListener() { |
575 | @Override | 577 | @Override |
576 | public void onClick(View v) { | 578 | public void onClick(View v) { |
577 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 579 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
578 | mContext.startActivity(intent); | 580 | mContext.startActivity(intent); |
579 | } | 581 | } |
580 | }) | 582 | }) |
581 | .show(); | 583 | .show(); |
582 | } | 584 | } |
583 | }); | 585 | }); |
584 | } | 586 | } |
585 | //修改保卡信息地址 | 587 | //修改保卡信息地址 |
586 | public void changecardadressinfo(final Context mContext, int userId, final String customerPhone, String authCode, final String customerAddress) { | 588 | public void changecardadressinfo(final Context mContext, int userId, final String customerPhone, String authCode, final String customerAddress) { |
587 | RequestParams params = new RequestParams(); | 589 | RequestParams params = new RequestParams(); |
588 | params.put("userId", userId); | 590 | params.put("userId", userId); |
589 | params.put("customerPhone", customerPhone); | 591 | params.put("customerPhone", customerPhone); |
590 | params.put("authCode", authCode); | 592 | params.put("authCode", authCode); |
591 | params.put("customerAddress", customerAddress); | 593 | params.put("customerAddress", customerAddress); |
592 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 594 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
593 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 595 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
594 | @Override | 596 | @Override |
595 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 597 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
596 | try { | 598 | try { |
597 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 599 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
598 | String status = jsonObject.optString("status"); | 600 | String status = jsonObject.optString("status"); |
599 | if (status.equals("1")) { | 601 | if (status.equals("1")) { |
600 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 602 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
601 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); | 603 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); |
602 | ((Activity) mContext).finish(); | 604 | ((Activity) mContext).finish(); |
603 | } | 605 | } |
604 | } catch (JSONException e) { | 606 | } catch (JSONException e) { |
605 | e.printStackTrace(); | 607 | e.printStackTrace(); |
606 | } | 608 | } |
607 | } | 609 | } |
608 | 610 | ||
609 | @Override | 611 | @Override |
610 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 612 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
611 | Log.e("test", "onFailure" + new String(bytes)); | 613 | Log.e("test", "onFailure" + new String(bytes)); |
612 | new CircleDialog.Builder((FragmentActivity) mContext) | 614 | new CircleDialog.Builder((FragmentActivity) mContext) |
613 | .setCanceledOnTouchOutside(false) | 615 | .setCanceledOnTouchOutside(false) |
614 | .setCancelable(false) | 616 | .setCancelable(false) |
615 | .setWidth(0.5f) | 617 | .setWidth(0.5f) |
616 | .configText(new ConfigText() { | 618 | .configText(new ConfigText() { |
617 | @Override | 619 | @Override |
618 | public void onConfig(TextParams params) { | 620 | public void onConfig(TextParams params) { |
619 | params.gravity = Gravity.CENTER; | 621 | params.gravity = Gravity.CENTER; |
620 | params.padding = new int[]{50, 50, 50, 50}; | 622 | params.padding = new int[]{50, 50, 50, 50}; |
621 | } | 623 | } |
622 | }) | 624 | }) |
623 | .setText("当前无网络,请检查网络设置") | 625 | .setText("当前无网络,请检查网络设置") |
624 | .setNegative("继续使用", null) | 626 | .setNegative("继续使用", null) |
625 | .setPositive("设置网络", new View.OnClickListener() { | 627 | .setPositive("设置网络", new View.OnClickListener() { |
626 | @Override | 628 | @Override |
627 | public void onClick(View v) { | 629 | public void onClick(View v) { |
628 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 630 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
629 | mContext.startActivity(intent); | 631 | mContext.startActivity(intent); |
630 | } | 632 | } |
631 | }) | 633 | }) |
632 | .show(); | 634 | .show(); |
633 | } | 635 | } |
634 | }); | 636 | }); |
635 | } | 637 | } |
636 | //验证是否保卡信息 | 638 | //验证是否保卡信息 |
637 | public void cardinfocheck(final Context mContext, int userId, final Handler handler) { | 639 | public void cardinfocheck(final Context mContext, int userId, final Handler handler) { |
638 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 640 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
639 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { | 641 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { |
640 | @Override | 642 | @Override |
641 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 643 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
642 | Log.e("test", "---" + new String(arg2)); | 644 | Log.e("test", "---" + new String(arg2)); |
643 | Message msg = Message.obtain(); | 645 | Message msg = Message.obtain(); |
644 | msg.what = HttpCode.CHECKCARD; | 646 | msg.what = HttpCode.CHECKCARD; |
645 | msg.obj = new String(arg2); | 647 | msg.obj = new String(arg2); |
646 | handler.sendMessage(msg); | 648 | handler.sendMessage(msg); |
647 | } | 649 | } |
648 | 650 | ||
649 | @Override | 651 | @Override |
650 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 652 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
651 | new CircleDialog.Builder((FragmentActivity) mContext) | 653 | new CircleDialog.Builder((FragmentActivity) mContext) |
652 | .setCanceledOnTouchOutside(false) | 654 | .setCanceledOnTouchOutside(false) |
653 | .setCancelable(false) | 655 | .setCancelable(false) |
654 | .configText(new ConfigText() { | 656 | .configText(new ConfigText() { |
655 | @Override | 657 | @Override |
656 | public void onConfig(TextParams params) { | 658 | public void onConfig(TextParams params) { |
657 | params.gravity = Gravity.CENTER; | 659 | params.gravity = Gravity.CENTER; |
658 | params.padding = new int[]{250, 50, 250, 50}; | 660 | params.padding = new int[]{250, 50, 250, 50}; |
659 | } | 661 | } |
660 | }) | 662 | }) |
661 | .setText("当前无网络,请检查网络设置") | 663 | .setText("当前无网络,请检查网络设置") |
662 | .setNegative("取消", null) | 664 | .setNegative("取消", null) |
663 | .setPositive("确定", new View.OnClickListener() { | 665 | .setPositive("确定", new View.OnClickListener() { |
664 | @Override | 666 | @Override |
665 | public void onClick(View v) { | 667 | public void onClick(View v) { |
666 | Intent intent = new Intent("/"); | 668 | Intent intent = new Intent("/"); |
667 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); | 669 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); |
668 | intent.setComponent(cm); | 670 | intent.setComponent(cm); |
669 | intent.setAction("android.intent.action.VIEW"); | 671 | intent.setAction("android.intent.action.VIEW"); |
670 | ((Activity) mContext).startActivityForResult( intent , 0); | 672 | ((Activity) mContext).startActivityForResult( intent , 0); |
671 | } | 673 | } |
672 | }) | 674 | }) |
673 | .show(); | 675 | .show(); |
674 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 676 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
675 | } | 677 | } |
676 | }); | 678 | }); |
677 | } | 679 | } |
678 | 680 | ||
679 | ///获取年级 | 681 | ///获取年级 |
680 | public void getgrade(final Context mContext, final Handler handler) { | 682 | public void getgrade(final Context mContext, final Handler handler) { |
681 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 683 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
682 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 684 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
683 | @Override | 685 | @Override |
684 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 686 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
685 | Log.e("test", "年级" + new String(arg2)); | 687 | Log.e("test", "年级" + new String(arg2)); |
686 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 688 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
687 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 689 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
688 | for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { | 690 | for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { |
689 | String name = gradeInfo.getData().get(i).getName(); | 691 | String name = gradeInfo.getData().get(i).getName(); |
690 | int id = gradeInfo.getData().get(i).getId(); | 692 | int id = gradeInfo.getData().get(i).getId(); |
691 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 693 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
692 | for (int j = 0; j < gradeinfoList.size(); j++) { | 694 | for (int j = 0; j < gradeinfoList.size(); j++) { |
693 | String secondname = gradeinfoList.get(j).getName(); | 695 | String secondname = gradeinfoList.get(j).getName(); |
694 | int secondid = gradeinfoList.get(j).getId(); | 696 | int secondid = gradeinfoList.get(j).getId(); |
695 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 697 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
696 | dataBean.setName(secondname); | 698 | dataBean.setName(secondname); |
697 | dataBean.setId(secondid); | 699 | dataBean.setId(secondid); |
698 | gradeInfoLists.add(dataBean); | 700 | gradeInfoLists.add(dataBean); |
699 | } | 701 | } |
700 | 702 | ||
701 | } | 703 | } |
702 | 704 | ||
703 | Message message = Message.obtain(); | 705 | Message message = Message.obtain(); |
704 | message.what = HttpCode.GRADER; | 706 | message.what = HttpCode.GRADER; |
705 | message.obj = gradeInfoLists; | 707 | message.obj = gradeInfoLists; |
706 | handler.sendMessage(message); | 708 | handler.sendMessage(message); |
707 | 709 | ||
708 | 710 | ||
709 | } | 711 | } |
710 | 712 | ||
711 | @Override | 713 | @Override |
712 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 714 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
713 | new CircleDialog.Builder((FragmentActivity) mContext) | 715 | new CircleDialog.Builder((FragmentActivity) mContext) |
714 | .setCanceledOnTouchOutside(false) | 716 | .setCanceledOnTouchOutside(false) |
715 | .setCancelable(false) | 717 | .setCancelable(false) |
716 | .setWidth(0.5f) | 718 | .setWidth(0.5f) |
717 | .configText(new ConfigText() { | 719 | .configText(new ConfigText() { |
718 | @Override | 720 | @Override |
719 | public void onConfig(TextParams params) { | 721 | public void onConfig(TextParams params) { |
720 | params.gravity = Gravity.CENTER; | 722 | params.gravity = Gravity.CENTER; |
721 | params.padding = new int[]{50, 50, 50, 50}; | 723 | params.padding = new int[]{50, 50, 50, 50}; |
722 | } | 724 | } |
723 | }) | 725 | }) |
724 | .setText("当前无网络,请检查网络设置") | 726 | .setText("当前无网络,请检查网络设置") |
725 | .setNegative("继续使用", null) | 727 | .setNegative("继续使用", null) |
726 | .setPositive("设置网络", new View.OnClickListener() { | 728 | .setPositive("设置网络", new View.OnClickListener() { |
727 | @Override | 729 | @Override |
728 | public void onClick(View v) { | 730 | public void onClick(View v) { |
729 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 731 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
730 | mContext.startActivity(intent); | 732 | mContext.startActivity(intent); |
731 | } | 733 | } |
732 | }) | 734 | }) |
733 | .show(); | 735 | .show(); |
734 | } | 736 | } |
735 | }); | 737 | }); |
736 | } | 738 | } |
737 | 739 | ||
738 | /** | 740 | /** |
739 | * 获取学校 | 741 | * 获取学校 |
740 | * @param mContext | 742 | * @param mContext |
741 | * @param regionId | 743 | * @param regionId |
742 | * @param gradeId | 744 | * @param gradeId |
743 | * @param handler | 745 | * @param handler |
744 | */ | 746 | */ |
745 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 747 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
746 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 748 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
747 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 749 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
748 | @Override | 750 | @Override |
749 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 751 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
750 | Log.e("test", "学校" + new String(arg2)); | 752 | Log.e("test", "学校" + new String(arg2)); |
751 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 753 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
752 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 754 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
753 | Message message = Message.obtain(); | 755 | Message message = Message.obtain(); |
754 | message.what = HttpCode.SCHOOL; | 756 | message.what = HttpCode.SCHOOL; |
755 | message.obj = schoolInfoBeanList; | 757 | message.obj = schoolInfoBeanList; |
756 | handler.sendMessage(message); | 758 | handler.sendMessage(message); |
757 | 759 | ||
758 | } | 760 | } |
759 | 761 | ||
760 | @Override | 762 | @Override |
761 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 763 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
762 | new CircleDialog.Builder((FragmentActivity) mContext) | 764 | new CircleDialog.Builder((FragmentActivity) mContext) |
763 | .setCanceledOnTouchOutside(false) | 765 | .setCanceledOnTouchOutside(false) |
764 | .setCancelable(false) | 766 | .setCancelable(false) |
765 | .setWidth(0.5f) | 767 | .setWidth(0.5f) |
766 | .configText(new ConfigText() { | 768 | .configText(new ConfigText() { |
767 | @Override | 769 | @Override |
768 | public void onConfig(TextParams params) { | 770 | public void onConfig(TextParams params) { |
769 | params.gravity = Gravity.CENTER; | 771 | params.gravity = Gravity.CENTER; |
770 | params.padding = new int[]{50, 50, 50, 50}; | 772 | params.padding = new int[]{50, 50, 50, 50}; |
771 | } | 773 | } |
772 | }) | 774 | }) |
773 | .setText("当前无网络,请检查网络设置") | 775 | .setText("当前无网络,请检查网络设置") |
774 | .setNegative("继续使用", null) | 776 | .setNegative("继续使用", null) |
775 | .setPositive("设置网络", new View.OnClickListener() { | 777 | .setPositive("设置网络", new View.OnClickListener() { |
776 | @Override | 778 | @Override |
777 | public void onClick(View v) { | 779 | public void onClick(View v) { |
778 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 780 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
779 | mContext.startActivity(intent); | 781 | mContext.startActivity(intent); |
780 | } | 782 | } |
781 | }) | 783 | }) |
782 | .show(); | 784 | .show(); |
783 | } | 785 | } |
784 | }); | 786 | }); |
785 | } | 787 | } |
786 | 788 | ||
787 | 789 | ||
788 | 790 | ||
791 | /** | ||
792 | * 获取个人信息 | ||
793 | * @param mContext | ||
794 | * @param userId | ||
795 | * @param handler | ||
796 | */ | ||
797 | public void getpresonalinfo(final Context mContext, int userId, final Handler handler) { | ||
798 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | ||
799 | false, true, null); | ||
800 | HttpClient.getInstance().addHeader("Accept", "application/json"); | ||
801 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { | ||
802 | @Override | ||
803 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
804 | closeProgress(); | ||
805 | Log.e("test", "个人信息" + new String(arg2)); | ||
806 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | ||
807 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | ||
808 | Message message = Message.obtain(); | ||
809 | message.what = HttpCode.GETINFO; | ||
810 | message.obj = pesonalInfoBeanList; | ||
811 | handler.sendMessage(message); | ||
812 | |||
813 | } | ||
814 | |||
815 | @Override | ||
816 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
817 | closeProgress(); | ||
818 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
819 | .setCanceledOnTouchOutside(false) | ||
820 | .setCancelable(false) | ||
821 | .setWidth(0.5f) | ||
822 | .configText(new ConfigText() { | ||
823 | @Override | ||
824 | public void onConfig(TextParams params) { | ||
825 | params.gravity = Gravity.CENTER; | ||
826 | params.padding = new int[]{50, 50, 50, 50}; | ||
827 | } | ||
828 | }) | ||
829 | .setText("当前无网络,请检查网络设置") | ||
830 | .setNegative("继续使用", null) | ||
831 | .setPositive("设置网络", new View.OnClickListener() { | ||
832 | @Override | ||
833 | public void onClick(View v) { | ||
834 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
835 | mContext.startActivity(intent); | ||
836 | } | ||
837 | }) | ||
838 | .show(); | ||
839 | } | ||
840 | }); | ||
841 | } | ||
842 | //修改个人信息 | ||
843 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { | ||
844 | Gson gson = new Gson(); | ||
845 | String jsonObject = gson.toJson(object); | ||
846 | Log.e("test", "onSuccess" + jsonObject); | ||
847 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | ||
848 | false, true, null); | ||
849 | ByteArrayEntity entity = null; | ||
850 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | ||
851 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | ||
852 | |||
853 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
854 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { | ||
855 | @Override | ||
856 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
857 | super.onSuccess(statusCode, headers, response); | ||
858 | closeProgress(); | ||
859 | String status = response.optString("status"); | ||
860 | if (status.equals("1")) { | ||
861 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | ||
862 | ((Activity) mContext).finish(); | ||
863 | } | ||
864 | Log.e("test", "onSuccess" + response); | ||
865 | |||
866 | } | ||
867 | |||
868 | @Override | ||
869 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
870 | super.onFailure(statusCode, headers, throwable, errorResponse); | ||
871 | closeProgress(); | ||
872 | Log.e("test", "onFailure" + errorResponse); | ||
873 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
874 | .setCanceledOnTouchOutside(false) | ||
875 | .setCancelable(false) | ||
876 | .setWidth(0.5f) | ||
877 | .configText(new ConfigText() { | ||
878 | @Override | ||
879 | public void onConfig(TextParams params) { | ||
880 | params.gravity = Gravity.CENTER; | ||
881 | params.padding = new int[]{50, 50, 50, 50}; | ||
882 | } | ||
883 | }) | ||
884 | .setText("当前无网络,请检查网络设置") | ||
885 | .setNegative("继续使用", null) | ||
886 | .setPositive("设置网络", new View.OnClickListener() { | ||
887 | @Override | ||
888 | public void onClick(View v) { | ||
889 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
890 | mContext.startActivity(intent); | ||
891 | } | ||
892 | }) | ||
893 | .show(); | ||
894 | } | ||
895 | |||
896 | }); | ||
897 | } | ||
898 | //修改个性签名 | ||
899 | public void changsignature(final Context mContext, int userId, final String signature) { | ||
900 | RequestParams params = new RequestParams(); | ||
901 | params.put("userId", userId); | ||
902 | params.put("signature", signature); | ||
903 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
904 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | ||
905 | @Override | ||
906 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | ||
907 | try { | ||
908 | JSONObject jsonObject = new JSONObject(new String(bytes)); | ||
909 | String status = jsonObject.optString("status"); | ||
910 | if (status.equals("1")) { | ||
911 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | ||
912 | } | ||
913 | } catch (JSONException e) { | ||
914 | e.printStackTrace(); | ||
915 | } | ||
916 | } | ||
917 | |||
918 | @Override | ||
919 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | ||
920 | Log.e("test", "onFailure" + new String(bytes)); | ||
921 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
922 | .setCanceledOnTouchOutside(false) | ||
923 | .setCancelable(false) | ||
924 | .setWidth(0.5f) | ||
925 | .configText(new ConfigText() { | ||
926 | @Override | ||
927 | public void onConfig(TextParams params) { | ||
928 | params.gravity = Gravity.CENTER; | ||
929 | params.padding = new int[]{50, 50, 50, 50}; | ||
930 | } | ||
931 | }) | ||
932 | .setText("当前无网络,请检查网络设置") | ||
933 | .setNegative("继续使用", null) | ||
934 | .setPositive("设置网络", new View.OnClickListener() { | ||
935 | @Override | ||
936 | public void onClick(View v) { | ||
937 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
938 | mContext.startActivity(intent); | ||
939 | } | ||
940 | }) | ||
941 | .show(); | ||
942 | } | ||
943 | }); | ||
944 | } | ||
945 | |||
946 | /** | ||
947 | * 获取个性签名 | ||
948 | * @param mContext | ||
949 | * @param userId | ||
950 | * @param handler | ||
951 | */ | ||
952 | public void getsignatures(final Context mContext,int userId , final Handler handler) { | ||
953 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
954 | HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { | ||
955 | @Override | ||
956 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | ||
957 | Log.e("test", "个性签名" + new String(arg2)); | ||
958 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | ||
959 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | ||
960 | Message message = Message.obtain(); | ||
961 | message.what = HttpCode.SIGN; | ||
962 | message.obj = signInfoBeanList; | ||
963 | handler.sendMessage(message); | ||
964 | |||
965 | } | ||
966 | |||
967 | @Override | ||
968 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | ||
969 | Log.e("test", "失败原因" + arg3); | ||
970 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
971 | .setCanceledOnTouchOutside(false) | ||
972 | .setCancelable(false) | ||
973 | .setWidth(0.5f) | ||
974 | .configText(new ConfigText() { | ||
975 | @Override | ||
976 | public void onConfig(TextParams params) { | ||
977 | params.gravity = Gravity.CENTER; | ||
978 | params.padding = new int[]{50, 50, 50, 50}; | ||
979 | } | ||
980 | }) | ||
981 | .setText("当前无网络,请检查网络设置") | ||
982 | .setNegative("继续使用", null) | ||
983 | .setPositive("设置网络", new View.OnClickListener() { | ||
984 | @Override | ||
985 | public void onClick(View v) { | ||
986 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
987 | mContext.startActivity(intent); | ||
988 | } | ||
989 | }) | ||
990 | .show(); | ||
991 | } | ||
992 | }); | ||
993 | } | ||
994 | |||
995 | |||
996 | |||
789 | 997 | ||
790 | 998 | ||
791 | ///省级接口 | 999 | ///省级接口 |
792 | public void provices(final Context mContext, final Handler handler) { | 1000 | public void provices(final Context mContext, final Handler handler) { |
793 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1001 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
794 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1002 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
795 | @Override | 1003 | @Override |
796 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1004 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
797 | Log.e("test", "省" + new String(arg2)); | 1005 | Log.e("test", "省" + new String(arg2)); |
798 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1006 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
799 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1007 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
800 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1008 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
801 | Message message = Message.obtain(); | 1009 | Message message = Message.obtain(); |
802 | message.what = HttpCode.PROVICES; | 1010 | message.what = HttpCode.PROVICES; |
803 | message.obj = provincesBeanList; | 1011 | message.obj = provincesBeanList; |
804 | handler.sendMessage(message); | 1012 | handler.sendMessage(message); |
805 | 1013 | ||
806 | } | 1014 | } |
807 | 1015 | ||
808 | @Override | 1016 | @Override |
809 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1017 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
810 | new CircleDialog.Builder((FragmentActivity) mContext) | 1018 | new CircleDialog.Builder((FragmentActivity) mContext) |
811 | .setCanceledOnTouchOutside(false) | 1019 | .setCanceledOnTouchOutside(false) |
812 | .setCancelable(false) | 1020 | .setCancelable(false) |
813 | .setWidth(0.5f) | 1021 | .setWidth(0.5f) |
814 | .configText(new ConfigText() { | 1022 | .configText(new ConfigText() { |
815 | @Override | 1023 | @Override |
816 | public void onConfig(TextParams params) { | 1024 | public void onConfig(TextParams params) { |
817 | params.gravity = Gravity.CENTER; | 1025 | params.gravity = Gravity.CENTER; |
818 | params.padding = new int[]{50, 50, 50, 50}; | 1026 | params.padding = new int[]{50, 50, 50, 50}; |
819 | } | 1027 | } |
820 | }) | 1028 | }) |
821 | .setText("当前无网络,请检查网络设置") | 1029 | .setText("当前无网络,请检查网络设置") |
822 | .setNegative("继续使用", null) | 1030 | .setNegative("继续使用", null) |
823 | .setPositive("设置网络", new View.OnClickListener() { | 1031 | .setPositive("设置网络", new View.OnClickListener() { |
824 | @Override | 1032 | @Override |
825 | public void onClick(View v) { | 1033 | public void onClick(View v) { |
826 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1034 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
827 | mContext.startActivity(intent); | 1035 | mContext.startActivity(intent); |
828 | } | 1036 | } |
829 | }) | 1037 | }) |
830 | .show(); | 1038 | .show(); |
831 | } | 1039 | } |
832 | }); | 1040 | }); |
833 | } | 1041 | } |
834 | 1042 | ||
835 | //市级接口 | 1043 | //市级接口 |
836 | public void cityinfo(final Context mContext, long regionId , final Handler handler) { | 1044 | public void cityinfo(final Context mContext, long regionId , final Handler handler) { |
837 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1045 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
838 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1046 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
839 | @Override | 1047 | @Override |
840 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1048 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
841 | Log.e("test", "市" + new String(arg2)); | 1049 | Log.e("test", "市" + new String(arg2)); |
842 | Gson gson = new Gson(); | 1050 | Gson gson = new Gson(); |
843 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1051 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
844 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1052 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
845 | Message message = Message.obtain(); | 1053 | Message message = Message.obtain(); |
846 | message.what = HttpCode.CITYS; | 1054 | message.what = HttpCode.CITYS; |
847 | message.obj = cityInfoBeanList; | 1055 | message.obj = cityInfoBeanList; |
848 | handler.sendMessage(message); | 1056 | handler.sendMessage(message); |
849 | 1057 | ||
850 | 1058 | ||
851 | } | 1059 | } |
852 | 1060 | ||
853 | @Override | 1061 | @Override |
854 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1062 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
855 | new CircleDialog.Builder((FragmentActivity) mContext) | 1063 | new CircleDialog.Builder((FragmentActivity) mContext) |
856 | .setCanceledOnTouchOutside(false) | 1064 | .setCanceledOnTouchOutside(false) |
857 | .setCancelable(false) | 1065 | .setCancelable(false) |
858 | .setWidth(0.5f) | 1066 | .setWidth(0.5f) |
859 | .configText(new ConfigText() { | 1067 | .configText(new ConfigText() { |
860 | @Override | 1068 | @Override |
861 | public void onConfig(TextParams params) { | 1069 | public void onConfig(TextParams params) { |
862 | params.gravity = Gravity.CENTER; | 1070 | params.gravity = Gravity.CENTER; |
863 | params.padding = new int[]{50, 50, 50, 50}; | 1071 | params.padding = new int[]{50, 50, 50, 50}; |
864 | } | 1072 | } |
865 | }) | 1073 | }) |
866 | .setText("当前无网络,请检查网络设置") | 1074 | .setText("当前无网络,请检查网络设置") |
867 | .setNegative("继续使用", null) | 1075 | .setNegative("继续使用", null) |
868 | .setPositive("设置网络", new View.OnClickListener() { | 1076 | .setPositive("设置网络", new View.OnClickListener() { |
869 | @Override | 1077 | @Override |
870 | public void onClick(View v) { | 1078 | public void onClick(View v) { |
871 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1079 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
872 | mContext.startActivity(intent); | 1080 | mContext.startActivity(intent); |
873 | } | 1081 | } |
874 | }) | 1082 | }) |
875 | .show(); | 1083 | .show(); |
876 | } | 1084 | } |
877 | }); | 1085 | }); |
878 | } | 1086 | } |
879 | 1087 | ||
880 | //区县级接口 | 1088 | //区县级接口 |
881 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1089 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
882 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1090 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
883 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1091 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
884 | @Override | 1092 | @Override |
885 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1093 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
886 | Log.e("test", "区" + new String(arg2)); | 1094 | Log.e("test", "区" + new String(arg2)); |
887 | Gson gson = new Gson(); | 1095 | Gson gson = new Gson(); |
888 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1096 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
889 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1097 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
890 | Message message = Message.obtain(); | 1098 | Message message = Message.obtain(); |
891 | message.what = HttpCode.COUNTRY; | 1099 | message.what = HttpCode.COUNTRY; |
892 | message.obj = countyInfoInfoBeanList; | 1100 | message.obj = countyInfoInfoBeanList; |
893 | handler.sendMessage(message); | 1101 | handler.sendMessage(message); |
894 | 1102 | ||
895 | 1103 | ||
896 | } | 1104 | } |
897 | 1105 | ||
898 | @Override | 1106 | @Override |
899 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1107 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
900 | new CircleDialog.Builder((FragmentActivity) mContext) | 1108 | new CircleDialog.Builder((FragmentActivity) mContext) |
901 | .setCanceledOnTouchOutside(false) | 1109 | .setCanceledOnTouchOutside(false) |
902 | .setCancelable(false) | 1110 | .setCancelable(false) |
903 | .setWidth(0.5f) | 1111 | .setWidth(0.5f) |
904 | .configText(new ConfigText() { | 1112 | .configText(new ConfigText() { |
905 | @Override | 1113 | @Override |
906 | public void onConfig(TextParams params) { | 1114 | public void onConfig(TextParams params) { |
907 | params.gravity = Gravity.CENTER; | 1115 | params.gravity = Gravity.CENTER; |
908 | params.padding = new int[]{50, 50, 50, 50}; | 1116 | params.padding = new int[]{50, 50, 50, 50}; |
909 | } | 1117 | } |
910 | }) | 1118 | }) |
911 | .setText("当前无网络,请检查网络设置") | 1119 | .setText("当前无网络,请检查网络设置") |
912 | .setNegative("继续使用", null) | 1120 | .setNegative("继续使用", null) |
913 | .setPositive("设置网络", new View.OnClickListener() { | 1121 | .setPositive("设置网络", new View.OnClickListener() { |
914 | @Override | 1122 | @Override |
915 | public void onClick(View v) { | 1123 | public void onClick(View v) { |
916 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1124 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
917 | mContext.startActivity(intent); | 1125 | mContext.startActivity(intent); |
918 | } | 1126 | } |
919 | }) | 1127 | }) |
920 | .show(); | 1128 | .show(); |
921 | } | 1129 | } |
922 | }); | 1130 | }); |
923 | } | 1131 | } |
924 | 1132 | ||
925 | 1133 | ||
926 | private void closeProgress() { | 1134 | private void closeProgress() { |
927 | try { | 1135 | try { |
928 | if (mProgress != null) { | 1136 | if (mProgress != null) { |
929 | mProgress.dismiss(); | 1137 | mProgress.dismiss(); |
930 | mProgress = null; | 1138 | mProgress = null; |
931 | } | 1139 | } |
932 | } catch (Exception e) { | 1140 | } catch (Exception e) { |
933 | e.printStackTrace(); | 1141 | e.printStackTrace(); |
934 | } | 1142 | } |
935 | } | 1143 | } |
936 | 1144 | ||
937 | } | 1145 | } |
938 | 1146 |
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 schoolUrl = GetDomain()+"/school/get";//学校 | 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
16 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | ||
30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 | ||
31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | ||
32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | ||
33 | |||
34 | |||
29 | 35 | ||
30 | } | 36 | } |
31 | 37 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/ChangeInfo.java
File was created | 1 | package com.hjx.personalcenter.model; | |
2 | |||
3 | import java.io.Serializable; | ||
4 | |||
5 | /** | ||
6 | * Created by h on 2017/8/23. | ||
7 | */ | ||
8 | |||
9 | public class ChangeInfo implements Serializable{ | ||
10 | |||
11 | /** | ||
12 | * id : 688 | ||
13 | * nickname : 1688kkkkkkkkk | ||
14 | * gender : 1 | ||
15 | * birthday : 1505209000000 | ||
16 | * contact : {"qq":"1666600"} | ||
17 | * regionName : 闵行区 | ||
18 | * regionId : 310112 | ||
19 | * gradeId : 9 | ||
20 | * school : {"schoolId":499705} | ||
21 | */ | ||
22 | |||
23 | private String id; | ||
24 | private String nickname; | ||
25 | private String gender; | ||
26 | private String birthday; | ||
27 | private ContactBean contact; | ||
28 | private String regionName; | ||
29 | private int regionId; | ||
30 | private int gradeId; | ||
31 | private SchoolBean school; | ||
32 | |||
33 | public String getId() { | ||
34 | return id; | ||
35 | } | ||
36 | |||
37 | public void setId(String id) { | ||
38 | this.id = id; | ||
39 | } | ||
40 | |||
41 | public String getNickname() { | ||
42 | return nickname; | ||
43 | } | ||
44 | |||
45 | public void setNickname(String nickname) { | ||
46 | this.nickname = nickname; | ||
47 | } | ||
48 | |||
49 | public String getGender() { | ||
50 | return gender; | ||
51 | } | ||
52 | |||
53 | public void setGender(String gender) { | ||
54 | this.gender = gender; | ||
55 | } | ||
56 | |||
57 | public String getBirthday() { | ||
58 | return birthday; | ||
59 | } | ||
60 | |||
61 | public void setBirthday(String birthday) { | ||
62 | this.birthday = birthday; | ||
63 | } | ||
64 | |||
65 | public ContactBean getContact() { | ||
66 | return contact; | ||
67 | } | ||
68 | |||
69 | public void setContact(ContactBean contact) { | ||
70 | this.contact = contact; | ||
71 | } | ||
72 | |||
73 | public String getRegionName() { | ||
74 | return regionName; | ||
75 | } | ||
76 | |||
77 | public void setRegionName(String regionName) { | ||
78 | this.regionName = regionName; | ||
79 | } | ||
80 | |||
81 | public int getRegionId() { | ||
82 | return regionId; | ||
83 | } | ||
84 | |||
85 | public void setRegionId(int regionId) { | ||
86 | this.regionId = regionId; | ||
87 | } | ||
88 | |||
89 | public int getGradeId() { | ||
90 | return gradeId; | ||
91 | } | ||
92 | |||
93 | public void setGradeId(int gradeId) { | ||
94 | this.gradeId = gradeId; | ||
95 | } | ||
96 | |||
97 | public SchoolBean getSchool() { | ||
98 | return school; | ||
99 | } | ||
100 | |||
101 | public void setSchool(SchoolBean school) { | ||
102 | this.school = school; | ||
103 | } | ||
104 | |||
105 | public static class ContactBean { | ||
106 | /** | ||
107 | * qq : 1666600 | ||
108 | */ | ||
109 | |||
110 | private String qq; | ||
111 | |||
112 | public String getQq() { | ||
113 | return qq; | ||
114 | } | ||
115 | |||
116 | public void setQq(String qq) { | ||
117 | this.qq = qq; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | public static class SchoolBean { | ||
122 | /** | ||
123 | * schoolId : 499705 | ||
124 | */ | ||
125 | |||
126 | private long schoolId; | ||
127 | |||
128 | public long getSchoolId() { | ||
129 | return schoolId; | ||
130 | } | ||
131 | |||
132 | public void setSchoolId(long schoolId) { | ||
133 | this.schoolId = schoolId; | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/SchoolInfo.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/8/21. | 6 | * Created by h on 2017/8/21. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class SchoolInfo { | 9 | public class SchoolInfo { |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * status : 1 | 12 | * status : 1 |
13 | * pageSize : 0 | 13 | * pageSize : 0 |
14 | * data : [{"schoolName":"自强学校","schoolId":554606},{"schoolName":"石家庄十三中","schoolId":560171},{"schoolName":"石家庄五十中","schoolId":560172},{"schoolName":"石家庄二十二中","schoolId":561412},{"schoolName":"石家庄二十四中","schoolId":561413},{"schoolName":"石家庄四十五中","schoolId":561414},{"schoolName":"石家庄五十二中","schoolId":561415},{"schoolName":"石家庄五十三中","schoolId":561416},{"schoolName":"石家庄五十一中","schoolId":561417},{"schoolName":"国化工十二建公学校","schoolId":562347},{"schoolName":"建一局六公司子弟学校","schoolId":562540},{"schoolName":"石家庄八十二中(化肥厂学校)","schoolId":562966},{"schoolName":"固安一中","schoolId":605836},{"schoolName":"石家庄市二十一中","schoolId":647584}] | 14 | * data : [{"schoolName":"自强学校","schoolId":554606},{"schoolName":"石家庄十三中","schoolId":560171},{"schoolName":"石家庄五十中","schoolId":560172},{"schoolName":"石家庄二十二中","schoolId":561412},{"schoolName":"石家庄二十四中","schoolId":561413},{"schoolName":"石家庄四十五中","schoolId":561414},{"schoolName":"石家庄五十二中","schoolId":561415},{"schoolName":"石家庄五十三中","schoolId":561416},{"schoolName":"石家庄五十一中","schoolId":561417},{"schoolName":"国化工十二建公学校","schoolId":562347},{"schoolName":"建一局六公司子弟学校","schoolId":562540},{"schoolName":"石家庄八十二中(化肥厂学校)","schoolId":562966},{"schoolName":"固安一中","schoolId":605836},{"schoolName":"石家庄市二十一中","schoolId":647584}] |
15 | * msg : success | 15 | * msg : success |
16 | * pageNum : 0 | 16 | * pageNum : 0 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | private int status; | 19 | private int status; |
20 | private int pageSize; | 20 | private int pageSize; |
21 | private String msg; | 21 | private String msg; |
22 | private int pageNum; | 22 | private int pageNum; |
23 | private List<DataBean> data; | 23 | private List<DataBean> data; |
24 | 24 | ||
25 | public int getStatus() { | 25 | public int getStatus() { |
26 | return status; | 26 | return status; |
27 | } | 27 | } |
28 | 28 | ||
29 | public void setStatus(int status) { | 29 | public void setStatus(int status) { |
30 | this.status = status; | 30 | this.status = status; |
31 | } | 31 | } |
32 | 32 | ||
33 | public int getPageSize() { | 33 | public int getPageSize() { |
34 | return pageSize; | 34 | return pageSize; |
35 | } | 35 | } |
36 | 36 | ||
37 | public void setPageSize(int pageSize) { | 37 | public void setPageSize(int pageSize) { |
38 | this.pageSize = pageSize; | 38 | this.pageSize = pageSize; |
39 | } | 39 | } |
40 | 40 | ||
41 | public String getMsg() { | 41 | public String getMsg() { |
42 | return msg; | 42 | return msg; |
43 | } | 43 | } |
44 | 44 | ||
45 | public void setMsg(String msg) { | 45 | public void setMsg(String msg) { |
46 | this.msg = msg; | 46 | this.msg = msg; |
47 | } | 47 | } |
48 | 48 | ||
49 | public int getPageNum() { | 49 | public int getPageNum() { |
50 | return pageNum; | 50 | return pageNum; |
51 | } | 51 | } |
52 | 52 | ||
53 | public void setPageNum(int pageNum) { | 53 | public void setPageNum(int pageNum) { |
54 | this.pageNum = pageNum; | 54 | this.pageNum = pageNum; |
55 | } | 55 | } |
56 | 56 | ||
57 | public List<DataBean> getData() { | 57 | public List<DataBean> getData() { |
58 | return data; | 58 | return data; |
59 | } | 59 | } |
60 | 60 | ||
61 | public void setData(List<DataBean> data) { | 61 | public void setData(List<DataBean> data) { |
62 | this.data = data; | 62 | this.data = data; |
63 | } | 63 | } |
64 | 64 | ||
65 | public static class DataBean { | 65 | public static class DataBean { |
66 | /** | 66 | /** |
67 | * schoolName : 自强学校 | 67 | * schoolName : 自强学校 |
68 | * schoolId : 554606 | 68 | * schoolId : 554606 |
69 | */ | 69 | */ |
70 | 70 | ||
71 | private String schoolName; | 71 | private String schoolName; |
72 | private int schoolId; | 72 | private long schoolId; |
73 | 73 | ||
74 | public String getSchoolName() { | 74 | public String getSchoolName() { |
75 | return schoolName; | 75 | return schoolName; |
76 | } | 76 | } |
77 | 77 | ||
78 | public void setSchoolName(String schoolName) { | 78 | public void setSchoolName(String schoolName) { |
79 | this.schoolName = schoolName; | 79 | this.schoolName = schoolName; |
80 | } | 80 | } |
81 | 81 | ||
82 | public int getSchoolId() { | 82 | public long getSchoolId() { |
83 | return schoolId; | 83 | return schoolId; |
84 | } | 84 | } |
85 | 85 | ||
86 | public void setSchoolId(int schoolId) { | 86 | public void setSchoolId(int schoolId) { |
87 | this.schoolId = schoolId; | 87 | this.schoolId = schoolId; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/SignInfo.java
File was created | 1 | package com.hjx.personalcenter.model; | |
2 | |||
3 | import java.io.Serializable; | ||
4 | |||
5 | /** | ||
6 | * Created by h on 2017/8/23. | ||
7 | */ | ||
8 | |||
9 | public class SignInfo implements Serializable{ | ||
10 | |||
11 | /** | ||
12 | * status : 1 | ||
13 | * pageSize : 0 | ||
14 | * data : {"userId":645,"signature":"I Love You,WSQ"} | ||
15 | * msg : success | ||
16 | * pageNum : 0 | ||
17 | */ | ||
18 | |||
19 | private int status; | ||
20 | private int pageSize; | ||
21 | private DataBean data; | ||
22 | private String msg; | ||
23 | private int pageNum; | ||
24 | |||
25 | public int getStatus() { | ||
26 | return status; | ||
27 | } | ||
28 | |||
29 | public void setStatus(int status) { | ||
30 | this.status = status; | ||
31 | } | ||
32 | |||
33 | public int getPageSize() { | ||
34 | return pageSize; | ||
35 | } | ||
36 | |||
37 | public void setPageSize(int pageSize) { | ||
38 | this.pageSize = pageSize; | ||
39 | } | ||
40 | |||
41 | public DataBean getData() { | ||
42 | return data; | ||
43 | } | ||
44 | |||
45 | public void setData(DataBean data) { | ||
46 | this.data = data; | ||
47 | } | ||
48 | |||
49 | public String getMsg() { | ||
50 | return msg; | ||
51 | } | ||
52 | |||
53 | public void setMsg(String msg) { | ||
54 | this.msg = msg; | ||
55 | } | ||
56 | |||
57 | public int getPageNum() { | ||
58 | return pageNum; | ||
59 | } | ||
60 | |||
61 | public void setPageNum(int pageNum) { | ||
62 | this.pageNum = pageNum; | ||
63 | } | ||
64 | |||
65 | public static class DataBean { | ||
66 | /** | ||
67 | * userId : 645 | ||
68 | * signature : I Love You,WSQ | ||
69 | */ | ||
70 | |||
71 | private int userId; | ||
72 | private String signature; | ||
73 | |||
74 | public int getUserId() { | ||
75 | return userId; | ||
76 | } | ||
77 | |||
78 | public void setUserId(int userId) { | ||
79 | this.userId = userId; | ||
80 | } | ||
81 | |||
82 | public String getSignature() { | ||
83 | return signature; | ||
84 | } | ||
85 | |||
86 | public void setSignature(String signature) { | ||
87 | this.signature = signature; | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 |
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 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
13 | 13 | ||
14 | <ImageView | 14 | <ImageView |
15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
20 | android:visibility="gone" | 20 | android:visibility="gone" |
21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
22 | 22 | ||
23 | <TextView | 23 | <TextView |
24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
26 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
29 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | 32 | ||
33 | <ImageView | 33 | <ImageView |
34 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
36 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
37 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
38 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_skin" |
39 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
40 | android:padding="10dp" | 40 | android:padding="10dp" |
41 | android:src="@mipmap/shezhi" | 41 | android:src="@mipmap/shezhi" |
42 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
43 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
44 | 44 | ||
45 | <ImageView | 45 | <ImageView |
46 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_skin" |
47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
49 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
50 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
51 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
52 | android:padding="10dp" | 52 | android:padding="10dp" |
53 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/pifu" |
54 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
55 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
56 | 56 | ||
57 | <ImageView | 57 | <ImageView |
58 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
60 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
61 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
62 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
63 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
64 | android:padding="10dp" | 64 | android:padding="10dp" |
65 | android:src="@mipmap/fankui" | 65 | android:src="@mipmap/fankui" |
66 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
68 | 68 | ||
69 | 69 | ||
70 | </RelativeLayout> | 70 | </RelativeLayout> |
71 | 71 | ||
72 | <LinearLayout | 72 | <LinearLayout |
73 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
74 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
75 | 75 | ||
76 | <LinearLayout | 76 | <LinearLayout |
77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
78 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
79 | android:layout_weight="1" | 79 | android:layout_weight="1" |
80 | android:orientation="vertical"> | 80 | android:orientation="vertical"> |
81 | 81 | ||
82 | <LinearLayout | 82 | <LinearLayout |
83 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
85 | android:layout_marginTop="20dp" | 85 | android:layout_marginTop="20dp" |
86 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
87 | <ImageView | 87 | <ImageView |
88 | android:id="@+id/iv_look_card" | 88 | android:id="@+id/iv_look_card" |
89 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
91 | android:padding="10dp" | 91 | android:padding="10dp" |
92 | android:layout_marginLeft="20dp" | 92 | android:layout_marginLeft="20dp" |
93 | android:src="@mipmap/card_icoc" /> | 93 | android:src="@mipmap/card_icoc" /> |
94 | <com.facebook.drawee.view.SimpleDraweeView | 94 | <com.facebook.drawee.view.SimpleDraweeView |
95 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
96 | android:layout_width="60dp" | 96 | android:layout_width="60dp" |
97 | android:layout_height="60dp" | 97 | android:layout_height="60dp" |
98 | android:layout_marginLeft="60dp" | 98 | android:layout_marginLeft="60dp" |
99 | android:layout_gravity="center" | 99 | android:layout_gravity="center" |
100 | fresco:placeholderImage="@mipmap/header_default" | 100 | fresco:placeholderImage="@mipmap/header_default" |
101 | fresco:roundAsCircle="true" | 101 | fresco:roundAsCircle="true" |
102 | fresco:placeholderImageScaleType="fitCenter" /> | 102 | fresco:placeholderImageScaleType="fitCenter" /> |
103 | 103 | ||
104 | <TextView | 104 | <TextView |
105 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
107 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
108 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
109 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
110 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
111 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
112 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
113 | android:text="签到" | 113 | android:text="签到" |
114 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
116 | 116 | ||
117 | </LinearLayout> | 117 | </LinearLayout> |
118 | 118 | ||
119 | <LinearLayout | 119 | <LinearLayout |
120 | android:layout_width="match_parent" | 120 | android:layout_width="match_parent" |
121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
122 | android:layout_marginLeft="20dp" | 122 | android:layout_marginLeft="20dp" |
123 | android:layout_marginTop="20dp" | 123 | android:layout_marginTop="20dp" |
124 | android:orientation="horizontal"> | 124 | android:orientation="horizontal"> |
125 | 125 | ||
126 | <TextView | 126 | <TextView |
127 | android:id="@+id/tv_username" | 127 | android:id="@+id/tv_username" |
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:text="熊巍" | 130 | android:text="熊巍" |
131 | android:textSize="20dp" /> | 131 | android:textSize="20dp" /> |
132 | 132 | ||
133 | <ImageView | 133 | <ImageView |
134 | android:id="@+id/iv_sex" | 134 | android:id="@+id/iv_sex" |
135 | android:layout_width="wrap_content" | 135 | android:layout_width="wrap_content" |
136 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
137 | android:layout_marginLeft="50dp" | 137 | android:layout_marginLeft="50dp" |
138 | android:src="@mipmap/men" /> | 138 | android:src="@mipmap/men" /> |
139 | 139 | ||
140 | </LinearLayout> | 140 | </LinearLayout> |
141 | 141 | ||
142 | <LinearLayout | 142 | <LinearLayout |
143 | android:layout_width="match_parent" | 143 | android:layout_width="match_parent" |
144 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
145 | android:layout_marginLeft="20dp" | 145 | android:layout_marginLeft="20dp" |
146 | android:layout_marginTop="20dp" | 146 | android:layout_marginTop="20dp" |
147 | android:gravity="center" | 147 | android:gravity="center" |
148 | android:orientation="horizontal"> | 148 | android:orientation="horizontal"> |
149 | 149 | ||
150 | <TextView | 150 | <TextView |
151 | android:id="@+id/tv_sign" | 151 | android:id="@+id/tv_sign" |
152 | android:layout_width="0dp" | 152 | android:layout_width="0dp" |
153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
154 | android:layout_weight="5" | 154 | android:layout_weight="5" |
155 | android:text="阿士大夫撒打发士大夫士大夫撒的范德萨" | 155 | android:text="请输入个性签名" |
156 | android:textSize="18sp" /> | 156 | android:textSize="18sp" /> |
157 | 157 | ||
158 | <ImageView | 158 | <ImageView |
159 | android:id="@+id/iv_sign" | 159 | android:id="@+id/iv_sign" |
160 | android:layout_width="0dp" | 160 | android:layout_width="0dp" |
161 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
162 | android:layout_weight="1" | 162 | android:layout_weight="1" |
163 | android:padding="10dp" | 163 | android:padding="10dp" |
164 | android:src="@mipmap/pencil" /> | 164 | android:src="@mipmap/pencil" /> |
165 | 165 | ||
166 | 166 | ||
167 | </LinearLayout> | 167 | </LinearLayout> |
168 | 168 | ||
169 | <View | 169 | <View |
170 | android:layout_width="match_parent" | 170 | android:layout_width="match_parent" |
171 | android:layout_height="0.7dp" | 171 | android:layout_height="0.7dp" |
172 | android:layout_marginTop="20dp" | 172 | android:layout_marginTop="20dp" |
173 | android:background="@color/cutoff_line"> | 173 | android:background="@color/cutoff_line"> |
174 | 174 | ||
175 | </View> | 175 | </View> |
176 | 176 | ||
177 | <LinearLayout | 177 | <LinearLayout |
178 | android:id="@+id/linel_mycuoti" | 178 | android:id="@+id/linel_mycuoti" |
179 | android:layout_width="match_parent" | 179 | android:layout_width="match_parent" |
180 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
181 | android:layout_marginTop="30dp" | 181 | android:layout_marginTop="30dp" |
182 | android:orientation="vertical"> | 182 | android:orientation="vertical"> |
183 | 183 | ||
184 | <LinearLayout | 184 | <LinearLayout |
185 | android:layout_width="match_parent" | 185 | android:layout_width="match_parent" |
186 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
187 | android:gravity="center_vertical" | 187 | android:gravity="center_vertical" |
188 | android:orientation="horizontal"> | 188 | android:orientation="horizontal"> |
189 | 189 | ||
190 | <ImageView | 190 | <ImageView |
191 | android:layout_width="0dp" | 191 | android:layout_width="0dp" |
192 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
193 | android:layout_weight="1" | 193 | android:layout_weight="1" |
194 | android:src="@mipmap/wodecuoti" /> | 194 | android:src="@mipmap/wodecuoti" /> |
195 | 195 | ||
196 | <TextView | 196 | <TextView |
197 | android:layout_width="0dp" | 197 | android:layout_width="0dp" |
198 | android:layout_height="wrap_content" | 198 | android:layout_height="wrap_content" |
199 | android:layout_weight="5" | 199 | android:layout_weight="5" |
200 | android:text="我的错题" | 200 | android:text="我的错题" |
201 | android:textSize="20sp" /> | 201 | android:textSize="20sp" /> |
202 | 202 | ||
203 | <ImageView | 203 | <ImageView |
204 | android:layout_width="0dp" | 204 | android:layout_width="0dp" |
205 | android:layout_height="wrap_content" | 205 | android:layout_height="wrap_content" |
206 | android:layout_weight="1" | 206 | android:layout_weight="1" |
207 | android:src="@mipmap/youjiantou" /> | 207 | android:src="@mipmap/youjiantou" /> |
208 | 208 | ||
209 | </LinearLayout> | 209 | </LinearLayout> |
210 | 210 | ||
211 | <LinearLayout | 211 | <LinearLayout |
212 | android:id="@+id/linel_mynote" | 212 | android:id="@+id/linel_mynote" |
213 | android:layout_width="match_parent" | 213 | android:layout_width="match_parent" |
214 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
215 | android:layout_marginTop="35dp" | 215 | android:layout_marginTop="35dp" |
216 | android:gravity="center_vertical" | 216 | android:gravity="center_vertical" |
217 | android:orientation="horizontal"> | 217 | android:orientation="horizontal"> |
218 | 218 | ||
219 | <ImageView | 219 | <ImageView |
220 | android:layout_width="0dp" | 220 | android:layout_width="0dp" |
221 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
222 | android:layout_weight="1" | 222 | android:layout_weight="1" |
223 | android:src="@mipmap/wodebiji" /> | 223 | android:src="@mipmap/wodebiji" /> |
224 | 224 | ||
225 | <TextView | 225 | <TextView |
226 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
228 | android:layout_weight="5" | 228 | android:layout_weight="5" |
229 | android:text="我的笔记" | 229 | android:text="我的笔记" |
230 | android:textSize="20sp" /> | 230 | android:textSize="20sp" /> |
231 | 231 | ||
232 | <ImageView | 232 | <ImageView |
233 | android:layout_width="0dp" | 233 | android:layout_width="0dp" |
234 | android:layout_height="wrap_content" | 234 | android:layout_height="wrap_content" |
235 | android:layout_weight="1" | 235 | android:layout_weight="1" |
236 | android:src="@mipmap/youjiantou" /> | 236 | android:src="@mipmap/youjiantou" /> |
237 | 237 | ||
238 | </LinearLayout> | 238 | </LinearLayout> |
239 | 239 | ||
240 | <LinearLayout | 240 | <LinearLayout |
241 | android:id="@+id/linel_mycollege" | 241 | android:id="@+id/linel_mycollege" |
242 | android:layout_width="match_parent" | 242 | android:layout_width="match_parent" |
243 | android:layout_height="wrap_content" | 243 | android:layout_height="wrap_content" |
244 | android:layout_marginTop="35dp" | 244 | android:layout_marginTop="35dp" |
245 | android:gravity="center_vertical" | 245 | android:gravity="center_vertical" |
246 | android:orientation="horizontal"> | 246 | android:orientation="horizontal"> |
247 | 247 | ||
248 | <ImageView | 248 | <ImageView |
249 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
250 | android:layout_height="wrap_content" | 250 | android:layout_height="wrap_content" |
251 | android:layout_weight="1" | 251 | android:layout_weight="1" |
252 | android:src="@mipmap/wodeshoucang" /> | 252 | android:src="@mipmap/wodeshoucang" /> |
253 | 253 | ||
254 | <TextView | 254 | <TextView |
255 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
256 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
257 | android:layout_weight="5" | 257 | android:layout_weight="5" |
258 | android:text="我的收藏" | 258 | android:text="我的收藏" |
259 | android:textSize="20sp" /> | 259 | android:textSize="20sp" /> |
260 | 260 | ||
261 | <ImageView | 261 | <ImageView |
262 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
263 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
264 | android:layout_weight="1" | 264 | android:layout_weight="1" |
265 | android:src="@mipmap/youjiantou" /> | 265 | android:src="@mipmap/youjiantou" /> |
266 | 266 | ||
267 | </LinearLayout> | 267 | </LinearLayout> |
268 | 268 | ||
269 | <LinearLayout | 269 | <LinearLayout |
270 | android:id="@+id/linel_myclass" | 270 | android:id="@+id/linel_myclass" |
271 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
272 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
273 | android:layout_marginTop="35dp" | 273 | android:layout_marginTop="35dp" |
274 | android:gravity="center_vertical" | 274 | android:gravity="center_vertical" |
275 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
276 | 276 | ||
277 | <ImageView | 277 | <ImageView |
278 | android:layout_width="0dp" | 278 | android:layout_width="0dp" |
279 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
280 | android:layout_weight="1" | 280 | android:layout_weight="1" |
281 | android:src="@mipmap/wodebanji" /> | 281 | android:src="@mipmap/wodebanji" /> |
282 | 282 | ||
283 | <TextView | 283 | <TextView |
284 | android:layout_width="0dp" | 284 | android:layout_width="0dp" |
285 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
286 | android:layout_weight="5" | 286 | android:layout_weight="5" |
287 | android:text="我的班级" | 287 | android:text="我的班级" |
288 | android:textSize="20sp" /> | 288 | android:textSize="20sp" /> |
289 | 289 | ||
290 | <ImageView | 290 | <ImageView |
291 | android:layout_width="0dp" | 291 | android:layout_width="0dp" |
292 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
293 | android:layout_weight="1" | 293 | android:layout_weight="1" |
294 | android:src="@mipmap/youjiantou" /> | 294 | android:src="@mipmap/youjiantou" /> |
295 | 295 | ||
296 | </LinearLayout> | 296 | </LinearLayout> |
297 | 297 | ||
298 | 298 | ||
299 | </LinearLayout> | 299 | </LinearLayout> |
300 | 300 | ||
301 | <LinearLayout | 301 | <LinearLayout |
302 | android:layout_width="match_parent" | 302 | android:layout_width="match_parent" |
303 | android:layout_height="match_parent" | 303 | android:layout_height="match_parent" |
304 | android:layout_marginTop="120dp" | 304 | android:layout_marginTop="120dp" |
305 | android:background="@mipmap/xiaoguanggao"> | 305 | android:background="@mipmap/xiaoguanggao"> |
306 | 306 | ||
307 | </LinearLayout> | 307 | </LinearLayout> |
308 | 308 | ||
309 | 309 | ||
310 | </LinearLayout> | 310 | </LinearLayout> |
311 | 311 | ||
312 | 312 | ||
313 | <View | 313 | <View |
314 | android:layout_width="0.7dp" | 314 | android:layout_width="0.7dp" |
315 | android:layout_height="match_parent" | 315 | android:layout_height="match_parent" |
316 | android:background="@color/cutoff_line"> | 316 | android:background="@color/cutoff_line"> |
317 | 317 | ||
318 | </View> | 318 | </View> |
319 | 319 | ||
320 | <LinearLayout | 320 | <LinearLayout |
321 | android:layout_width="0dp" | 321 | android:layout_width="0dp" |
322 | android:layout_height="match_parent" | 322 | android:layout_height="match_parent" |
323 | android:layout_weight="2.5" | 323 | android:layout_weight="2.5" |
324 | android:orientation="vertical"> | 324 | android:orientation="vertical"> |
325 | 325 | ||
326 | <LinearLayout | 326 | <LinearLayout |
327 | android:layout_width="match_parent" | 327 | android:layout_width="match_parent" |
328 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
329 | android:layout_margin="20dp" | 329 | android:layout_margin="20dp" |
330 | android:gravity="center_vertical" | 330 | android:gravity="center_vertical" |
331 | android:orientation="horizontal"> | 331 | android:orientation="horizontal"> |
332 | 332 | ||
333 | <View | 333 | <View |
334 | android:layout_width="5dp" | 334 | android:layout_width="5dp" |
335 | android:layout_height="20dp" | 335 | android:layout_height="20dp" |
336 | android:background="@color/login_text_blue"> | 336 | android:background="@color/login_text_blue"> |
337 | 337 | ||
338 | </View> | 338 | </View> |
339 | 339 | ||
340 | <TextView | 340 | <TextView |
341 | android:layout_width="wrap_content" | 341 | android:layout_width="wrap_content" |
342 | android:layout_height="wrap_content" | 342 | android:layout_height="wrap_content" |
343 | android:layout_marginLeft="5dp" | 343 | android:layout_marginLeft="5dp" |
344 | android:text="最近学习" | 344 | android:text="最近学习" |
345 | android:textSize="22sp" /> | 345 | android:textSize="22sp" /> |
346 | 346 | ||
347 | </LinearLayout> | 347 | </LinearLayout> |
348 | 348 | ||
349 | <LinearLayout | 349 | <LinearLayout |
350 | android:layout_width="match_parent" | 350 | android:layout_width="match_parent" |
351 | android:layout_height="wrap_content"> | 351 | android:layout_height="wrap_content"> |
352 | 352 | ||
353 | <TextView | 353 | <TextView |
354 | android:id="@+id/list_item_study" | 354 | android:id="@+id/list_item_study" |
355 | android:layout_width="match_parent" | 355 | android:layout_width="match_parent" |
356 | android:layout_height="100dp" | 356 | android:layout_height="100dp" |
357 | android:layout_marginLeft="20dp" | 357 | android:layout_marginLeft="20dp" |
358 | android:layout_marginTop="10dp" | 358 | android:layout_marginTop="10dp" |
359 | android:gravity="center" | 359 | android:gravity="center" |
360 | android:text="这里需要显示水平滑动的" /> | 360 | android:text="这里需要显示水平滑动的" /> |
361 | </LinearLayout> | 361 | </LinearLayout> |
362 | 362 | ||
363 | <View | 363 | <View |
364 | android:layout_width="match_parent" | 364 | android:layout_width="match_parent" |
365 | android:layout_height="0.7dp" | 365 | android:layout_height="0.7dp" |
366 | android:background="@color/cutoff_line"> | 366 | android:background="@color/cutoff_line"> |
367 | 367 | ||
368 | </View> | 368 | </View> |
369 | 369 | ||
370 | <LinearLayout | 370 | <LinearLayout |
371 | android:layout_width="match_parent" | 371 | android:layout_width="match_parent" |
372 | android:layout_height="wrap_content" | 372 | android:layout_height="wrap_content" |
373 | android:layout_margin="20dp" | 373 | android:layout_margin="20dp" |
374 | android:gravity="center_vertical" | 374 | android:gravity="center_vertical" |
375 | android:orientation="horizontal"> | 375 | android:orientation="horizontal"> |
376 | 376 | ||
377 | <View | 377 | <View |
378 | android:layout_width="5dp" | 378 | android:layout_width="5dp" |
379 | android:layout_height="20dp" | 379 | android:layout_height="20dp" |
380 | android:background="@color/login_text_blue"> | 380 | android:background="@color/login_text_blue"> |
381 | 381 | ||
382 | </View> | 382 | </View> |
383 | 383 | ||
384 | <TextView | 384 | <TextView |
385 | android:layout_width="0dp" | 385 | android:layout_width="0dp" |
386 | android:layout_height="wrap_content" | 386 | android:layout_height="wrap_content" |
387 | android:layout_marginLeft="5dp" | 387 | android:layout_marginLeft="5dp" |
388 | android:layout_weight="2" | 388 | android:layout_weight="2" |
389 | android:text="个人信息" | 389 | android:text="个人信息" |
390 | android:textSize="22sp" /> | 390 | android:textSize="22sp" /> |
391 | 391 | ||
392 | <TextView | 392 | <TextView |
393 | android:id="@+id/tv_edit_presoninfo" | 393 | android:id="@+id/tv_edit_presoninfo" |
394 | android:padding="5dp" | 394 | android:padding="5dp" |
395 | android:layout_width="0dp" | 395 | android:layout_width="0dp" |
396 | android:layout_height="wrap_content" | 396 | android:layout_height="wrap_content" |
397 | android:layout_marginLeft="10dp" | 397 | android:layout_marginLeft="10dp" |
398 | android:layout_weight="0.2" | 398 | android:layout_weight="0.2" |
399 | android:text="编辑" | 399 | android:text="编辑" |
400 | android:textSize="18sp" /> | 400 | android:textSize="18sp" /> |
401 | 401 | ||
402 | <ImageView | 402 | <ImageView |
403 | android:layout_width="0dp" | 403 | android:layout_width="0dp" |
404 | android:layout_height="wrap_content" | 404 | android:layout_height="wrap_content" |
405 | android:layout_weight="0.1" | 405 | android:layout_weight="0.1" |
406 | 406 | ||
407 | android:src="@mipmap/youjiantou" /> | 407 | android:src="@mipmap/youjiantou" /> |
408 | 408 | ||
409 | 409 | ||
410 | </LinearLayout> | 410 | </LinearLayout> |
411 | 411 | ||
412 | <LinearLayout | 412 | <LinearLayout |
413 | android:layout_width="match_parent" | 413 | android:layout_width="match_parent" |
414 | android:layout_height="wrap_content" | 414 | android:layout_height="wrap_content" |
415 | android:layout_marginLeft="50dp" | 415 | android:layout_marginLeft="50dp" |
416 | android:layout_marginTop="10dp" | 416 | android:layout_marginTop="10dp" |
417 | android:orientation="vertical"> | 417 | android:orientation="vertical"> |
418 | 418 | ||
419 | <LinearLayout | 419 | <LinearLayout |
420 | android:layout_width="match_parent" | 420 | android:layout_width="match_parent" |
421 | android:layout_height="wrap_content" | 421 | android:layout_height="wrap_content" |
422 | android:gravity="center_vertical" | 422 | android:gravity="center_vertical" |
423 | android:orientation="horizontal"> | 423 | android:orientation="horizontal"> |
424 | 424 | ||
425 | <TextView | 425 | <TextView |
426 | android:layout_width="0dp" | 426 | android:layout_width="0dp" |
427 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
428 | android:layout_weight="1" | 428 | android:layout_weight="1" |
429 | android:text="昵称" | 429 | android:text="昵称" |
430 | android:textSize="20sp" /> | 430 | android:textSize="20sp" /> |
431 | 431 | ||
432 | <TextView | 432 | <TextView |
433 | android:id="@+id/tv_username1" | 433 | android:id="@+id/tv_username1" |
434 | android:layout_width="0dp" | 434 | android:layout_width="0dp" |
435 | android:layout_height="wrap_content" | 435 | android:layout_height="wrap_content" |
436 | android:layout_weight="2" | 436 | android:layout_weight="2" |
437 | android:text="我的错题" | 437 | android:text="我的错题" |
438 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
439 | 439 | ||
440 | <TextView | 440 | <TextView |
441 | android:layout_width="1dp" | 441 | android:layout_width="1dp" |
442 | android:layout_height="wrap_content" | 442 | android:layout_height="wrap_content" |
443 | android:layout_weight="1" | 443 | android:layout_weight="1" |
444 | android:text="星座" | 444 | android:text="星座" |
445 | android:textSize="20sp" /> | 445 | android:textSize="20sp" /> |
446 | 446 | ||
447 | <TextView | 447 | <TextView |
448 | android:id="@+id/tv_mygad" | 448 | android:id="@+id/tv_mygad" |
449 | android:layout_width="0dp" | 449 | android:layout_width="0dp" |
450 | android:layout_height="wrap_content" | 450 | android:layout_height="wrap_content" |
451 | android:layout_weight="2" | 451 | android:layout_weight="2" |
452 | android:text="我的错题" | 452 | android:text="我的错题" |
453 | android:textSize="20sp" /> | 453 | android:textSize="20sp" /> |
454 | </LinearLayout> | 454 | </LinearLayout> |
455 | 455 | ||
456 | <LinearLayout | 456 | <LinearLayout |
457 | android:layout_width="match_parent" | 457 | android:layout_width="match_parent" |
458 | android:layout_height="wrap_content" | 458 | android:layout_height="wrap_content" |
459 | android:layout_marginTop="20dp" | 459 | android:layout_marginTop="20dp" |
460 | android:gravity="center_vertical" | 460 | android:gravity="center_vertical" |
461 | android:orientation="horizontal"> | 461 | android:orientation="horizontal"> |
462 | 462 | ||
463 | <TextView | 463 | <TextView |
464 | android:layout_width="0dp" | 464 | android:layout_width="0dp" |
465 | android:layout_height="wrap_content" | 465 | android:layout_height="wrap_content" |
466 | android:layout_weight="1" | 466 | android:layout_weight="1" |
467 | android:text="性别" | 467 | android:text="性别" |
468 | android:textSize="20sp" /> | 468 | android:textSize="20sp" /> |
469 | 469 | ||
470 | <TextView | 470 | <TextView |
471 | android:id="@+id/tv_sex" | 471 | android:id="@+id/tv_sex" |
472 | android:layout_width="0dp" | 472 | android:layout_width="0dp" |
473 | android:layout_height="wrap_content" | 473 | android:layout_height="wrap_content" |
474 | android:layout_weight="2" | 474 | android:layout_weight="2" |
475 | android:text="男" | 475 | android:text="男" |
476 | android:textSize="20sp" /> | 476 | android:textSize="20sp" /> |
477 | 477 | ||
478 | <TextView | 478 | <TextView |
479 | android:layout_width="1dp" | 479 | android:layout_width="1dp" |
480 | android:layout_height="wrap_content" | 480 | android:layout_height="wrap_content" |
481 | android:layout_weight="1" | 481 | android:layout_weight="1" |
482 | android:text="地区" | 482 | android:text="地区" |
483 | android:textSize="20sp" /> | 483 | android:textSize="20sp" /> |
484 | 484 | ||
485 | <TextView | 485 | <TextView |
486 | android:id="@+id/tv_useinfo_adress" | 486 | android:id="@+id/tv_useinfo_adress" |
487 | android:layout_width="0dp" | 487 | android:layout_width="0dp" |
488 | android:layout_height="wrap_content" | 488 | android:layout_height="wrap_content" |
489 | android:layout_weight="2" | 489 | android:layout_weight="2" |
490 | android:text="我的错题" | 490 | android:text="我的错题" |
491 | android:textSize="20sp" /> | 491 | android:textSize="20sp" /> |
492 | </LinearLayout> | 492 | </LinearLayout> |
493 | 493 | ||
494 | <LinearLayout | 494 | <LinearLayout |
495 | android:layout_width="match_parent" | 495 | android:layout_width="match_parent" |
496 | android:layout_height="wrap_content" | 496 | android:layout_height="wrap_content" |
497 | android:layout_marginTop="20dp" | 497 | android:layout_marginTop="20dp" |
498 | android:gravity="center_vertical" | 498 | android:gravity="center_vertical" |
499 | android:orientation="horizontal"> | 499 | android:orientation="horizontal"> |
500 | 500 | ||
501 | <TextView | 501 | <TextView |
502 | android:layout_width="0dp" | 502 | android:layout_width="0dp" |
503 | android:layout_height="wrap_content" | 503 | android:layout_height="wrap_content" |
504 | android:layout_weight="1" | 504 | android:layout_weight="1" |
505 | android:text="生日" | 505 | android:text="生日" |
506 | android:textSize="20sp" /> | 506 | android:textSize="20sp" /> |
507 | 507 | ||
508 | <TextView | 508 | <TextView |
509 | android:id="@+id/tv_useinfo_birthday" | 509 | android:id="@+id/tv_useinfo_birthday" |
510 | android:layout_width="0dp" | 510 | android:layout_width="0dp" |
511 | android:layout_height="wrap_content" | 511 | android:layout_height="wrap_content" |
512 | android:layout_weight="2" | 512 | android:layout_weight="2" |
513 | android:text="我的错题" | 513 | android:text="我的错题" |
514 | android:textSize="20sp" /> | 514 | android:textSize="20sp" /> |
515 | 515 | ||
516 | <TextView | 516 | <TextView |
517 | android:layout_width="1dp" | 517 | android:layout_width="1dp" |
518 | android:layout_height="wrap_content" | 518 | android:layout_height="wrap_content" |
519 | android:layout_weight="1" | 519 | android:layout_weight="1" |
520 | android:text="学校" | 520 | android:text="学校" |
521 | android:textSize="20sp" /> | 521 | android:textSize="20sp" /> |
522 | 522 | ||
523 | <TextView | 523 | <TextView |
524 | android:id="@+id/tv_useinfo_school" | 524 | android:id="@+id/tv_useinfo_school" |
525 | android:layout_width="0dp" | 525 | android:layout_width="0dp" |
526 | android:layout_height="wrap_content" | 526 | android:layout_height="wrap_content" |
527 | android:layout_weight="2" | 527 | android:layout_weight="2" |
528 | android:text="我的错题" | 528 | android:text="我的错题" |
529 | android:textSize="20sp" /> | 529 | android:textSize="20sp" /> |
530 | </LinearLayout> | 530 | </LinearLayout> |
531 | 531 | ||
532 | <LinearLayout | 532 | <LinearLayout |
533 | android:layout_width="match_parent" | 533 | android:layout_width="match_parent" |
534 | android:layout_height="wrap_content" | 534 | android:layout_height="wrap_content" |
535 | android:layout_marginTop="20dp" | 535 | android:layout_marginTop="20dp" |
536 | android:gravity="center_vertical" | 536 | android:gravity="center_vertical" |
537 | android:orientation="horizontal"> | 537 | android:orientation="horizontal"> |
538 | 538 | ||
539 | <TextView | 539 | <TextView |
540 | android:layout_width="0dp" | 540 | android:layout_width="0dp" |
541 | android:layout_height="wrap_content" | 541 | android:layout_height="wrap_content" |
542 | android:layout_weight="1" | 542 | android:layout_weight="1" |
543 | android:text="Q Q" | 543 | android:text="Q Q" |
544 | android:textSize="20sp" /> | 544 | android:textSize="20sp" /> |
545 | 545 | ||
546 | <TextView | 546 | <TextView |
547 | android:id="@+id/tv_useinfo_qq" | 547 | android:id="@+id/tv_useinfo_qq" |
548 | android:layout_width="0dp" | 548 | android:layout_width="0dp" |
549 | android:layout_height="wrap_content" | 549 | android:layout_height="wrap_content" |
550 | android:layout_weight="2" | 550 | android:layout_weight="2" |
551 | android:text="我的错题" | 551 | android:text="我的错题" |
552 | android:textSize="20sp" /> | 552 | android:textSize="20sp" /> |
553 | 553 | ||
554 | <TextView | 554 | <TextView |
555 | android:layout_width="1dp" | 555 | android:layout_width="1dp" |
556 | android:layout_height="wrap_content" | 556 | android:layout_height="wrap_content" |
557 | android:layout_weight="1" | 557 | android:layout_weight="1" |
558 | android:text="年级" | 558 | android:text="年级" |
559 | android:textSize="20sp" /> | 559 | android:textSize="20sp" /> |
560 | 560 | ||
561 | <TextView | 561 | <TextView |
562 | android:id="@+id/tv_useinfo_gender" | 562 | android:id="@+id/tv_useinfo_gender" |
563 | android:layout_width="0dp" | 563 | android:layout_width="0dp" |
564 | android:layout_height="wrap_content" | 564 | android:layout_height="wrap_content" |
565 | android:layout_weight="2" | 565 | android:layout_weight="2" |
566 | android:text="我的错题" | 566 | android:text="我的错题" |
567 | android:textSize="20sp" /> | 567 | android:textSize="20sp" /> |
568 | </LinearLayout> | 568 | </LinearLayout> |
569 | 569 | ||
570 | 570 | ||
571 | </LinearLayout> | 571 | </LinearLayout> |
572 | <View | 572 | <View |
573 | android:layout_width="match_parent" | 573 | android:layout_width="match_parent" |
574 | android:layout_height="0.7dp" | 574 | android:layout_height="0.7dp" |
575 | android:layout_marginTop="20dp" | 575 | android:layout_marginTop="20dp" |
576 | android:background="@color/cutoff_line"> | 576 | android:background="@color/cutoff_line"> |
577 | 577 | ||
578 | </View> | 578 | </View> |
579 | <LinearLayout | 579 | <LinearLayout |
580 | android:layout_width="match_parent" | 580 | android:layout_width="match_parent" |
581 | android:layout_height="wrap_content" | 581 | android:layout_height="wrap_content" |
582 | android:layout_margin="20dp" | 582 | android:layout_margin="20dp" |
583 | android:gravity="center_vertical" | 583 | android:gravity="center_vertical" |
584 | android:orientation="horizontal"> | 584 | android:orientation="horizontal"> |
585 | 585 | ||
586 | <View | 586 | <View |
587 | android:layout_width="5dp" | 587 | android:layout_width="5dp" |
588 | android:layout_height="20dp" | 588 | android:layout_height="20dp" |
589 | android:background="@color/login_text_blue"> | 589 | android:background="@color/login_text_blue"> |
590 | 590 | ||
591 | </View> | 591 | </View> |
592 | 592 | ||
593 | <TextView | 593 | <TextView |
594 | android:layout_width="wrap_content" | 594 | android:layout_width="wrap_content" |
595 | android:layout_height="wrap_content" | 595 | android:layout_height="wrap_content" |
596 | android:layout_marginLeft="5dp" | 596 | android:layout_marginLeft="5dp" |
597 | android:text="版本信息" | 597 | android:text="版本信息" |
598 | android:textSize="22sp" /> | 598 | android:textSize="22sp" /> |
599 | 599 | ||
600 | </LinearLayout> | 600 | </LinearLayout> |
601 | 601 | ||
602 | <LinearLayout | 602 | <LinearLayout |
603 | android:layout_width="match_parent" | 603 | android:layout_width="match_parent" |
604 | android:layout_height="wrap_content" | 604 | android:layout_height="wrap_content" |
605 | android:layout_marginTop="20dp"> | 605 | android:layout_marginTop="20dp"> |
606 | 606 | ||
607 | <TextView | 607 | <TextView |
608 | android:layout_width="match_parent" | 608 | android:layout_width="match_parent" |
609 | android:layout_height="100dp" | 609 | android:layout_height="100dp" |
610 | android:layout_marginLeft="20dp" | 610 | android:layout_marginLeft="20dp" |
611 | android:layout_marginTop="10dp" | 611 | android:layout_marginTop="10dp" |
612 | android:gravity="center" | 612 | android:gravity="center" |
613 | android:text="这里需要显示水平滑动的" /> | 613 | android:text="这里需要显示水平滑动的" /> |
614 | </LinearLayout> | 614 | </LinearLayout> |
615 | 615 | ||
616 | 616 | ||
617 | </LinearLayout> | 617 | </LinearLayout> |
618 | 618 | ||
619 | 619 | ||
620 | </LinearLayout> | 620 | </LinearLayout> |
621 | 621 | ||
622 | 622 | ||
623 | </LinearLayout> | 623 | </LinearLayout> |
624 | 624 |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.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:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="wrap_content" | 10 | android:layout_width="wrap_content" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:layout_marginTop="60dp" | 12 | android:layout_marginTop="60dp" |
13 | android:orientation="horizontal"> | 13 | android:orientation="horizontal"> |
14 | 14 | ||
15 | <View | 15 | <View |
16 | android:layout_width="450dp" | 16 | android:layout_width="450dp" |
17 | android:layout_height="0.7dp" | 17 | android:layout_height="0.7dp" |
18 | android:layout_marginLeft="150dp" | 18 | android:layout_marginLeft="150dp" |
19 | android:background="@color/electronic_text"> | 19 | android:background="@color/electronic_text"> |
20 | 20 | ||
21 | </View> | 21 | </View> |
22 | 22 | ||
23 | <View | 23 | <View |
24 | android:layout_width="450dp" | 24 | android:layout_width="450dp" |
25 | android:layout_height="0.7dp" | 25 | android:layout_height="0.7dp" |
26 | android:layout_marginLeft="80dp" | 26 | android:layout_marginLeft="80dp" |
27 | android:background="@color/electronic_text"> | 27 | android:background="@color/electronic_text"> |
28 | 28 | ||
29 | </View> | 29 | </View> |
30 | 30 | ||
31 | 31 | ||
32 | </LinearLayout> | 32 | </LinearLayout> |
33 | 33 | ||
34 | <LinearLayout | 34 | <LinearLayout |
35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
37 | android:layout_marginLeft="200dp" | 37 | android:layout_marginLeft="200dp" |
38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="0dp" | 42 | android:layout_width="0dp" |
43 | android:layout_height="80dp" | 43 | android:layout_height="80dp" |
44 | android:layout_weight="1" | 44 | android:layout_weight="1" |
45 | android:gravity="center_vertical"> | 45 | android:gravity="center_vertical"> |
46 | 46 | ||
47 | <TextView | 47 | <TextView |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
50 | android:text="昵称" | 50 | android:text="昵称" |
51 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 51 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
52 | android:textSize="22sp" /> | 52 | android:textSize="22sp" /> |
53 | 53 | ||
54 | <EditText | 54 | <EditText |
55 | android:id="@+id/tv_username1" | 55 | android:id="@+id/tv_username1" |
56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" |
58 | android:layout_marginLeft="50dp" | 58 | android:layout_marginLeft="50dp" |
59 | android:background="@null" | 59 | android:background="@null" |
60 | android:hint="请输入12个以内的中文或英文字符" | 60 | android:hint="请输入12个以内的中文或英文字符" |
61 | android:textColor="@color/electronic_text" | 61 | android:textColor="@color/electronic_text" |
62 | android:textSize="22sp" /> | 62 | android:textSize="22sp" /> |
63 | 63 | ||
64 | </LinearLayout> | 64 | </LinearLayout> |
65 | 65 | ||
66 | <LinearLayout | 66 | <LinearLayout |
67 | android:layout_width="0dp" | 67 | android:layout_width="0dp" |
68 | android:layout_height="80dp" | 68 | android:layout_height="80dp" |
69 | android:layout_weight="1" | 69 | android:layout_weight="1" |
70 | android:gravity="center_vertical"> | 70 | android:gravity="center_vertical"> |
71 | 71 | ||
72 | <TextView | 72 | <TextView |
73 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
74 | android:layout_height="wrap_content" | 74 | android:layout_height="wrap_content" |
75 | android:text="地区" | 75 | android:text="地区" |
76 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 76 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
77 | android:textSize="22sp" /> | 77 | android:textSize="22sp" /> |
78 | 78 | ||
79 | <TextView | 79 | <TextView |
80 | android:id="@+id/tv_useinfo_adress" | 80 | android:id="@+id/tv_useinfo_adress" |
81 | android:layout_width="wrap_content" | 81 | android:layout_width="wrap_content" |
82 | android:layout_height="wrap_content" | 82 | android:layout_height="wrap_content" |
83 | android:layout_marginLeft="50dp" | 83 | android:layout_marginLeft="50dp" |
84 | android:text="请选择" | 84 | android:hint="请选择" |
85 | android:textColor="@color/btn_text_color" | 85 | android:textColor="@color/btn_text_color" |
86 | android:textSize="22sp" /> | 86 | android:textSize="22sp" /> |
87 | 87 | ||
88 | <ImageView | 88 | <ImageView |
89 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
91 | android:layout_marginLeft="150dp" | 91 | android:layout_marginLeft="150dp" |
92 | android:src="@mipmap/xiajiantou"> | 92 | android:src="@mipmap/xiajiantou"> |
93 | 93 | ||
94 | </ImageView> | 94 | </ImageView> |
95 | </LinearLayout> | 95 | </LinearLayout> |
96 | 96 | ||
97 | </LinearLayout> | 97 | </LinearLayout> |
98 | 98 | ||
99 | <LinearLayout | 99 | <LinearLayout |
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:orientation="horizontal"> | 102 | android:orientation="horizontal"> |
103 | 103 | ||
104 | <View | 104 | <View |
105 | android:layout_width="450dp" | 105 | android:layout_width="450dp" |
106 | android:layout_height="0.7dp" | 106 | android:layout_height="0.7dp" |
107 | android:layout_marginLeft="150dp" | 107 | android:layout_marginLeft="150dp" |
108 | android:background="@color/electronic_text"> | 108 | android:background="@color/electronic_text"> |
109 | 109 | ||
110 | </View> | 110 | </View> |
111 | 111 | ||
112 | <View | 112 | <View |
113 | android:layout_width="450dp" | 113 | android:layout_width="450dp" |
114 | android:layout_height="0.7dp" | 114 | android:layout_height="0.7dp" |
115 | android:layout_marginLeft="80dp" | 115 | android:layout_marginLeft="80dp" |
116 | android:background="@color/electronic_text"> | 116 | android:background="@color/electronic_text"> |
117 | 117 | ||
118 | </View> | 118 | </View> |
119 | 119 | ||
120 | 120 | ||
121 | </LinearLayout> | 121 | </LinearLayout> |
122 | 122 | ||
123 | <LinearLayout | 123 | <LinearLayout |
124 | android:layout_width="match_parent" | 124 | android:layout_width="match_parent" |
125 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
126 | android:layout_marginLeft="200dp" | 126 | android:layout_marginLeft="200dp" |
127 | android:gravity="center_vertical" | 127 | android:gravity="center_vertical" |
128 | android:orientation="horizontal"> | 128 | android:orientation="horizontal"> |
129 | 129 | ||
130 | <LinearLayout | 130 | <LinearLayout |
131 | android:layout_width="0dp" | 131 | android:layout_width="0dp" |
132 | android:layout_height="80dp" | 132 | android:layout_height="80dp" |
133 | android:layout_weight="1" | 133 | android:layout_weight="1" |
134 | android:gravity="center_vertical"> | 134 | android:gravity="center_vertical"> |
135 | 135 | ||
136 | <TextView | 136 | <TextView |
137 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
138 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
139 | android:text="性别" | 139 | android:text="性别" |
140 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 140 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
141 | android:textSize="22sp" /> | 141 | android:textSize="22sp" /> |
142 | 142 | ||
143 | <TextView | 143 | <TextView |
144 | android:id="@+id/tv_sex" | 144 | android:id="@+id/tv_sex" |
145 | android:layout_width="wrap_content" | 145 | android:layout_width="wrap_content" |
146 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
147 | android:layout_marginLeft="50dp" | 147 | android:layout_marginLeft="50dp" |
148 | android:text="请选择" | 148 | android:hint="请选择" |
149 | android:textSize="22sp" /> | 149 | android:textSize="22sp" /> |
150 | 150 | ||
151 | <ImageView | 151 | <ImageView |
152 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
154 | android:layout_marginLeft="150dp" | 154 | android:layout_marginLeft="150dp" |
155 | android:src="@mipmap/xiajiantou"> | 155 | android:src="@mipmap/xiajiantou"> |
156 | 156 | ||
157 | </ImageView> | 157 | </ImageView> |
158 | 158 | ||
159 | 159 | ||
160 | </LinearLayout> | 160 | </LinearLayout> |
161 | 161 | ||
162 | <LinearLayout | 162 | <LinearLayout |
163 | android:layout_width="0dp" | 163 | android:layout_width="0dp" |
164 | android:layout_height="80dp" | 164 | android:layout_height="80dp" |
165 | android:layout_weight="1" | 165 | android:layout_weight="1" |
166 | android:gravity="center_vertical"> | 166 | android:gravity="center_vertical"> |
167 | 167 | ||
168 | <TextView | 168 | <TextView |
169 | android:layout_width="wrap_content" | 169 | android:layout_width="wrap_content" |
170 | android:layout_height="wrap_content" | 170 | android:layout_height="wrap_content" |
171 | android:text=" " | 171 | android:text=" " |
172 | android:textColor="@color/white" | 172 | android:textColor="@color/white" |
173 | android:textSize="22sp" /> | 173 | android:textSize="22sp" /> |
174 | 174 | ||
175 | <EditText | 175 | <EditText |
176 | android:id="@+id/tv_useinfo_adress1" | 176 | android:id="@+id/tv_useinfo_adress1" |
177 | android:layout_width="wrap_content" | 177 | android:layout_width="wrap_content" |
178 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
179 | android:layout_marginLeft="50dp" | 179 | android:layout_marginLeft="50dp" |
180 | android:background="@null" | 180 | android:background="@null" |
181 | android:hint="请输入详细地址" | 181 | android:hint="请输入详细地址" |
182 | android:textSize="22sp" /> | 182 | android:textSize="22sp" /> |
183 | 183 | ||
184 | </LinearLayout> | 184 | </LinearLayout> |
185 | 185 | ||
186 | </LinearLayout> | 186 | </LinearLayout> |
187 | 187 | ||
188 | <LinearLayout | 188 | <LinearLayout |
189 | android:layout_width="wrap_content" | 189 | android:layout_width="wrap_content" |
190 | android:layout_height="wrap_content" | 190 | android:layout_height="wrap_content" |
191 | 191 | ||
192 | android:orientation="horizontal"> | 192 | android:orientation="horizontal"> |
193 | 193 | ||
194 | <View | 194 | <View |
195 | android:layout_width="450dp" | 195 | android:layout_width="450dp" |
196 | android:layout_height="0.7dp" | 196 | android:layout_height="0.7dp" |
197 | android:layout_marginLeft="150dp" | 197 | android:layout_marginLeft="150dp" |
198 | android:background="@color/electronic_text"> | 198 | android:background="@color/electronic_text"> |
199 | 199 | ||
200 | </View> | 200 | </View> |
201 | 201 | ||
202 | <View | 202 | <View |
203 | android:layout_width="450dp" | 203 | android:layout_width="450dp" |
204 | android:layout_height="0.7dp" | 204 | android:layout_height="0.7dp" |
205 | android:layout_marginLeft="80dp" | 205 | android:layout_marginLeft="80dp" |
206 | android:background="@color/electronic_text"> | 206 | android:background="@color/electronic_text"> |
207 | 207 | ||
208 | </View> | 208 | </View> |
209 | 209 | ||
210 | 210 | ||
211 | </LinearLayout> | 211 | </LinearLayout> |
212 | 212 | ||
213 | <LinearLayout | 213 | <LinearLayout |
214 | android:layout_width="match_parent" | 214 | android:layout_width="match_parent" |
215 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
216 | android:layout_marginLeft="200dp" | 216 | android:layout_marginLeft="200dp" |
217 | android:gravity="center_vertical" | 217 | android:gravity="center_vertical" |
218 | android:orientation="horizontal"> | 218 | android:orientation="horizontal"> |
219 | 219 | ||
220 | 220 | ||
221 | <LinearLayout | 221 | <LinearLayout |
222 | android:layout_width="0dp" | 222 | android:layout_width="0dp" |
223 | android:layout_height="80dp" | 223 | android:layout_height="80dp" |
224 | android:layout_weight="1" | 224 | android:layout_weight="1" |
225 | android:gravity="center_vertical"> | 225 | android:gravity="center_vertical"> |
226 | 226 | ||
227 | <TextView | 227 | <TextView |
228 | android:layout_width="wrap_content" | 228 | android:layout_width="wrap_content" |
229 | android:layout_height="wrap_content" | 229 | android:layout_height="wrap_content" |
230 | android:text="生日" | 230 | android:text="生日" |
231 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 231 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
232 | android:textSize="22sp" /> | 232 | android:textSize="22sp" /> |
233 | 233 | ||
234 | <TextView | 234 | <TextView |
235 | android:id="@+id/tv_useinfo_birthday" | 235 | android:id="@+id/tv_useinfo_birthday" |
236 | android:layout_width="wrap_content" | 236 | android:layout_width="wrap_content" |
237 | android:layout_height="wrap_content" | 237 | android:layout_height="wrap_content" |
238 | android:layout_marginLeft="50dp" | 238 | android:layout_marginLeft="50dp" |
239 | android:hint="请选择" | 239 | android:hint="请选择" |
240 | android:textSize="22sp" /> | 240 | android:textSize="22sp" /> |
241 | 241 | ||
242 | <ImageView | 242 | <ImageView |
243 | android:layout_width="wrap_content" | 243 | android:layout_width="wrap_content" |
244 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
245 | android:layout_marginLeft="150dp" | 245 | android:layout_marginLeft="150dp" |
246 | android:src="@mipmap/xiajiantou"/> | 246 | android:src="@mipmap/xiajiantou"/> |
247 | </LinearLayout> | 247 | </LinearLayout> |
248 | <LinearLayout | 248 | <LinearLayout |
249 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
250 | android:layout_height="80dp" | 250 | android:layout_height="80dp" |
251 | android:layout_weight="1" | 251 | android:layout_weight="1" |
252 | android:gravity="center_vertical"> | 252 | android:gravity="center_vertical"> |
253 | 253 | ||
254 | <TextView | 254 | <TextView |
255 | android:layout_width="wrap_content" | 255 | android:layout_width="wrap_content" |
256 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
257 | android:text="年级" | 257 | android:text="年级" |
258 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 258 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
259 | android:textSize="22sp" /> | 259 | android:textSize="22sp" /> |
260 | 260 | ||
261 | <TextView | 261 | <TextView |
262 | android:id="@+id/tv_useinfo_gender" | 262 | android:id="@+id/tv_useinfo_gender" |
263 | android:layout_width="wrap_content" | 263 | android:layout_width="wrap_content" |
264 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
265 | android:layout_marginLeft="50dp" | 265 | android:layout_marginLeft="50dp" |
266 | android:hint="请选择" | 266 | android:hint="请选择" |
267 | android:textSize="22sp" /> | 267 | android:textSize="22sp" /> |
268 | 268 | ||
269 | <ImageView | 269 | <ImageView |
270 | android:layout_width="wrap_content" | 270 | android:layout_width="wrap_content" |
271 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
272 | android:layout_marginLeft="150dp" | 272 | android:layout_marginLeft="150dp" |
273 | android:src="@mipmap/xiajiantou"/> | 273 | android:src="@mipmap/xiajiantou"/> |
274 | </LinearLayout> | 274 | </LinearLayout> |
275 | 275 | ||
276 | </LinearLayout> | 276 | </LinearLayout> |
277 | 277 | ||
278 | <LinearLayout | 278 | <LinearLayout |
279 | android:layout_width="wrap_content" | 279 | android:layout_width="wrap_content" |
280 | android:layout_height="wrap_content" | 280 | android:layout_height="wrap_content" |
281 | 281 | ||
282 | android:orientation="horizontal"> | 282 | android:orientation="horizontal"> |
283 | 283 | ||
284 | <View | 284 | <View |
285 | android:layout_width="450dp" | 285 | android:layout_width="450dp" |
286 | android:layout_height="0.7dp" | 286 | android:layout_height="0.7dp" |
287 | android:layout_marginLeft="150dp" | 287 | android:layout_marginLeft="150dp" |
288 | android:background="@color/electronic_text"> | 288 | android:background="@color/electronic_text"> |
289 | 289 | ||
290 | </View> | 290 | </View> |
291 | 291 | ||
292 | <View | 292 | <View |
293 | android:layout_width="450dp" | 293 | android:layout_width="450dp" |
294 | android:layout_height="0.7dp" | 294 | android:layout_height="0.7dp" |
295 | android:layout_marginLeft="80dp" | 295 | android:layout_marginLeft="80dp" |
296 | android:background="@color/electronic_text"> | 296 | android:background="@color/electronic_text"> |
297 | 297 | ||
298 | </View> | 298 | </View> |
299 | 299 | ||
300 | 300 | ||
301 | </LinearLayout> | 301 | </LinearLayout> |
302 | 302 | ||
303 | <LinearLayout | 303 | <LinearLayout |
304 | android:layout_width="match_parent" | 304 | android:layout_width="match_parent" |
305 | android:layout_height="wrap_content" | 305 | android:layout_height="wrap_content" |
306 | android:layout_marginLeft="200dp" | 306 | android:layout_marginLeft="200dp" |
307 | android:gravity="center_vertical" | 307 | android:gravity="center_vertical" |
308 | android:orientation="horizontal"> | 308 | android:orientation="horizontal"> |
309 | 309 | ||
310 | <LinearLayout | 310 | <LinearLayout |
311 | android:id="@+id/lineL_buy_time" | 311 | android:id="@+id/lineL_buy_time" |
312 | android:layout_width="0dp" | 312 | android:layout_width="0dp" |
313 | android:layout_height="80dp" | 313 | android:layout_height="80dp" |
314 | android:layout_weight="1" | 314 | android:layout_weight="1" |
315 | android:gravity="center_vertical"> | 315 | android:gravity="center_vertical"> |
316 | 316 | ||
317 | <TextView | 317 | <TextView |
318 | android:layout_width="wrap_content" | 318 | android:layout_width="wrap_content" |
319 | android:layout_height="wrap_content" | 319 | android:layout_height="wrap_content" |
320 | android:text="Q Q" | 320 | android:text="Q Q" |
321 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 321 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
322 | android:textSize="22sp" /> | 322 | android:textSize="22sp" /> |
323 | 323 | ||
324 | <EditText | 324 | <EditText |
325 | android:id="@+id/tv_useinfo_qq" | 325 | android:id="@+id/tv_useinfo_qq" |
326 | android:layout_width="wrap_content" | 326 | android:layout_width="wrap_content" |
327 | android:layout_height="wrap_content" | 327 | android:layout_height="wrap_content" |
328 | android:layout_marginLeft="50dp" | 328 | android:layout_marginLeft="50dp" |
329 | android:background="@null" | 329 | android:background="@null" |
330 | android:hint="请输入" | 330 | android:hint="请输入" |
331 | android:textSize="22sp" /> | 331 | android:textSize="22sp" /> |
332 | 332 | ||
333 | </LinearLayout> | 333 | </LinearLayout> |
334 | 334 | ||
335 | <LinearLayout | 335 | <LinearLayout |
336 | android:layout_width="0dp" | 336 | android:layout_width="0dp" |
337 | android:layout_height="80dp" | 337 | android:layout_height="80dp" |
338 | android:layout_weight="1" | 338 | android:layout_weight="1" |
339 | 339 | ||
340 | android:gravity="center_vertical"> | 340 | android:gravity="center_vertical"> |
341 | 341 | ||
342 | <TextView | 342 | <TextView |
343 | android:layout_width="wrap_content" | 343 | android:layout_width="wrap_content" |
344 | android:layout_height="wrap_content" | 344 | android:layout_height="wrap_content" |
345 | android:text="学校" | 345 | android:text="学校" |
346 | android:textColor="@color/pickerview_wheelview_textcolor_center" | 346 | android:textColor="@color/pickerview_wheelview_textcolor_center" |
347 | android:textSize="22sp" /> | 347 | android:textSize="22sp" /> |
348 | 348 | ||
349 | <TextView | 349 | <TextView |
350 | android:id="@+id/tv_useinfo_school" | 350 | android:id="@+id/tv_useinfo_school" |
351 | android:layout_width="wrap_content" | 351 | android:layout_width="wrap_content" |
352 | android:layout_height="wrap_content" | 352 | android:layout_height="wrap_content" |
353 | android:layout_marginLeft="50dp" | 353 | android:layout_marginLeft="50dp" |
354 | android:text="请选择" | 354 | android:hint="请选择" |
355 | android:textColor="@color/btn_text_color" | 355 | android:textColor="@color/btn_text_color" |
356 | android:textSize="22sp" /> | 356 | android:textSize="22sp" /> |
357 | 357 | ||
358 | <ImageView | 358 | <ImageView |
359 | android:layout_width="wrap_content" | 359 | android:layout_width="wrap_content" |
360 | android:layout_height="wrap_content" | 360 | android:layout_height="wrap_content" |
361 | android:layout_marginLeft="150dp" | 361 | android:layout_marginLeft="150dp" |
362 | android:src="@mipmap/xiajiantou"> | 362 | android:src="@mipmap/xiajiantou"> |
363 | 363 | ||
364 | </ImageView> | 364 | </ImageView> |
365 | </LinearLayout> | 365 | </LinearLayout> |
366 | 366 | ||
367 | </LinearLayout> | 367 | </LinearLayout> |
368 | 368 | ||
369 | <LinearLayout | 369 | <LinearLayout |
370 | android:layout_width="wrap_content" | 370 | android:layout_width="wrap_content" |
371 | android:layout_height="wrap_content" | 371 | android:layout_height="wrap_content" |
372 | android:orientation="horizontal"> | 372 | android:orientation="horizontal"> |
373 | 373 | ||
374 | <View | 374 | <View |
375 | android:layout_width="450dp" | 375 | android:layout_width="450dp" |
376 | android:layout_height="0.7dp" | 376 | android:layout_height="0.7dp" |
377 | android:layout_marginLeft="150dp" | 377 | android:layout_marginLeft="150dp" |
378 | android:background="@color/electronic_text"> | 378 | android:background="@color/electronic_text"> |
379 | 379 | ||
380 | </View> | 380 | </View> |
381 | 381 | ||
382 | <View | 382 | <View |
383 | android:layout_width="450dp" | 383 | android:layout_width="450dp" |
384 | android:layout_height="0.7dp" | 384 | android:layout_height="0.7dp" |
385 | android:layout_marginLeft="80dp" | 385 | android:layout_marginLeft="80dp" |
386 | android:background="@color/electronic_text"> | 386 | android:background="@color/electronic_text"> |
387 | 387 | ||
388 | </View> | 388 | </View> |
389 | 389 | ||
390 | 390 | ||
391 | </LinearLayout> | 391 | </LinearLayout> |
392 | 392 | ||
393 | </LinearLayout> | 393 | </LinearLayout> |