Commit c2f64dd6c945aebe8d7ee6b81d4dbefe190f0226
1 parent
4912f2ed51
Exists in
master
完善电子保卡
Showing
19 changed files
with
511 additions
and
72 deletions
Show diff stats
PersonalCenter/app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | package="com.hjx.personalcenter"> | 3 | package="com.hjx.personalcenter"> |
4 | 4 | ||
5 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 5 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
6 | <application | 6 | <application |
7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/ic_launcher" |
9 | android:label="@string/app_name" | 9 | android:label="@string/app_name" |
10 | android:supportsRtl="true" | 10 | android:supportsRtl="true" |
11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 11 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
12 | <activity | 12 | <activity |
13 | android:name=".activity.MainActivity" | 13 | android:name=".activity.MainActivity" |
14 | android:launchMode="singleTask" | 14 | android:launchMode="singleTask" |
15 | android:screenOrientation="landscape"> | 15 | android:screenOrientation="landscape"> |
16 | <intent-filter> | 16 | <intent-filter> |
17 | <action android:name="android.intent.action.MAIN" /> | 17 | <action android:name="android.intent.action.MAIN" /> |
18 | 18 | ||
19 | <category android:name="android.intent.category.LAUNCHER" /> | 19 | <category android:name="android.intent.category.LAUNCHER" /> |
20 | </intent-filter> | 20 | </intent-filter> |
21 | </activity> | 21 | </activity> |
22 | <activity | 22 | <activity |
23 | android:name=".activity.LoginAndRegisterActivity" | 23 | android:name=".activity.LoginAndRegisterActivity" |
24 | android:launchMode="singleTask" | 24 | android:launchMode="singleTask" |
25 | android:screenOrientation="landscape"> | 25 | android:screenOrientation="landscape"> |
26 | 26 | ||
27 | </activity> | 27 | </activity> |
28 | <activity | 28 | <activity |
29 | android:name=".activity.ForgotPasswordActivity" | 29 | android:name=".activity.ForgotPasswordActivity" |
30 | android:launchMode="singleTask" | 30 | android:launchMode="singleTask" |
31 | android:screenOrientation="landscape"> | 31 | android:screenOrientation="landscape"> |
32 | 32 | ||
33 | </activity> | 33 | </activity> |
34 | <activity | 34 | <activity |
35 | android:name=".activity.ChangePasswordActivity" | 35 | android:name=".activity.ChangePasswordActivity" |
36 | android:launchMode="singleTask" | 36 | android:launchMode="singleTask" |
37 | android:screenOrientation="landscape"> | 37 | android:screenOrientation="landscape"> |
38 | 38 | ||
39 | </activity> | 39 | </activity> |
40 | <activity | 40 | <activity |
41 | android:name=".activity.RegisterInfoActivity" | 41 | android:name=".activity.RegisterInfoActivity" |
42 | android:launchMode="singleTask" | 42 | android:launchMode="singleTask" |
43 | android:screenOrientation="landscape"> | 43 | android:screenOrientation="landscape"> |
44 | 44 | ||
45 | </activity> | 45 | </activity> |
46 | <activity | 46 | <activity |
47 | android:name=".activity.ElectronicCardValidationActivity" | 47 | android:name=".activity.ElectronicCardValidationActivity" |
48 | android:launchMode="singleTask" | 48 | android:launchMode="singleTask" |
49 | android:screenOrientation="landscape"> | 49 | android:screenOrientation="landscape"> |
50 | 50 | ||
51 | </activity> | 51 | </activity> |
52 | <activity | 52 | <activity |
53 | android:name=".activity.ChangeBangDingActivity" | 53 | android:name=".activity.ChangeBangDingActivity" |
54 | android:launchMode="singleTask" | 54 | android:launchMode="singleTask" |
55 | android:screenOrientation="landscape"> | 55 | android:screenOrientation="landscape"> |
56 | 56 | ||
57 | </activity> | 57 | </activity> |
58 | <activity | 58 | <activity |
59 | android:name=".activity.ChangeElectronicCardInfoActivity" | 59 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
60 | android:launchMode="singleTask" | 60 | android:launchMode="singleTask" |
61 | android:screenOrientation="landscape"> | 61 | android:screenOrientation="landscape"> |
62 | 62 | ||
63 | </activity> | 63 | </activity> |
64 | <activity | 64 | <activity |
65 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 65 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
66 | android:launchMode="singleTask" | 66 | android:launchMode="singleTask" |
67 | android:screenOrientation="landscape"> | 67 | android:screenOrientation="landscape"> |
68 | 68 | ||
69 | </activity> | 69 | </activity> |
70 | <activity | 70 | <activity |
71 | android:name=".activity.ChoiseTextBookActivity" | 71 | android:name=".activity.ChoiseTextBookActivity" |
72 | android:launchMode="singleTask" | 72 | android:launchMode="singleTask" |
73 | android:screenOrientation="landscape"> | 73 | android:screenOrientation="landscape"> |
74 | 74 | ||
75 | </activity> | 75 | </activity> |
76 | <activity | 76 | <activity |
77 | android:name=".activity.TheStartPageActivity" | 77 | android:name=".activity.TheStartPageActivity" |
78 | android:launchMode="singleTask" | 78 | android:launchMode="singleTask" |
79 | android:screenOrientation="landscape"> | 79 | android:screenOrientation="landscape"> |
80 | 80 | ||
81 | </activity> | 81 | </activity> |
82 | <activity | 82 | <activity |
83 | android:name=".activity.ElectronicCardEditInfoActivity" | 83 | android:name=".activity.ElectronicCardEditInfoActivity" |
84 | android:launchMode="singleTask" | 84 | android:launchMode="singleTask" |
85 | android:screenOrientation="landscape"> | 85 | android:screenOrientation="landscape"> |
86 | 86 | ||
87 | </activity> | 87 | </activity> |
88 | <activity | 88 | <activity |
89 | android:name=".activity.ElectronicCardInfoOKActivity" | 89 | android:name=".activity.ElectronicCardInfoOKActivity" |
90 | android:launchMode="singleTask" | 90 | android:launchMode="singleTask" |
91 | android:screenOrientation="landscape"> | 91 | android:screenOrientation="landscape"> |
92 | 92 | ||
93 | </activity> | 93 | </activity> |
94 | <activity | 94 | <activity |
95 | android:name=".activity.ElectronicCardLookInfoActivity" | 95 | android:name=".activity.ElectronicCardLookInfoActivity" |
96 | android:launchMode="singleTask" | 96 | android:launchMode="singleTask" |
97 | android:screenOrientation="landscape"> | 97 | android:screenOrientation="landscape"> |
98 | 98 | ||
99 | </activity> | 99 | </activity> |
100 | <activity | 100 | <activity |
101 | android:name=".activity.FeedBackActivity" | 101 | android:name=".activity.FeedBackActivity" |
102 | android:launchMode="singleTask" | 102 | android:launchMode="singleTask" |
103 | android:screenOrientation="landscape"> | 103 | android:screenOrientation="landscape"> |
104 | 104 | ||
105 | </activity> | 105 | </activity> |
106 | <activity | 106 | <activity |
107 | android:name=".activity.AccountManagementActivity" | 107 | android:name=".activity.AccountManagementActivity" |
108 | android:launchMode="singleTask" | 108 | android:launchMode="singleTask" |
109 | android:screenOrientation="landscape"> | 109 | android:screenOrientation="landscape"> |
110 | 110 | ||
111 | </activity> | 111 | </activity> |
112 | <activity | 112 | <activity |
113 | android:name=".activity.ChangePresonalInfoActivity" | 113 | android:name=".activity.ChangePresonalInfoActivity" |
114 | android:launchMode="singleTask" | 114 | android:launchMode="singleTask" |
115 | android:screenOrientation="landscape"> | 115 | android:screenOrientation="landscape"> |
116 | 116 | ||
117 | </activity> | 117 | </activity> |
118 | </application> | 118 | </application> |
119 | <!--权限--> | 119 | <!--权限--> |
120 | <uses-permission android:name="android.permission.CAMERA" /> | 120 | <uses-permission android:name="android.permission.CAMERA" /> |
121 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 121 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
122 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 122 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
123 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 123 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
124 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 124 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
125 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 125 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
126 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 126 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
127 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 127 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
128 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 128 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
129 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 129 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
130 | <uses-permission android:name="android.permission.INTERNET" /> | 130 | <uses-permission android:name="android.permission.INTERNET" /> |
131 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 131 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
132 | <uses-permission android:name="android.permission.READ_LOGS" /> | 132 | <uses-permission android:name="android.permission.READ_LOGS" /> |
133 | 133 | ||
134 | </manifest> | 134 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardAdressInfoActivity.java
File was created | 1 | package com.hjx.personalcenter.activity; | |
2 | |||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | ||
5 | |||
6 | import com.hjx.personalcenter.R; | ||
7 | |||
8 | /** | ||
9 | * Created by h on 2017/8/9. | ||
10 | */ | ||
11 | |||
12 | public class ChangeElectronicCardAdressInfoActivity extends Activity{ | ||
13 | @Override | ||
14 | protected void onCreate(Bundle savedInstanceState) { | ||
15 | super.onCreate(savedInstanceState); | ||
16 | setContentView(R.layout.activity_change_card_validation); | ||
17 | } | ||
18 | } | ||
19 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardInfoActivity.java
1 | package com.hjx.personalcenter.activity; | File was deleted | |
2 | |||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | ||
5 | |||
6 | import com.hjx.personalcenter.R; | ||
7 | |||
8 | /** | ||
9 | * Created by h on 2017/8/9. | ||
10 | */ | ||
11 | |||
12 | public class ChangeElectronicCardInfoActivity extends Activity{ | ||
13 | @Override | ||
14 | protected void onCreate(Bundle savedInstanceState) { | ||
15 | super.onCreate(savedInstanceState); | ||
16 | setContentView(R.layout.activity_change_card_validation); | ||
17 | } | ||
18 | } | ||
19 | 1 | package com.hjx.personalcenter.activity; |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardEditInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.text.TextUtils; | ||
7 | import android.view.View; | 8 | import android.view.View; |
8 | import android.widget.Button; | 9 | import android.widget.Button; |
9 | import android.widget.EditText; | 10 | import android.widget.EditText; |
10 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
11 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
12 | import android.widget.TextView; | 13 | import android.widget.TextView; |
13 | 14 | ||
14 | import com.bigkoo.pickerview.TimePickerView; | 15 | import com.bigkoo.pickerview.TimePickerView; |
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.db.SaveParam; | ||
18 | import com.hjx.personalcenter.util.AlertUtils; | ||
16 | 19 | ||
17 | import java.text.SimpleDateFormat; | 20 | import java.text.SimpleDateFormat; |
18 | import java.util.Date; | 21 | import java.util.Date; |
19 | 22 | ||
20 | /**填写保卡信息 熊巍 | 23 | /**填写保卡信息 熊巍 |
21 | * Created by h on 2017/8/11. | 24 | * Created by h on 2017/8/11. |
22 | */ | 25 | */ |
23 | 26 | ||
24 | public class ElectronicCardEditInfoActivity extends Activity implements View.OnClickListener { | 27 | public class ElectronicCardEditInfoActivity extends Activity implements View.OnClickListener { |
25 | private LinearLayout lineL_buy_time; | 28 | private LinearLayout lineL_buy_time; |
26 | private TextView tv_buy_time,adress_shop,adress_custem; | 29 | private TextView tv_buy_time,adress_shop,adress_custem; |
27 | private EditText username,store,detalAdress,telphone; | 30 | private EditText username,store,detalAdress,telphone; |
28 | private TimePickerView pvTime; | 31 | private TimePickerView pvTime; |
29 | private Button btn_change_info; | 32 | private Button btn_change_info; |
30 | private ImageView iv_card_back; | 33 | private ImageView iv_card_back; |
31 | 34 | ||
32 | @Override | 35 | @Override |
33 | protected void onCreate(Bundle savedInstanceState) { | 36 | protected void onCreate(Bundle savedInstanceState) { |
34 | super.onCreate(savedInstanceState); | 37 | super.onCreate(savedInstanceState); |
35 | setContentView(R.layout.activity_electroniccard_info); | 38 | setContentView(R.layout.activity_electroniccard_info); |
36 | initView(); | 39 | initView(); |
37 | initData(); | 40 | initData(); |
38 | initLister(); | 41 | initLister(); |
39 | initTimePicker(); | 42 | initTimePicker(); |
40 | } | 43 | } |
41 | 44 | ||
42 | private void initView() { | 45 | private void initView() { |
43 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 46 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
44 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 47 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
45 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 48 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
46 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 49 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
47 | username = (EditText) findViewById(R.id.et_edit_username); | 50 | username = (EditText) findViewById(R.id.et_edit_username); |
48 | store = (EditText) findViewById(R.id.et_edit_store); | 51 | store = (EditText) findViewById(R.id.et_edit_store); |
49 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 52 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
50 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 53 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
51 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 54 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
52 | } | 55 | } |
53 | 56 | ||
54 | private void initData() { | 57 | private void initData() { |
55 | 58 | ||
56 | } | 59 | } |
57 | 60 | ||
58 | private void initLister() { | 61 | private void initLister() { |
59 | lineL_buy_time.setOnClickListener(this); | 62 | lineL_buy_time.setOnClickListener(this); |
60 | adress_shop.setOnClickListener(this); | 63 | adress_shop.setOnClickListener(this); |
61 | adress_custem.setOnClickListener(this); | 64 | adress_custem.setOnClickListener(this); |
62 | btn_change_info.setOnClickListener(this); | 65 | btn_change_info.setOnClickListener(this); |
63 | 66 | ||
64 | } | 67 | } |
65 | //自定义时间选择器 | 68 | //自定义时间选择器 |
66 | private void initTimePicker() { | 69 | private void initTimePicker() { |
67 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 70 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
68 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 71 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
69 | // Calendar selectedDate = Calendar.getInstance(); | 72 | // Calendar selectedDate = Calendar.getInstance(); |
70 | // Calendar startDate = Calendar.getInstance(); | 73 | // Calendar startDate = Calendar.getInstance(); |
71 | // startDate.set(1900, 1, 1); | 74 | // startDate.set(1900, 1, 1); |
72 | // Calendar endDate = Calendar.getInstance(); | 75 | // Calendar endDate = Calendar.getInstance(); |
73 | // endDate.set(2100, 1, 1); | 76 | // endDate.set(2100, 1, 1); |
74 | //时间选择器 | 77 | //时间选择器 |
75 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { | 78 | pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { |
76 | @Override | 79 | @Override |
77 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 80 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
78 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 81 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
79 | /*btn_Time.setText(getTime(date));*/ | 82 | /*btn_Time.setText(getTime(date));*/ |
80 | TextView btn = (TextView) v; | 83 | TextView btn = (TextView) v; |
81 | btn.setText(getTime(date)); | 84 | btn.setText(getTime(date)); |
82 | } | 85 | } |
83 | }) | 86 | }) |
84 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 87 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
85 | .setType(new boolean[]{true, true, true, false, false, false}) | 88 | .setType(new boolean[]{true, true, true, false, false, false}) |
86 | .setLabel("", "", "", "", "", "") | 89 | .setLabel("", "", "", "", "", "") |
87 | .isCenterLabel(false) | 90 | .isCenterLabel(false) |
88 | .setDividerColor(Color.DKGRAY) | 91 | .setDividerColor(Color.DKGRAY) |
89 | .setContentSize(21) | 92 | .setContentSize(21) |
90 | // .setDate(selectedDate) | 93 | // .setDate(selectedDate) |
91 | // .setRangDate(startDate, endDate) | 94 | // .setRangDate(startDate, endDate) |
92 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 95 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
93 | .setDecorView(null) | 96 | .setDecorView(null) |
94 | .setTitleText("购买日期") | 97 | .setTitleText("购买日期") |
95 | .setTitleSize(22) | 98 | .setTitleSize(22) |
96 | .setCancelColor(Color.GRAY) | 99 | .setCancelColor(Color.GRAY) |
97 | .setSubCalSize(22) | 100 | .setSubCalSize(22) |
98 | .setDividerColor(Color.GRAY) | 101 | .setDividerColor(Color.GRAY) |
99 | .setSubmitColor(Color.GRAY) | 102 | .setSubmitColor(Color.GRAY) |
100 | .build(); | 103 | .build(); |
101 | } | 104 | } |
102 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 105 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
103 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 106 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
104 | return format.format(date); | 107 | return format.format(date); |
105 | } | 108 | } |
106 | 109 | ||
107 | @Override | 110 | @Override |
108 | public void onClick(View v) { | 111 | public void onClick(View v) { |
109 | switch (v.getId()){ | 112 | switch (v.getId()){ |
110 | case R.id.lineL_buy_time: | 113 | case R.id.lineL_buy_time: |
111 | pvTime.show(tv_buy_time);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 114 | pvTime.show(tv_buy_time);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
112 | break; | 115 | break; |
113 | case R.id.btn_change_info: | 116 | case R.id.btn_change_info: |
114 | Intent intent = new Intent(); | 117 | String info1 =username.getText().toString().trim(); |
115 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 118 | String info2 =adress_custem.getText().toString().trim(); |
116 | startActivity(intent); | 119 | String info3 =detalAdress.getText().toString().trim(); |
117 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 120 | String info4 =tv_buy_time.getText().toString().trim(); |
121 | String info5 =adress_shop.getText().toString().trim(); | ||
122 | String info6 =store.getText().toString().trim(); | ||
123 | String info7 =telphone.getText().toString().trim(); | ||
124 | |||
125 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | ||
126 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | ||
127 | ||TextUtils.isEmpty(info7)) { | ||
128 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | ||
129 | return; | ||
130 | }else { | ||
131 | savedata(); | ||
132 | Intent intent = new Intent(); | ||
133 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | ||
134 | startActivity(intent); | ||
135 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
136 | } | ||
137 | |||
118 | break; | 138 | break; |
119 | case R.id.tv_edit_adress_shop: | 139 | case R.id.tv_edit_adress_shop: |
120 | 140 | ||
141 | adress_shop.setText("湖南省益阳市上河区"); | ||
121 | break; | 142 | break; |
122 | case R.id.tv_edit_adress_custem: | 143 | case R.id.tv_edit_adress_custem: |
144 | adress_custem.setText("湖南省益阳市上河区"); | ||
123 | break; | 145 | break; |
124 | 146 | ||
125 | } | 147 | } |
126 | 148 | ||
127 | 149 | ||
128 | } | 150 | } |
151 | //保存数据 | ||
152 | private void savedata() { | ||
153 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | ||
154 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | ||
155 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | ||
156 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | ||
157 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | ||
158 | |||
159 | } | ||
129 | } | 160 | } |
130 | 161 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardInfoOKActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | ||
5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
6 | import android.view.View; | 5 | import android.view.View; |
7 | import android.widget.Button; | 6 | import android.widget.Button; |
8 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
9 | import android.widget.TextView; | 8 | import android.widget.TextView; |
10 | 9 | ||
11 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.SaveParam; | ||
12 | import com.hjx.personalcenter.http.HttpManager; | ||
12 | import com.hjx.personalcenter.util.GetDevicesUtil; | 13 | import com.hjx.personalcenter.util.GetDevicesUtil; |
13 | 14 | ||
14 | /**确认保卡信息 | 15 | /**确认保卡信息 |
15 | * Created by h on 2017/8/11. | 16 | * Created by h on 2017/8/11. |
16 | */ | 17 | */ |
17 | 18 | ||
18 | public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { | 19 | public class ElectronicCardInfoOKActivity extends Activity implements View.OnClickListener { |
19 | private Button btn_finish; | 20 | private Button btn_finish; |
20 | private ImageView iv_last_step; | 21 | private ImageView iv_last_step; |
21 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 22 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; |
22 | @Override | 23 | @Override |
23 | protected void onCreate(Bundle savedInstanceState) { | 24 | protected void onCreate(Bundle savedInstanceState) { |
24 | super.onCreate(savedInstanceState); | 25 | super.onCreate(savedInstanceState); |
25 | setContentView(R.layout.activity_ok_cardinfo); | 26 | setContentView(R.layout.activity_ok_cardinfo); |
26 | initView(); | 27 | initView(); |
27 | initData(); | 28 | initData(); |
28 | initLister(); | 29 | initLister(); |
29 | } | 30 | } |
30 | private void initView() { | 31 | private void initView() { |
31 | btn_finish = (Button) findViewById(R.id.btn_finish); | 32 | btn_finish = (Button) findViewById(R.id.btn_finish); |
33 | iv_last_step = (ImageView) findViewById(R.id.cancel); | ||
32 | usename = (TextView) findViewById(R.id.iv_card_username); | 34 | usename = (TextView) findViewById(R.id.iv_card_username); |
33 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 35 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
34 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 36 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
35 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 37 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
36 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 38 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
37 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 39 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
38 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 40 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
39 | phone = (TextView) findViewById(R.id.tv_card_phone); | 41 | phone = (TextView) findViewById(R.id.tv_card_phone); |
40 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 42 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
41 | } | 43 | } |
42 | 44 | ||
43 | private void initData() { | 45 | private void initData() { |
44 | //获取设备信息 | 46 | //获取设备信息 |
45 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 47 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
46 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 48 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
47 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 49 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
48 | //获取保卡信息 | 50 | //获取保卡信息 |
51 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | ||
52 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | ||
53 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | ||
54 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | ||
55 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | ||
56 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | ||
57 | |||
49 | 58 | ||
50 | } | 59 | } |
51 | 60 | ||
52 | private void initLister() { | 61 | private void initLister() { |
62 | iv_last_step.setOnClickListener(this); | ||
53 | btn_finish.setOnClickListener(this); | 63 | btn_finish.setOnClickListener(this); |
54 | } | 64 | } |
55 | 65 | ||
56 | @Override | 66 | @Override |
57 | public void onClick(View v) { | 67 | public void onClick(View v) { |
58 | switch (v.getId()){ | 68 | switch (v.getId()){ |
59 | case R.id.btn_finish: | 69 | case R.id.btn_finish: |
60 | Intent intent = new Intent(); | 70 | HttpManager.getInstance().subcardinfo(this,636,usename.getText().toString().trim(), |
61 | intent.setClass(ElectronicCardInfoOKActivity.this,TheStartPageActivity.class); | 71 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
62 | startActivity(intent); | 72 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
63 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 73 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
74 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | ||
75 | break; | ||
76 | case R.id.cancel: | ||
77 | finish(); | ||
64 | break; | 78 | break; |
65 | } | 79 | } |
66 | } | 80 | } |
81 | |||
82 | |||
67 | } | 83 | } |
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.app.Activity; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | ||
6 | import android.view.View; | ||
7 | import android.widget.ImageView; | ||
8 | import android.widget.TextView; | ||
5 | 9 | ||
6 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.Content; | ||
12 | import com.hjx.personalcenter.db.SaveParam; | ||
13 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
7 | 14 | ||
8 | /** | 15 | /** |
9 | * Created by h on 2017/8/11. | 16 | * Created by h on 2017/8/11. |
10 | */ | 17 | */ |
11 | 18 | ||
12 | public class ElectronicCardLookInfoActivity extends Activity{ | 19 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener{ |
20 | private ImageView iv_last_step; | ||
21 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber, | ||
22 | shopadress,phone,tlePhone,tv_card_adress_change,tv_card_phone_change; | ||
23 | |||
13 | @Override | 24 | @Override |
14 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
15 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
16 | setContentView(R.layout.activity_electronic_look_cardinfo); | 27 | setContentView(R.layout.activity_electronic_look_cardinfo); |
28 | initView(); | ||
29 | initData(); | ||
30 | initLister(); | ||
31 | } | ||
32 | private void initView() { | ||
33 | usename = (TextView) findViewById(R.id.iv_card_username); | ||
34 | iv_last_step = (ImageView) findViewById(R.id.cancel); | ||
35 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | ||
36 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | ||
37 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | ||
38 | shoptime = (TextView) findViewById(R.id.tv_card_time); | ||
39 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | ||
40 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | ||
41 | phone = (TextView) findViewById(R.id.tv_card_phone); | ||
42 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | ||
43 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | ||
44 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | ||
45 | } | ||
46 | private void initData() { | ||
47 | //获取设备信息 | ||
48 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | ||
49 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | ||
50 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | ||
51 | //获取保卡信息 | ||
52 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | ||
53 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | ||
54 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | ||
55 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | ||
56 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | ||
57 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | ||
58 | |||
59 | |||
60 | } | ||
61 | private void initLister() { | ||
62 | tv_card_adress_change.setOnClickListener(this); | ||
63 | tv_card_phone_change.setOnClickListener(this); | ||
64 | iv_last_step.setOnClickListener(this); | ||
17 | } | 65 | } |
66 | @Override | ||
67 | public void onClick(View v) { | ||
68 | switch (v.getId()){ | ||
69 | case R.id.tv_card_adress_change: | ||
70 | Intent intent = new Intent(); | ||
71 | intent.setClass(this,ChangeElectronicCardAdressInfoActivity.class); | ||
72 | startActivity(intent); | ||
73 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
74 | |||
75 | break; | ||
76 | case R.id.tv_card_phone_change: | ||
77 | Content.authcodeflag =2; | ||
78 | Intent intent1 = new Intent(); | ||
79 | intent1.setClass(this,ElectronicCardValidationActivity.class); | ||
80 | startActivity(intent1); | ||
81 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
82 | |||
83 | |||
84 | break; | ||
85 | case R.id.cancel: | ||
86 | finish(); | ||
87 | break; | ||
88 | } | ||
89 | } | ||
90 | |||
18 | } | 91 | } |
19 | 92 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.os.Handler; | ||
7 | import android.os.Message; | ||
8 | import android.text.TextUtils; | ||
6 | import android.view.View; | 9 | import android.view.View; |
7 | import android.widget.Button; | 10 | import android.widget.Button; |
11 | import android.widget.EditText; | ||
12 | import android.widget.TextView; | ||
8 | 13 | ||
9 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.db.Content; | ||
16 | import com.hjx.personalcenter.db.SaveParam; | ||
17 | import com.hjx.personalcenter.http.HttpCode; | ||
18 | import com.hjx.personalcenter.http.HttpManager; | ||
19 | import com.hjx.personalcenter.util.AlertUtils; | ||
20 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | ||
21 | |||
22 | import org.json.JSONObject; | ||
10 | 23 | ||
11 | /** | 24 | /** |
12 | * Created by h on 2017/8/9. | 25 | * Created by h on 2017/8/9. |
13 | */ | 26 | */ |
14 | 27 | ||
15 | public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener { | 28 | public class ElectronicCardValidationActivity extends Activity implements View.OnClickListener { |
16 | private Button btn_card_valiyanzhen; | 29 | private Button btn_card_valiyanzhen,get_authcode; |
30 | private EditText phonenumber,anth_6num;//;//密码 | ||
31 | private TextView menu_title; | ||
32 | private int i = 0; | ||
33 | private Thread thread; | ||
34 | private String sourceStr ="android"; | ||
35 | private String typeStr = "register"; | ||
36 | String authcode = ""; | ||
37 | Handler handler = new Handler() { | ||
38 | @Override | ||
39 | public void handleMessage(Message msg) { | ||
40 | super.handleMessage(msg); | ||
41 | JSONObject jsonObject; | ||
42 | String status; | ||
43 | switch (msg.what) { | ||
44 | case HttpCode.AUTHCODE_SUCESS: | ||
45 | jsonObject = (JSONObject) msg.obj; | ||
46 | status = jsonObject.optString("status"); | ||
47 | authcode = jsonObject.optString("jsessionid"); | ||
48 | if (status.equals("100")) { | ||
49 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | ||
50 | } | ||
51 | |||
52 | break; | ||
53 | case HttpCode.AUTHCODE_FAIL: | ||
54 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | ||
55 | break; | ||
56 | case 1: | ||
57 | get_authcode.setEnabled(false); | ||
58 | get_authcode.setClickable(false); | ||
59 | get_authcode.setText(Integer.toString(i--)+" s"); | ||
60 | if (i<=0){ | ||
61 | get_authcode.setEnabled(true); | ||
62 | get_authcode.setClickable(true); | ||
63 | get_authcode.setText("获取验证码"); | ||
64 | } | ||
65 | break; | ||
66 | } | ||
67 | } | ||
68 | }; | ||
17 | @Override | 69 | @Override |
18 | protected void onCreate(Bundle savedInstanceState) { | 70 | protected void onCreate(Bundle savedInstanceState) { |
19 | super.onCreate(savedInstanceState); | 71 | super.onCreate(savedInstanceState); |
20 | setContentView(R.layout.activity_electroniccard_validation); | 72 | setContentView(R.layout.activity_electroniccard_validation); |
21 | initView(); | 73 | initView(); |
22 | initData(); | 74 | initData(); |
23 | initLister(); | 75 | initLister(); |
24 | } | 76 | } |
25 | 77 | ||
26 | private void initView() { | 78 | private void initView() { |
27 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 79 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
80 | get_authcode = (Button) findViewById(R.id.btn_authcode); | ||
81 | anth_6num = (EditText) findViewById(R.id.et_authcode); | ||
82 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | ||
83 | menu_title = (TextView) findViewById(R.id.menu_title); | ||
28 | } | 84 | } |
29 | 85 | ||
30 | private void initData() { | 86 | private void initData() { |
87 | if (Content.authcodeflag==1){ | ||
88 | menu_title.setText("填写保卡信息"); | ||
89 | |||
90 | }else if (Content.authcodeflag==2){ | ||
91 | menu_title.setText("修改保卡信息"); | ||
92 | }else { | ||
93 | menu_title.setText("更换绑定"); | ||
94 | } | ||
95 | |||
96 | |||
31 | 97 | ||
32 | } | 98 | } |
33 | 99 | ||
34 | private void initLister() { | 100 | private void initLister() { |
101 | get_authcode.setOnClickListener(this); | ||
35 | btn_card_valiyanzhen.setOnClickListener(this); | 102 | btn_card_valiyanzhen.setOnClickListener(this); |
36 | 103 | ||
37 | } | 104 | } |
38 | 105 | ||
39 | @Override | 106 | @Override |
40 | public void onClick(View v) { | 107 | public void onClick(View v) { |
41 | switch (v.getId()){ | 108 | switch (v.getId()){ |
42 | case R.id.btn_card_valiyanzhen: | 109 | case R.id.btn_card_valiyanzhen: |
110 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | ||
43 | Intent intent = new Intent(); | 111 | Intent intent = new Intent(); |
44 | intent.setClass(ElectronicCardValidationActivity.this,ElectronicCardEditInfoActivity.class); | 112 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
45 | startActivity(intent); | 113 | startActivity(intent); |
46 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 114 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
115 | |||
116 | String usernameStr = phonenumber.getText().toString().trim(); | ||
117 | String authcodeStr = anth_6num.getText().toString().trim(); | ||
118 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | ||
119 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | ||
120 | return; | ||
121 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | ||
122 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | ||
123 | |||
124 | }else if (!authcode.equals(authcodeStr)){ | ||
125 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | ||
126 | }else { | ||
127 | if (Content.authcodeflag==1){ | ||
128 | menu_title.setText("填写保卡信息"); | ||
129 | |||
130 | }else if (Content.authcodeflag==2){ | ||
131 | //调用接口 | ||
132 | menu_title.setText("修改保卡信息"); | ||
133 | }else { | ||
134 | //修改手机号 | ||
135 | menu_title.setText("更换绑定"); | ||
136 | } | ||
137 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | ||
138 | // Intent intent = new Intent(); | ||
139 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | ||
140 | // startActivity(intent); | ||
141 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
142 | } | ||
143 | break; | ||
144 | case R.id.btn_authcode: | ||
145 | String usernameStr1 = phonenumber.getText().toString().trim(); | ||
146 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | ||
147 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | ||
148 | }else { | ||
149 | anth_6num.requestFocus(); | ||
150 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | ||
151 | i = 60; | ||
152 | if(thread == null){ | ||
153 | thread = new Thread( new ThreadShow()); | ||
154 | thread.start(); | ||
155 | } | ||
156 | |||
157 | } | ||
158 | |||
47 | break; | 159 | break; |
48 | } | 160 | } |
49 | } | 161 | } |
162 | // 线程类 定时器 | ||
163 | class ThreadShow implements Runnable { | ||
164 | |||
165 | @Override | ||
166 | public void run() { | ||
167 | // TODO Auto-generated method stub | ||
168 | while (true) { | ||
169 | try { | ||
170 | Thread.sleep(1000); | ||
171 | Message msg = new Message(); | ||
172 | msg.what = 1; | ||
173 | handler.sendMessage(msg); | ||
174 | System.out.println("send..."); | ||
175 | } catch (Exception e) { | ||
176 | // TODO Auto-generated catch block | ||
177 | e.printStackTrace(); | ||
178 | System.out.println("thread error..."); | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | } | ||
50 | } | 183 | } |
51 | 184 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ForgotPasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
9 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
10 | import android.view.View; | 10 | import android.view.View; |
11 | import android.widget.Button; | 11 | import android.widget.Button; |
12 | import android.widget.EditText; | 12 | import android.widget.EditText; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | 14 | ||
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.http.HttpCode; | 16 | import com.hjx.personalcenter.http.HttpCode; |
17 | import com.hjx.personalcenter.http.HttpManager; | 17 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
19 | import com.hjx.personalcenter.util.Judgment; | 19 | import com.hjx.personalcenter.util.Judgment; |
20 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 20 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
22 | 22 | ||
23 | import org.json.JSONException; | 23 | import org.json.JSONException; |
24 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
25 | 25 | ||
26 | /**忘记密码 | 26 | /**忘记密码 |
27 | * Created by h on 2017/6/17. | 27 | * Created by h on 2017/6/17. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | public class ForgotPasswordActivity extends Activity implements View.OnClickListener { | 30 | public class ForgotPasswordActivity extends Activity implements View.OnClickListener { |
31 | private ImageView back_forgit,iv_pwd_change; | 31 | private ImageView back_forgit,iv_pwd_change; |
32 | private EditText forot_pwd_phone,forot_pwd_anthcode,forot_pwd_pwd,forot_pwd_pwd2; | 32 | private EditText forot_pwd_phone,forot_pwd_anthcode,forot_pwd_pwd,forot_pwd_pwd2; |
33 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 33 | private Button forot_pwd_sub,forot_pwd_getanthcode; |
34 | private String forot_pwd_phone1; | 34 | private String forot_pwd_phone1; |
35 | private String forot_pwd_anthcode1; | 35 | private String forot_pwd_anthcode1; |
36 | private String forot_pwd_pwd3; | 36 | private String forot_pwd_pwd3; |
37 | private String forot_pwd_pwd4; | 37 | private String forot_pwd_pwd4; |
38 | private String typeStr = "login"; | 38 | private String typeStr = "login"; |
39 | private int i = 0; | 39 | private int i = 0; |
40 | private Thread thread; | 40 | private Thread thread; |
41 | public static Boolean showPassword = false; | 41 | public static Boolean showPassword = false; |
42 | 42 | ||
43 | Handler handler = new Handler() { | 43 | Handler handler = new Handler() { |
44 | @Override | 44 | @Override |
45 | public void handleMessage(Message msg) { | 45 | public void handleMessage(Message msg) { |
46 | super.handleMessage(msg); | 46 | super.handleMessage(msg); |
47 | try { | 47 | try { |
48 | JSONObject jsonObject; | 48 | JSONObject jsonObject; |
49 | String status; | 49 | String status; |
50 | switch (msg.what) { | 50 | switch (msg.what) { |
51 | case HttpCode.PASSWORD_SUCESS: | 51 | case HttpCode.PASSWORD_SUCESS: |
52 | jsonObject = (JSONObject) msg.obj; | 52 | jsonObject = (JSONObject) msg.obj; |
53 | status = jsonObject.getString("status"); | 53 | status = jsonObject.getString("status"); |
54 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 54 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
55 | if (status.equals("100")) { | 55 | if (status.equals("100")) { |
56 | AlertUtils.showToast(ForgotPasswordActivity.this,"密码修改成功"); | 56 | AlertUtils.showToast(ForgotPasswordActivity.this,"密码修改成功"); |
57 | } | 57 | } |
58 | 58 | ||
59 | break; | 59 | break; |
60 | case HttpCode.PASSWORD_FAIL: | 60 | case HttpCode.PASSWORD_FAIL: |
61 | jsonObject = (JSONObject) msg.obj; | 61 | jsonObject = (JSONObject) msg.obj; |
62 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 62 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
63 | break; | 63 | break; |
64 | case HttpCode.AUTHCODE_SUCESS1: | 64 | case HttpCode.AUTHCODE_SUCESS1: |
65 | jsonObject = (JSONObject) msg.obj; | 65 | jsonObject = (JSONObject) msg.obj; |
66 | status = jsonObject.optString("status"); | 66 | status = jsonObject.optString("status"); |
67 | if (status.equals("100")) { | 67 | if (status.equals("100")) { |
68 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 68 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
69 | } | 69 | } |
70 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 70 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
71 | break; | 71 | break; |
72 | case HttpCode.AUTHCODE_FAIL1: | 72 | case HttpCode.AUTHCODE_FAIL1: |
73 | jsonObject = (JSONObject) msg.obj; | 73 | jsonObject = (JSONObject) msg.obj; |
74 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 74 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
75 | break; | 75 | break; |
76 | case HttpCode.IS_REFISTER: | 76 | case HttpCode.IS_REFISTER: |
77 | jsonObject = (JSONObject) msg.obj; | 77 | jsonObject = (JSONObject) msg.obj; |
78 | status = jsonObject.getString("status"); | 78 | status = jsonObject.getString("status"); |
79 | if (status.equals("true")) { | 79 | if (status.equals("true")) { |
80 | getauthcode(); | 80 | getauthcode(); |
81 | // i = 60; | 81 | // i = 60; |
82 | // new Thread(new ForgotPassword.ThreadShow()).start(); | 82 | // new Thread(new ForgotPassword.ThreadShow()).start(); |
83 | 83 | ||
84 | }else { | 84 | }else { |
85 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 85 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
86 | } | 86 | } |
87 | break; | 87 | break; |
88 | case 1: | 88 | case 1: |
89 | forot_pwd_getanthcode.setEnabled(false); | 89 | forot_pwd_getanthcode.setEnabled(false); |
90 | forot_pwd_getanthcode.setClickable(false); | 90 | forot_pwd_getanthcode.setClickable(false); |
91 | forot_pwd_getanthcode.setText(Integer.toString(i--)+" s"); | 91 | forot_pwd_getanthcode.setText(Integer.toString(i--)+" s"); |
92 | if (i<=0){ | 92 | if (i<=0){ |
93 | forot_pwd_getanthcode.setEnabled(true); | 93 | forot_pwd_getanthcode.setEnabled(true); |
94 | forot_pwd_getanthcode.setClickable(true); | 94 | forot_pwd_getanthcode.setClickable(true); |
95 | forot_pwd_getanthcode.setText("获取验证码"); | 95 | forot_pwd_getanthcode.setText("获取验证码"); |
96 | 96 | ||
97 | } | 97 | } |
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | } catch (JSONException e) { | 100 | } catch (JSONException e) { |
101 | e.printStackTrace(); | 101 | e.printStackTrace(); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | }; | 104 | }; |
105 | @Override | 105 | @Override |
106 | protected void onCreate(Bundle savedInstanceState) { | 106 | protected void onCreate(Bundle savedInstanceState) { |
107 | super.onCreate(savedInstanceState); | 107 | super.onCreate(savedInstanceState); |
108 | setContentView(R.layout.activity_forgetpsword); | 108 | setContentView(R.layout.activity_forgetpsword); |
109 | initView(); | 109 | initView(); |
110 | setLister(); | 110 | setLister(); |
111 | } | 111 | } |
112 | //获取验证码 | 112 | //获取验证码 |
113 | private void getauthcode() { | 113 | private void getauthcode() { |
114 | forot_pwd_anthcode.requestFocus(); | 114 | forot_pwd_anthcode.requestFocus(); |
115 | HttpManager.getInstance().forgetauthCode(typeStr, forot_pwd_phone1, handler, this); | 115 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
116 | i = 60; | 116 | i = 60; |
117 | if(thread == null){ | 117 | if(thread == null){ |
118 | thread = new Thread( new ThreadShow()); | 118 | thread = new Thread( new ThreadShow()); |
119 | thread.start(); | 119 | thread.start(); |
120 | } | 120 | } |
121 | 121 | ||
122 | } | 122 | } |
123 | 123 | ||
124 | private void initView() { | 124 | private void initView() { |
125 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 125 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
126 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 126 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
127 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 127 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
128 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 128 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
129 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 129 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
130 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 130 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
131 | iv_pwd_change=(ImageView) findViewById(R.id.iv_pwd_change); | 131 | iv_pwd_change=(ImageView) findViewById(R.id.iv_pwd_change); |
132 | back_forgit= (ImageView) findViewById(R.id.cancel); | 132 | back_forgit= (ImageView) findViewById(R.id.cancel); |
133 | } | 133 | } |
134 | private void setLister() { | 134 | private void setLister() { |
135 | iv_pwd_change.setOnClickListener(this); | 135 | iv_pwd_change.setOnClickListener(this); |
136 | back_forgit.setOnClickListener(this); | 136 | back_forgit.setOnClickListener(this); |
137 | forot_pwd_sub.setOnClickListener(this); | 137 | forot_pwd_sub.setOnClickListener(this); |
138 | forot_pwd_getanthcode.setOnClickListener(this); | 138 | forot_pwd_getanthcode.setOnClickListener(this); |
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | @Override | 143 | @Override |
144 | public void onClick(View view) { | 144 | public void onClick(View view) { |
145 | switch (view.getId()){ | 145 | switch (view.getId()){ |
146 | case R.id.btn_ok: | 146 | case R.id.btn_ok: |
147 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 147 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
148 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 148 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
149 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 149 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
150 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 150 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
151 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 151 | if (TextUtils.isEmpty(forot_pwd_phone1)|| |
152 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 152 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ |
153 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 153 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
154 | return; | 154 | return; |
155 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 155 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ |
156 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 156 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
157 | 157 | ||
158 | } | 158 | } |
159 | else if(forot_pwd_pwd3.length()<8||forot_pwd_pwd4.length()<8){ | 159 | else if(forot_pwd_pwd3.length()<8||forot_pwd_pwd4.length()<8){ |
160 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 160 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
161 | }else if(!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 161 | }else if(!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 162 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
163 | } | 163 | } |
164 | else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)){ | 164 | else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)){ |
165 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 165 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
166 | return; | 166 | return; |
167 | }else { | 167 | }else { |
168 | //忘记密码接口 | 168 | //忘记密码接口 |
169 | HttpManager.getInstance().forgetpassword(this,forot_pwd_phone1,forot_pwd_pwd3,forot_pwd_anthcode1,handler); | 169 | HttpManager.getInstance().forgetpassword(this,forot_pwd_phone1,forot_pwd_pwd3,forot_pwd_anthcode1,handler); |
170 | } | 170 | } |
171 | break; | 171 | break; |
172 | case R.id.btn_authcode: | 172 | case R.id.btn_authcode: |
173 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 173 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
174 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 174 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ |
175 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 175 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
176 | }else { | 176 | }else { |
177 | forot_pwd_anthcode.requestFocus(); | 177 | forot_pwd_anthcode.requestFocus(); |
178 | ifregister(); | 178 | ifregister(); |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | break; | 182 | break; |
183 | case R.id.iv_pwd_change: | 183 | case R.id.iv_pwd_change: |
184 | if(showPassword){//显示密码 | 184 | if(showPassword){//显示密码 |
185 | showPassword = !showPassword; | 185 | showPassword = !showPassword; |
186 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 186 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
187 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 187 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
188 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 188 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
189 | }else{//隐藏密码 | 189 | }else{//隐藏密码 |
190 | showPassword = !showPassword; | 190 | showPassword = !showPassword; |
191 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 191 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
192 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 192 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
193 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 193 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
194 | } | 194 | } |
195 | break; | 195 | break; |
196 | 196 | ||
197 | case R.id.cancel: | 197 | case R.id.cancel: |
198 | finish(); | 198 | finish(); |
199 | break; | 199 | break; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | //是否注册 | 202 | //是否注册 |
203 | private void ifregister() { | 203 | private void ifregister() { |
204 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 204 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
205 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 205 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
206 | } | 206 | } |
207 | // 线程类 定时器 | 207 | // 线程类 定时器 |
208 | class ThreadShow implements Runnable { | 208 | class ThreadShow implements Runnable { |
209 | 209 | ||
210 | @Override | 210 | @Override |
211 | public void run() { | 211 | public void run() { |
212 | // TODO Auto-generated method stub | 212 | // TODO Auto-generated method stub |
213 | while (true) { | 213 | while (true) { |
214 | try { | 214 | try { |
215 | Thread.sleep(1000); | 215 | Thread.sleep(1000); |
216 | Message msg = new Message(); | 216 | Message msg = new Message(); |
217 | msg.what = 1; | 217 | msg.what = 1; |
218 | handler.sendMessage(msg); | 218 | handler.sendMessage(msg); |
219 | System.out.println("send..."); | 219 | System.out.println("send..."); |
220 | } catch (Exception e) { | 220 | } catch (Exception e) { |
221 | // TODO Auto-generated catch block | 221 | // TODO Auto-generated catch block |
222 | e.printStackTrace(); | 222 | e.printStackTrace(); |
223 | System.out.println("thread error..."); | 223 | System.out.println("thread error..."); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } | 226 | } |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.java
File was created | 1 | package com.hjx.personalcenter.customdialog; | |
2 | |||
3 | import android.content.Context; | ||
4 | import android.graphics.Color; | ||
5 | import android.os.Bundle; | ||
6 | import android.view.Gravity; | ||
7 | import android.view.LayoutInflater; | ||
8 | import android.view.View; | ||
9 | import android.view.ViewGroup; | ||
10 | import android.widget.AdapterView; | ||
11 | import android.widget.ArrayAdapter; | ||
12 | import android.widget.ListView; | ||
13 | |||
14 | import com.hjx.personalcenter.R; | ||
15 | import com.hjx.personalcenter.db.SaveParam; | ||
16 | import com.hjx.personalcenter.http.HttpManager; | ||
17 | import com.mylhyl.circledialog.BaseCircleDialog; | ||
18 | import com.mylhyl.circledialog.res.values.CircleDimen; | ||
19 | |||
20 | import java.util.ArrayList; | ||
21 | |||
22 | /** | ||
23 | * 自定义年级列表对话框 | ||
24 | * Created by h on 2017/8/10. | ||
25 | */ | ||
26 | |||
27 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | ||
28 | ArrayAdapter listadapter; | ||
29 | ListView listView; | ||
30 | ArrayList<String> data = new ArrayList<>(); | ||
31 | |||
32 | public static CitysListDialog getInstance() { | ||
33 | CitysListDialog dialogFragment = new CitysListDialog(); | ||
34 | dialogFragment.setCanceledBack(true); | ||
35 | dialogFragment.setCanceledOnTouchOutside(true); | ||
36 | dialogFragment.setRadius(CircleDimen.RADIUS); | ||
37 | dialogFragment.setWidth(0.5f); | ||
38 | dialogFragment.setGravity(Gravity.CENTER); | ||
39 | dialogFragment.setBackgroundColor(Color.WHITE); | ||
40 | return dialogFragment; | ||
41 | } | ||
42 | |||
43 | @Override | ||
44 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | ||
45 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | ||
46 | } | ||
47 | |||
48 | @Override | ||
49 | public void onActivityCreated(Bundle savedInstanceState) { | ||
50 | super.onActivityCreated(savedInstanceState); | ||
51 | listView = (ListView) getView().findViewById(R.id.listadapter); | ||
52 | String provinces = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | ||
53 | if (provinces != null) { | ||
54 | |||
55 | for (int i = 0; i < provinces.split(",").length; i++) { | ||
56 | String[] itmt = provinces.split(","); | ||
57 | data.add(itmt[i] + "区"); | ||
58 | //data.add(i,provinces.replaceAll(",","省")); | ||
59 | |||
60 | } | ||
61 | } else { | ||
62 | HttpManager.getInstance().provices(getActivity()); | ||
63 | } | ||
64 | |||
65 | listadapter = new ArrayAdapter(getActivity(), R.layout.custom_adilog_list_item, R.id.list_items, data); | ||
66 | listView.setAdapter(listadapter); | ||
67 | listView.setOnItemClickListener(this); | ||
68 | |||
69 | } | ||
70 | |||
71 | @Override | ||
72 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
73 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); | ||
74 | switch (position){ | ||
75 | |||
76 | |||
77 | |||
78 | } | ||
79 | |||
80 | |||
81 | |||
82 | dismiss(); | ||
83 | |||
84 | } | ||
85 | } | ||
86 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ElectronicCardDialog.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.content.Intent; | 4 | import android.content.Intent; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
8 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
11 | 11 | ||
12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; | 13 | import com.hjx.personalcenter.activity.ElectronicCardValidationActivity; |
14 | import com.hjx.personalcenter.db.Content; | ||
14 | import com.mylhyl.circledialog.BaseCircleDialog; | 15 | import com.mylhyl.circledialog.BaseCircleDialog; |
15 | import com.mylhyl.circledialog.res.values.CircleDimen; | 16 | import com.mylhyl.circledialog.res.values.CircleDimen; |
16 | 17 | ||
17 | /** | 18 | /** |
18 | * Created by h on 2017/8/10. | 19 | * Created by h on 2017/8/10. |
19 | */ | 20 | */ |
20 | 21 | ||
21 | public class ElectronicCardDialog extends BaseCircleDialog { | 22 | public class ElectronicCardDialog extends BaseCircleDialog { |
22 | public static ElectronicCardDialog getInstance() { | 23 | public static ElectronicCardDialog getInstance() { |
23 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); | 24 | ElectronicCardDialog dialogFragment = new ElectronicCardDialog(); |
24 | dialogFragment.setCanceledBack(true); | 25 | dialogFragment.setCanceledBack(true); |
25 | dialogFragment.setCanceledOnTouchOutside(true); | 26 | dialogFragment.setCanceledOnTouchOutside(true); |
26 | dialogFragment.setRadius(CircleDimen.RADIUS); | 27 | dialogFragment.setRadius(CircleDimen.RADIUS); |
27 | dialogFragment.setWidth(0.8f); | 28 | dialogFragment.setWidth(0.8f); |
28 | dialogFragment.setGravity(Gravity.CENTER); | 29 | dialogFragment.setGravity(Gravity.CENTER); |
29 | dialogFragment.setBackgroundColor(Color.WHITE); | 30 | dialogFragment.setBackgroundColor(Color.WHITE); |
30 | return dialogFragment; | 31 | return dialogFragment; |
31 | } | 32 | } |
32 | @Override | 33 | @Override |
33 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 34 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
34 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); | 35 | return inflater.inflate(R.layout.custom_adilog_electroniccard, container, false); |
35 | } | 36 | } |
36 | @Override | 37 | @Override |
37 | public void onActivityCreated(Bundle savedInstanceState) { | 38 | public void onActivityCreated(Bundle savedInstanceState) { |
38 | super.onActivityCreated(savedInstanceState); | 39 | super.onActivityCreated(savedInstanceState); |
39 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { | 40 | getView().findViewById(R.id.fill_card).setOnClickListener(new View.OnClickListener() { |
40 | @Override | 41 | @Override |
41 | public void onClick(View v) { | 42 | public void onClick(View v) { |
42 | //有保卡信息直接进入开始界面,没有则跳转保卡信息 | 43 | //有保卡信息直接进入开始界面,没有则跳转保卡信息 |
43 | // Intent intent = new Intent(); | 44 | // Intent intent = new Intent(); |
44 | // intent.setClass(getActivity(),TheStartPageActivity.class); | 45 | // intent.setClass(getActivity(),TheStartPageActivity.class); |
45 | // startActivity(intent); | 46 | // startActivity(intent); |
46 | // getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 47 | // getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
48 | Content.authcodeflag =1; | ||
47 | Intent intent = new Intent(); | 49 | Intent intent = new Intent(); |
48 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); | 50 | intent.setClass(getActivity(),ElectronicCardValidationActivity.class); |
49 | startActivity(intent); | 51 | startActivity(intent); |
50 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 52 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
51 | 53 | ||
52 | } | 54 | } |
53 | }); | 55 | }); |
54 | 56 | ||
55 | } | 57 | } |
56 | 58 | ||
57 | } | 59 | } |
58 | 60 |
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.view.Gravity; | 6 | import android.view.Gravity; |
7 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
10 | import android.widget.AdapterView; | 10 | import android.widget.AdapterView; |
11 | import android.widget.ArrayAdapter; | 11 | import android.widget.ArrayAdapter; |
12 | import android.widget.ListView; | 12 | import android.widget.ListView; |
13 | import android.widget.Toast; | ||
14 | 13 | ||
15 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.db.SaveParam; | 15 | import com.hjx.personalcenter.db.SaveParam; |
16 | import com.hjx.personalcenter.http.HttpManager; | ||
17 | import com.mylhyl.circledialog.BaseCircleDialog; | 17 | import com.mylhyl.circledialog.BaseCircleDialog; |
18 | import com.mylhyl.circledialog.res.values.CircleDimen; | 18 | import com.mylhyl.circledialog.res.values.CircleDimen; |
19 | 19 | ||
20 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
21 | 21 | ||
22 | /**自定义年级列表对话框 | 22 | /** |
23 | * 自定义年级列表对话框 | ||
23 | * Created by h on 2017/8/10. | 24 | * Created by h on 2017/8/10. |
24 | */ | 25 | */ |
25 | 26 | ||
26 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 27 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
27 | ArrayAdapter listadapter; | 28 | ArrayAdapter listadapter; |
28 | ListView listView; | 29 | ListView listView; |
29 | ArrayList<String> data = new ArrayList<>(); | 30 | ArrayList<String> data = new ArrayList<>(); |
31 | |||
30 | public static ProvinceListDialog getInstance() { | 32 | public static ProvinceListDialog getInstance() { |
31 | ProvinceListDialog dialogFragment = new ProvinceListDialog(); | 33 | ProvinceListDialog dialogFragment = new ProvinceListDialog(); |
32 | dialogFragment.setCanceledBack(true); | 34 | dialogFragment.setCanceledBack(true); |
33 | dialogFragment.setCanceledOnTouchOutside(true); | 35 | dialogFragment.setCanceledOnTouchOutside(true); |
34 | dialogFragment.setRadius(CircleDimen.RADIUS); | 36 | dialogFragment.setRadius(CircleDimen.RADIUS); |
35 | dialogFragment.setWidth(0.5f); | 37 | dialogFragment.setWidth(0.5f); |
36 | dialogFragment.setGravity(Gravity.CENTER); | 38 | dialogFragment.setGravity(Gravity.CENTER); |
37 | dialogFragment.setBackgroundColor(Color.WHITE); | 39 | dialogFragment.setBackgroundColor(Color.WHITE); |
38 | return dialogFragment; | 40 | return dialogFragment; |
39 | } | 41 | } |
42 | |||
40 | @Override | 43 | @Override |
41 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 44 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
42 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); | 45 | return inflater.inflate(R.layout.custom_adilog_provicelist, container, false); |
43 | } | 46 | } |
47 | |||
44 | @Override | 48 | @Override |
45 | public void onActivityCreated(Bundle savedInstanceState) { | 49 | public void onActivityCreated(Bundle savedInstanceState) { |
46 | super.onActivityCreated(savedInstanceState); | 50 | super.onActivityCreated(savedInstanceState); |
47 | listView = (ListView) getView().findViewById(R.id.listadapter); | 51 | listView = (ListView) getView().findViewById(R.id.listadapter); |
48 | String ranging = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.PROVINCES); | 52 | String provinces = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); |
49 | for (int i =0 ; i<ranging.split(",").length;i++){ | 53 | if (provinces != null) { |
50 | data.add(i,ranging.replaceAll(",","省")); | 54 | |
55 | for (int i = 0; i < provinces.split(",").length; i++) { | ||
56 | String[] itmt = provinces.split(","); | ||
57 | data.add(itmt[i] + "省"); | ||
58 | //data.add(i,provinces.replaceAll(",","省")); | ||
51 | 59 | ||
60 | } | ||
61 | } else { | ||
62 | HttpManager.getInstance().provices(getActivity()); | ||
52 | } | 63 | } |
53 | 64 | ||
54 | listadapter = new ArrayAdapter(getActivity(),R.layout.custom_adilog_list_item,R.id.list_items,data); | 65 | listadapter = new ArrayAdapter(getActivity(), R.layout.custom_adilog_list_item, R.id.list_items, data); |
55 | listView.setAdapter(listadapter); | 66 | listView.setAdapter(listadapter); |
56 | listView.setOnItemClickListener(this); | 67 | listView.setOnItemClickListener(this); |
57 | 68 | ||
58 | } | 69 | } |
59 | 70 | ||
60 | @Override | 71 | @Override |
61 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 72 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
62 | Toast.makeText(getActivity(),"你点击了第"+position+"个",Toast.LENGTH_LONG).show(); | 73 | //Toast.makeText(getActivity(), "你点击了第" + position + "个", Toast.LENGTH_LONG).show(); |
74 | switch (position){ | ||
75 | |||
76 | } | ||
77 | |||
78 | |||
63 | 79 | ||
64 | dismiss(); | 80 | dismiss(); |
65 | 81 | ||
66 | } | 82 | } |
67 | } | 83 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/Content.java
File was created | 1 | package com.hjx.personalcenter.db; | |
2 | |||
3 | /** | ||
4 | * Created by h on 2017/8/17. | ||
5 | */ | ||
6 | |||
7 | public class Content { | ||
8 | public static int authcodeflag;//1是进入填写保卡信息验证,2是修改保卡手机号验证,3是更改绑定验证 | ||
9 | } | ||
10 |
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 | //电子保卡信息 | ||
18 | public static String CARDPHONE = "cardphone";//保卡手机号 | ||
19 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | ||
20 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | ||
21 | public static String SHOPTIME = "shoptime";//购买时间 | ||
22 | public static String SHOPADRESS = "shopadress";//购买地址 | ||
23 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | ||
24 | |||
25 | //省市区参数 | ||
16 | public static String PROVINCES = "provinces";//省 | 26 | public static String PROVINCES = "provinces";//省 |
17 | public static String OBJECTIVE = "objective"; | 27 | public static String CITYS = "citys"; |
18 | 28 | ||
19 | 29 | ||
20 | public void saveLoginParam(Context context,String spname, String spstr) { | 30 | public void saveLoginParam(Context context,String spname, String spstr) { |
21 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 31 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
22 | Activity.MODE_PRIVATE); | 32 | Activity.MODE_PRIVATE); |
23 | 33 | ||
24 | sp.edit().putString(spname, spstr).commit(); | 34 | sp.edit().putString(spname, spstr).commit(); |
25 | } | 35 | } |
26 | 36 | ||
27 | public String getLoginParam(Context context,String spname) { | 37 | public String getLoginParam(Context context,String spname) { |
28 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 38 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
29 | Activity.MODE_PRIVATE); | 39 | Activity.MODE_PRIVATE); |
30 | String param = sp.getString(spname, null); | 40 | String param = sp.getString(spname, null); |
31 | return param; | 41 | return param; |
32 | } | 42 | } |
33 | public void clearData(Context context) { | 43 | public void clearData(Context context) { |
34 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 44 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
35 | Activity.MODE_PRIVATE); | 45 | Activity.MODE_PRIVATE); |
36 | sp.edit().clear().commit(); | 46 | sp.edit().clear().commit(); |
37 | } | 47 | } |
38 | 48 | ||
39 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 49 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
40 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 50 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
41 | Activity.MODE_PRIVATE); | 51 | Activity.MODE_PRIVATE); |
42 | 52 | ||
43 | sp.edit().putString(spname, spstr).commit(); | 53 | sp.edit().putString(spname, spstr).commit(); |
44 | 54 | ||
45 | } | 55 | } |
46 | 56 | ||
47 | public String getCustomizeParam(Context context,String spname) { | 57 | public String getCustomizeParam(Context context,String spname) { |
48 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 58 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
49 | Activity.MODE_PRIVATE); | 59 | Activity.MODE_PRIVATE); |
50 | String param = sp.getString(spname, null); | 60 | String param = sp.getString(spname, null); |
51 | return param; | 61 | return param; |
52 | } | 62 | } |
53 | 63 | ||
54 | public void clearCustomizeParam(Context context ){ | 64 | public void clearCustomizeParam(Context context ){ |
55 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 65 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
56 | Activity.MODE_PRIVATE); | 66 | Activity.MODE_PRIVATE); |
57 | sp.edit().clear().commit(); | 67 | sp.edit().clear().commit(); |
58 | } | 68 | } |
59 | } | 69 | } |
60 | 70 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpClient.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | 3 | ||
4 | import com.loopj.android.http.AsyncHttpClient; | 4 | import com.loopj.android.http.AsyncHttpClient; |
5 | 5 | ||
6 | public class HttpClient extends AsyncHttpClient { | 6 | public class HttpClient extends AsyncHttpClient { |
7 | private static HttpClient client; | 7 | private static HttpClient client; |
8 | 8 | ||
9 | public static HttpClient getInstance() { | 9 | public static HttpClient getInstance() { |
10 | if(client == null) { | 10 | if(client == null) { |
11 | client = new HttpClient(); | 11 | client = new HttpClient(); |
12 | } | 12 | } |
13 | return client; | 13 | return client; |
14 | } | 14 | } |
15 | private HttpClient() {} | 15 | private HttpClient() {} |
16 | 16 | ||
17 | |||
17 | } | 18 | } |
18 | 19 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpKey.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /**请求参数 | 3 | /**请求参数 |
4 | * Created by wei on 2017/6/20. | 4 | * Created by wei on 2017/6/20. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpKey { | 7 | public class HttpKey { |
8 | //注册key | 8 | //注册key |
9 | public static String USERNAME = "username"; | 9 | public static String USERNAME = "username"; |
10 | public static String PASSWORD = "password"; | 10 | public static String PASSWORD = "password"; |
11 | public static String SMSCODE = "smscode"; | 11 | public static String SMSCODE = "smscode"; |
12 | public static String SOURCE = "source"; | 12 | public static String SOURCE = "source"; |
13 | //忘记密码 | 13 | //忘记密码 |
14 | public static String AUTHCODE = "authCode"; | 14 | public static String AUTHCODE = "authCode"; |
15 | //注册验证码和忘记密码验证码 | 15 | //注册验证码和忘记密码验证码 |
16 | public static String TYPE = "type"; | 16 | public static String TYPE = "type"; |
17 | public static String MOBIL = "mobile"; | 17 | public static String MOBIL = "mobile"; |
18 | //修改密码 | 18 | //修改密码 |
19 | public static String OLDPASS = "oldPass"; | 19 | public static String OLDPASS = "oldPass"; |
20 | public static String NEWPASS = "newPass"; | 20 | public static String NEWPASS = "newPass"; |
21 | //提交保卡 | ||
22 | public static String USEID = "userId"; | ||
23 | public static String CUSTOMENAME = "customerName"; | ||
24 | public static String CUSTOMADRESS = "customerAddress"; | ||
25 | public static String BUYADREES = "buyAddress"; | ||
26 | public static String BUYTIME = "buyTime"; | ||
27 | public static String ALTERSALECALL = "alterSaleCall"; | ||
28 | public static String PRODUCTMODEL = "productModel"; | ||
29 | public static String DEVICENUMBER = "deviceNumber"; | ||
30 | public static String MACADRESS = "macAddress"; | ||
31 | public static String MOBILPHONE = "customerPhone"; | ||
32 | |||
33 | |||
34 | |||
21 | 35 | ||
22 | 36 | ||
23 | 37 | ||
24 | } | 38 | } |
25 | 39 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
5 | import android.content.Context; | 5 | import android.content.Context; |
6 | import android.content.Intent; | 6 | import android.content.Intent; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.util.Log; | 9 | import android.util.Log; |
10 | import android.widget.Toast; | 10 | import android.widget.Toast; |
11 | 11 | ||
12 | import com.google.gson.Gson; | 12 | import com.google.gson.Gson; |
13 | import com.hjx.personalcenter.R; | ||
13 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 14 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
15 | import com.hjx.personalcenter.activity.TheStartPageActivity; | ||
14 | import com.hjx.personalcenter.db.SaveParam; | 16 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.gson.GsonTool; | 17 | import com.hjx.personalcenter.gson.GsonTool; |
16 | import com.hjx.personalcenter.model.CityInfo; | 18 | import com.hjx.personalcenter.model.CityInfo; |
17 | import com.hjx.personalcenter.model.CountyInfo; | 19 | import com.hjx.personalcenter.model.CountyInfo; |
18 | import com.hjx.personalcenter.model.ProvinceInfo; | 20 | import com.hjx.personalcenter.model.ProvinceInfo; |
19 | import com.hjx.personalcenter.util.DialogPermission; | 21 | import com.hjx.personalcenter.util.DialogPermission; |
20 | import com.loopj.android.http.AsyncHttpResponseHandler; | 22 | import com.loopj.android.http.AsyncHttpResponseHandler; |
21 | import com.loopj.android.http.JsonHttpResponseHandler; | 23 | import com.loopj.android.http.JsonHttpResponseHandler; |
22 | import com.loopj.android.http.RequestParams; | 24 | import com.loopj.android.http.RequestParams; |
23 | 25 | ||
24 | import org.apache.http.Header; | 26 | import org.apache.http.Header; |
25 | import org.apache.http.entity.ByteArrayEntity; | 27 | import org.apache.http.entity.ByteArrayEntity; |
26 | import org.apache.http.message.BasicHeader; | 28 | import org.apache.http.message.BasicHeader; |
27 | import org.apache.http.protocol.HTTP; | 29 | import org.apache.http.protocol.HTTP; |
28 | import org.json.JSONException; | 30 | import org.json.JSONException; |
29 | import org.json.JSONObject; | 31 | import org.json.JSONObject; |
30 | 32 | ||
31 | import java.io.UnsupportedEncodingException; | 33 | import java.io.UnsupportedEncodingException; |
32 | 34 | ||
33 | public class HttpManager { | 35 | public class HttpManager { |
34 | private static HttpManager instance; | 36 | private static HttpManager instance; |
35 | private ProgressDialog mProgress = null; | 37 | private ProgressDialog mProgress = null; |
36 | public static HttpManager getInstance() { | 38 | public static HttpManager getInstance() { |
37 | if (instance == null) { | 39 | if (instance == null) { |
38 | instance = new HttpManager(); | 40 | instance = new HttpManager(); |
39 | } | 41 | } |
40 | return instance; | 42 | return instance; |
41 | } | 43 | } |
42 | 44 | ||
43 | 45 | ||
44 | //登录接口 | 46 | //登录接口 |
45 | 47 | ||
46 | public void login(final String username, final String password, final Context mContext) { | 48 | public void login(final String username, final String password, final Context mContext) { |
47 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 49 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
48 | false, true, null); | 50 | false, true, null); |
49 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 51 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
50 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 52 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
51 | @Override | 53 | @Override |
52 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 54 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
53 | 55 | ||
54 | String str = new String(arg2); | 56 | String str = new String(arg2); |
55 | JSONObject jsonObject = null; | 57 | JSONObject jsonObject = null; |
56 | try { | 58 | try { |
57 | jsonObject = new JSONObject(new String(arg2)); | 59 | jsonObject = new JSONObject(new String(arg2)); |
58 | String status = jsonObject.getString("status"); | 60 | String status = jsonObject.getString("status"); |
59 | if (status.equals("100")) { | 61 | if (status.equals("100")) { |
60 | String access_token = jsonObject.getString("access_token"); | 62 | String access_token = jsonObject.getString("access_token"); |
61 | String userId = jsonObject.getString("userId"); | 63 | String userId = jsonObject.getString("userId"); |
62 | // //登录成功,保存登录数据并且获取个人信息 | 64 | // //登录成功,保存登录数据并且获取个人信息 |
63 | saveLoginInfo(mContext,username, password, access_token, "true", userId); | 65 | saveLoginInfo(mContext,username, password, access_token, "true", userId); |
64 | //HttpManager.getInstance().getuserinfo(username,mContext); | 66 | //HttpManager.getInstance().getuserinfo(username,mContext); |
65 | 67 | ||
66 | }else if (status.equals("200")) { | 68 | }else if (status.equals("200")) { |
67 | closeProgress(); | 69 | closeProgress(); |
68 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); | 70 | Toast.makeText(mContext, "用户名不存在!", Toast.LENGTH_LONG).show(); |
69 | return; | 71 | return; |
70 | } else if(status.equals("204")){ | 72 | } else if(status.equals("204")){ |
71 | closeProgress(); | 73 | closeProgress(); |
72 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); | 74 | Toast.makeText(mContext, "密码错误!", Toast.LENGTH_LONG).show(); |
73 | }else{ | 75 | }else{ |
74 | closeProgress(); | 76 | closeProgress(); |
75 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 77 | Toast.makeText(mContext, "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
76 | 78 | ||
77 | 79 | ||
78 | 80 | ||
79 | } | 81 | } |
80 | } catch (JSONException e) { | 82 | } catch (JSONException e) { |
81 | e.printStackTrace(); | 83 | e.printStackTrace(); |
82 | } | 84 | } |
83 | 85 | ||
84 | 86 | ||
85 | } | 87 | } |
86 | 88 | ||
87 | @Override | 89 | @Override |
88 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 90 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
89 | closeProgress(); | 91 | closeProgress(); |
90 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); | 92 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); |
91 | } | 93 | } |
92 | }); | 94 | }); |
93 | } | 95 | } |
94 | 96 | ||
95 | //注册接口 | 97 | //注册接口 |
96 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 98 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
97 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 99 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
98 | false, true, null); | 100 | false, true, null); |
99 | JSONObject jsonObject = new JSONObject(); | 101 | JSONObject jsonObject = new JSONObject(); |
100 | ByteArrayEntity entity = null; | 102 | ByteArrayEntity entity = null; |
101 | try { | 103 | try { |
102 | jsonObject.put(HttpKey.USERNAME, username); | 104 | jsonObject.put(HttpKey.USERNAME, username); |
103 | jsonObject.put(HttpKey.PASSWORD, password); | 105 | jsonObject.put(HttpKey.PASSWORD, password); |
104 | jsonObject.put(HttpKey.SMSCODE, smscode); | 106 | jsonObject.put(HttpKey.SMSCODE, smscode); |
105 | jsonObject.put(HttpKey.SOURCE, source); | 107 | jsonObject.put(HttpKey.SOURCE, source); |
106 | Log.e("test", "jsonObject" + jsonObject); | 108 | Log.e("test", "jsonObject" + jsonObject); |
107 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 109 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
108 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 110 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
109 | } catch (JSONException e) { | 111 | } catch (JSONException e) { |
110 | e.printStackTrace(); | 112 | e.printStackTrace(); |
111 | } catch (UnsupportedEncodingException e) { | 113 | } catch (UnsupportedEncodingException e) { |
112 | e.printStackTrace(); | 114 | e.printStackTrace(); |
113 | } | 115 | } |
114 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 116 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
115 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 117 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
116 | @Override | 118 | @Override |
117 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 119 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
118 | super.onSuccess(statusCode, headers, response); | 120 | super.onSuccess(statusCode, headers, response); |
119 | closeProgress(); | 121 | closeProgress(); |
120 | Log.e("test", "onSuccess" + response); | 122 | Log.e("test", "onSuccess" + response); |
121 | Message msg = Message.obtain(); | 123 | Message msg = Message.obtain(); |
122 | msg.what = HttpCode.REGISTERED_SUCESS; | 124 | msg.what = HttpCode.REGISTERED_SUCESS; |
123 | msg.obj = response; | 125 | msg.obj = response; |
124 | handler.sendMessage(msg); | 126 | handler.sendMessage(msg); |
125 | 127 | ||
126 | } | 128 | } |
127 | 129 | ||
128 | @Override | 130 | @Override |
129 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 131 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
130 | super.onFailure(statusCode, headers, throwable, errorResponse); | 132 | super.onFailure(statusCode, headers, throwable, errorResponse); |
131 | closeProgress(); | 133 | closeProgress(); |
132 | Log.e("test", "onFailure" + errorResponse); | 134 | Log.e("test", "onFailure" + errorResponse); |
133 | Toast.makeText(context, "请检查网络。。", Toast.LENGTH_LONG).show(); | 135 | Toast.makeText(context, "请检查网络。。", Toast.LENGTH_LONG).show(); |
134 | } | 136 | } |
135 | 137 | ||
136 | }); | 138 | }); |
137 | } | 139 | } |
138 | 140 | ||
139 | //注册验证码 | 141 | //注册验证码 |
140 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 142 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
141 | RequestParams params = new RequestParams(); | 143 | RequestParams params = new RequestParams(); |
142 | params.put(HttpKey.TYPE, type); | 144 | params.put(HttpKey.TYPE, type); |
143 | params.put(HttpKey.MOBIL, mobile); | 145 | params.put(HttpKey.MOBIL, mobile); |
144 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 146 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
145 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 147 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
146 | 148 | ||
147 | @Override | 149 | @Override |
148 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 150 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
149 | Log.e("test", "onSuccess-----" + response); | 151 | Log.e("test", "onSuccess-----" + response); |
150 | Message msg = Message.obtain(); | 152 | Message msg = Message.obtain(); |
151 | msg.what = HttpCode.AUTHCODE_SUCESS; | 153 | msg.what = HttpCode.AUTHCODE_SUCESS; |
152 | msg.obj = response; | 154 | msg.obj = response; |
153 | handler.sendMessage(msg); | 155 | handler.sendMessage(msg); |
154 | } | 156 | } |
155 | 157 | ||
156 | @Override | 158 | @Override |
157 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 159 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
158 | Toast.makeText(mContext, "请检查网络。。" + errorResponse, Toast.LENGTH_LONG).show(); | 160 | Toast.makeText(mContext, "请检查网络。。" + errorResponse, Toast.LENGTH_LONG).show(); |
159 | } | 161 | } |
160 | }); | 162 | }); |
161 | } | 163 | } |
162 | 164 | ||
163 | //验证码 | ||
164 | public void forgetauthCode(final String type, final String mobile, final Handler handler, final Context mContext) { | ||
165 | RequestParams params = new RequestParams(); | ||
166 | params.put("type", type); | ||
167 | params.put("mobile", mobile); | ||
168 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | ||
169 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | ||
170 | |||
171 | @Override | ||
172 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
173 | Log.e("test", "onSuccess-----" + response); | ||
174 | Message msg = Message.obtain(); | ||
175 | msg.what = HttpCode.AUTHCODE_SUCESS1; | ||
176 | msg.obj = response; | ||
177 | handler.sendMessage(msg); | ||
178 | } | ||
179 | |||
180 | @Override | ||
181 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
182 | Toast.makeText(mContext, "请检查网络。。" + errorResponse, Toast.LENGTH_LONG).show(); | ||
183 | } | ||
184 | }); | ||
185 | } | ||
186 | 165 | ||
187 | //手机号是否注册 | 166 | //手机号是否注册 |
188 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 167 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
189 | RequestParams params = new RequestParams(); | 168 | RequestParams params = new RequestParams(); |
190 | params.put(HttpKey.USERNAME, mobile); | 169 | params.put(HttpKey.USERNAME, mobile); |
191 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 170 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
192 | @Override | 171 | @Override |
193 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 172 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
194 | Log.e("test", "isregistered" + response.toString()); | 173 | Log.e("test", "isregistered" + response.toString()); |
195 | Message msg = Message.obtain(); | 174 | Message msg = Message.obtain(); |
196 | msg.what = HttpCode.IS_REFISTER; | 175 | msg.what = HttpCode.IS_REFISTER; |
197 | msg.obj = response; | 176 | msg.obj = response; |
198 | handler.sendMessage(msg); | 177 | handler.sendMessage(msg); |
199 | 178 | ||
200 | } | 179 | } |
201 | 180 | ||
202 | @Override | 181 | @Override |
203 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 182 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
204 | Toast.makeText(mContext, "失敗" + errorResponse, Toast.LENGTH_LONG).show(); | 183 | Toast.makeText(mContext, "失敗" + errorResponse, Toast.LENGTH_LONG).show(); |
205 | 184 | ||
206 | } | 185 | } |
207 | }); | 186 | }); |
208 | } | 187 | } |
209 | 188 | ||
210 | //修改密码 | 189 | //修改密码 |
211 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 190 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
212 | RequestParams params = new RequestParams(); | 191 | RequestParams params = new RequestParams(); |
213 | params.put(HttpKey.USERNAME, username); | 192 | params.put(HttpKey.USERNAME, username); |
214 | params.put(HttpKey.OLDPASS, old_pwd1); | 193 | params.put(HttpKey.OLDPASS, old_pwd1); |
215 | params.put(HttpKey.NEWPASS, newpassword3); | 194 | params.put(HttpKey.NEWPASS, newpassword3); |
216 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 195 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
217 | HttpClient.getInstance().setTimeout(10 * 1000); | 196 | HttpClient.getInstance().setTimeout(10 * 1000); |
218 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 197 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
219 | @Override | 198 | @Override |
220 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 199 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
221 | try { | 200 | try { |
222 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 201 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
223 | String status = jsonObject.optString("status"); | 202 | String status = jsonObject.optString("status"); |
224 | if (status.equals("100")) { | 203 | if (status.equals("100")) { |
225 | Log.e("test", "onSuccess" + new String(bytes)); | 204 | Log.e("test", "onSuccess" + new String(bytes)); |
226 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 205 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
227 | SaveParam.getInstance().clearData((Activity) context); | 206 | SaveParam.getInstance().clearData((Activity) context); |
228 | Intent intent = new Intent(); | 207 | Intent intent = new Intent(); |
229 | intent.setClass(context, LoginAndRegisterActivity.class); | 208 | intent.setClass(context, LoginAndRegisterActivity.class); |
230 | ((Activity) context).startActivity(intent); | 209 | ((Activity) context).startActivity(intent); |
231 | ((Activity) context).finish(); | 210 | ((Activity) context).finish(); |
232 | } | 211 | } |
233 | } catch (JSONException e) { | 212 | } catch (JSONException e) { |
234 | e.printStackTrace(); | 213 | e.printStackTrace(); |
235 | } | 214 | } |
236 | } | 215 | } |
237 | 216 | ||
238 | @Override | 217 | @Override |
239 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 218 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
240 | Log.e("test", "onFailure" + new String(bytes)); | 219 | Log.e("test", "onFailure" + new String(bytes)); |
241 | Toast.makeText(context, "密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); | 220 | Toast.makeText(context, "密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); |
242 | onFinish(); | 221 | onFinish(); |
243 | } | 222 | } |
244 | }); | 223 | }); |
245 | 224 | ||
246 | } | 225 | } |
247 | 226 | ||
248 | //忘记密码 | 227 | //忘记密码 |
249 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 228 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
250 | RequestParams params = new RequestParams(); | 229 | RequestParams params = new RequestParams(); |
251 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 230 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
252 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 231 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
253 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 232 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
254 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 233 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
255 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 234 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
256 | @Override | 235 | @Override |
257 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 236 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
258 | try { | 237 | try { |
259 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 238 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
260 | String status = jsonObject.optString("status"); | 239 | String status = jsonObject.optString("status"); |
261 | if (status.equals("100")) { | 240 | if (status.equals("100")) { |
262 | Log.e("test", "onSuccess" + new String(bytes)); | 241 | Log.e("test", "onSuccess" + new String(bytes)); |
263 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 242 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
264 | ((Activity) context).finish(); | 243 | ((Activity) context).finish(); |
265 | } | 244 | } |
266 | } catch (JSONException e) { | 245 | } catch (JSONException e) { |
267 | e.printStackTrace(); | 246 | e.printStackTrace(); |
268 | } | 247 | } |
269 | } | 248 | } |
270 | 249 | ||
271 | @Override | 250 | @Override |
272 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 251 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
273 | Log.e("test", "onFailure" + new String(bytes)); | 252 | Log.e("test", "onFailure" + new String(bytes)); |
274 | Toast.makeText(context, "忘记密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); | 253 | Toast.makeText(context, "忘记密码修改失败,请检查网络!", Toast.LENGTH_LONG).show(); |
275 | } | 254 | } |
276 | }); | 255 | }); |
277 | 256 | ||
278 | } | 257 | } |
279 | 258 | ||
280 | //保存用户登录信息 | 259 | //保存用户登录信息 |
281 | public void saveLoginInfo(Context context,String username, String password, String access_token, String loginStatus, String userId) { | 260 | public void saveLoginInfo(Context context,String username, String password, String access_token, String loginStatus, String userId) { |
282 | SaveParam.getInstance().saveLoginParam(context,"username", username); | 261 | SaveParam.getInstance().saveLoginParam(context,"username", username); |
283 | SaveParam.getInstance().saveLoginParam(context,"password", password); | 262 | SaveParam.getInstance().saveLoginParam(context,"password", password); |
284 | SaveParam.getInstance().saveLoginParam(context,"access_token", access_token); | 263 | SaveParam.getInstance().saveLoginParam(context,"access_token", access_token); |
285 | SaveParam.getInstance().saveLoginParam(context,"login", loginStatus); | 264 | SaveParam.getInstance().saveLoginParam(context,"login", loginStatus); |
286 | SaveParam.getInstance().saveLoginParam(context,"userId", userId); | 265 | SaveParam.getInstance().saveLoginParam(context,"userId", userId); |
287 | 266 | ||
288 | 267 | ||
289 | } | 268 | } |
290 | 269 | ||
291 | //保存用户个人信息 | 270 | //保存用户个人信息 |
292 | public void savePresonInfo(Context context,String lastname, String gender, String mobilePortrait) { | 271 | public void savePresonInfo(Context context,String lastname, String gender, String mobilePortrait) { |
293 | SaveParam.getInstance().saveLoginParam(context,"lastname", lastname); | 272 | SaveParam.getInstance().saveLoginParam(context,"lastname", lastname); |
294 | SaveParam.getInstance().saveLoginParam(context,"gender", gender); | 273 | SaveParam.getInstance().saveLoginParam(context,"gender", gender); |
295 | SaveParam.getInstance().saveLoginParam(context,"mobilePortrait", mobilePortrait); | 274 | SaveParam.getInstance().saveLoginParam(context,"mobilePortrait", mobilePortrait); |
296 | } | 275 | } |
297 | ///省级接口 | 276 | //提交保卡信息 |
277 | public void subcardinfo(final Context context, int userId, String customerName, String customerAddress, | ||
278 | String buyAddress,String buyTime,String alterSaleCall, | ||
279 | String productModel,String deviceNumber,String macAddress, | ||
280 | String mobilePhone) { | ||
281 | JSONObject params = new JSONObject(); | ||
282 | ByteArrayEntity entity = null; | ||
283 | try { | ||
284 | params.put(HttpKey.USEID, userId); | ||
285 | params.put(HttpKey.CUSTOMENAME, customerName); | ||
286 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | ||
287 | params.put(HttpKey.BUYADREES, buyAddress); | ||
288 | params.put(HttpKey.BUYTIME, buyTime); | ||
289 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | ||
290 | params.put(HttpKey.PRODUCTMODEL, productModel); | ||
291 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | ||
292 | params.put(HttpKey.MACADRESS, macAddress); | ||
293 | params.put(HttpKey.MOBILPHONE, mobilePhone); | ||
294 | entity = new ByteArrayEntity(params.toString().getBytes("UTF-8")); | ||
295 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | ||
296 | } catch (Exception e) { | ||
297 | e.printStackTrace(); | ||
298 | } | ||
299 | |||
300 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
301 | |||
302 | Log.e("test", "params" + params); | ||
303 | HttpClient.getInstance().post(context,HttpUrl.subcardinfo, entity, "application/json", new JsonHttpResponseHandler() { | ||
304 | @Override | ||
305 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
306 | super.onSuccess(statusCode, headers, response); | ||
307 | String status = response.optString("status"); | ||
308 | if (status.equals("1")) { | ||
309 | Log.e("test", "onSuccess" +response); | ||
310 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | ||
311 | Intent intent = new Intent(); | ||
312 | intent.setClass((Activity) context,TheStartPageActivity.class); | ||
313 | ((Activity) context).startActivity(intent); | ||
314 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
315 | ((Activity) context).finish(); | ||
316 | } | ||
317 | |||
318 | } | ||
319 | |||
320 | @Override | ||
321 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
322 | super.onFailure(statusCode, headers, throwable, errorResponse); | ||
323 | Log.e("test", "onFailure" + (errorResponse)); | ||
324 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | ||
325 | } | ||
326 | }); | ||
327 | |||
328 | } | ||
329 | |||
330 | |||
331 | |||
332 | |||
333 | |||
334 | |||
335 | |||
336 | ///省级接口 | ||
298 | public void provices(final Context mContext) { | 337 | public void provices(final Context mContext) { |
299 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 338 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
300 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 339 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
301 | @Override | 340 | @Override |
302 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 341 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
303 | Log.e("test", "省" + new String(arg2)); | 342 | Log.e("test", "省" + new String(arg2)); |
304 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 343 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
305 | Log.e("test", "状态码" +provinceInfo.getStatus()); | 344 | Log.e("test", "状态码" +provinceInfo.getStatus()); |
306 | StringBuffer sb = new StringBuffer(); | 345 | StringBuffer sb = new StringBuffer(); |
346 | StringBuffer sb1 = new StringBuffer(); | ||
307 | for (int i =0 ; i<provinceInfo.getProvinces().size();i++){ | 347 | for (int i =0 ; i<provinceInfo.getProvinces().size();i++){ |
308 | Log.e("test", "省" +provinceInfo.getProvinces().get(i) | ||
309 | .getParentId()); | ||
310 | Log.e("test", "省" +provinceInfo.getProvinces().get(i) | ||
311 | .getRegionId()); | ||
312 | Log.e("test", "省" +provinceInfo.getProvinces().get(i).getRegionName()); | ||
313 | sb.append(provinceInfo.getProvinces().get(i).getRegionName()+","); | 348 | sb.append(provinceInfo.getProvinces().get(i).getRegionName()+","); |
349 | sb1.append(provinceInfo.getProvinces().get(i).getRegionId()+","); | ||
314 | 350 | ||
315 | } | 351 | } |
316 | Log.e("test", "省" +sb.toString()); | 352 | Log.e("test", "省" +sb.toString()); |
317 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.PROVINCES, "" + sb.toString()); | 353 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PROVINCES, "" + sb.toString()); |
354 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.CITYS, sb1.toString()); | ||
318 | 355 | ||
319 | 356 | ||
320 | } | 357 | } |
321 | 358 | ||
322 | @Override | 359 | @Override |
323 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 360 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
324 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); | 361 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); |
325 | } | 362 | } |
326 | }); | 363 | }); |
327 | } | 364 | } |
328 | //市级接口 | 365 | //市级接口 |
329 | public void cityinfo(final Context mContext,int regionId) { | 366 | public void cityinfo(final Context mContext,int regionId) { |
330 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 367 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
331 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 368 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
332 | @Override | 369 | @Override |
333 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 370 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
334 | Log.e("test", "市" + new String(arg2)); | 371 | Log.e("test", "市" + new String(arg2)); |
335 | Gson gson = new Gson(); | 372 | Gson gson = new Gson(); |
336 | CityInfo cityInfo = gson.fromJson(new String(arg2),CityInfo.class); | 373 | CityInfo cityInfo = gson.fromJson(new String(arg2),CityInfo.class); |
337 | for (int i =0 ; i<cityInfo.getCities().size();i++){ | 374 | for (int i =0 ; i<cityInfo.getCities().size();i++){ |
338 | Log.e("test", "市" +cityInfo.getCities().get(i) | 375 | Log.e("test", "市" +cityInfo.getCities().get(i) |
339 | .getParentId()); | 376 | .getParentId()); |
340 | Log.e("test", "市" +cityInfo.getCities().get(i) | 377 | Log.e("test", "市" +cityInfo.getCities().get(i) |
341 | .getRegionId()); | 378 | .getRegionId()); |
342 | Log.e("test", "市" +cityInfo.getCities().get(i).getRegionName()+""); | 379 | Log.e("test", "市" +cityInfo.getCities().get(i).getRegionName()+""); |
343 | 380 | ||
344 | } | 381 | } |
345 | 382 | ||
346 | 383 | ||
347 | } | 384 | } |
348 | 385 | ||
349 | @Override | 386 | @Override |
350 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 387 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
351 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); | 388 | Toast.makeText(mContext, "请检查网络。。"+arg3 , Toast.LENGTH_LONG).show(); |
352 | } | 389 | } |
353 | }); | 390 | }); |
354 | } | 391 | } |
355 | //区县级接口 | 392 | //区县级接口 |
356 | public void countyinfo(final Context mContext,int parentId) { | 393 | public void countyinfo(final Context mContext,int parentId) { |
357 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 394 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
358 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 395 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
359 | @Override | 396 | @Override |
360 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 397 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
361 | Log.e("test", "区" + new String(arg2)); | 398 | Log.e("test", "区" + new String(arg2)); |
362 | Gson gson = new Gson(); | 399 | Gson gson = new Gson(); |
363 | CountyInfo countyInfo = gson.fromJson(new String(arg2),CountyInfo.class); | 400 | CountyInfo countyInfo = gson.fromJson(new String(arg2),CountyInfo.class); |
364 | for (int i =0 ; i<countyInfo.getCounties().size();i++){ | 401 | for (int i =0 ; i<countyInfo.getCounties().size();i++){ |
365 | Log.e("test", "区" +countyInfo.getCounties().get(i) | 402 | Log.e("test", "区" +countyInfo.getCounties().get(i) |
366 | .getParentId()); | 403 | .getParentId()); |
367 | Log.e("test", "区" +countyInfo.getCounties().get(i) | 404 | Log.e("test", "区" +countyInfo.getCounties().get(i) |
368 | .getRegionId()); | 405 | .getRegionId()); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by h on 2017/8/15. | 4 | * Created by h on 2017/8/15. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class HttpUrl { | 7 | public class HttpUrl { |
8 | private final static String Enviroment = "DEVELOPMENT"; | 8 | private final static String Enviroment = "DEVELOPMENT"; |
9 | 9 | ||
10 | public static String GetDomain(){ | 10 | public static String GetDomain(){ |
11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; | 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; |
12 | } | 12 | } |
13 | 13 | ||
14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
15 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 15 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
16 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 16 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
17 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 17 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
18 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 18 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
19 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 19 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
20 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 20 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
21 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 21 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
22 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 22 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
23 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | ||
23 | 24 | ||
24 | } | 25 | } |
25 | 26 |
PersonalCenter/app/src/main/res/layout/activity_electronic_look_cardinfo.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:orientation="vertical"> | 5 | android:orientation="vertical"> |
6 | 6 | ||
7 | <RelativeLayout | 7 | <RelativeLayout |
8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 11 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp"> | 12 | android:minHeight="50dp"> |
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="wrap_content" | 17 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 18 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
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="wrap_content" | 26 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:text="@string/string_electroniccard_info_look" | 28 | android:text="@string/string_electroniccard_info_look" |
29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 31 | </RelativeLayout> |
32 | 32 | ||
33 | <LinearLayout | 33 | <LinearLayout |
34 | android:layout_width="match_parent" | 34 | android:layout_width="match_parent" |
35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
36 | android:layout_margin="20dp" | 36 | android:layout_margin="20dp" |
37 | android:background="@mipmap/cardbackgrangd" | 37 | android:background="@mipmap/cardbackgrangd" |
38 | android:gravity="center" | 38 | android:gravity="center" |
39 | android:orientation="vertical"> | 39 | android:orientation="vertical"> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="match_parent" | 42 | android:layout_width="match_parent" |
43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
44 | android:layout_marginTop="70dp" | 44 | android:layout_marginTop="70dp" |
45 | android:gravity="center_vertical" | 45 | android:gravity="center_vertical" |
46 | android:orientation="horizontal"> | 46 | android:orientation="horizontal"> |
47 | 47 | ||
48 | <LinearLayout | 48 | <LinearLayout |
49 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:layout_marginLeft="200dp" | 51 | android:layout_marginLeft="200dp" |
52 | android:layout_weight="1" | 52 | android:layout_weight="1" |
53 | android:gravity="center_vertical"> | 53 | android:gravity="center_vertical"> |
54 | 54 | ||
55 | <ImageView | 55 | <ImageView |
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:src="@mipmap/logo_info" /> | 58 | android:src="@mipmap/logo_info" /> |
59 | 59 | ||
60 | <TextView | 60 | <TextView |
61 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
62 | android:layout_height="wrap_content" | 62 | android:layout_height="wrap_content" |
63 | android:layout_marginLeft="50dp" | 63 | android:layout_marginLeft="50dp" |
64 | android:background="@null" | 64 | android:background="@null" |
65 | android:text="电子保卡" | 65 | android:text="电子保卡" |
66 | android:textColor="@color/electronic_card" | 66 | android:textColor="@color/electronic_card" |
67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
68 | 68 | ||
69 | </LinearLayout> | 69 | </LinearLayout> |
70 | 70 | ||
71 | <LinearLayout | 71 | <LinearLayout |
72 | android:layout_width="0dp" | 72 | android:layout_width="0dp" |
73 | android:layout_height="80dp" | 73 | android:layout_height="80dp" |
74 | android:layout_weight="1" | 74 | android:layout_weight="1" |
75 | android:layout_marginLeft="80dp" | 75 | android:layout_marginLeft="80dp" |
76 | android:gravity="center_vertical"> | 76 | android:gravity="center_vertical"> |
77 | 77 | ||
78 | <TextView | 78 | <TextView |
79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
81 | android:text="客户姓名" | 81 | android:text="客户姓名" |
82 | android:textColor="@color/btn_text_color" | 82 | android:textColor="@color/btn_text_color" |
83 | android:textSize="22sp" /> | 83 | android:textSize="22sp" /> |
84 | 84 | ||
85 | <TextView | 85 | <TextView |
86 | android:id="@+id/iv_card_username" | ||
86 | android:layout_width="wrap_content" | 87 | android:layout_width="wrap_content" |
87 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
88 | android:layout_marginLeft="60dp" | 89 | android:layout_marginLeft="60dp" |
89 | android:text="王小明" | 90 | android:text="王小明" |
90 | android:textColor="@color/btn_text_color" | 91 | android:textColor="@color/btn_text_color" |
91 | android:textSize="22sp" /> | 92 | android:textSize="22sp" /> |
92 | 93 | ||
93 | </LinearLayout> | 94 | </LinearLayout> |
94 | 95 | ||
95 | </LinearLayout> | 96 | </LinearLayout> |
96 | 97 | ||
97 | <LinearLayout | 98 | <LinearLayout |
98 | android:layout_width="match_parent" | 99 | android:layout_width="match_parent" |
99 | android:layout_height="wrap_content" | 100 | android:layout_height="wrap_content" |
100 | android:gravity="center_vertical" | 101 | android:gravity="center_vertical" |
101 | android:orientation="horizontal"> | 102 | android:orientation="horizontal"> |
102 | 103 | ||
103 | <LinearLayout | 104 | <LinearLayout |
104 | android:layout_width="0dp" | 105 | android:layout_width="0dp" |
105 | android:layout_height="60dp" | 106 | android:layout_height="60dp" |
106 | android:layout_weight="1" | 107 | android:layout_weight="1" |
107 | android:layout_marginLeft="200dp" | 108 | android:layout_marginLeft="200dp" |
108 | android:gravity="center_vertical"> | 109 | android:gravity="center_vertical"> |
109 | 110 | ||
110 | <TextView | 111 | <TextView |
111 | android:layout_width="wrap_content" | 112 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
113 | android:text="产品型号" | 114 | android:text="产品型号" |
114 | android:textColor="@color/btn_text_color" | 115 | android:textColor="@color/btn_text_color" |
115 | android:textSize="22sp" /> | 116 | android:textSize="22sp" /> |
116 | 117 | ||
117 | <TextView | 118 | <TextView |
119 | android:id="@+id/tv_card_deviceModel" | ||
118 | android:layout_width="wrap_content" | 120 | android:layout_width="wrap_content" |
119 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
120 | android:layout_marginLeft="50dp" | 122 | android:layout_marginLeft="50dp" |
121 | android:text="IPone888" | 123 | android:text="IPone888" |
122 | android:textSize="22sp" /> | 124 | android:textSize="22sp" /> |
123 | 125 | ||
124 | 126 | ||
125 | </LinearLayout> | 127 | </LinearLayout> |
126 | 128 | ||
127 | <LinearLayout | 129 | <LinearLayout |
128 | android:layout_width="0dp" | 130 | android:layout_width="0dp" |
129 | android:layout_height="60dp" | 131 | android:layout_height="60dp" |
130 | android:layout_weight="1" | 132 | android:layout_weight="1" |
131 | android:layout_marginLeft="80dp" | 133 | android:layout_marginLeft="80dp" |
132 | android:gravity="center_vertical"> | 134 | android:gravity="center_vertical"> |
133 | 135 | ||
134 | <TextView | 136 | <TextView |
135 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
136 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
137 | android:text="客户地址" | 139 | android:text="客户地址" |
138 | android:textSize="22sp" /> | 140 | android:textSize="22sp" /> |
139 | 141 | ||
140 | <TextView | 142 | <TextView |
143 | android:id="@+id/tv_card_adress" | ||
141 | android:layout_width="wrap_content" | 144 | android:layout_width="wrap_content" |
142 | android:layout_height="wrap_content" | 145 | android:layout_height="wrap_content" |
143 | android:layout_marginLeft="60dp" | 146 | android:layout_marginLeft="60dp" |
144 | android:background="@null" | 147 | android:background="@null" |
145 | android:text="北京市昭阳区三里屯" | 148 | android:text="北京市昭阳区三里屯" |
146 | android:textSize="22sp" /> | 149 | android:textSize="22sp" /> |
147 | <TextView | 150 | <TextView |
151 | android:id="@+id/tv_card_adress_change" | ||
148 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
149 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
150 | android:layout_marginLeft="18dp" | 154 | android:layout_marginLeft="18dp" |
151 | android:background="@drawable/corcle_black_bg" | 155 | android:background="@drawable/corcle_black_bg" |
152 | android:text="修改" | 156 | android:text="修改" |
153 | android:paddingLeft="5dp" | 157 | android:paddingLeft="5dp" |
154 | android:paddingRight="5dp" | 158 | android:paddingRight="5dp" |
155 | android:textColor="@color/login_text_blue" | 159 | android:textColor="@color/login_text_blue" |
156 | android:textSize="18sp" /> | 160 | android:textSize="18sp" /> |
157 | 161 | ||
158 | 162 | ||
159 | </LinearLayout> | 163 | </LinearLayout> |
160 | 164 | ||
161 | </LinearLayout> | 165 | </LinearLayout> |
162 | 166 | ||
163 | <LinearLayout | 167 | <LinearLayout |
164 | android:layout_width="match_parent" | 168 | android:layout_width="match_parent" |
165 | android:layout_height="wrap_content" | 169 | android:layout_height="wrap_content" |
166 | android:gravity="center_vertical" | 170 | android:gravity="center_vertical" |
167 | android:orientation="horizontal"> | 171 | android:orientation="horizontal"> |
168 | 172 | ||
169 | <LinearLayout | 173 | <LinearLayout |
170 | android:layout_width="0dp" | 174 | android:layout_width="0dp" |
171 | android:layout_height="60dp" | 175 | android:layout_height="60dp" |
172 | android:layout_weight="1" | 176 | android:layout_weight="1" |
173 | android:layout_marginLeft="200dp" | 177 | android:layout_marginLeft="200dp" |
174 | android:gravity="center_vertical"> | 178 | android:gravity="center_vertical"> |
175 | 179 | ||
176 | <TextView | 180 | <TextView |
177 | android:layout_width="wrap_content" | 181 | android:layout_width="wrap_content" |
178 | android:layout_height="wrap_content" | 182 | android:layout_height="wrap_content" |
179 | android:text="MAC地址" | 183 | android:text="MAC地址" |
180 | android:textSize="22sp" /> | 184 | android:textSize="22sp" /> |
181 | 185 | ||
182 | <TextView | 186 | <TextView |
187 | android:id="@+id/tv_card_mac" | ||
183 | android:layout_width="wrap_content" | 188 | android:layout_width="wrap_content" |
184 | android:layout_height="wrap_content" | 189 | android:layout_height="wrap_content" |
185 | android:layout_marginLeft="50dp" | 190 | android:layout_marginLeft="50dp" |
186 | android:background="@null" | 191 | android:background="@null" |
187 | android:text="237462873463278" | 192 | android:text="237462873463278" |
188 | android:textSize="22sp" /> | 193 | android:textSize="22sp" /> |
189 | 194 | ||
190 | </LinearLayout> | 195 | </LinearLayout> |
191 | 196 | ||
192 | <LinearLayout | 197 | <LinearLayout |
193 | android:layout_width="0dp" | 198 | android:layout_width="0dp" |
194 | android:layout_height="60dp" | 199 | android:layout_height="60dp" |
195 | android:layout_weight="1" | 200 | android:layout_weight="1" |
196 | android:layout_marginLeft="80dp" | 201 | android:layout_marginLeft="80dp" |
197 | android:gravity="center_vertical"> | 202 | android:gravity="center_vertical"> |
198 | 203 | ||
199 | <TextView | 204 | <TextView |
200 | android:layout_width="wrap_content" | 205 | android:layout_width="wrap_content" |
201 | android:layout_height="wrap_content" | 206 | android:layout_height="wrap_content" |
202 | android:text="购买时间" | 207 | android:text="购买时间" |
203 | android:textColor="@color/btn_text_color" | 208 | android:textColor="@color/btn_text_color" |
204 | android:textSize="22sp" /> | 209 | android:textSize="22sp" /> |
205 | 210 | ||
206 | <TextView | 211 | <TextView |
212 | android:id="@+id/tv_card_time" | ||
207 | android:layout_width="wrap_content" | 213 | android:layout_width="wrap_content" |
208 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
209 | android:layout_marginLeft="60dp" | 215 | android:layout_marginLeft="60dp" |
210 | android:background="@null" | 216 | android:background="@null" |
211 | android:text="4433322-334--34" | 217 | android:text="4433322-334--34" |
212 | android:textColor="@color/btn_text_color" | 218 | android:textColor="@color/btn_text_color" |
213 | android:textSize="22sp" /> | 219 | android:textSize="22sp" /> |
214 | </LinearLayout> | 220 | </LinearLayout> |
215 | 221 | ||
216 | </LinearLayout> | 222 | </LinearLayout> |
217 | 223 | ||
218 | <LinearLayout | 224 | <LinearLayout |
219 | android:layout_width="match_parent" | 225 | android:layout_width="match_parent" |
220 | android:layout_height="wrap_content" | 226 | android:layout_height="wrap_content" |
221 | android:gravity="center_vertical" | 227 | android:gravity="center_vertical" |
222 | android:orientation="horizontal"> | 228 | android:orientation="horizontal"> |
223 | 229 | ||
224 | <LinearLayout | 230 | <LinearLayout |
225 | android:layout_width="0dp" | 231 | android:layout_width="0dp" |
226 | android:layout_height="60dp" | 232 | android:layout_height="60dp" |
227 | android:layout_weight="1" | 233 | android:layout_weight="1" |
228 | android:layout_marginLeft="200dp" | 234 | android:layout_marginLeft="200dp" |
229 | android:gravity="center_vertical"> | 235 | android:gravity="center_vertical"> |
230 | 236 | ||
231 | <TextView | 237 | <TextView |
232 | android:layout_width="wrap_content" | 238 | android:layout_width="wrap_content" |
233 | android:layout_height="wrap_content" | 239 | android:layout_height="wrap_content" |
234 | android:text="机身编码" | 240 | android:text="机身编码" |
235 | android:textColor="@color/btn_text_color" | 241 | android:textColor="@color/btn_text_color" |
236 | android:textSize="22sp" /> | 242 | android:textSize="22sp" /> |
237 | 243 | ||
238 | <TextView | 244 | <TextView |
245 | android:id="@+id/tv_card_deviceNumber" | ||
239 | android:layout_width="wrap_content" | 246 | android:layout_width="wrap_content" |
240 | android:layout_height="wrap_content" | 247 | android:layout_height="wrap_content" |
241 | android:layout_marginLeft="50dp" | 248 | android:layout_marginLeft="50dp" |
242 | android:hint="473463746343" | 249 | android:hint="473463746343" |
243 | android:textSize="22sp" /> | 250 | android:textSize="22sp" /> |
244 | 251 | ||
245 | </LinearLayout> | 252 | </LinearLayout> |
246 | 253 | ||
247 | <LinearLayout | 254 | <LinearLayout |
248 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
249 | android:layout_height="60dp" | 256 | android:layout_height="60dp" |
250 | android:layout_weight="1" | 257 | android:layout_weight="1" |
251 | android:layout_marginLeft="80dp" | 258 | android:layout_marginLeft="80dp" |
252 | android:gravity="center_vertical"> | 259 | android:gravity="center_vertical"> |
253 | 260 | ||
254 | <TextView | 261 | <TextView |
262 | android:id="@+id/tv_card_shopAdress" | ||
255 | android:layout_width="wrap_content" | 263 | android:layout_width="wrap_content" |
256 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
257 | android:text="购买地址" | 265 | android:text="购买地址" |
258 | android:textColor="@color/btn_text_color" | 266 | android:textColor="@color/btn_text_color" |
259 | android:textSize="22sp" /> | 267 | android:textSize="22sp" /> |
260 | 268 | ||
261 | <TextView | 269 | <TextView |
262 | android:layout_width="wrap_content" | 270 | android:layout_width="wrap_content" |
263 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
264 | android:layout_marginLeft="60dp" | 272 | android:layout_marginLeft="60dp" |
265 | android:text="啥啥啥 专卖店" | 273 | android:text="啥啥啥 专卖店" |
266 | android:textColor="@color/btn_text_color" | 274 | android:textColor="@color/btn_text_color" |
267 | android:textSize="22sp" /> | 275 | android:textSize="22sp" /> |
268 | </LinearLayout> | 276 | </LinearLayout> |
269 | 277 | ||
270 | </LinearLayout> | 278 | </LinearLayout> |
271 | 279 | ||
272 | <LinearLayout | 280 | <LinearLayout |
273 | android:layout_width="match_parent" | 281 | android:layout_width="match_parent" |
274 | android:layout_height="wrap_content" | 282 | android:layout_height="wrap_content" |
275 | android:gravity="center_vertical" | 283 | android:gravity="center_vertical" |
276 | android:layout_marginBottom="30dp" | 284 | android:layout_marginBottom="30dp" |
277 | android:orientation="horizontal"> | 285 | android:orientation="horizontal"> |
278 | 286 | ||
279 | <LinearLayout | 287 | <LinearLayout |
280 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
281 | android:layout_height="60dp" | 289 | android:layout_height="60dp" |
282 | android:layout_weight="1" | 290 | android:layout_weight="1" |
283 | android:layout_marginLeft="200dp" | 291 | android:layout_marginLeft="200dp" |
284 | android:gravity="center_vertical"> | 292 | android:gravity="center_vertical"> |
285 | 293 | ||
286 | <TextView | 294 | <TextView |
287 | android:layout_width="wrap_content" | 295 | android:layout_width="wrap_content" |
288 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
289 | android:text="手机号码" | 297 | android:text="手机号码" |
290 | android:textColor="@color/btn_text_color" | 298 | android:textColor="@color/btn_text_color" |
291 | android:textSize="22sp" /> | 299 | android:textSize="22sp" /> |
292 | 300 | ||
293 | <TextView | 301 | <TextView |
302 | android:id="@+id/tv_card_phone" | ||
294 | android:layout_width="wrap_content" | 303 | android:layout_width="wrap_content" |
295 | android:layout_height="wrap_content" | 304 | android:layout_height="wrap_content" |
296 | android:layout_marginLeft="50dp" | 305 | android:layout_marginLeft="50dp" |
297 | android:text="IPone888" | 306 | android:text="IPone888" |
298 | android:textSize="22sp" /> | 307 | android:textSize="22sp" /> |
299 | <TextView | 308 | <TextView |
309 | android:id="@+id/tv_card_phone_change" | ||
300 | android:layout_width="wrap_content" | 310 | android:layout_width="wrap_content" |
301 | android:layout_height="wrap_content" | 311 | android:layout_height="wrap_content" |
302 | android:layout_marginLeft="18dp" | 312 | android:layout_marginLeft="18dp" |
303 | android:background="@drawable/corcle_black_bg" | 313 | android:background="@drawable/corcle_black_bg" |
304 | android:text="修改" | 314 | android:text="修改" |
305 | android:paddingLeft="5dp" | 315 | android:paddingLeft="5dp" |
306 | android:paddingRight="5dp" | 316 | android:paddingRight="5dp" |
307 | android:textColor="@color/login_text_blue" | 317 | android:textColor="@color/login_text_blue" |
308 | android:textSize="18sp" /> | 318 | android:textSize="18sp" /> |
309 | 319 | ||
310 | 320 | ||
311 | </LinearLayout> | 321 | </LinearLayout> |
312 | 322 | ||
313 | <LinearLayout | 323 | <LinearLayout |
314 | android:layout_width="0dp" | 324 | android:layout_width="0dp" |
315 | android:layout_height="60dp" | 325 | android:layout_height="60dp" |
316 | android:layout_weight="1" | 326 | android:layout_weight="1" |
317 | android:layout_marginLeft="80dp" | 327 | android:layout_marginLeft="80dp" |
318 | android:gravity="center_vertical"> | 328 | android:gravity="center_vertical"> |
319 | 329 | ||
320 | <TextView | 330 | <TextView |
321 | android:layout_width="wrap_content" | 331 | android:layout_width="wrap_content" |
322 | android:layout_height="wrap_content" | 332 | android:layout_height="wrap_content" |
323 | android:text="本地售后电话" | 333 | android:text="本地售后电话" |
324 | android:textSize="22sp" /> | 334 | android:textSize="22sp" /> |
325 | 335 | ||
326 | <TextView | 336 | <TextView |
337 | android:id="@+id/tv_card_tleNember" | ||
327 | android:layout_width="wrap_content" | 338 | android:layout_width="wrap_content" |
328 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
329 | android:layout_marginLeft="60dp" | 340 | android:layout_marginLeft="60dp" |
330 | android:background="@null" | 341 | android:background="@null" |
331 | android:text="1111111" | 342 | android:text="1111111" |
332 | android:textSize="22sp" /> | 343 | android:textSize="22sp" /> |
333 | 344 | ||
334 | </LinearLayout> | 345 | </LinearLayout> |
335 | 346 | ||
336 | </LinearLayout> | 347 | </LinearLayout> |
337 | </LinearLayout> | 348 | </LinearLayout> |
338 | 349 | ||
339 | <LinearLayout | 350 | <LinearLayout |
340 | android:layout_width="match_parent" | 351 | android:layout_width="match_parent" |
341 | android:layout_height="wrap_content" | 352 | android:layout_height="wrap_content" |
342 | android:layout_marginTop="5dp" | 353 | android:layout_marginTop="5dp" |
343 | android:gravity="center" | 354 | android:gravity="center" |
344 | android:orientation="vertical"> | 355 | android:orientation="vertical"> |
345 | 356 | ||
346 | <TextView | 357 | <TextView |
347 | android:layout_width="wrap_content" | 358 | android:layout_width="wrap_content" |
348 | android:layout_height="wrap_content" | 359 | android:layout_height="wrap_content" |
349 | android:layout_marginTop="5dp" | 360 | android:layout_marginTop="5dp" |
350 | android:text="@string/electronic_card" | 361 | android:text="@string/electronic_card" |
351 | android:textColor="@color/electronic_text" | 362 | android:textColor="@color/electronic_text" |
352 | android:textSize="18sp" /> | 363 | android:textSize="18sp" /> |
353 | 364 | ||
354 | 365 | ||
355 | 366 | ||
356 | </LinearLayout> | 367 | </LinearLayout> |
357 | <LinearLayout | 368 | <LinearLayout |
358 | android:layout_width="match_parent" | 369 | android:layout_width="match_parent" |
359 | android:layout_height="wrap_content" | 370 | android:layout_height="wrap_content" |
360 | android:layout_marginTop="30dp" | 371 | android:layout_marginTop="30dp" |
361 | android:gravity="center" | 372 | android:gravity="center" |
362 | android:orientation="horizontal"> | 373 | android:orientation="horizontal"> |
363 | 374 | ||
364 | <ImageView | 375 | <ImageView |
365 | android:layout_width="wrap_content" | 376 | android:layout_width="wrap_content" |
366 | android:layout_height="wrap_content" | 377 | android:layout_height="wrap_content" |
367 | android:src="@mipmap/phone"/> | 378 | android:src="@mipmap/phone"/> |
368 | <TextView | 379 | <TextView |
369 | android:layout_width="wrap_content" | 380 | android:layout_width="wrap_content" |
370 | android:layout_height="wrap_content" | 381 | android:layout_height="wrap_content" |
371 | android:textSize="30sp" | 382 | android:textSize="30sp" |
372 | android:layout_marginLeft="5dp" | 383 | android:layout_marginLeft="5dp" |
373 | android:textColor="@color/login_text_blue" | 384 | android:textColor="@color/login_text_blue" |
374 | android:text="400-400-000"/> | 385 | android:text="400-400-000"/> |
375 | 386 | ||
376 | 387 | ||
377 | </LinearLayout> | 388 | </LinearLayout> |
378 | 389 | ||
379 | 390 | ||
380 | 391 | ||
381 | </LinearLayout> | 392 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_validation.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="#ffffffff" | 5 | android:background="#ffffffff" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | <RelativeLayout | 7 | <RelativeLayout |
8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | android:background="@color/login_text_blue" | 11 | android:background="@color/login_text_blue" |
12 | android:minHeight="50dp" > | 12 | android:minHeight="50dp" > |
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="wrap_content" | 17 | android:layout_height="wrap_content" |
18 | android:layout_centerVertical="true" | 18 | android:layout_centerVertical="true" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
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="wrap_content" | 26 | android:layout_height="wrap_content" |
27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
28 | android:text="@string/string_electroniccard_info_change" | 28 | android:text="@string/string_electroniccard_info_title" |
29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
31 | </RelativeLayout> | 31 | </RelativeLayout> |
32 | <RelativeLayout | 32 | <RelativeLayout |
33 | android:layout_width="match_parent" | 33 | android:layout_width="match_parent" |
34 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
35 | android:layout_below="@id/title" | 35 | android:layout_below="@id/title" |
36 | android:background="#ffffffff" | 36 | android:background="#ffffffff" |
37 | android:orientation="vertical" | 37 | android:orientation="vertical" |
38 | android:paddingLeft="250dp" | 38 | android:paddingLeft="250dp" |
39 | android:paddingRight="250dp" > | 39 | android:paddingRight="250dp" > |
40 | 40 | ||
41 | <EditText | 41 | <EditText |
42 | android:id="@+id/et_phonenumber" | 42 | android:id="@+id/et_phonenumber" |
43 | style="@style/login_register_edit_style" | 43 | style="@style/login_register_edit_style" |
44 | android:layout_marginTop="150dp" | 44 | android:layout_marginTop="150dp" |
45 | android:hint="手机号" | 45 | android:hint="手机号" |
46 | android:inputType="phone" /> | 46 | android:inputType="phone" /> |
47 | 47 | ||
48 | <TextView | 48 | <TextView |
49 | android:id="@+id/phonenumber_error_hint" | 49 | android:id="@+id/phonenumber_error_hint" |
50 | style="@style/registererrhint_style" | 50 | style="@style/registererrhint_style" |
51 | android:layout_below="@id/et_phonenumber" /> | 51 | android:layout_below="@id/et_phonenumber" /> |
52 | 52 | ||
53 | <LinearLayout | 53 | <LinearLayout |
54 | android:id="@+id/rl_authcode" | 54 | android:id="@+id/rl_authcode" |
55 | android:layout_width="match_parent" | 55 | android:layout_width="match_parent" |
56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
57 | android:layout_below="@id/et_phonenumber" | 57 | android:layout_below="@id/et_phonenumber" |
58 | android:layout_marginTop="30dp" | 58 | android:layout_marginTop="30dp" |
59 | android:orientation="horizontal"> | 59 | android:orientation="horizontal"> |
60 | 60 | ||
61 | <EditText | 61 | <EditText |
62 | android:id="@+id/et_authcode" | 62 | android:id="@+id/et_authcode" |
63 | style="@style/login_register_edit_rect_style" | 63 | style="@style/login_register_edit_rect_style" |
64 | android:layout_marginRight="-4px" | 64 | android:layout_marginRight="-4px" |
65 | android:layout_weight="1" | 65 | android:layout_weight="1" |
66 | android:hint="验证码" | 66 | android:hint="验证码" |
67 | android:numeric="integer" /> | 67 | android:numeric="integer" /> |
68 | 68 | ||
69 | <Button | 69 | <Button |
70 | android:id="@+id/btn_authcode" | 70 | android:id="@+id/btn_authcode" |
71 | style="@style/login_register_btn_authcode_rect_style" | 71 | style="@style/login_register_btn_authcode_rect_style" |
72 | android:layout_marginLeft="0px" | 72 | android:layout_marginLeft="0px" |
73 | android:layout_marginTop="0px" | 73 | android:layout_marginTop="0px" |
74 | android:layout_weight="2" | 74 | android:layout_weight="2" |
75 | android:text="获取验证码" | 75 | android:text="获取验证码" |
76 | android:textColor="@color/btn_text_color" /> | 76 | android:textColor="@color/btn_text_color" /> |
77 | </LinearLayout> | 77 | </LinearLayout> |
78 | 78 | ||
79 | <TextView | 79 | <TextView |
80 | android:id="@+id/authcode_error_hint" | 80 | android:id="@+id/authcode_error_hint" |
81 | style="@style/registererrhint_style" | 81 | style="@style/registererrhint_style" |
82 | android:layout_below="@id/rl_authcode" /> | 82 | android:layout_below="@id/rl_authcode" /> |
83 | 83 | ||
84 | <TextView | 84 | <TextView |
85 | android:id="@+id/password_error_hint" | 85 | android:id="@+id/password_error_hint" |
86 | style="@style/registererrhint_style" | 86 | style="@style/registererrhint_style" |
87 | android:layout_below="@id/pwd_rl" /> | 87 | android:layout_below="@id/pwd_rl" /> |
88 | 88 | ||
89 | <Button | 89 | <Button |
90 | android:id="@+id/btn_card_valiyanzhen" | 90 | android:id="@+id/btn_card_valiyanzhen" |
91 | style="@style/button_login_register_style" | 91 | style="@style/button_login_register_style" |
92 | android:layout_below="@id/rl_authcode" | 92 | android:layout_below="@id/rl_authcode" |
93 | android:layout_marginTop="30dp" | 93 | android:layout_marginTop="30dp" |
94 | android:text="@string/string_regist_next" /> | 94 | android:text="@string/string_regist_next" /> |
95 | </RelativeLayout> | 95 | </RelativeLayout> |
96 | 96 | ||
97 | </RelativeLayout> | 97 | </RelativeLayout> |