Commit 73e24d52d44cb61591420c299860f9941088de32
1 parent
ee4c3fd153
Exists in
master
个人中心完善
Showing
37 changed files
with
265 additions
and
201 deletions
Show diff stats
PersonalCenter/.idea/encodings.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <project version="4"> | ||
3 | <component name="Encoding"> | ||
4 | <file url="PROJECT" charset="UTF-8" /> | ||
5 | </component> | ||
6 | </project> |
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 | <application | 5 | <application |
6 | android:name=".activity.MyApplication" | 6 | android:name=".activity.MyApplication" |
7 | android:allowBackup="true" | 7 | android:allowBackup="true" |
8 | android:icon="@mipmap/ic_launcher" | 8 | android:icon="@mipmap/icon" |
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="@android:style/Theme.Light.NoTitleBar.Fullscreen"> |
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="sensorLandscape"> |
16 | </activity> | 16 | </activity> |
17 | <activity | 17 | <activity |
18 | android:name=".activity.LoginAndRegisterActivity" | 18 | android:name=".activity.LoginAndRegisterActivity" |
19 | android:launchMode="singleTask" | 19 | android:launchMode="singleTask" |
20 | 20 | ||
21 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="sensorLandscape"> |
22 | <intent-filter> | 22 | <intent-filter> |
23 | <action android:name="android.intent.action.MAIN" /> | 23 | <action android:name="android.intent.action.MAIN" /> |
24 | 24 | ||
25 | <category android:name="android.intent.category.LAUNCHER" /> | 25 | <category android:name="android.intent.category.LAUNCHER" /> |
26 | </intent-filter> | 26 | </intent-filter> |
27 | 27 | ||
28 | </activity> | 28 | </activity> |
29 | <activity | 29 | <activity |
30 | android:name=".activity.ForgotPasswordActivity" | 30 | android:name=".activity.ForgotPasswordActivity" |
31 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
32 | android:screenOrientation="landscape"> | 32 | android:screenOrientation="sensorLandscape"> |
33 | 33 | ||
34 | </activity> | 34 | </activity> |
35 | <activity | 35 | <activity |
36 | android:name=".activity.ChangePasswordActivity" | 36 | android:name=".activity.ChangePasswordActivity" |
37 | android:launchMode="singleTask" | 37 | android:launchMode="singleTask" |
38 | android:screenOrientation="landscape"> | 38 | android:screenOrientation="sensorLandscape"> |
39 | 39 | ||
40 | </activity> | 40 | </activity> |
41 | <activity | 41 | <activity |
42 | android:name=".activity.RegisterInfoActivity" | 42 | android:name=".activity.RegisterInfoActivity" |
43 | android:launchMode="singleTask" | 43 | android:launchMode="singleTask" |
44 | android:screenOrientation="landscape"> | 44 | android:screenOrientation="sensorLandscape"> |
45 | 45 | ||
46 | </activity> | 46 | </activity> |
47 | <activity | 47 | <activity |
48 | android:name=".activity.ElectronicCardValidationActivity" | 48 | android:name=".activity.ElectronicCardValidationActivity" |
49 | android:launchMode="singleTask" | 49 | android:launchMode="singleTask" |
50 | android:screenOrientation="landscape"> | 50 | android:screenOrientation="sensorLandscape"> |
51 | 51 | ||
52 | </activity> | 52 | </activity> |
53 | <activity | 53 | <activity |
54 | android:name=".activity.ChangeBangDingActivity" | 54 | android:name=".activity.ChangeBangDingActivity" |
55 | android:launchMode="singleTask" | 55 | android:launchMode="singleTask" |
56 | android:screenOrientation="landscape"> | 56 | android:screenOrientation="sensorLandscape"> |
57 | 57 | ||
58 | </activity> | 58 | </activity> |
59 | <activity | 59 | <activity |
60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" | 60 | android:name=".activity.ChangeElectronicCardAdressInfoActivity" |
61 | android:launchMode="singleTask" | 61 | android:launchMode="singleTask" |
62 | android:screenOrientation="landscape"> | 62 | android:screenOrientation="sensorLandscape"> |
63 | 63 | ||
64 | </activity> | 64 | </activity> |
65 | <activity | 65 | <activity |
66 | android:name=".activity.ChangeEletronicCardPhoneActivity" | 66 | android:name=".activity.ChangeEletronicCardPhoneActivity" |
67 | android:launchMode="singleTask" | 67 | android:launchMode="singleTask" |
68 | android:screenOrientation="landscape"> | 68 | android:screenOrientation="sensorLandscape"> |
69 | 69 | ||
70 | </activity> | 70 | </activity> |
71 | <activity | 71 | <activity |
72 | android:name=".activity.ChoiseTextBookActivity" | 72 | android:name=".activity.ChoiseTextBookActivity" |
73 | android:launchMode="singleTask" | 73 | android:launchMode="singleTask" |
74 | android:screenOrientation="landscape"> | 74 | android:screenOrientation="sensorLandscape"> |
75 | 75 | ||
76 | </activity> | 76 | </activity> |
77 | <activity | 77 | <activity |
78 | android:name=".activity.TheStartPageActivity" | 78 | android:name=".activity.TheStartPageActivity" |
79 | android:launchMode="singleTask" | 79 | android:launchMode="singleTask" |
80 | android:screenOrientation="landscape"> | 80 | android:screenOrientation="sensorLandscape"> |
81 | 81 | ||
82 | </activity> | 82 | </activity> |
83 | <activity | 83 | <activity |
84 | android:name=".activity.ElectronicCardEditInfoActivity" | 84 | android:name=".activity.ElectronicCardEditInfoActivity" |
85 | android:launchMode="singleTask" | 85 | android:launchMode="singleTask" |
86 | android:screenOrientation="landscape"> | 86 | android:screenOrientation="sensorLandscape" |
87 | android:windowSoftInputMode="adjustPan"> | ||
87 | 88 | ||
88 | </activity> | 89 | </activity> |
89 | <activity | 90 | <activity |
90 | android:name=".activity.ElectronicCardInfoOKActivity" | 91 | android:name=".activity.ElectronicCardInfoOKActivity" |
91 | android:launchMode="singleTask" | 92 | android:launchMode="singleTask" |
92 | android:screenOrientation="landscape"> | 93 | android:screenOrientation="sensorLandscape"> |
93 | 94 | ||
94 | </activity> | 95 | </activity> |
95 | <activity | 96 | <activity |
96 | android:name=".activity.ElectronicCardLookInfoActivity" | 97 | android:name=".activity.ElectronicCardLookInfoActivity" |
97 | android:launchMode="singleTask" | 98 | android:launchMode="singleTask" |
98 | android:screenOrientation="landscape"> | 99 | android:screenOrientation="sensorLandscape" |
100 | > | ||
99 | 101 | ||
100 | </activity> | 102 | </activity> |
101 | <activity | 103 | <activity |
102 | android:name=".activity.FeedBackActivity" | 104 | android:name=".activity.FeedBackActivity" |
103 | android:launchMode="singleTask" | 105 | android:launchMode="singleTask" |
104 | android:screenOrientation="landscape"> | 106 | android:screenOrientation="sensorLandscape"> |
105 | 107 | ||
106 | </activity> | 108 | </activity> |
107 | <activity | 109 | <activity |
108 | android:name=".activity.AccountManagementActivity" | 110 | android:name=".activity.AccountManagementActivity" |
109 | android:launchMode="singleTask" | 111 | android:launchMode="singleTask" |
110 | android:screenOrientation="landscape"> | 112 | android:screenOrientation="sensorLandscape"> |
111 | 113 | ||
112 | </activity> | 114 | </activity> |
113 | <activity | 115 | <activity |
114 | android:name=".activity.ChangePresonalInfoActivity" | 116 | android:name=".activity.ChangePresonalInfoActivity" |
115 | android:launchMode="singleTask" | 117 | android:launchMode="singleTask" |
116 | android:screenOrientation="landscape"> | 118 | android:screenOrientation="sensorLandscape" |
119 | android:windowSoftInputMode="adjustPan"> | ||
117 | 120 | ||
118 | </activity> | 121 | </activity> |
119 | <activity | 122 | <activity |
120 | android:name=".activity.BangDingCode" | 123 | android:name=".activity.BangDingCode" |
121 | android:launchMode="singleTask" | 124 | android:launchMode="singleTask" |
122 | android:screenOrientation="landscape"> | 125 | android:screenOrientation="sensorLandscape"> |
123 | 126 | ||
124 | </activity> | 127 | </activity> |
125 | <service android:name="com.hjx.personalcenter.service.CenterService" | 128 | <service android:name="com.hjx.personalcenter.service.CenterService" |
126 | android:enabled="true" | 129 | android:enabled="true" |
127 | android:exported="true"> | 130 | android:exported="true"> |
128 | <intent-filter> | 131 | <intent-filter> |
129 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> | 132 | <action android:name="com.hjx.mypresonallibrary.ICenterService"/> |
130 | </intent-filter> | 133 | </intent-filter> |
131 | </service> | 134 | </service> |
132 | <service | 135 | <service |
133 | android:name="com.hjx.personalcenter.update.DownloadService" | 136 | android:name="com.hjx.personalcenter.update.DownloadService" |
134 | android:enabled="true"/> | 137 | android:enabled="true"/> |
135 | <receiver | 138 | <receiver |
136 | android:name="com.hjx.personalcenter.service.StaticReceiver" | 139 | android:name="com.hjx.personalcenter.service.StaticReceiver" |
137 | android:exported="true"> | 140 | android:exported="true"> |
138 | <intent-filter > | 141 | <intent-filter > |
139 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> | 142 | <action android:name="com.ozing.launcher.SWITCH_GRADE"/> |
140 | </intent-filter> | 143 | </intent-filter> |
141 | 144 | ||
142 | </receiver> | 145 | </receiver> |
143 | </application> | 146 | </application> |
144 | <!--权限--> | 147 | <!--权限--> |
145 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 148 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
146 | <uses-permission android:name="android.permission.CAMERA" /> | 149 | <uses-permission android:name="android.permission.CAMERA" /> |
147 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 150 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
148 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 151 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
149 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 152 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
150 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 153 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
151 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 154 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
152 | <uses-permission android:name="android.permission.CALL_PHONE" /> | 155 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
153 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 156 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
154 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 157 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> |
155 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 158 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
156 | <uses-permission android:name="android.permission.INTERNET" /> | 159 | <uses-permission android:name="android.permission.INTERNET" /> |
157 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 160 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
158 | <uses-permission android:name="android.permission.READ_LOGS" /> | 161 | <uses-permission android:name="android.permission.READ_LOGS" /> |
159 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> | 162 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> |
160 | 163 | ||
161 | </manifest> | 164 | </manifest> |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v4.app.FragmentActivity; |
8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
10 | import android.util.Log; | ||
10 | import android.view.View; | 11 | import android.view.View; |
11 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
13 | import android.widget.TextView; | 14 | import android.widget.TextView; |
14 | 15 | ||
15 | import com.facebook.drawee.view.SimpleDraweeView; | 16 | import com.facebook.drawee.view.SimpleDraweeView; |
16 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 18 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 19 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
19 | import com.hjx.personalcenter.db.Content; | 20 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpCode; | 22 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 23 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.GetDevicesUtil; | 26 | import com.hjx.personalcenter.util.GetDevicesUtil; |
26 | 27 | ||
27 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
28 | import java.util.List; | 29 | import java.util.List; |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * 账户管理 熊巍 | 32 | * 账户管理 熊巍 |
32 | * Created by h on 2017/8/12. | 33 | * Created by h on 2017/8/12. |
33 | */ | 34 | */ |
34 | 35 | ||
35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { | 36 | public class AccountManagementActivity extends FragmentActivity implements View.OnClickListener { |
36 | private TextView changbangding, changpassword, usernames, | 37 | private TextView changbangding, changpassword, usernames, |
37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; | 38 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
38 | private ImageView iv_useing, cancel; | 39 | private ImageView iv_useing, cancel; |
39 | private SimpleDraweeView mSimpleDraweeView; | 40 | private SimpleDraweeView mSimpleDraweeView; |
40 | private RecyclerView listview; | 41 | private RecyclerView listview; |
41 | private LinearLayout add_accunt, ll_zhu_backgrangd; | 42 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
42 | private AccountChildsAdapter childsAdapter; | 43 | private AccountChildsAdapter childsAdapter; |
43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 44 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
44 | Handler handler = new Handler() { | 45 | Handler handler = new Handler() { |
45 | @Override | 46 | @Override |
46 | public void handleMessage(Message msg) { | 47 | public void handleMessage(Message msg) { |
47 | super.handleMessage(msg); | 48 | super.handleMessage(msg); |
48 | switch (msg.what) { | 49 | switch (msg.what) { |
49 | case HttpCode.CHILDS_SUCESS: | 50 | case HttpCode.CHILDS_SUCESS: |
50 | ChildsInfo childsInfo = new ChildsInfo(); | 51 | ChildsInfo childsInfo = new ChildsInfo(); |
51 | if (childsInfo.getStatus()==1000) { | 52 | if (childsInfo.getStatus()==1000) { |
52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); | 53 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); |
53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); | 54 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); |
54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); | 55 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); | 56 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
56 | tv_username.setText(names); | 57 | tv_username.setText(names); |
57 | tv_grade.setText(grades); | 58 | tv_grade.setText(grades); |
58 | tv_school.setText(schools); | 59 | tv_school.setText(schools); |
59 | tv_adress.setText(adress); | 60 | tv_adress.setText(adress); |
60 | tv_changzhu.setText("使用中"); | 61 | tv_changzhu.setText("使用中"); |
61 | tv_changzhu.setEnabled(false); | 62 | tv_changzhu.setEnabled(false); |
62 | iv_useing.setVisibility(View.VISIBLE); | 63 | iv_useing.setVisibility(View.VISIBLE); |
63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 64 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
64 | //mSimpleDraweeView.setImageURI(phote); | 65 | //mSimpleDraweeView.setImageURI(phote); |
65 | 66 | ||
66 | } else { | 67 | } else { |
67 | String name = null; | 68 | String name = null; |
68 | String grade = null; | 69 | String grade = null; |
69 | String school = null; | 70 | String school = null; |
70 | String addr = null; | 71 | String addr = null; |
71 | String phote = null; | 72 | String phote = null; |
72 | String subAccountId = null; | 73 | String subAccountId = null; |
73 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | 74 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); |
74 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | 75 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; |
75 | for (int i = 0; i < list.size(); i++) { | 76 | for (int i = 0; i < list.size(); i++) { |
76 | int type = list.get(i).getType(); | 77 | int type = list.get(i).getType(); |
77 | if (type == 1) { | 78 | if (type == 1) { |
78 | name = list.get(i).getName(); | 79 | name = list.get(i).getName(); |
79 | grade = list.get(i).getGrade(); | 80 | grade = list.get(i).getGrade(); |
80 | school = list.get(i).getSchool(); | 81 | school = list.get(i).getSchool(); |
81 | addr = list.get(i).getRegion(); | 82 | addr = list.get(i).getRegion(); |
82 | phote = list.get(i).getImage(); | 83 | phote = list.get(i).getImage(); |
83 | subAccountId = list.get(i).getSubAccountId(); | 84 | subAccountId = list.get(i).getSubAccountId(); |
84 | } else if (type == 2) { | 85 | } else if (type == 2) { |
85 | childList.add(list.get(i)); | 86 | childList.add(list.get(i)); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | tv_username.setText(name); | 89 | tv_username.setText(name); |
89 | tv_grade.setText(grade); | 90 | tv_grade.setText(grade); |
90 | tv_school.setText(school); | 91 | tv_school.setText(school); |
91 | tv_adress.setText(addr); | 92 | tv_adress.setText(addr); |
92 | mSimpleDraweeView.setImageURI(phote); | 93 | mSimpleDraweeView.setImageURI(phote); |
93 | data.clear(); | 94 | data.clear(); |
94 | data.addAll(childList); | 95 | data.addAll(childList); |
95 | childsAdapter.notifyDataSetChanged(); | 96 | childsAdapter.notifyDataSetChanged(); |
96 | } | 97 | } |
97 | break; | 98 | break; |
98 | } | 99 | } |
99 | } | 100 | } |
100 | }; | 101 | }; |
101 | 102 | ||
102 | @Override | 103 | @Override |
103 | protected void onCreate(Bundle savedInstanceState) { | 104 | protected void onCreate(Bundle savedInstanceState) { |
104 | super.onCreate(savedInstanceState); | 105 | super.onCreate(savedInstanceState); |
105 | setContentView(R.layout.activity_account_management); | 106 | setContentView(R.layout.activity_account_management); |
106 | initView(); | 107 | initView(); |
107 | initData(); | 108 | initData(); |
108 | initLister(); | 109 | initLister(); |
109 | } | 110 | } |
110 | 111 | ||
111 | private void initView() { | 112 | private void initView() { |
112 | changbangding = (TextView) findViewById(R.id.changBangding); | 113 | changbangding = (TextView) findViewById(R.id.changBangding); |
113 | changpassword = (TextView) findViewById(R.id.changpassword); | 114 | changpassword = (TextView) findViewById(R.id.changpassword); |
114 | usernames = (TextView) findViewById(R.id.cunt_username); | 115 | usernames = (TextView) findViewById(R.id.cunt_username); |
115 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 116 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
116 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 117 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
117 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 118 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
118 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 119 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
119 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); | 120 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); |
120 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 121 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
121 | cancel = (ImageView) findViewById(R.id.cancel); | 122 | cancel = (ImageView) findViewById(R.id.cancel); |
122 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 123 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
123 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 124 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
124 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 125 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
125 | } | 126 | } |
126 | 127 | ||
127 | private void initData() { | 128 | private void initData() { |
128 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 129 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
129 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 130 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
130 | usernames.setText(cunt_username); | 131 | usernames.setText(cunt_username); |
131 | 132 | ||
132 | if (account.equals("1")) { | 133 | if (account.equals("1")) { |
133 | tv_changzhu.setText("使用中"); | 134 | tv_changzhu.setText("使用中"); |
134 | tv_changzhu.setEnabled(false); | 135 | tv_changzhu.setEnabled(false); |
135 | iv_useing.setVisibility(View.VISIBLE); | 136 | iv_useing.setVisibility(View.VISIBLE); |
136 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 137 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
137 | } else { | 138 | } else { |
138 | |||
139 | tv_changzhu.setText("切换主账户"); | 139 | tv_changzhu.setText("切换主账户"); |
140 | tv_changzhu.setEnabled(true); | 140 | tv_changzhu.setEnabled(true); |
141 | iv_useing.setVisibility(View.GONE); | 141 | iv_useing.setVisibility(View.GONE); |
142 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 142 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 146 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
147 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 147 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
148 | listview.setLayoutManager(linearLayoutManager); | 148 | listview.setLayoutManager(linearLayoutManager); |
149 | childsAdapter = new AccountChildsAdapter(data, this); | 149 | childsAdapter = new AccountChildsAdapter(data, this); |
150 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 150 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
151 | listview.setAdapter(childsAdapter); | 151 | listview.setAdapter(childsAdapter); |
152 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 152 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
153 | @Override | 153 | @Override |
154 | public void onItemClick(View view, int position) { | 154 | public void onItemClick(View view, int position) { |
155 | 155 | ||
156 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); | 156 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
157 | } | 157 | } |
158 | }); | 158 | }); |
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | private void initLister() { | 163 | private void initLister() { |
164 | changbangding.setOnClickListener(this); | 164 | changbangding.setOnClickListener(this); |
165 | changpassword.setOnClickListener(this); | 165 | changpassword.setOnClickListener(this); |
166 | cancel.setOnClickListener(this); | 166 | cancel.setOnClickListener(this); |
167 | tv_changzhu.setOnClickListener(this); | 167 | tv_changzhu.setOnClickListener(this); |
168 | 168 | ||
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | @Override | 172 | @Override |
173 | public void onClick(View v) { | 173 | public void onClick(View v) { |
174 | switch (v.getId()) { | 174 | switch (v.getId()) { |
175 | case R.id.changBangding: | 175 | case R.id.changBangding: |
176 | Content.authcodeflag = 1; | 176 | Content.authcodeflag = 1; |
177 | Intent changebangding = new Intent(); | 177 | Intent changebangding = new Intent(); |
178 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); | 178 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); |
179 | startActivity(changebangding); | 179 | startActivity(changebangding); |
180 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 180 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
181 | break; | 181 | break; |
182 | case R.id.changpassword: | 182 | case R.id.changpassword: |
183 | Intent changpwd = new Intent(); | 183 | Intent changpwd = new Intent(); |
184 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); | 184 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
185 | startActivity(changpwd); | 185 | startActivity(changpwd); |
186 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 186 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
187 | break; | 187 | break; |
188 | case R.id.change_zhu_account: | 188 | case R.id.change_zhu_account: |
189 | Content.changgeaccountflag = 1; | 189 | Content.changgeaccountflag = 1; |
190 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 190 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
191 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); | 191 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
192 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 192 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
193 | String ss = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADENS); | ||
194 | String zizhuanhui = SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.CHILDSGRADENS); | ||
193 | try { | 195 | try { |
194 | long auserID = Long.parseLong(userID); | 196 | long auserID = Long.parseLong(userID); |
197 | int zhugrade = Integer.parseInt(ss); | ||
198 | int zigrade = Integer.parseInt(zizhuanhui); | ||
199 | if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { | ||
200 | Intent intentbroad = new Intent(); | ||
201 | intentbroad.putExtra("info", "小学"); | ||
202 | //4、定义广播发送的action | ||
203 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
204 | //5、发送广播 | ||
205 | sendBroadcast(intentbroad); | ||
206 | Log.i("---", "发送完了"); | ||
207 | } | ||
195 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, | 208 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
196 | devicenumber, 1); | 209 | devicenumber, 1); |
197 | 210 | ||
198 | } catch (NumberFormatException e) { | 211 | } catch (NumberFormatException e) { |
199 | e.printStackTrace(); | 212 | e.printStackTrace(); |
200 | } | 213 | } |
201 | 214 | ||
202 | 215 | ||
203 | break; | 216 | break; |
204 | case R.id.cancel: | 217 | case R.id.cancel: |
205 | finish(); | 218 | finish(); |
206 | break; | 219 | break; |
207 | 220 | ||
208 | } | 221 | } |
209 | 222 | ||
210 | } | 223 | } |
211 | 224 | ||
212 | @Override | 225 | @Override |
213 | protected void onResume() { | 226 | protected void onResume() { |
214 | super.onResume(); | 227 | super.onResume(); |
215 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 228 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
216 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 229 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
217 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 230 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
218 | usernames.setText(cunt_username); | 231 | usernames.setText(cunt_username); |
219 | try { | 232 | try { |
220 | long auserID = Long.parseLong(userID); | 233 | long auserID = Long.parseLong(userID); |
221 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); | 234 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); |
222 | 235 | ||
223 | } catch (NumberFormatException e) { | 236 | } catch (NumberFormatException e) { |
224 | e.printStackTrace(); | 237 | e.printStackTrace(); |
225 | } | 238 | } |
226 | } | 239 | } |
227 | } | 240 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/BangDingCode.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.graphics.Bitmap; | 4 | import android.graphics.Bitmap; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v4.app.FragmentActivity; |
7 | import android.util.DisplayMetrics; | 7 | import android.util.DisplayMetrics; |
8 | import android.view.KeyEvent; | 8 | import android.view.KeyEvent; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.Button; | 10 | import android.widget.Button; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
13 | 13 | ||
14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.util.FileUtil; | 15 | import com.hjx.personalcenter.util.FileUtil; |
16 | import com.hjx.personalcenter.util.QRCodeUtil; | 16 | import com.hjx.personalcenter.util.QRCodeUtil; |
17 | 17 | ||
18 | import java.io.File; | 18 | import java.io.File; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Created by h on 2017/8/31. | 21 | * Created by h on 2017/8/31. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | public class BangDingCode extends AppCompatActivity { | 24 | public class BangDingCode extends FragmentActivity { |
25 | private ImageView EQpicture; | 25 | private ImageView EQpicture; |
26 | private Button btn_next_tep; | 26 | private Button btn_next_tep; |
27 | File file; | 27 | File file; |
28 | @Override | 28 | @Override |
29 | protected void onCreate(Bundle savedInstanceState) { | 29 | protected void onCreate(Bundle savedInstanceState) { |
30 | super.onCreate(savedInstanceState); | 30 | super.onCreate(savedInstanceState); |
31 | setContentView(R.layout.activity_binding_code); | 31 | setContentView(R.layout.activity_binding_code); |
32 | SysApplication.getInstance().addActivity(this); | 32 | SysApplication.getInstance().addActivity(this); |
33 | EQpicture = (ImageView) findViewById(R.id.EQpicture); | 33 | EQpicture = (ImageView) findViewById(R.id.EQpicture); |
34 | btn_next_tep = (Button) findViewById(R.id.btn_next_tep); | 34 | btn_next_tep = (Button) findViewById(R.id.btn_next_tep); |
35 | btn_next_tep.setOnClickListener(new View.OnClickListener() { | 35 | btn_next_tep.setOnClickListener(new View.OnClickListener() { |
36 | @Override | 36 | @Override |
37 | public void onClick(View v) { | 37 | public void onClick(View v) { |
38 | Intent intent = new Intent(); | 38 | Intent intent = new Intent(); |
39 | intent.setClass(BangDingCode.this, TheStartPageActivity.class); | 39 | intent.setClass(BangDingCode.this, TheStartPageActivity.class); |
40 | startActivity(intent); | 40 | startActivity(intent); |
41 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 41 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
42 | } | 42 | } |
43 | }); | 43 | }); |
44 | EQPicture(); | 44 | EQPicture(); |
45 | 45 | ||
46 | 46 | ||
47 | } | 47 | } |
48 | public void EQPicture() { | 48 | public void EQPicture() { |
49 | DisplayMetrics dm = new DisplayMetrics(); | 49 | DisplayMetrics dm = new DisplayMetrics(); |
50 | getWindowManager().getDefaultDisplay().getMetrics(dm); | 50 | getWindowManager().getDefaultDisplay().getMetrics(dm); |
51 | int screenHeight = dm.heightPixels;//屏幕高度 | 51 | int screenHeight = dm.heightPixels;//屏幕高度 |
52 | //设置二维码外布局占屏幕高宽 | 52 | //设置二维码外布局占屏幕高宽 |
53 | LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams(); | 53 | LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) EQpicture.getLayoutParams(); |
54 | layoutParams.width = screenHeight * 15 / 30; | 54 | layoutParams.width = screenHeight * 15 / 30; |
55 | layoutParams.height = screenHeight * 17 / 30; | 55 | layoutParams.height = screenHeight * 17 / 30; |
56 | EQpicture.setLayoutParams(layoutParams); | 56 | EQpicture.setLayoutParams(layoutParams); |
57 | //生成占屏幕一定比例 的二维码存储在本地并显示 | 57 | //生成占屏幕一定比例 的二维码存储在本地并显示 |
58 | file = new File(FileUtil.getCachePath(this), "user-code.jpg"); | 58 | file = new File(FileUtil.getCachePath(this), "user-code.jpg"); |
59 | Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath()); | 59 | Bitmap bitmap = QRCodeUtil.createQRImage("www.baidu.com", screenHeight * 15 / 30, screenHeight * 15 / 30, null, file.getPath()); |
60 | if (bitmap != null) { | 60 | if (bitmap != null) { |
61 | EQpicture.setImageBitmap(bitmap); | 61 | EQpicture.setImageBitmap(bitmap); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | @Override | 64 | @Override |
65 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 65 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
66 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 66 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
67 | return true; | 67 | return true; |
68 | } | 68 | } |
69 | return super.onKeyDown(keyCode, event); | 69 | return super.onKeyDown(keyCode, event); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeBangDingActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v4.app.FragmentActivity; | ||
5 | 5 | ||
6 | import com.hjx.personalcenter.R; | 6 | import com.hjx.personalcenter.R; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Created by h on 2017/8/9. | 9 | * Created by h on 2017/8/9. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | public class ChangeBangDingActivity extends Activity { | 12 | public class ChangeBangDingActivity extends FragmentActivity { |
13 | @Override | 13 | @Override |
14 | protected void onCreate(Bundle savedInstanceState) { | 14 | protected void onCreate(Bundle savedInstanceState) { |
15 | super.onCreate(savedInstanceState); | 15 | super.onCreate(savedInstanceState); |
16 | setContentView(R.layout.activity_chage_binding); | 16 | setContentView(R.layout.activity_chage_binding); |
17 | } | 17 | } |
18 | } | 18 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeElectronicCardAdressInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.os.Handler; | 4 | import android.os.Handler; |
5 | import android.os.Message; | 5 | import android.os.Message; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v4.app.FragmentActivity; |
7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 15 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
16 | import com.hjx.personalcenter.customdialog.CountryDialog; | 16 | import com.hjx.personalcenter.customdialog.CountryDialog; |
17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
18 | import com.hjx.personalcenter.db.SaveParam; | 18 | import com.hjx.personalcenter.db.SaveParam; |
19 | import com.hjx.personalcenter.http.HttpCode; | 19 | import com.hjx.personalcenter.http.HttpCode; |
20 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.GetDevicesUtil; | 26 | import com.hjx.personalcenter.util.GetDevicesUtil; |
27 | import com.hjx.personalcenter.util.Judgment; | 27 | import com.hjx.personalcenter.util.Judgment; |
28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
29 | 29 | ||
30 | import org.json.JSONObject; | 30 | import org.json.JSONObject; |
31 | 31 | ||
32 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
33 | import java.util.TimerTask; | 33 | import java.util.TimerTask; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Created by h on 2017/8/9. | 36 | * Created by h on 2017/8/9. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | public class ChangeElectronicCardAdressInfoActivity extends AppCompatActivity implements View.OnClickListener | 39 | public class ChangeElectronicCardAdressInfoActivity extends FragmentActivity implements View.OnClickListener |
40 | ,DialogCallBack.ProvincesCallBack | 40 | ,DialogCallBack.ProvincesCallBack |
41 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 41 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
42 | private ImageView back_forgit; | 42 | private ImageView back_forgit; |
43 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; | 43 | private EditText forot_pwd_phone,forot_pwd_anthcode,newadress; |
44 | private TextView adress; | 44 | private TextView adress; |
45 | private Button forot_pwd_sub,forot_pwd_getanthcode; | 45 | private Button forot_pwd_sub,forot_pwd_getanthcode; |
46 | private String typeStr = "register"; | 46 | private String typeStr = "register"; |
47 | private int delayTime=60; | 47 | private int delayTime=60; |
48 | private java.util.Timer Delaytimer; | 48 | private java.util.Timer Delaytimer; |
49 | Handler handler = new Handler() { | 49 | Handler handler = new Handler() { |
50 | @Override | 50 | @Override |
51 | public void handleMessage(Message msg) { | 51 | public void handleMessage(Message msg) { |
52 | super.handleMessage(msg); | 52 | super.handleMessage(msg); |
53 | JSONObject jsonObject; | 53 | JSONObject jsonObject; |
54 | String status; | 54 | String status; |
55 | switch (msg.what) { | 55 | switch (msg.what) { |
56 | case HttpCode.AUTHCODE_SUCESS1: | 56 | case HttpCode.AUTHCODE_SUCESS1: |
57 | jsonObject = (JSONObject) msg.obj; | 57 | jsonObject = (JSONObject) msg.obj; |
58 | status = jsonObject.optString("status"); | 58 | status = jsonObject.optString("status"); |
59 | if (status.equals("100")) { | 59 | if (status.equals("100")) { |
60 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); | 60 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "验证码发送成功"); |
61 | } | 61 | } |
62 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 62 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
63 | break; | 63 | break; |
64 | case HttpCode.AUTHCODE_FAIL1: | 64 | case HttpCode.AUTHCODE_FAIL1: |
65 | jsonObject = (JSONObject) msg.obj; | 65 | jsonObject = (JSONObject) msg.obj; |
66 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 66 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
67 | break; | 67 | break; |
68 | case 21: | 68 | case 21: |
69 | if(delayTime<=0){ | 69 | if(delayTime<=0){ |
70 | if(Delaytimer!=null){ | 70 | if(Delaytimer!=null){ |
71 | Delaytimer.cancel(); | 71 | Delaytimer.cancel(); |
72 | } | 72 | } |
73 | forot_pwd_getanthcode.setEnabled(true); | 73 | forot_pwd_getanthcode.setEnabled(true); |
74 | forot_pwd_getanthcode.setClickable(true); | 74 | forot_pwd_getanthcode.setClickable(true); |
75 | forot_pwd_getanthcode.setText("获取验证码"); | 75 | forot_pwd_getanthcode.setText("获取验证码"); |
76 | delayTime=60; | 76 | delayTime=60; |
77 | }else{ | 77 | }else{ |
78 | forot_pwd_getanthcode.setEnabled(false); | 78 | forot_pwd_getanthcode.setEnabled(false); |
79 | forot_pwd_getanthcode.setClickable(false); | 79 | forot_pwd_getanthcode.setClickable(false); |
80 | forot_pwd_getanthcode.setText(delayTime + " s"); | 80 | forot_pwd_getanthcode.setText(delayTime + " s"); |
81 | } | 81 | } |
82 | break; | 82 | break; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | }; | 85 | }; |
86 | @Override | 86 | @Override |
87 | protected void onCreate(Bundle savedInstanceState) { | 87 | protected void onCreate(Bundle savedInstanceState) { |
88 | super.onCreate(savedInstanceState); | 88 | super.onCreate(savedInstanceState); |
89 | setContentView(R.layout.activity_change_card_validation); | 89 | setContentView(R.layout.activity_change_card_validation); |
90 | SysApplication.getInstance().addActivity(this); | 90 | SysApplication.getInstance().addActivity(this); |
91 | initView(); | 91 | initView(); |
92 | setLister(); | 92 | setLister(); |
93 | } | 93 | } |
94 | //获取验证码 | 94 | //获取验证码 |
95 | private void getauthcode() { | 95 | private void getauthcode() { |
96 | forot_pwd_anthcode.requestFocus(); | 96 | forot_pwd_anthcode.requestFocus(); |
97 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 97 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
98 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 98 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
99 | valiDelay(); | 99 | valiDelay(); |
100 | 100 | ||
101 | } | 101 | } |
102 | private void initView() { | 102 | private void initView() { |
103 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 103 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
104 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 104 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
105 | adress = (TextView) findViewById(R.id.et_newpassword); | 105 | adress = (TextView) findViewById(R.id.et_newpassword); |
106 | newadress = (EditText) findViewById(R.id.et_again_newpassword); | 106 | newadress = (EditText) findViewById(R.id.et_again_newpassword); |
107 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 107 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
108 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 108 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
109 | back_forgit= (ImageView) findViewById(R.id.cancel); | 109 | back_forgit= (ImageView) findViewById(R.id.cancel); |
110 | } | 110 | } |
111 | private void setLister() { | 111 | private void setLister() { |
112 | back_forgit.setOnClickListener(this); | 112 | back_forgit.setOnClickListener(this); |
113 | forot_pwd_sub.setOnClickListener(this); | 113 | forot_pwd_sub.setOnClickListener(this); |
114 | forot_pwd_getanthcode.setOnClickListener(this); | 114 | forot_pwd_getanthcode.setOnClickListener(this); |
115 | adress.setOnClickListener(this); | 115 | adress.setOnClickListener(this); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | public void onClick(View view) { | 120 | public void onClick(View view) { |
121 | switch (view.getId()){ | 121 | switch (view.getId()){ |
122 | case R.id.btn_ok: | 122 | case R.id.btn_ok: |
123 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 123 | String forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
124 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 124 | String forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
125 | String forot_pwd_pwd3 = adress.getText().toString().trim(); | 125 | String forot_pwd_pwd3 = adress.getText().toString().trim(); |
126 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); | 126 | String forot_pwd_pwd4 = newadress.getText().toString().trim(); |
127 | if (TextUtils.isEmpty(forot_pwd_phone1)|| | 127 | if (TextUtils.isEmpty(forot_pwd_phone1)|| |
128 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ | 128 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)){ |
129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); | 129 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请将必填项填写完整"); |
130 | return; | 130 | return; |
131 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ | 131 | }else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)){ |
132 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); | 132 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "手机号码输入有误"); |
133 | 133 | ||
134 | } else { | 134 | } else { |
135 | //修改地址接口 | 135 | //修改地址接口 |
136 | String userID = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 136 | String userID = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
137 | long auserID = 0; | 137 | HttpManager.getInstance().changecardadressinfo(this,userID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); |
138 | try { | 138 | |
139 | auserID = Long.parseLong(userID); | ||
140 | HttpManager.getInstance().changecardadressinfo(this,auserID,forot_pwd_phone1,forot_pwd_anthcode1,forot_pwd_pwd3+forot_pwd_pwd4); | ||
141 | } catch (NumberFormatException e) { | ||
142 | e.printStackTrace(); | ||
143 | } | ||
144 | 139 | ||
145 | } | 140 | } |
146 | break; | 141 | break; |
147 | case R.id.btn_authcode: | 142 | case R.id.btn_authcode: |
148 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 143 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
149 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ | 144 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)){ |
150 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); | 145 | AlertUtils.showToast(ChangeElectronicCardAdressInfoActivity.this, "请输入正确的手机号"); |
151 | }else { | 146 | }else { |
152 | forot_pwd_anthcode.requestFocus(); | 147 | forot_pwd_anthcode.requestFocus(); |
153 | getauthcode(); | 148 | getauthcode(); |
154 | 149 | ||
155 | } | 150 | } |
156 | 151 | ||
157 | break; | 152 | break; |
158 | case R.id.et_newpassword: | 153 | case R.id.et_newpassword: |
159 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 154 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) ChangeElectronicCardAdressInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
160 | break; | 155 | break; |
161 | 156 | ||
162 | case R.id.cancel: | 157 | case R.id.cancel: |
163 | finish(); | 158 | finish(); |
164 | break; | 159 | break; |
165 | } | 160 | } |
166 | } | 161 | } |
167 | 162 | ||
168 | @Override | 163 | @Override |
169 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 164 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
170 | String regionName = data.get(position).getRegionName(); | 165 | String regionName = data.get(position).getRegionName(); |
171 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 166 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
172 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 167 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
173 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 168 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
174 | adress.setText(""); | 169 | adress.setText(""); |
175 | adress.setText(provice+regionName); | 170 | adress.setText(provice+regionName); |
176 | 171 | ||
177 | 172 | ||
178 | } | 173 | } |
179 | 174 | ||
180 | @Override | 175 | @Override |
181 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 176 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
182 | String regionName = data.get(position).getRegionName(); | 177 | String regionName = data.get(position).getRegionName(); |
183 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 178 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
184 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 179 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
185 | adress.setText(""); | 180 | adress.setText(""); |
186 | adress.setText(provices+citys+regionName); | 181 | adress.setText(provices+citys+regionName); |
187 | } | 182 | } |
188 | 183 | ||
189 | @Override | 184 | @Override |
190 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 185 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
191 | String regionName = data.get(position).getRegionName(); | 186 | String regionName = data.get(position).getRegionName(); |
192 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 187 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
193 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 188 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
194 | adress.setText(""); | 189 | adress.setText(""); |
195 | adress.setText(regionName); | 190 | adress.setText(regionName); |
196 | } | 191 | } |
197 | 192 | ||
198 | // 线程类 定时器 | 193 | // 线程类 定时器 |
199 | public void valiDelay() { | 194 | public void valiDelay() { |
200 | 195 | ||
201 | Delaytimer = new java.util.Timer(true); | 196 | Delaytimer = new java.util.Timer(true); |
202 | 197 | ||
203 | 198 | ||
204 | TimerTask task = new TimerTask() { | 199 | TimerTask task = new TimerTask() { |
205 | public void run() { | 200 | public void run() { |
206 | //每次需要执行的代码放到这里面。 | 201 | //每次需要执行的代码放到这里面。 |
207 | delayTime--; | 202 | delayTime--; |
208 | handler.sendEmptyMessage(21); | 203 | handler.sendEmptyMessage(21); |
209 | 204 | ||
210 | 205 | ||
211 | 206 | ||
212 | } | 207 | } |
213 | }; | 208 | }; |
214 | Delaytimer.schedule(task, 1000,1000); | 209 | Delaytimer.schedule(task, 1000,1000); |
215 | } | 210 | } |
216 | 211 | ||
217 | } | 212 | } |
218 | 213 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeEletronicCardPhoneActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v7.app.AppCompatActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | 5 | ||
6 | import com.hjx.personalcenter.R; | 6 | import com.hjx.personalcenter.R; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Created by h on 2017/8/9. | 9 | * Created by h on 2017/8/9. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | public class ChangeEletronicCardPhoneActivity extends AppCompatActivity { | 12 | public class ChangeEletronicCardPhoneActivity extends FragmentActivity { |
13 | 13 | ||
14 | 14 | ||
15 | @Override | 15 | @Override |
16 | protected void onCreate(Bundle savedInstanceState) { | 16 | protected void onCreate(Bundle savedInstanceState) { |
17 | super.onCreate(savedInstanceState); | 17 | super.onCreate(savedInstanceState); |
18 | setContentView(R.layout.activity_electronicard_phone); | 18 | setContentView(R.layout.activity_electronicard_phone); |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePasswordActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v7.app.AppCompatActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
6 | import android.text.method.HideReturnsTransformationMethod; | 6 | import android.text.method.HideReturnsTransformationMethod; |
7 | import android.text.method.PasswordTransformationMethod; | 7 | import android.text.method.PasswordTransformationMethod; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.Button; | 9 | import android.widget.Button; |
10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.db.SaveParam; | 14 | import com.hjx.personalcenter.db.SaveParam; |
15 | import com.hjx.personalcenter.http.HttpManager; | 15 | import com.hjx.personalcenter.http.HttpManager; |
16 | import com.hjx.personalcenter.util.AlertUtils; | 16 | import com.hjx.personalcenter.util.AlertUtils; |
17 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 17 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
18 | 18 | ||
19 | /**修改密码 | 19 | /**修改密码 |
20 | * Created by h on 2017/6/27. | 20 | * Created by h on 2017/6/27. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | public class ChangePasswordActivity extends AppCompatActivity implements View.OnClickListener { | 23 | public class ChangePasswordActivity extends FragmentActivity implements View.OnClickListener { |
24 | private EditText old_pwd,newpassword,newpassword1; | 24 | private EditText old_pwd,newpassword,newpassword1; |
25 | private Button sub_change_pwd; | 25 | private Button sub_change_pwd; |
26 | private ImageView back_change_pwd,eyes_iv_change1; | 26 | private ImageView back_change_pwd,eyes_iv_change1; |
27 | public static Boolean showPassword = false; | 27 | public static Boolean showPassword = false; |
28 | @Override | 28 | @Override |
29 | protected void onCreate(Bundle savedInstanceState) { | 29 | protected void onCreate(Bundle savedInstanceState) { |
30 | super.onCreate(savedInstanceState); | 30 | super.onCreate(savedInstanceState); |
31 | setContentView(R.layout.activity_changepsword); | 31 | setContentView(R.layout.activity_changepsword); |
32 | initView(); | 32 | initView(); |
33 | setLister(); | 33 | setLister(); |
34 | } | 34 | } |
35 | 35 | ||
36 | private void initView() { | 36 | private void initView() { |
37 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); | 37 | old_pwd = (EditText) findViewById(R.id.et_oldpassword); |
38 | newpassword = (EditText) findViewById(R.id.et_newpassword); | 38 | newpassword = (EditText) findViewById(R.id.et_newpassword); |
39 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); | 39 | newpassword1 = (EditText) findViewById(R.id.et_again_newpassword); |
40 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); | 40 | sub_change_pwd = (Button) findViewById(R.id.btn_ok); |
41 | back_change_pwd = (ImageView) findViewById(R.id.cancel); | 41 | back_change_pwd = (ImageView) findViewById(R.id.cancel); |
42 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); | 42 | eyes_iv_change1 = (ImageView) findViewById(R.id.iv_pwd_change); |
43 | 43 | ||
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | private void setLister() { | 47 | private void setLister() { |
48 | sub_change_pwd.setOnClickListener(this); | 48 | sub_change_pwd.setOnClickListener(this); |
49 | back_change_pwd.setOnClickListener(this); | 49 | back_change_pwd.setOnClickListener(this); |
50 | eyes_iv_change1.setOnClickListener(this); | 50 | eyes_iv_change1.setOnClickListener(this); |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public void onClick(View v) { | 54 | public void onClick(View v) { |
55 | String old_pwd1 = old_pwd.getText().toString().trim(); | 55 | String old_pwd1 = old_pwd.getText().toString().trim(); |
56 | String newpassword3 = newpassword.getText().toString().trim(); | 56 | String newpassword3 = newpassword.getText().toString().trim(); |
57 | String newpassword4 = newpassword1.getText().toString().trim(); | 57 | String newpassword4 = newpassword1.getText().toString().trim(); |
58 | switch (v.getId()){ | 58 | switch (v.getId()){ |
59 | //确认修改 | 59 | //确认修改 |
60 | case R.id.btn_ok: | 60 | case R.id.btn_ok: |
61 | 61 | ||
62 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); | 62 | //Log.e("test","sp保存的密码是"+sp.getLoginParam(ChangePwd.this, "password")); |
63 | if (TextUtils.isEmpty(old_pwd1)|| | 63 | if (TextUtils.isEmpty(old_pwd1)|| |
64 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ | 64 | TextUtils.isEmpty(newpassword3) || TextUtils.isEmpty(newpassword4)){ |
65 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); | 65 | AlertUtils.showToast(ChangePasswordActivity.this, "请将必填项填写完整"); |
66 | return; | 66 | return; |
67 | }else if(newpassword3.length()<8||newpassword4.length()<8){ | 67 | }else if(newpassword3.length()<8||newpassword4.length()<8){ |
68 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); | 68 | AlertUtils.showToast(ChangePasswordActivity.this,"密码不能少于8位"); |
69 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ | 69 | }else if(!newpassword3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)||!newpassword4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)){ |
70 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); | 70 | AlertUtils.showToast(ChangePasswordActivity.this, "密码必须由数字和字母组成"); |
71 | } | 71 | } |
72 | //得到原密码并且判断是否输入的一样 | 72 | //得到原密码并且判断是否输入的一样 |
73 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ | 73 | else if(!SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"password").equals(old_pwd1)){ |
74 | 74 | ||
75 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); | 75 | AlertUtils.showToast(ChangePasswordActivity.this, "原密码输入错误"); |
76 | 76 | ||
77 | }else if (!newpassword3.equals(newpassword4)){ | 77 | }else if (!newpassword3.equals(newpassword4)){ |
78 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); | 78 | AlertUtils.showToast(ChangePasswordActivity.this, "两次密码输入不一致"); |
79 | return; | 79 | return; |
80 | }else{ | 80 | }else{ |
81 | //修改密码接口 | 81 | //修改密码接口 |
82 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); | 82 | String name = SaveParam.getInstance().getLoginParam(ChangePasswordActivity.this,"username"); |
83 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); | 83 | HttpManager.getInstance().changepwd(this,name,old_pwd1,newpassword3); |
84 | } | 84 | } |
85 | 85 | ||
86 | break; | 86 | break; |
87 | case R.id.iv_pwd_change: | 87 | case R.id.iv_pwd_change: |
88 | if(showPassword){//显示密码 | 88 | if(showPassword){//显示密码 |
89 | showPassword = !showPassword; | 89 | showPassword = !showPassword; |
90 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); | 90 | eyes_iv_change1.setImageResource(R.mipmap.pwd_open); |
91 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 91 | newpassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
92 | newpassword.setSelection(newpassword.getText().toString().length()); | 92 | newpassword.setSelection(newpassword.getText().toString().length()); |
93 | }else{//隐藏密码 | 93 | }else{//隐藏密码 |
94 | showPassword = !showPassword; | 94 | showPassword = !showPassword; |
95 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); | 95 | eyes_iv_change1.setImageResource(R.mipmap.pwd_hide); |
96 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 96 | newpassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
97 | newpassword.setSelection(newpassword.getText().toString().length()); | 97 | newpassword.setSelection(newpassword.getText().toString().length()); |
98 | } | 98 | } |
99 | break; | 99 | break; |
100 | 100 | ||
101 | case R.id.cancel: | 101 | case R.id.cancel: |
102 | finish(); | 102 | finish(); |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v4.app.Fragment; | 4 | import android.support.v4.app.Fragment; |
5 | import android.support.v4.app.FragmentActivity; | ||
5 | import android.support.v4.view.ViewPager; | 6 | import android.support.v4.view.ViewPager; |
6 | import android.support.v7.app.AppCompatActivity; | ||
7 | 7 | ||
8 | import com.hjx.personalcenter.R; | 8 | import com.hjx.personalcenter.R; |
9 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 9 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
10 | import com.hjx.personalcenter.fragment.PresonInfoFragment; | 10 | import com.hjx.personalcenter.fragment.PresonInfoFragment; |
11 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; | 11 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; |
12 | 12 | ||
13 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
15 | import java.util.List; | 15 | import java.util.List; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Created by h on 2017/8/12. | 18 | * Created by h on 2017/8/12. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | public class ChangePresonalInfoActivity extends AppCompatActivity { | 21 | public class ChangePresonalInfoActivity extends FragmentActivity { |
22 | private ViewPager viewPager; | 22 | private ViewPager viewPager; |
23 | // private SlidingTabLayout tableLayout; | 23 | // private SlidingTabLayout tableLayout; |
24 | private List<Fragment> presoninfo; | 24 | private List<Fragment> presoninfo; |
25 | private LoginAndRegisterAdapter presoninfodapter; | 25 | private LoginAndRegisterAdapter presoninfodapter; |
26 | public interface Fragment2Fragment{ | 26 | public interface Fragment2Fragment{ |
27 | public void gotoFragment(ViewPager viewPager); | 27 | public void gotoFragment(ViewPager viewPager); |
28 | } | 28 | } |
29 | private Fragment2Fragment fragment2Fragment; | 29 | private Fragment2Fragment fragment2Fragment; |
30 | public void setFragment2Fragment(Fragment2Fragment fragment2Fragment){ | 30 | public void setFragment2Fragment(Fragment2Fragment fragment2Fragment){ |
31 | this.fragment2Fragment = fragment2Fragment; | 31 | this.fragment2Fragment = fragment2Fragment; |
32 | } | 32 | } |
33 | public void forSkip(){ | 33 | public void forSkip(){ |
34 | if(fragment2Fragment!=null){ | 34 | if(fragment2Fragment!=null){ |
35 | fragment2Fragment.gotoFragment(viewPager); | 35 | fragment2Fragment.gotoFragment(viewPager); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | private List<String> title = Arrays.asList("个人信息", "版本信息"); | 38 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
39 | @Override | 39 | @Override |
40 | protected void onCreate(Bundle savedInstanceState) { | 40 | protected void onCreate(Bundle savedInstanceState) { |
41 | super.onCreate(savedInstanceState); | 41 | super.onCreate(savedInstanceState); |
42 | setContentView(R.layout.activity_change_preson_info); | 42 | setContentView(R.layout.activity_change_preson_info); |
43 | initView(); | 43 | initView(); |
44 | initData(); | 44 | initData(); |
45 | 45 | ||
46 | } | 46 | } |
47 | private void initView() { | 47 | private void initView() { |
48 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 48 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
49 | //tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 49 | //tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
50 | } | 50 | } |
51 | 51 | ||
52 | private void initData() { | 52 | private void initData() { |
53 | presoninfo = new ArrayList<>(); | 53 | presoninfo = new ArrayList<>(); |
54 | for (int i = 0; i < title.size(); i++) { | 54 | for (int i = 0; i < title.size(); i++) { |
55 | if (title.get(i).equals("个人信息")) { | 55 | if (title.get(i).equals("个人信息")) { |
56 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); | 56 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); |
57 | } else { | 57 | } else { |
58 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); | 58 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | //设置Tab上的标题 | 63 | //设置Tab上的标题 |
64 | //tableLayout.setData(title); | 64 | //tableLayout.setData(title); |
65 | //设置关联的ViewPager | 65 | //设置关联的ViewPager |
66 | //tableLayout.setViewPager(viewPager, 0); | 66 | //tableLayout.setViewPager(viewPager, 0); |
67 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); | 67 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); |
68 | //给ViewPager设置适配器 | 68 | //给ViewPager设置适配器 |
69 | viewPager.setAdapter(presoninfodapter); | 69 | viewPager.setAdapter(presoninfodapter); |
70 | //设置滑动时数据不丢失 | 70 | //设置滑动时数据不丢失 |
71 | viewPager.setOffscreenPageLimit(1); | 71 | viewPager.setOffscreenPageLimit(1); |
72 | //将TabLayout和ViewPager关联起来。 | 72 | //将TabLayout和ViewPager关联起来。 |
73 | } | 73 | } |
74 | 74 | ||
75 | } | 75 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v4.app.FragmentActivity; | ||
7 | import android.support.v7.app.AppCompatActivity; | 8 | import android.support.v7.app.AppCompatActivity; |
8 | import android.util.Log; | 9 | import android.util.Log; |
9 | import android.view.View; | 10 | import android.view.View; |
10 | import android.widget.AdapterView; | 11 | import android.widget.AdapterView; |
11 | import android.widget.Button; | 12 | import android.widget.Button; |
12 | import android.widget.GridView; | 13 | import android.widget.GridView; |
13 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
14 | import android.widget.TextView; | 15 | import android.widget.TextView; |
15 | import android.widget.Toast; | 16 | import android.widget.Toast; |
16 | 17 | ||
17 | import com.facebook.drawee.view.SimpleDraweeView; | 18 | import com.facebook.drawee.view.SimpleDraweeView; |
18 | import com.hjx.personalcenter.R; | 19 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.adapter.GridAdapter; | 20 | import com.hjx.personalcenter.adapter.GridAdapter; |
20 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 21 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
21 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 22 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
22 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.http.HttpCode; | 24 | import com.hjx.personalcenter.http.HttpCode; |
24 | import com.hjx.personalcenter.http.HttpManager; | 25 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 26 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.DefautPublishInfo; | 27 | import com.hjx.personalcenter.model.DefautPublishInfo; |
27 | import com.hjx.personalcenter.model.VersionInfo; | 28 | import com.hjx.personalcenter.model.VersionInfo; |
28 | import com.hjx.personalcenter.util.AlertUtils; | 29 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 30 | import com.hjx.personalcenter.util.GetDevicesUtil; |
30 | 31 | ||
31 | import org.json.JSONException; | 32 | import org.json.JSONException; |
32 | import org.json.JSONObject; | 33 | import org.json.JSONObject; |
33 | 34 | ||
34 | import java.util.ArrayList; | 35 | import java.util.ArrayList; |
35 | import java.util.List; | 36 | import java.util.List; |
36 | 37 | ||
37 | /** | 38 | /** |
38 | * 选择教材 | 39 | * 选择教材 |
39 | * Created by h on 2017/8/10. | 40 | * Created by h on 2017/8/10. |
40 | */ | 41 | */ |
41 | 42 | ||
42 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 43 | public class ChoiseTextBookActivity extends FragmentActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { |
43 | private GridView gridView; | 44 | private GridView gridView; |
44 | private Button btn_ok; | 45 | private Button btn_ok; |
45 | private ImageView cancel; | 46 | private ImageView cancel; |
46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 47 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
47 | private GridAdapter sim_adapter; | 48 | private GridAdapter sim_adapter; |
48 | private SimpleDraweeView simpleDraweeView; | 49 | private SimpleDraweeView simpleDraweeView; |
49 | private TextView publish; | 50 | private TextView publish; |
50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; | 51 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; |
51 | 52 | ||
52 | 53 | ||
53 | Handler handler = new Handler() { | 54 | Handler handler = new Handler() { |
54 | @Override | 55 | @Override |
55 | public void handleMessage(Message msg) { | 56 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 57 | super.handleMessage(msg); |
57 | JSONObject jsonObject; | 58 | JSONObject jsonObject; |
58 | String status; | 59 | String status; |
59 | switch (msg.what) { | 60 | switch (msg.what) { |
60 | case HttpCode.CHECKCARD: | 61 | case HttpCode.CHECKCARD: |
61 | try { | 62 | try { |
62 | jsonObject = new JSONObject((String) msg.obj); | 63 | jsonObject = new JSONObject((String) msg.obj); |
63 | status = jsonObject.optString("status"); | 64 | status = jsonObject.optString("status"); |
64 | if (status.equals("1")) { | 65 | if (status.equals("1")) { |
65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 66 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
66 | Intent intent = new Intent(); | 67 | Intent intent = new Intent(); |
67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 68 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
68 | ChoiseTextBookActivity.this.startActivity(intent); | 69 | ChoiseTextBookActivity.this.startActivity(intent); |
69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 70 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
70 | } else if (status.equals("2001")) { | 71 | } else if (status.equals("2001")) { |
71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 72 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
72 | } else if (status.equals("2002")) { | 73 | } else if (status.equals("2002")) { |
73 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); | 74 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您的机器为样机,可直接使用!"); |
74 | Intent intent = new Intent(); | 75 | Intent intent = new Intent(); |
75 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 76 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
76 | ChoiseTextBookActivity.this.startActivity(intent); | 77 | ChoiseTextBookActivity.this.startActivity(intent); |
77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 78 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
78 | } | 79 | } |
79 | 80 | ||
80 | } catch (JSONException e) { | 81 | } catch (JSONException e) { |
81 | e.printStackTrace(); | 82 | e.printStackTrace(); |
82 | } | 83 | } |
83 | 84 | ||
84 | break; | 85 | break; |
85 | case HttpCode.PUBLISH_SUCESS: | 86 | case HttpCode.PUBLISH_SUCESS: |
86 | defautPublishInfos.clear(); | 87 | defautPublishInfos.clear(); |
87 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 88 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
88 | sim_adapter.notifyDataSetChanged(); | 89 | sim_adapter.notifyDataSetChanged(); |
89 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 90 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
90 | String subject = defautPublishInfos.get(i).getSubject(); | 91 | String subject = defautPublishInfos.get(i).getSubject(); |
91 | if (subject.equals("语文")) { | 92 | if (subject.equals("语文")) { |
92 | chinese = defautPublishInfos.get(i).getPress(); | 93 | chinese = defautPublishInfos.get(i).getPress(); |
93 | } else if (subject.equals("数学")) { | 94 | } else if (subject.equals("数学")) { |
94 | math = defautPublishInfos.get(i).getPress(); | 95 | math = defautPublishInfos.get(i).getPress(); |
95 | } else if (subject.equals("英语")) { | 96 | } else if (subject.equals("英语")) { |
96 | english = defautPublishInfos.get(i).getPress(); | 97 | english = defautPublishInfos.get(i).getPress(); |
97 | } else if (subject.equals("物理")) { | 98 | } else if (subject.equals("物理")) { |
98 | physics = defautPublishInfos.get(i).getPress(); | 99 | physics = defautPublishInfos.get(i).getPress(); |
99 | } else if (subject.equals("化学")) { | 100 | } else if (subject.equals("化学")) { |
100 | chemistry = defautPublishInfos.get(i).getPress(); | 101 | chemistry = defautPublishInfos.get(i).getPress(); |
101 | } else if (subject.equals("历史")) { | 102 | } else if (subject.equals("历史")) { |
102 | history = defautPublishInfos.get(i).getPress(); | 103 | history = defautPublishInfos.get(i).getPress(); |
103 | } else if (subject.equals("地理")) { | 104 | } else if (subject.equals("地理")) { |
104 | geography = defautPublishInfos.get(i).getPress(); | 105 | geography = defautPublishInfos.get(i).getPress(); |
105 | } else if (subject.equals("政治")) { | 106 | } else if (subject.equals("政治")) { |
106 | political = defautPublishInfos.get(i).getPress(); | 107 | political = defautPublishInfos.get(i).getPress(); |
107 | } else if (subject.equals("生物")) { | 108 | } else if (subject.equals("生物")) { |
108 | biology = defautPublishInfos.get(i).getPress(); | 109 | biology = defautPublishInfos.get(i).getPress(); |
109 | } else if (subject.equals("科学")) { | 110 | } else if (subject.equals("科学")) { |
110 | science = defautPublishInfos.get(i).getPress(); | 111 | science = defautPublishInfos.get(i).getPress(); |
111 | } | 112 | } |
112 | } | 113 | } |
113 | break; | 114 | break; |
114 | case HttpCode.REGISTERINFO_SUCESS: | 115 | case HttpCode.REGISTERINFO_SUCESS: |
115 | try { | 116 | try { |
116 | jsonObject = new JSONObject((String) msg.obj); | 117 | jsonObject = new JSONObject((String) msg.obj); |
117 | String statusregister = jsonObject.optString("status"); | 118 | String statusregister = jsonObject.optString("status"); |
118 | if (statusregister.equals("1")) { | 119 | if (statusregister.equals("1")) { |
119 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | 120 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); |
120 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); | 121 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); |
121 | if (deviceNumber == null) { | 122 | if (deviceNumber == null) { |
122 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 123 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
123 | 124 | ||
124 | } else { | 125 | } else { |
125 | //验证保卡信息 | 126 | //验证保卡信息 |
126 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); | 127 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); |
127 | } | 128 | } |
128 | 129 | ||
129 | } else { | 130 | } else { |
130 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | 131 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); |
131 | } | 132 | } |
132 | } catch (JSONException e) { | 133 | } catch (JSONException e) { |
133 | e.printStackTrace(); | 134 | e.printStackTrace(); |
134 | } | 135 | } |
135 | 136 | ||
136 | 137 | ||
137 | break; | 138 | break; |
138 | 139 | ||
139 | } | 140 | } |
140 | 141 | ||
141 | } | 142 | } |
142 | }; | 143 | }; |
143 | 144 | ||
144 | @Override | 145 | @Override |
145 | protected void onCreate(Bundle savedInstanceState) { | 146 | protected void onCreate(Bundle savedInstanceState) { |
146 | super.onCreate(savedInstanceState); | 147 | super.onCreate(savedInstanceState); |
147 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 148 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
148 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); | 149 | String graderid = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); |
149 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); | 150 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); |
150 | try { | 151 | try { |
151 | long auserID = Long.parseLong(userID); | 152 | long auserID = Long.parseLong(userID); |
152 | int graderID = Integer.parseInt(graderid); | 153 | int graderID = Integer.parseInt(graderid); |
153 | int accountss = Integer.parseInt(accounts); | 154 | int accountss = Integer.parseInt(accounts); |
154 | //获取版本信息 | 155 | //获取版本信息 |
155 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); | 156 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); |
156 | 157 | ||
157 | } catch (NumberFormatException e) { | 158 | } catch (NumberFormatException e) { |
158 | e.printStackTrace(); | 159 | e.printStackTrace(); |
159 | } | 160 | } |
160 | setContentView(R.layout.activity_choisetextbook); | 161 | setContentView(R.layout.activity_choisetextbook); |
161 | SysApplication.getInstance().addActivity(this); | 162 | SysApplication.getInstance().addActivity(this); |
162 | initView(); | 163 | initView(); |
163 | initData(); | 164 | initData(); |
164 | initLister(); | 165 | initLister(); |
165 | } | 166 | } |
166 | 167 | ||
167 | private void initView() { | 168 | private void initView() { |
168 | gridView = (GridView) findViewById(R.id.grideview); | 169 | gridView = (GridView) findViewById(R.id.grideview); |
169 | cancel = (ImageView) findViewById(R.id.cancel); | 170 | cancel = (ImageView) findViewById(R.id.cancel); |
170 | btn_ok = (Button) findViewById(R.id.btn_ok); | 171 | btn_ok = (Button) findViewById(R.id.btn_ok); |
171 | } | 172 | } |
172 | 173 | ||
173 | private void initData() { | 174 | private void initData() { |
174 | sim_adapter = new GridAdapter(defautPublishInfos, this); | 175 | sim_adapter = new GridAdapter(defautPublishInfos, this); |
175 | //配置适配器 | 176 | //配置适配器 |
176 | gridView.setAdapter(sim_adapter); | 177 | gridView.setAdapter(sim_adapter); |
177 | 178 | ||
178 | } | 179 | } |
179 | 180 | ||
180 | private void initLister() { | 181 | private void initLister() { |
181 | btn_ok.setOnClickListener(this); | 182 | btn_ok.setOnClickListener(this); |
182 | cancel.setOnClickListener(this); | 183 | cancel.setOnClickListener(this); |
183 | gridView.setOnItemClickListener(this); | 184 | gridView.setOnItemClickListener(this); |
184 | 185 | ||
185 | } | 186 | } |
186 | 187 | ||
187 | @Override | 188 | @Override |
188 | public void onClick(View v) { | 189 | public void onClick(View v) { |
189 | switch (v.getId()) { | 190 | switch (v.getId()) { |
190 | case R.id.btn_ok: | 191 | case R.id.btn_ok: |
191 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 192 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
192 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | 193 | String regionId = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); |
193 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | 194 | String regionId1 = SaveParam.getInstance().getsaveCityParam(ChoiseTextBookActivity.this, SaveParam.CITYS); |
194 | if (regionId == null) { | 195 | if (regionId == null) { |
195 | regionId = regionId1; | 196 | regionId = regionId1; |
196 | } | 197 | } |
197 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); | 198 | String grade = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CHILDSGRADENS); |
198 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | 199 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); |
199 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | 200 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); |
200 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | 201 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); |
201 | 202 | ||
202 | try { | 203 | try { |
203 | if (userID == null) { | 204 | if (userID == null) { |
204 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 205 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
205 | 206 | ||
206 | } else { | 207 | } else { |
207 | Object schoolID; | 208 | Object schoolID; |
208 | long auserID = Long.parseLong(userID); | 209 | long auserID = Long.parseLong(userID); |
209 | int gradeID = Integer.parseInt(grade); | 210 | int gradeID = Integer.parseInt(grade); |
210 | long regionID = Long.parseLong(regionId); | 211 | long regionID = Long.parseLong(regionId); |
211 | if (schoolid == null) { | 212 | if (schoolid == null) { |
212 | schoolID = null; | 213 | schoolID = null; |
213 | } else { | 214 | } else { |
214 | schoolID = Long.parseLong(schoolid); | 215 | schoolID = Long.parseLong(schoolid); |
215 | } | 216 | } |
216 | 217 | ||
217 | //提交注册信息 | 218 | //提交注册信息 |
218 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, | 219 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
219 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); | 220 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); |
220 | } | 221 | } |
221 | 222 | ||
222 | } catch (NumberFormatException e) { | 223 | } catch (NumberFormatException e) { |
223 | e.printStackTrace(); | 224 | e.printStackTrace(); |
224 | } | 225 | } |
225 | 226 | ||
226 | break; | 227 | break; |
227 | case R.id.cancel: | 228 | case R.id.cancel: |
228 | finish(); | 229 | finish(); |
229 | break; | 230 | break; |
230 | } | 231 | } |
231 | 232 | ||
232 | } | 233 | } |
233 | 234 | ||
234 | @Override | 235 | @Override |
235 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 236 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
236 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 237 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
237 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 238 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); |
238 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 239 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
239 | publish = (TextView) view.findViewById(R.id.tv_publish); | 240 | publish = (TextView) view.findViewById(R.id.tv_publish); |
240 | 241 | ||
241 | } | 242 | } |
242 | 243 | ||
243 | @Override | 244 | @Override |
244 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 245 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
245 | String imageurl = data.get(position).getPressCover(); | 246 | String imageurl = data.get(position).getPressCover(); |
246 | String publishs = data.get(position).getPressName(); | 247 | String publishs = data.get(position).getPressName(); |
247 | simpleDraweeView.setImageURI(imageurl); | 248 | simpleDraweeView.setImageURI(imageurl); |
248 | publish.setText(publishs); | 249 | publish.setText(publishs); |
249 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); | 250 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); |
250 | Log.e("test", "选择的科目" + subject); | 251 | Log.e("test", "选择的科目" + subject); |
251 | if ("语文".equals(subject)) { | 252 | if ("语文".equals(subject)) { |
252 | chinese = publishs; | 253 | chinese = publishs; |
253 | } else if ("数学".equals(subject)) { | 254 | } else if ("数学".equals(subject)) { |
254 | math = publishs; | 255 | math = publishs; |
255 | } else if ("英语".equals(subject)) { | 256 | } else if ("英语".equals(subject)) { |
256 | english = publishs; | 257 | english = publishs; |
257 | } else if ("物理".equals(subject)) { | 258 | } else if ("物理".equals(subject)) { |
258 | physics = publishs; | 259 | physics = publishs; |
259 | } else if ("化学".equals(subject)) { | 260 | } else if ("化学".equals(subject)) { |
260 | chemistry = publishs; | 261 | chemistry = publishs; |
261 | } else if ("历史".equals(subject)) { | 262 | } else if ("历史".equals(subject)) { |
262 | history = publishs; | 263 | history = publishs; |
263 | } else if ("地理".equals(subject)) { | 264 | } else if ("地理".equals(subject)) { |
264 | geography = publishs; | 265 | geography = publishs; |
265 | } else if ("政治".equals(subject)) { | 266 | } else if ("政治".equals(subject)) { |
266 | political = publishs; | 267 | political = publishs; |
267 | } else if ("生物".equals(subject)) { | 268 | } else if ("生物".equals(subject)) { |
268 | biology = publishs; | 269 | biology = publishs; |
269 | } else if ("科学".equals(subject)) { | 270 | } else if ("科学".equals(subject)) { |
270 | science = publishs; | 271 | science = publishs; |
271 | } | 272 | } |
272 | 273 | ||
273 | } | 274 | } |
274 | } | 275 | } |
275 | 276 |
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.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v4.app.FragmentActivity; |
6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.Button; | 8 | import android.widget.Button; |
9 | import android.widget.EditText; | 9 | import android.widget.EditText; |
10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
11 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import com.bigkoo.pickerview.TimePickerView; | 14 | import com.bigkoo.pickerview.TimePickerView; |
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 16 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
17 | import com.hjx.personalcenter.customdialog.CountryDialog; | 17 | import com.hjx.personalcenter.customdialog.CountryDialog; |
18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 18 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
22 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
25 | import com.hjx.personalcenter.util.AlertUtils; | 25 | import com.hjx.personalcenter.util.AlertUtils; |
26 | import com.hjx.personalcenter.util.GetDate; | 26 | import com.hjx.personalcenter.util.GetDate; |
27 | 27 | ||
28 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
29 | 29 | ||
30 | /**填写保卡信息 熊巍 | 30 | /**填写保卡信息 熊巍 |
31 | * Created by h on 2017/8/11. | 31 | * Created by h on 2017/8/11. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | public class ElectronicCardEditInfoActivity extends AppCompatActivity implements View.OnClickListener | 34 | public class ElectronicCardEditInfoActivity extends FragmentActivity implements View.OnClickListener |
35 | ,DialogCallBack.ProvincesCallBack | 35 | ,DialogCallBack.ProvincesCallBack |
36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ | 36 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack{ |
37 | private LinearLayout lineL_buy_time; | 37 | private LinearLayout lineL_buy_time; |
38 | private TextView tv_buy_time,adress_shop,adress_custem; | 38 | private TextView tv_buy_time,adress_shop,adress_custem; |
39 | private EditText username,store,detalAdress,telphone; | 39 | private EditText username,store,detalAdress,telphone; |
40 | private TimePickerView pvTime; | 40 | private TimePickerView pvTime; |
41 | private Button btn_change_info; | 41 | private Button btn_change_info; |
42 | private ImageView iv_card_back,shop_adress,custom_adress; | 42 | private ImageView iv_card_back,shop_adress,custom_adress; |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected void onCreate(Bundle savedInstanceState) { | 45 | protected void onCreate(Bundle savedInstanceState) { |
46 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_electroniccard_info); | 47 | setContentView(R.layout.activity_electroniccard_info); |
48 | SysApplication.getInstance().addActivity(this); | 48 | SysApplication.getInstance().addActivity(this); |
49 | initView(); | 49 | initView(); |
50 | initData(); | 50 | initData(); |
51 | initLister(); | 51 | initLister(); |
52 | } | 52 | } |
53 | 53 | ||
54 | private void initView() { | 54 | private void initView() { |
55 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); | 55 | lineL_buy_time = (LinearLayout) findViewById(R.id.lineL_buy_time); |
56 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); | 56 | tv_buy_time = (TextView) findViewById(R.id.tv_buy_time); |
57 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); | 57 | adress_shop = (TextView) findViewById(R.id.tv_edit_adress_shop); |
58 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); | 58 | adress_custem = (TextView) findViewById(R.id.tv_edit_adress_custem); |
59 | username = (EditText) findViewById(R.id.et_edit_username); | 59 | username = (EditText) findViewById(R.id.et_edit_username); |
60 | store = (EditText) findViewById(R.id.et_edit_store); | 60 | store = (EditText) findViewById(R.id.et_edit_store); |
61 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); | 61 | detalAdress = (EditText) findViewById(R.id.et_edit_adress_detail); |
62 | telphone = (EditText) findViewById(R.id.et_edit_telphone); | 62 | telphone = (EditText) findViewById(R.id.et_edit_telphone); |
63 | btn_change_info = (Button) findViewById(R.id.btn_change_info); | 63 | btn_change_info = (Button) findViewById(R.id.btn_change_info); |
64 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); | 64 | iv_card_back = (ImageView) findViewById(R.id.iv_card_back); |
65 | shop_adress = (ImageView) findViewById(R.id.shopdizhi); | 65 | shop_adress = (ImageView) findViewById(R.id.shopdizhi); |
66 | custom_adress = (ImageView) findViewById(R.id.cunstomdizhi); | 66 | custom_adress = (ImageView) findViewById(R.id.cunstomdizhi); |
67 | } | 67 | } |
68 | 68 | ||
69 | private void initData() { | 69 | private void initData() { |
70 | GetDate date = new GetDate(); | 70 | GetDate date = new GetDate(); |
71 | tv_buy_time.setText(date.getYMD().toString()); | 71 | tv_buy_time.setText(date.getYMD().toString()); |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | private void initLister() { | 75 | private void initLister() { |
76 | adress_shop.setOnClickListener(this); | 76 | adress_shop.setOnClickListener(this); |
77 | adress_custem.setOnClickListener(this); | 77 | adress_custem.setOnClickListener(this); |
78 | btn_change_info.setOnClickListener(this); | 78 | btn_change_info.setOnClickListener(this); |
79 | iv_card_back.setOnClickListener(this); | 79 | iv_card_back.setOnClickListener(this); |
80 | shop_adress.setOnClickListener(this); | 80 | shop_adress.setOnClickListener(this); |
81 | custom_adress.setOnClickListener(this); | 81 | custom_adress.setOnClickListener(this); |
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override |
86 | public void onClick(View v) { | 86 | public void onClick(View v) { |
87 | switch (v.getId()){ | 87 | switch (v.getId()){ |
88 | case R.id.btn_change_info: | 88 | case R.id.btn_change_info: |
89 | String info1 =username.getText().toString().trim(); | 89 | String info1 =username.getText().toString().trim(); |
90 | String info2 =adress_custem.getText().toString().trim(); | 90 | String info2 =adress_custem.getText().toString().trim(); |
91 | String info3 =detalAdress.getText().toString().trim(); | 91 | String info3 =detalAdress.getText().toString().trim(); |
92 | String info4 =tv_buy_time.getText().toString().trim(); | 92 | String info4 =tv_buy_time.getText().toString().trim(); |
93 | String info5 =adress_shop.getText().toString().trim(); | 93 | String info5 =adress_shop.getText().toString().trim(); |
94 | String info6 =store.getText().toString().trim(); | 94 | String info6 =store.getText().toString().trim(); |
95 | String info7 =telphone.getText().toString().trim(); | 95 | String info7 =telphone.getText().toString().trim(); |
96 | 96 | ||
97 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) | 97 | if (TextUtils.isEmpty(info1) || TextUtils.isEmpty(info2)||TextUtils.isEmpty(info3) |
98 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) | 98 | ||TextUtils.isEmpty(info4)||TextUtils.isEmpty(info5)||TextUtils.isEmpty(info6) |
99 | ||TextUtils.isEmpty(info7)) { | 99 | ||TextUtils.isEmpty(info7)) { |
100 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); | 100 | AlertUtils.showToast(ElectronicCardEditInfoActivity.this, "所有内容不能为空。"); |
101 | return; | 101 | return; |
102 | }else { | 102 | }else { |
103 | savedata(); | 103 | savedata(); |
104 | Intent intent = new Intent(); | 104 | Intent intent = new Intent(); |
105 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); | 105 | intent.setClass(ElectronicCardEditInfoActivity.this,ElectronicCardInfoOKActivity.class); |
106 | startActivity(intent); | 106 | startActivity(intent); |
107 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 107 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
108 | } | 108 | } |
109 | 109 | ||
110 | break; | 110 | break; |
111 | case R.id.tv_edit_adress_shop: | 111 | case R.id.tv_edit_adress_shop: |
112 | case R.id.shopdizhi: | 112 | case R.id.shopdizhi: |
113 | Content.adressflag =1; | 113 | Content.adressflag =1; |
114 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 114 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
115 | 115 | ||
116 | break; | 116 | break; |
117 | case R.id.tv_edit_adress_custem: | 117 | case R.id.tv_edit_adress_custem: |
118 | case R.id.cunstomdizhi: | 118 | case R.id.cunstomdizhi: |
119 | Content.adressflag =2; | 119 | Content.adressflag =2; |
120 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 120 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
121 | 121 | ||
122 | break; | 122 | break; |
123 | case R.id.iv_card_back: | 123 | case R.id.iv_card_back: |
124 | finish(); | 124 | finish(); |
125 | break; | 125 | break; |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | } | 130 | } |
131 | //保存数据 | 131 | //保存数据 |
132 | private void savedata() { | 132 | private void savedata() { |
133 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); | 133 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CUNSTEMNAME, username.getText().toString().trim()); |
134 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); | 134 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.ADRESSCUNSTEM, adress_custem.getText().toString().trim()+detalAdress.getText().toString().trim()); |
135 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); | 135 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTIME, tv_buy_time.getText().toString().trim()); |
136 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); | 136 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPADRESS, adress_shop.getText().toString().trim()+store.getText().toString().trim()); |
137 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); | 137 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.SHOPTLEPHONE, telphone.getText().toString().trim()); |
138 | 138 | ||
139 | } | 139 | } |
140 | 140 | ||
141 | @Override | 141 | @Override |
142 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 142 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
143 | String regionName = data.get(position).getRegionName(); | 143 | String regionName = data.get(position).getRegionName(); |
144 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 144 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
145 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 145 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
146 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 146 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
147 | if (Content.adressflag ==1){ | 147 | if (Content.adressflag ==1){ |
148 | adress_shop.setText(""); | 148 | adress_shop.setText(""); |
149 | adress_shop.setText(provice+regionName); | 149 | adress_shop.setText(provice+regionName); |
150 | }else { | 150 | }else { |
151 | adress_custem.setText(""); | 151 | adress_custem.setText(""); |
152 | adress_custem.setText(provice+regionName); | 152 | adress_custem.setText(provice+regionName); |
153 | } | 153 | } |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | @Override | 157 | @Override |
158 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 158 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
159 | String regionName = data.get(position).getRegionName(); | 159 | String regionName = data.get(position).getRegionName(); |
160 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 160 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
161 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 161 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
162 | if (Content.adressflag ==1){ | 162 | if (Content.adressflag ==1){ |
163 | adress_shop.setText(""); | 163 | adress_shop.setText(""); |
164 | adress_shop.setText(provices+citys+regionName); | 164 | adress_shop.setText(provices+citys+regionName); |
165 | }else { | 165 | }else { |
166 | adress_custem.setText(""); | 166 | adress_custem.setText(""); |
167 | adress_custem.setText(provices+citys+regionName); | 167 | adress_custem.setText(provices+citys+regionName); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | @Override | 174 | @Override |
175 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 175 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
176 | String regionName = data.get(position).getRegionName(); | 176 | String regionName = data.get(position).getRegionName(); |
177 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 177 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
178 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 178 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
179 | adress_custem.setText(""); | 179 | adress_custem.setText(""); |
180 | adress_custem.setText(regionName); | 180 | adress_custem.setText(regionName); |
181 | 181 | ||
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 |
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.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.support.v7.app.AppCompatActivity; | 4 | import android.support.v4.app.FragmentActivity; |
5 | import android.view.View; | 5 | import android.view.View; |
6 | import android.widget.Button; | 6 | import android.widget.Button; |
7 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
9 | 9 | ||
10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.Content; | 11 | import com.hjx.personalcenter.db.Content; |
12 | import com.hjx.personalcenter.db.SaveParam; | 12 | import com.hjx.personalcenter.db.SaveParam; |
13 | import com.hjx.personalcenter.http.HttpManager; | 13 | import com.hjx.personalcenter.http.HttpManager; |
14 | import com.hjx.personalcenter.util.GetDevicesUtil; | 14 | import com.hjx.personalcenter.util.GetDevicesUtil; |
15 | 15 | ||
16 | /**确认保卡信息 | 16 | /**确认保卡信息 |
17 | * Created by h on 2017/8/11. | 17 | * Created by h on 2017/8/11. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | public class ElectronicCardInfoOKActivity extends AppCompatActivity implements View.OnClickListener { | 20 | public class ElectronicCardInfoOKActivity extends FragmentActivity implements View.OnClickListener { |
21 | private Button btn_finish,btn_bangding; | 21 | private Button btn_finish,btn_bangding; |
22 | private ImageView iv_last_step; | 22 | private ImageView iv_last_step; |
23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; | 23 | private TextView usename,deviceModel,customer_address,mac_adress,shoptime,deviceNumber,shopadress,phone,tlePhone; |
24 | @Override | 24 | @Override |
25 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
26 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
27 | setContentView(R.layout.activity_ok_cardinfo); | 27 | setContentView(R.layout.activity_ok_cardinfo); |
28 | SysApplication.getInstance().addActivity(this); | 28 | SysApplication.getInstance().addActivity(this); |
29 | initView(); | 29 | initView(); |
30 | initData(); | 30 | initData(); |
31 | initLister(); | 31 | initLister(); |
32 | } | 32 | } |
33 | private void initView() { | 33 | private void initView() { |
34 | btn_finish = (Button) findViewById(R.id.btn_finish); | 34 | btn_finish = (Button) findViewById(R.id.btn_finish); |
35 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 35 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
36 | usename = (TextView) findViewById(R.id.iv_card_username); | 36 | usename = (TextView) findViewById(R.id.iv_card_username); |
37 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 37 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
38 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 38 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
39 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 39 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
40 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 40 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
41 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 41 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
42 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 42 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
43 | phone = (TextView) findViewById(R.id.tv_card_phone); | 43 | phone = (TextView) findViewById(R.id.tv_card_phone); |
44 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 44 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
45 | btn_bangding = (Button) findViewById(R.id.btn_bangding); | 45 | btn_bangding = (Button) findViewById(R.id.btn_bangding); |
46 | } | 46 | } |
47 | 47 | ||
48 | private void initData() { | 48 | private void initData() { |
49 | //获取设备信息 | 49 | //获取设备信息 |
50 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 50 | deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
51 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 51 | deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
52 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 52 | mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
53 | //获取保卡信息 | 53 | //获取保卡信息 |
54 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 54 | usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
55 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 55 | customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
56 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 56 | shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
57 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 57 | shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
58 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 58 | tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
59 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 59 | phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
60 | 60 | ||
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
64 | private void initLister() { | 64 | private void initLister() { |
65 | iv_last_step.setOnClickListener(this); | 65 | iv_last_step.setOnClickListener(this); |
66 | btn_finish.setOnClickListener(this); | 66 | btn_finish.setOnClickListener(this); |
67 | btn_bangding.setOnClickListener(this); | 67 | btn_bangding.setOnClickListener(this); |
68 | } | 68 | } |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | public void onClick(View v) { | 71 | public void onClick(View v) { |
72 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 72 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
73 | long auserID = 0; | 73 | long auserID = 0; |
74 | switch (v.getId()){ | 74 | switch (v.getId()){ |
75 | case R.id.btn_finish: | 75 | case R.id.btn_finish: |
76 | Content.cardintentflag =1; | 76 | Content.cardintentflag =1; |
77 | try { | 77 | try { |
78 | auserID = Long.parseLong(userID); | 78 | auserID = Long.parseLong(userID); |
79 | } catch (NumberFormatException e) { | 79 | } catch (NumberFormatException e) { |
80 | e.printStackTrace(); | 80 | e.printStackTrace(); |
81 | } | 81 | } |
82 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 82 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
83 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 83 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
84 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 84 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
85 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 85 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
86 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 86 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
87 | break; | 87 | break; |
88 | case R.id.btn_bangding: | 88 | case R.id.btn_bangding: |
89 | Content.cardintentflag =2; | 89 | Content.cardintentflag =2; |
90 | try { | 90 | try { |
91 | auserID = Long.parseLong(userID); | 91 | auserID = Long.parseLong(userID); |
92 | } catch (NumberFormatException e) { | 92 | } catch (NumberFormatException e) { |
93 | e.printStackTrace(); | 93 | e.printStackTrace(); |
94 | } | 94 | } |
95 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 95 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
96 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 96 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
97 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 97 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
98 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 98 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
99 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 99 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
100 | 100 | ||
101 | break; | 101 | break; |
102 | case R.id.cancel: | 102 | case R.id.cancel: |
103 | finish(); | 103 | finish(); |
104 | break; | 104 | break; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | } | 109 | } |
110 | 110 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v4.app.FragmentActivity; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
10 | import android.widget.TextView; | 10 | import android.widget.TextView; |
11 | 11 | ||
12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.db.Content; | 13 | import com.hjx.personalcenter.db.Content; |
14 | import com.hjx.personalcenter.db.SaveParam; | ||
14 | import com.hjx.personalcenter.http.HttpCode; | 15 | import com.hjx.personalcenter.http.HttpCode; |
15 | import com.hjx.personalcenter.http.HttpManager; | 16 | import com.hjx.personalcenter.http.HttpManager; |
16 | import com.hjx.personalcenter.model.CardInfo; | 17 | import com.hjx.personalcenter.model.CardInfo; |
17 | import com.hjx.personalcenter.util.AlertUtils; | 18 | import com.hjx.personalcenter.util.AlertUtils; |
18 | import com.hjx.personalcenter.util.GetDevicesUtil; | 19 | import com.hjx.personalcenter.util.GetDevicesUtil; |
19 | 20 | ||
20 | import java.util.ArrayList; | 21 | import java.util.ArrayList; |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Created by h on 2017/8/11. | 24 | * Created by h on 2017/8/11. |
24 | */ | 25 | */ |
25 | 26 | ||
26 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener { | 27 | public class ElectronicCardLookInfoActivity extends FragmentActivity implements View.OnClickListener { |
27 | private ImageView iv_last_step; | 28 | private ImageView iv_last_step; |
28 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, | 29 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, |
29 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change; | 30 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change; |
30 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | 31 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); |
31 | 32 | ||
32 | Handler handler = new Handler() { | 33 | Handler handler = new Handler() { |
33 | @Override | 34 | @Override |
34 | public void handleMessage(Message msg) { | 35 | public void handleMessage(Message msg) { |
35 | super.handleMessage(msg); | 36 | super.handleMessage(msg); |
36 | switch (msg.what) { | 37 | switch (msg.what) { |
37 | 38 | ||
38 | case HttpCode.SUCHCARDINFO: | 39 | case HttpCode.SUCHCARDINFO: |
39 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; | 40 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; |
40 | if (cardinfoBean != null) { | 41 | if (cardinfoBean != null) { |
41 | //获取设备信息 | 42 | //获取设备信息 |
42 | deviceModel.setText(cardinfoBean.getProductModel()); | 43 | deviceModel.setText(cardinfoBean.getProductModel()); |
43 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); | 44 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); |
44 | mac_adress.setText(cardinfoBean.getMacAddress()); | 45 | mac_adress.setText(cardinfoBean.getMacAddress()); |
45 | //获取保卡信息 | 46 | //获取保卡信息 |
46 | usename.setText(cardinfoBean.getCustomerName()); | 47 | usename.setText(cardinfoBean.getCustomerName()); |
48 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CUNSTEMNAME, cardinfoBean.getCustomerName()); | ||
47 | customer_address.setText(cardinfoBean.getCustomerAddress()); | 49 | customer_address.setText(cardinfoBean.getCustomerAddress()); |
50 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.ADRESSCUNSTEM, cardinfoBean.getCustomerAddress()); | ||
48 | shoptime.setText(cardinfoBean.getBuyTime()); | 51 | shoptime.setText(cardinfoBean.getBuyTime()); |
52 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTIME, cardinfoBean.getBuyTime()); | ||
49 | shopadress.setText(cardinfoBean.getBuyAddress()); | 53 | shopadress.setText(cardinfoBean.getBuyAddress()); |
54 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPADRESS, cardinfoBean.getBuyAddress()); | ||
50 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); | 55 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); |
56 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.SHOPTLEPHONE, cardinfoBean.getMobilePhone()); | ||
51 | phone.setText(cardinfoBean.getMobilePhone()); | 57 | phone.setText(cardinfoBean.getMobilePhone()); |
58 | SaveParam.getInstance().saveCustomizeParam(ElectronicCardLookInfoActivity.this,SaveParam.CARDPHONE, cardinfoBean.getMobilePhone() ); | ||
59 | initData(); | ||
52 | }else { | 60 | }else { |
53 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); | 61 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); |
54 | } | 62 | } |
55 | 63 | ||
56 | break; | 64 | break; |
57 | 65 | ||
58 | } | 66 | } |
59 | 67 | ||
60 | } | 68 | } |
61 | }; | 69 | }; |
62 | 70 | ||
63 | @Override | 71 | @Override |
64 | protected void onCreate(Bundle savedInstanceState) { | 72 | protected void onCreate(Bundle savedInstanceState) { |
65 | super.onCreate(savedInstanceState); | 73 | super.onCreate(savedInstanceState); |
66 | setContentView(R.layout.activity_electronic_look_cardinfo); | 74 | setContentView(R.layout.activity_electronic_look_cardinfo); |
67 | initView(); | 75 | initView(); |
68 | initData(); | 76 | initData(); |
69 | initLister(); | 77 | initLister(); |
70 | } | 78 | } |
71 | 79 | ||
72 | @Override | 80 | @Override |
73 | protected void onResume() { | 81 | protected void onResume() { |
74 | super.onResume(); | 82 | super.onResume(); |
75 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber(); | 83 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber(); |
76 | HttpManager.getInstance().getcardinfo(this, deviceNumber, handler); | 84 | HttpManager.getInstance().getcardinfo(this, deviceNumber, handler); |
77 | } | 85 | } |
78 | 86 | ||
79 | private void initView() { | 87 | private void initView() { |
80 | usename = (TextView) findViewById(R.id.iv_card_username); | 88 | usename = (TextView) findViewById(R.id.iv_card_username); |
81 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 89 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
82 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 90 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
83 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 91 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
84 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 92 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
85 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 93 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
86 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 94 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
87 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 95 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
88 | phone = (TextView) findViewById(R.id.tv_card_phone); | 96 | phone = (TextView) findViewById(R.id.tv_card_phone); |
89 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 97 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
90 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | 98 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); |
91 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | 99 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
92 | } | 100 | } |
93 | 101 | ||
94 | private void initData() { | 102 | private void initData() { |
95 | 103 | ||
96 | // //获取设备信息 | 104 | // //获取设备信息 |
97 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 105 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
98 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 106 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
99 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 107 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
100 | // //获取保卡信息 | 108 | // //获取保卡信息 |
101 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 109 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
102 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 110 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
103 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 111 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
104 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 112 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
105 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 113 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
106 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 114 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
107 | 115 | ||
108 | 116 | ||
109 | } | 117 | } |
110 | 118 | ||
111 | private void initLister() { | 119 | private void initLister() { |
112 | tv_card_adress_change.setOnClickListener(this); | 120 | tv_card_adress_change.setOnClickListener(this); |
113 | tv_card_phone_change.setOnClickListener(this); | 121 | tv_card_phone_change.setOnClickListener(this); |
114 | iv_last_step.setOnClickListener(this); | 122 | iv_last_step.setOnClickListener(this); |
115 | } | 123 | } |
116 | 124 | ||
117 | @Override | 125 | @Override |
118 | public void onClick(View v) { | 126 | public void onClick(View v) { |
119 | switch (v.getId()) { | 127 | switch (v.getId()) { |
120 | case R.id.tv_card_adress_change: | 128 | case R.id.tv_card_adress_change: |
121 | Intent intent = new Intent(); | 129 | Intent intent = new Intent(); |
122 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); | 130 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); |
123 | startActivity(intent); | 131 | startActivity(intent); |
124 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 132 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
125 | 133 | ||
126 | break; | 134 | break; |
127 | case R.id.tv_card_phone_change: | 135 | case R.id.tv_card_phone_change: |
128 | Content.authcodeflag = 2; | 136 | Content.authcodeflag = 2; |
129 | Intent intent1 = new Intent(); | 137 | Intent intent1 = new Intent(); |
130 | intent1.setClass(this, ElectronicCardValidationActivity.class); | 138 | intent1.setClass(this, ElectronicCardValidationActivity.class); |
131 | startActivity(intent1); | 139 | startActivity(intent1); |
132 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 140 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
133 | 141 | ||
134 | 142 | ||
135 | break; | 143 | break; |
136 | case R.id.cancel: | 144 | case R.id.cancel: |
137 | finish(); | 145 | finish(); |
138 | break; | 146 | break; |
139 | } | 147 | } |
140 | } | 148 | } |
141 | 149 | ||
142 | } | 150 | } |
143 | 151 |
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.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v4.app.FragmentActivity; |
8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.Button; | 10 | import android.widget.Button; |
11 | import android.widget.EditText; | 11 | import android.widget.EditText; |
12 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.db.Content; | 16 | import com.hjx.personalcenter.db.Content; |
17 | import com.hjx.personalcenter.db.SaveParam; | 17 | import com.hjx.personalcenter.db.SaveParam; |
18 | import com.hjx.personalcenter.http.HttpCode; | 18 | import com.hjx.personalcenter.http.HttpCode; |
19 | import com.hjx.personalcenter.http.HttpManager; | 19 | import com.hjx.personalcenter.http.HttpManager; |
20 | import com.hjx.personalcenter.util.AlertUtils; | 20 | import com.hjx.personalcenter.util.AlertUtils; |
21 | import com.hjx.personalcenter.util.GetDevicesUtil; | 21 | import com.hjx.personalcenter.util.GetDevicesUtil; |
22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
23 | 23 | ||
24 | import org.json.JSONObject; | 24 | import org.json.JSONObject; |
25 | 25 | ||
26 | import java.util.TimerTask; | 26 | import java.util.TimerTask; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Created by h on 2017/8/9. | 29 | * Created by h on 2017/8/9. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | public class ElectronicCardValidationActivity extends AppCompatActivity implements View.OnClickListener { | 32 | public class ElectronicCardValidationActivity extends FragmentActivity implements View.OnClickListener { |
33 | private Button btn_card_valiyanzhen,get_authcode; | 33 | private Button btn_card_valiyanzhen,get_authcode; |
34 | private EditText phonenumber,anth_6num;//;//密码 | 34 | private EditText phonenumber,anth_6num;//;//密码 |
35 | private TextView menu_title; | 35 | private TextView menu_title; |
36 | private ImageView cancel; | 36 | private ImageView cancel; |
37 | private int delayTime=60; | 37 | private int delayTime=60; |
38 | private java.util.Timer Delaytimer; | 38 | private java.util.Timer Delaytimer; |
39 | private String sourceStr ="android"; | 39 | private String sourceStr ="android"; |
40 | private String typeStr = "register"; | 40 | private String typeStr = "general"; |
41 | String authcode = ""; | 41 | String authcode = ""; |
42 | Handler handler = new Handler() { | 42 | Handler handler = new Handler() { |
43 | @Override | 43 | @Override |
44 | public void handleMessage(Message msg) { | 44 | public void handleMessage(Message msg) { |
45 | super.handleMessage(msg); | 45 | super.handleMessage(msg); |
46 | JSONObject jsonObject; | 46 | JSONObject jsonObject; |
47 | String status; | 47 | String status; |
48 | switch (msg.what) { | 48 | switch (msg.what) { |
49 | case HttpCode.AUTHCODE_SUCESS: | 49 | case HttpCode.AUTHCODE_SUCESS: |
50 | jsonObject = (JSONObject) msg.obj; | 50 | jsonObject = (JSONObject) msg.obj; |
51 | status = jsonObject.optString("status"); | 51 | status = jsonObject.optString("status"); |
52 | authcode = jsonObject.optString("jsessionid"); | 52 | authcode = jsonObject.optString("jsessionid"); |
53 | if (status.equals("100")) { | 53 | if (status.equals("100")) { |
54 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); | 54 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送成功"); |
55 | } | 55 | } |
56 | 56 | ||
57 | break; | 57 | break; |
58 | case HttpCode.AUTHCODE_FAIL: | 58 | case HttpCode.AUTHCODE_FAIL: |
59 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); | 59 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "验证码发送失败"); |
60 | break; | 60 | break; |
61 | case 21: | 61 | case 21: |
62 | if(delayTime<=0){ | 62 | if(delayTime<=0){ |
63 | if(Delaytimer!=null){ | 63 | if(Delaytimer!=null){ |
64 | Delaytimer.cancel(); | 64 | Delaytimer.cancel(); |
65 | } | 65 | } |
66 | get_authcode.setEnabled(true); | 66 | get_authcode.setEnabled(true); |
67 | get_authcode.setClickable(true); | 67 | get_authcode.setClickable(true); |
68 | get_authcode.setText("获取验证码"); | 68 | get_authcode.setText("获取验证码"); |
69 | delayTime=60; | 69 | delayTime=60; |
70 | }else{ | 70 | }else{ |
71 | get_authcode.setEnabled(false); | 71 | get_authcode.setEnabled(false); |
72 | get_authcode.setClickable(false); | 72 | get_authcode.setClickable(false); |
73 | get_authcode.setText(delayTime + " s"); | 73 | get_authcode.setText(delayTime + " s"); |
74 | } | 74 | } |
75 | break; | 75 | break; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | }; | 78 | }; |
79 | @Override | 79 | @Override |
80 | protected void onCreate(Bundle savedInstanceState) { | 80 | protected void onCreate(Bundle savedInstanceState) { |
81 | super.onCreate(savedInstanceState); | 81 | super.onCreate(savedInstanceState); |
82 | setContentView(R.layout.activity_electroniccard_validation); | 82 | setContentView(R.layout.activity_electroniccard_validation); |
83 | SysApplication.getInstance().addActivity(this); | 83 | SysApplication.getInstance().addActivity(this); |
84 | initView(); | 84 | initView(); |
85 | initData(); | 85 | initData(); |
86 | initLister(); | 86 | initLister(); |
87 | } | 87 | } |
88 | 88 | ||
89 | private void initView() { | 89 | private void initView() { |
90 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); | 90 | btn_card_valiyanzhen = (Button) findViewById(R.id.btn_card_valiyanzhen); |
91 | get_authcode = (Button) findViewById(R.id.btn_authcode); | 91 | get_authcode = (Button) findViewById(R.id.btn_authcode); |
92 | anth_6num = (EditText) findViewById(R.id.et_authcode); | 92 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
93 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); | 93 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
94 | menu_title = (TextView) findViewById(R.id.menu_title); | 94 | menu_title = (TextView) findViewById(R.id.menu_title); |
95 | cancel = (ImageView) findViewById(R.id.cancel); | 95 | cancel = (ImageView) findViewById(R.id.cancel); |
96 | } | 96 | } |
97 | 97 | ||
98 | private void initData() { | 98 | private void initData() { |
99 | if (Content.authcodeflag==1){ | 99 | if (Content.authcodeflag==1){ |
100 | menu_title.setText("更换绑定"); | 100 | menu_title.setText("更换绑定"); |
101 | btn_card_valiyanzhen.setText("确定"); | 101 | btn_card_valiyanzhen.setText("确定"); |
102 | 102 | ||
103 | }else if (Content.authcodeflag==2){ | 103 | }else if (Content.authcodeflag==2){ |
104 | menu_title.setText("修改保卡信息"); | 104 | menu_title.setText("修改保卡信息"); |
105 | btn_card_valiyanzhen.setText("确定"); | 105 | btn_card_valiyanzhen.setText("确定"); |
106 | 106 | ||
107 | }else { | 107 | }else { |
108 | menu_title.setText("填写保卡信息"); | 108 | menu_title.setText("填写保卡信息"); |
109 | btn_card_valiyanzhen.setText("下一步"); | 109 | btn_card_valiyanzhen.setText("下一步"); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | private void initLister() { | 116 | private void initLister() { |
117 | get_authcode.setOnClickListener(this); | 117 | get_authcode.setOnClickListener(this); |
118 | btn_card_valiyanzhen.setOnClickListener(this); | 118 | btn_card_valiyanzhen.setOnClickListener(this); |
119 | cancel.setOnClickListener(this); | 119 | cancel.setOnClickListener(this); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | @Override | 123 | @Override |
124 | public void onClick(View v) { | 124 | public void onClick(View v) { |
125 | switch (v.getId()){ | 125 | switch (v.getId()){ |
126 | case R.id.btn_card_valiyanzhen: | 126 | case R.id.btn_card_valiyanzhen: |
127 | 127 | ||
128 | String usernameStr = phonenumber.getText().toString().trim(); | 128 | String usernameStr = phonenumber.getText().toString().trim(); |
129 | String authcodeStr = anth_6num.getText().toString().trim(); | 129 | String authcodeStr = anth_6num.getText().toString().trim(); |
130 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { | 130 | if (TextUtils.isEmpty(usernameStr) || TextUtils.isEmpty(authcodeStr)) { |
131 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); | 131 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号,和验证码不能为空"); |
132 | return; | 132 | return; |
133 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ | 133 | } else if (!PhoneNumCheckUtils.isPhone(usernameStr)){ |
134 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); | 134 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "手机号码输入错误"); |
135 | 135 | ||
136 | }else if (!authcode.equals(authcodeStr)){ | 136 | }else if (!authcode.equals(authcodeStr)){ |
137 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); | 137 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "您输入的验证码不正确"); |
138 | }else { | 138 | }else { |
139 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 139 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
140 | Long auserID = null; | 140 | Long auserID = null; |
141 | try { | 141 | try { |
142 | auserID = Long.parseLong(userID); | 142 | auserID = Long.parseLong(userID); |
143 | } catch (NumberFormatException e) { | 143 | } catch (NumberFormatException e) { |
144 | e.printStackTrace(); | 144 | e.printStackTrace(); |
145 | } | 145 | } |
146 | if (Content.authcodeflag==1){ | 146 | if (Content.authcodeflag==1){ |
147 | //修改账户手机号 | 147 | //修改账户手机号 |
148 | HttpManager.getInstance().changeaccountphone(this, | 148 | HttpManager.getInstance().changeaccountphone(this, |
149 | auserID,usernameStr,authcodeStr); | 149 | auserID,usernameStr,authcodeStr); |
150 | 150 | ||
151 | }else if (Content.authcodeflag==2){ | 151 | }else if (Content.authcodeflag==2){ |
152 | //修改保卡手机号 | 152 | //修改保卡手机号 |
153 | String userID22 = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 153 | String userID22 = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
154 | HttpManager.getInstance().changecardinfophone(this, | 154 | HttpManager.getInstance().changecardinfophone(this, |
155 | userID22,usernameStr,authcodeStr); | 155 | userID22,usernameStr,authcodeStr); |
156 | }else { | 156 | }else { |
157 | String phone =phonenumber.getText().toString().trim(); | 157 | String phone =phonenumber.getText().toString().trim(); |
158 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); | 158 | SaveParam.getInstance().saveCustomizeParam(this,SaveParam.CARDPHONE, phone ); |
159 | Intent intent = new Intent(); | 159 | Intent intent = new Intent(); |
160 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 160 | intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
161 | startActivity(intent); | 161 | startActivity(intent); |
162 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 162 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
163 | } | 163 | } |
164 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); | 164 | // SaveParam.getInstance().saveLoginParam(this,SaveParam.CARDPHONE, phonenumber.getText().toString().trim()); |
165 | // Intent intent = new Intent(); | 165 | // Intent intent = new Intent(); |
166 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); | 166 | // intent.setClass(ElectronicCardValidationActivity.this, ElectronicCardEditInfoActivity.class); |
167 | // startActivity(intent); | 167 | // startActivity(intent); |
168 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); | 168 | // overridePendingTransition(R.anim.rightin, R.anim.rightout); |
169 | } | 169 | } |
170 | break; | 170 | break; |
171 | case R.id.btn_authcode: | 171 | case R.id.btn_authcode: |
172 | String usernameStr1 = phonenumber.getText().toString().trim(); | 172 | String usernameStr1 = phonenumber.getText().toString().trim(); |
173 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ | 173 | if (!PhoneNumCheckUtils.isPhone(usernameStr1)){ |
174 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); | 174 | AlertUtils.showToast(ElectronicCardValidationActivity.this, "请输入正确的手机号"); |
175 | }else { | 175 | }else { |
176 | anth_6num.requestFocus(); | 176 | anth_6num.requestFocus(); |
177 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); | 177 | HttpManager.getInstance().authCode(typeStr, usernameStr1, handler, ElectronicCardValidationActivity.this); |
178 | valiDelay(); | 178 | valiDelay(); |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | break; | 182 | break; |
183 | case R.id.cancel: | 183 | case R.id.cancel: |
184 | finish(); | 184 | finish(); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | // 线程类 定时器 | 188 | // 线程类 定时器 |
189 | public void valiDelay() { | 189 | public void valiDelay() { |
190 | 190 | ||
191 | Delaytimer = new java.util.Timer(true); | 191 | Delaytimer = new java.util.Timer(true); |
192 | 192 | ||
193 | 193 | ||
194 | TimerTask task = new TimerTask() { | 194 | TimerTask task = new TimerTask() { |
195 | public void run() { | 195 | public void run() { |
196 | //每次需要执行的代码放到这里面。 | 196 | //每次需要执行的代码放到这里面。 |
197 | delayTime--; | 197 | delayTime--; |
198 | handler.sendEmptyMessage(21); | 198 | handler.sendEmptyMessage(21); |
199 | } | 199 | } |
200 | }; | 200 | }; |
201 | Delaytimer.schedule(task, 1000,1000); | 201 | Delaytimer.schedule(task, 1000,1000); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/FeedBackActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.content.pm.PackageManager; | 4 | import android.content.pm.PackageManager; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.provider.MediaStore; | 9 | import android.provider.MediaStore; |
10 | import android.support.annotation.NonNull; | 10 | import android.support.annotation.NonNull; |
11 | import android.support.v4.app.FragmentActivity; | ||
11 | import android.support.v4.content.FileProvider; | 12 | import android.support.v4.content.FileProvider; |
12 | import android.support.v7.app.AppCompatActivity; | ||
13 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
14 | import android.view.Gravity; | 14 | import android.view.Gravity; |
15 | import android.view.View; | 15 | import android.view.View; |
16 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
17 | import android.widget.EditText; | 17 | import android.widget.EditText; |
18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
19 | import android.widget.TextView; | 19 | import android.widget.TextView; |
20 | import android.widget.Toast; | 20 | import android.widget.Toast; |
21 | 21 | ||
22 | import com.facebook.drawee.backends.pipeline.Fresco; | 22 | import com.facebook.drawee.backends.pipeline.Fresco; |
23 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 23 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
24 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 24 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
25 | import com.facebook.drawee.generic.RoundingParams; | 25 | import com.facebook.drawee.generic.RoundingParams; |
26 | import com.facebook.drawee.interfaces.DraweeController; | 26 | import com.facebook.drawee.interfaces.DraweeController; |
27 | import com.facebook.drawee.view.SimpleDraweeView; | 27 | import com.facebook.drawee.view.SimpleDraweeView; |
28 | import com.hjx.personalcenter.R; | 28 | import com.hjx.personalcenter.R; |
29 | import com.hjx.personalcenter.db.SaveParam; | 29 | import com.hjx.personalcenter.db.SaveParam; |
30 | import com.hjx.personalcenter.http.HttpManager; | 30 | import com.hjx.personalcenter.http.HttpManager; |
31 | import com.hjx.personalcenter.util.AlertUtils; | 31 | import com.hjx.personalcenter.util.AlertUtils; |
32 | import com.hjx.personalcenter.util.CropUtils; | 32 | import com.hjx.personalcenter.util.CropUtils; |
33 | import com.hjx.personalcenter.util.DialogPermission; | 33 | import com.hjx.personalcenter.util.DialogPermission; |
34 | import com.hjx.personalcenter.util.FileUtil; | 34 | import com.hjx.personalcenter.util.FileUtil; |
35 | import com.hjx.personalcenter.util.PermissionUtil; | 35 | import com.hjx.personalcenter.util.PermissionUtil; |
36 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 36 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
37 | import com.mylhyl.circledialog.CircleDialog; | 37 | import com.mylhyl.circledialog.CircleDialog; |
38 | import com.mylhyl.circledialog.callback.ConfigButton; | 38 | import com.mylhyl.circledialog.callback.ConfigButton; |
39 | import com.mylhyl.circledialog.callback.ConfigDialog; | 39 | import com.mylhyl.circledialog.callback.ConfigDialog; |
40 | import com.mylhyl.circledialog.params.ButtonParams; | 40 | import com.mylhyl.circledialog.params.ButtonParams; |
41 | import com.mylhyl.circledialog.params.DialogParams; | 41 | import com.mylhyl.circledialog.params.DialogParams; |
42 | 42 | ||
43 | import java.io.File; | 43 | import java.io.File; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Created by h on 2017/8/11. | 46 | * Created by h on 2017/8/11. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | public class FeedBackActivity extends AppCompatActivity implements View.OnClickListener { | 49 | public class FeedBackActivity extends FragmentActivity implements View.OnClickListener { |
50 | private ImageView iv_cance, iv_show, iv_take; | 50 | private ImageView iv_cance, iv_show, iv_take; |
51 | private EditText content, phone; | 51 | private EditText content, phone; |
52 | private TextView tv_sub; | 52 | private TextView tv_sub; |
53 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 53 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
54 | private static final int REQUEST_CODE_ALBUM = 2; | 54 | private static final int REQUEST_CODE_ALBUM = 2; |
55 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 55 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
56 | private SimpleDraweeView mSimpleDraweeView; | 56 | private SimpleDraweeView mSimpleDraweeView; |
57 | String type = "个人中心"; | 57 | String type = "个人中心"; |
58 | private File file; | 58 | private File file; |
59 | private Uri uri; | 59 | private Uri uri; |
60 | 60 | ||
61 | @Override | 61 | @Override |
62 | protected void onCreate(Bundle savedInstanceState) { | 62 | protected void onCreate(Bundle savedInstanceState) { |
63 | super.onCreate(savedInstanceState); | 63 | super.onCreate(savedInstanceState); |
64 | Fresco.initialize(this); | 64 | Fresco.initialize(this); |
65 | setContentView(R.layout.activity_feedback); | 65 | setContentView(R.layout.activity_feedback); |
66 | initView(); | 66 | initView(); |
67 | initData(); | 67 | initData(); |
68 | initLister(); | 68 | initLister(); |
69 | } | 69 | } |
70 | 70 | ||
71 | private void initView() { | 71 | private void initView() { |
72 | iv_cance = (ImageView) findViewById(R.id.cancel); | 72 | iv_cance = (ImageView) findViewById(R.id.cancel); |
73 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); | 73 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); |
74 | iv_take = (ImageView) findViewById(R.id.iv_take); | 74 | iv_take = (ImageView) findViewById(R.id.iv_take); |
75 | content = (EditText) findViewById(R.id.feedback_content); | 75 | content = (EditText) findViewById(R.id.feedback_content); |
76 | phone = (EditText) findViewById(R.id.feedback_phone); | 76 | phone = (EditText) findViewById(R.id.feedback_phone); |
77 | tv_sub = (TextView) findViewById(R.id.feedback_sub); | 77 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | private void initData() { | 81 | private void initData() { |
82 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); | 82 | file = new File(FileUtil.getCachePath(this), "user-feedback.jpg"); |
83 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 83 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
84 | uri = Uri.fromFile(file); | 84 | uri = Uri.fromFile(file); |
85 | } else { | 85 | } else { |
86 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 86 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
87 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 87 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
88 | } | 88 | } |
89 | 89 | ||
90 | } | 90 | } |
91 | 91 | ||
92 | private void initLister() { | 92 | private void initLister() { |
93 | iv_cance.setOnClickListener(this); | 93 | iv_cance.setOnClickListener(this); |
94 | iv_take.setOnClickListener(this); | 94 | iv_take.setOnClickListener(this); |
95 | tv_sub.setOnClickListener(this); | 95 | tv_sub.setOnClickListener(this); |
96 | mSimpleDraweeView.setOnClickListener(this); | 96 | mSimpleDraweeView.setOnClickListener(this); |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | @Override | 100 | @Override |
101 | public void onClick(View v) { | 101 | public void onClick(View v) { |
102 | String contents = content.getText().toString().trim(); | 102 | String contents = content.getText().toString().trim(); |
103 | String contants = phone.getText().toString().trim(); | 103 | String contants = phone.getText().toString().trim(); |
104 | switch (v.getId()) { | 104 | switch (v.getId()) { |
105 | case R.id.cancel: | 105 | case R.id.cancel: |
106 | finish(); | 106 | finish(); |
107 | break; | 107 | break; |
108 | case R.id.iv_take: | 108 | case R.id.iv_take: |
109 | choiceAvatar(); | 109 | choiceAvatar(); |
110 | break; | 110 | break; |
111 | case R.id.feedback_sub: | 111 | case R.id.feedback_sub: |
112 | //提交用户反馈 | 112 | //提交用户反馈 |
113 | if (TextUtils.isEmpty(contents)) { | 113 | if (TextUtils.isEmpty(contents)) { |
114 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); | 114 | AlertUtils.showToast(FeedBackActivity.this, "写下两点宝贵的意见或建议吧"); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 117 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
118 | try { | 118 | try { |
119 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, | 119 | HttpManager.getInstance().feedback(FeedBackActivity.this, userID, |
120 | contents,contants,file.getPath(),type); | 120 | contents,contants,file.getPath(),type); |
121 | } catch (Exception e) { | 121 | } catch (Exception e) { |
122 | e.printStackTrace(); | 122 | e.printStackTrace(); |
123 | } | 123 | } |
124 | break; | 124 | break; |
125 | case R.id.show_iv: | 125 | case R.id.show_iv: |
126 | 126 | ||
127 | 127 | ||
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | //拍摄头像 | 132 | //拍摄头像 |
133 | private void choiceAvatar() { | 133 | private void choiceAvatar() { |
134 | final String[] items = {"拍照", "从相册选择"}; | 134 | final String[] items = {"拍照", "从相册选择"}; |
135 | new CircleDialog.Builder(this) | 135 | new CircleDialog.Builder(this) |
136 | .configDialog(new ConfigDialog() { | 136 | .configDialog(new ConfigDialog() { |
137 | @Override | 137 | @Override |
138 | public void onConfig(DialogParams params) { | 138 | public void onConfig(DialogParams params) { |
139 | //增加弹出动画 | 139 | //增加弹出动画 |
140 | params.gravity = Gravity.CENTER; | 140 | params.gravity = Gravity.CENTER; |
141 | } | 141 | } |
142 | }) | 142 | }) |
143 | .setTitle("请选择图片来源") | 143 | .setTitle("请选择图片来源") |
144 | .setWidth(0.5f) | 144 | .setWidth(0.5f) |
145 | .setItems(items, new AdapterView.OnItemClickListener() { | 145 | .setItems(items, new AdapterView.OnItemClickListener() { |
146 | @Override | 146 | @Override |
147 | public void onItemClick(AdapterView<?> parent, View view, int | 147 | public void onItemClick(AdapterView<?> parent, View view, int |
148 | position, long id) { | 148 | position, long id) { |
149 | switch (position) { | 149 | switch (position) { |
150 | case 0: | 150 | case 0: |
151 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { | 151 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
152 | uploadAvatarFromPhotoRequest(); | 152 | uploadAvatarFromPhotoRequest(); |
153 | } | 153 | } |
154 | break; | 154 | break; |
155 | case 1: | 155 | case 1: |
156 | uploadAvatarFromAlbumRequest(); | 156 | uploadAvatarFromAlbumRequest(); |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | 159 | ||
160 | } | 160 | } |
161 | }) | 161 | }) |
162 | .setNegative("取消", null) | 162 | .setNegative("取消", null) |
163 | .configNegative(new ConfigButton() { | 163 | .configNegative(new ConfigButton() { |
164 | @Override | 164 | @Override |
165 | public void onConfig(ButtonParams params) { | 165 | public void onConfig(ButtonParams params) { |
166 | //取消按钮字体颜色 | 166 | //取消按钮字体颜色 |
167 | params.textColor = Color.RED; | 167 | params.textColor = Color.RED; |
168 | } | 168 | } |
169 | }) | 169 | }) |
170 | .show(); | 170 | .show(); |
171 | 171 | ||
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | //照相 | 175 | //照相 |
176 | private void uploadAvatarFromPhotoRequest() { | 176 | private void uploadAvatarFromPhotoRequest() { |
177 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 177 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
178 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 178 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
179 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 179 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
180 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 180 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
181 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 181 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
182 | } | 182 | } |
183 | 183 | ||
184 | //选择图库 | 184 | //选择图库 |
185 | private void uploadAvatarFromAlbumRequest() { | 185 | private void uploadAvatarFromAlbumRequest() { |
186 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 186 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
187 | photoPickerIntent.setType("image/*"); | 187 | photoPickerIntent.setType("image/*"); |
188 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 188 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
189 | } | 189 | } |
190 | 190 | ||
191 | //回掉 | 191 | //回掉 |
192 | @Override | 192 | @Override |
193 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 193 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
194 | super.onActivityResult(requestCode, resultCode, data); | 194 | super.onActivityResult(requestCode, resultCode, data); |
195 | if (resultCode != -1) { | 195 | if (resultCode != -1) { |
196 | return; | 196 | return; |
197 | } | 197 | } |
198 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 198 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
199 | Uri newUri; | 199 | Uri newUri; |
200 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 200 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
201 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 201 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
202 | } else { | 202 | } else { |
203 | newUri = data.getData(); | 203 | newUri = data.getData(); |
204 | } | 204 | } |
205 | if (newUri != null) { | 205 | if (newUri != null) { |
206 | //uploadAvatarFromPhoto(); | 206 | //uploadAvatarFromPhoto(); |
207 | //裁剪图片 | 207 | //裁剪图片 |
208 | startPhotoZoom(newUri); | 208 | startPhotoZoom(newUri); |
209 | } else { | 209 | } else { |
210 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 210 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
211 | } | 211 | } |
212 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 212 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
213 | uploadAvatarFromPhoto(); | 213 | uploadAvatarFromPhoto(); |
214 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 214 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
215 | uploadAvatarFromPhoto(); | 215 | uploadAvatarFromPhoto(); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | private void uploadAvatarFromPhoto() { | 219 | private void uploadAvatarFromPhoto() { |
220 | compressAndUploadAvatar(file.getPath()); | 220 | compressAndUploadAvatar(file.getPath()); |
221 | 221 | ||
222 | } | 222 | } |
223 | 223 | ||
224 | private void compressAndUploadAvatar(String fileSrc) { | 224 | private void compressAndUploadAvatar(String fileSrc) { |
225 | 225 | ||
226 | 226 | ||
227 | //上传到服务器 | 227 | //上传到服务器 |
228 | 228 | ||
229 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 229 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
230 | String mimeType = "image/*"; | 230 | String mimeType = "image/*"; |
231 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 231 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
232 | //String fileName = cover.getName(); | 232 | //String fileName = cover.getName(); |
233 | //HttpManager.getInstance().header(this, fileSrc); | 233 | //HttpManager.getInstance().header(this, fileSrc); |
234 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 234 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
235 | //Fresco设置圆形头像 | 235 | //Fresco设置圆形头像 |
236 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 236 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
237 | GenericDraweeHierarchy hierarchy = builder | 237 | GenericDraweeHierarchy hierarchy = builder |
238 | .setDesiredAspectRatio(1f) | 238 | .setDesiredAspectRatio(1f) |
239 | .setFailureImage(R.mipmap.blank) | 239 | .setFailureImage(R.mipmap.blank) |
240 | //圆形头像 | 240 | //圆形头像 |
241 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) | 241 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) |
242 | .build(); | 242 | .build(); |
243 | 243 | ||
244 | //加载本地图片 | 244 | //加载本地图片 |
245 | Uri uri = Uri.fromFile(cover); | 245 | Uri uri = Uri.fromFile(cover); |
246 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 246 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
247 | .setOldController(mSimpleDraweeView.getController()) | 247 | .setOldController(mSimpleDraweeView.getController()) |
248 | .setUri(uri) | 248 | .setUri(uri) |
249 | .build(); | 249 | .build(); |
250 | mSimpleDraweeView.setHierarchy(hierarchy); | 250 | mSimpleDraweeView.setHierarchy(hierarchy); |
251 | mSimpleDraweeView.setController(controller); | 251 | mSimpleDraweeView.setController(controller); |
252 | 252 | ||
253 | } | 253 | } |
254 | 254 | ||
255 | public void startPhotoZoom(Uri uri) { | 255 | public void startPhotoZoom(Uri uri) { |
256 | Intent intent = new Intent("com.android.camera.action.CROP"); | 256 | Intent intent = new Intent("com.android.camera.action.CROP"); |
257 | intent.setDataAndType(uri, "image/*"); | 257 | intent.setDataAndType(uri, "image/*"); |
258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 258 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
259 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 259 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
260 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 260 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
261 | intent.putExtra("aspectY", 1);// x:y=1:1 | 261 | intent.putExtra("aspectY", 1);// x:y=1:1 |
262 | // intent.putExtra("outputX", 400);//图片输出大小 | 262 | // intent.putExtra("outputX", 400);//图片输出大小 |
263 | // intent.putExtra("outputY", 400); | 263 | // intent.putExtra("outputY", 400); |
264 | intent.putExtra("output", Uri.fromFile(file)); | 264 | intent.putExtra("output", Uri.fromFile(file)); |
265 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 265 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
266 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 266 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
267 | } | 267 | } |
268 | 268 | ||
269 | @Override | 269 | @Override |
270 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 270 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
271 | switch (requestCode) { | 271 | switch (requestCode) { |
272 | 272 | ||
273 | case PermissionUtil.REQUEST_SHOWCAMERA: | 273 | case PermissionUtil.REQUEST_SHOWCAMERA: |
274 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 274 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
275 | // Permission Granted | 275 | // Permission Granted |
276 | uploadAvatarFromPhotoRequest(); | 276 | uploadAvatarFromPhotoRequest(); |
277 | 277 | ||
278 | } else { | 278 | } else { |
279 | if (!SharedPreferenceMark.getHasShowCamera()) { | 279 | if (!SharedPreferenceMark.getHasShowCamera()) { |
280 | SharedPreferenceMark.setHasShowCamera(true); | 280 | SharedPreferenceMark.setHasShowCamera(true); |
281 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 281 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
282 | 282 | ||
283 | } else { | 283 | } else { |
284 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 284 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
285 | .show(); | 285 | .show(); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | break; | 288 | break; |
289 | default: | 289 | default: |
290 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 290 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | } | 293 | } |
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.os.Bundle; | 3 | import android.os.Bundle; |
4 | import android.os.Handler; | 4 | import android.os.Handler; |
5 | import android.os.Message; | 5 | import android.os.Message; |
6 | import android.support.v4.app.FragmentActivity; | ||
6 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
7 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
8 | import android.text.method.HideReturnsTransformationMethod; | 9 | import android.text.method.HideReturnsTransformationMethod; |
9 | import android.text.method.PasswordTransformationMethod; | 10 | import android.text.method.PasswordTransformationMethod; |
10 | import android.view.View; | 11 | import android.view.View; |
11 | import android.widget.Button; | 12 | import android.widget.Button; |
12 | import android.widget.EditText; | 13 | import android.widget.EditText; |
13 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
14 | 15 | ||
15 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.http.HttpCode; | 17 | import com.hjx.personalcenter.http.HttpCode; |
17 | import com.hjx.personalcenter.http.HttpManager; | 18 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 19 | import com.hjx.personalcenter.util.AlertUtils; |
19 | import com.hjx.personalcenter.util.Judgment; | 20 | import com.hjx.personalcenter.util.Judgment; |
20 | import com.hjx.personalcenter.util.PasswordCheckUtils; | 21 | import com.hjx.personalcenter.util.PasswordCheckUtils; |
21 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 22 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
22 | 23 | ||
23 | import org.json.JSONException; | 24 | import org.json.JSONException; |
24 | import org.json.JSONObject; | 25 | import org.json.JSONObject; |
25 | 26 | ||
26 | import java.util.TimerTask; | 27 | import java.util.TimerTask; |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * 忘记密码 | 30 | * 忘记密码 |
30 | * Created by h on 2017/6/17. | 31 | * Created by h on 2017/6/17. |
31 | */ | 32 | */ |
32 | 33 | ||
33 | public class ForgotPasswordActivity extends AppCompatActivity implements View.OnClickListener { | 34 | public class ForgotPasswordActivity extends FragmentActivity implements View.OnClickListener { |
34 | private ImageView back_forgit, iv_pwd_change; | 35 | private ImageView back_forgit, iv_pwd_change; |
35 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; | 36 | private EditText forot_pwd_phone, forot_pwd_anthcode, forot_pwd_pwd, forot_pwd_pwd2; |
36 | private Button forot_pwd_sub, forot_pwd_getanthcode; | 37 | private Button forot_pwd_sub, forot_pwd_getanthcode; |
37 | private String forot_pwd_phone1; | 38 | private String forot_pwd_phone1; |
38 | private String forot_pwd_anthcode1; | 39 | private String forot_pwd_anthcode1; |
39 | private String forot_pwd_pwd3; | 40 | private String forot_pwd_pwd3; |
40 | private String forot_pwd_pwd4; | 41 | private String forot_pwd_pwd4; |
41 | private String typeStr = "login"; | 42 | private String typeStr = "login"; |
42 | private int delayTime=60; | 43 | private int delayTime=60; |
43 | private java.util.Timer Delaytimer; | 44 | private java.util.Timer Delaytimer; |
44 | public static Boolean showPassword = false; | 45 | public static Boolean showPassword = false; |
45 | 46 | ||
46 | Handler handler = new Handler() { | 47 | Handler handler = new Handler() { |
47 | @Override | 48 | @Override |
48 | public void handleMessage(Message msg) { | 49 | public void handleMessage(Message msg) { |
49 | super.handleMessage(msg); | 50 | super.handleMessage(msg); |
50 | try { | 51 | try { |
51 | JSONObject jsonObject; | 52 | JSONObject jsonObject; |
52 | String status; | 53 | String status; |
53 | switch (msg.what) { | 54 | switch (msg.what) { |
54 | case HttpCode.PASSWORD_SUCESS: | 55 | case HttpCode.PASSWORD_SUCESS: |
55 | jsonObject = (JSONObject) msg.obj; | 56 | jsonObject = (JSONObject) msg.obj; |
56 | status = jsonObject.getString("status"); | 57 | status = jsonObject.getString("status"); |
57 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 58 | // AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
58 | if (status.equals("100")) { | 59 | if (status.equals("100")) { |
59 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); | 60 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改成功"); |
60 | } | 61 | } |
61 | 62 | ||
62 | break; | 63 | break; |
63 | case HttpCode.PASSWORD_FAIL: | 64 | case HttpCode.PASSWORD_FAIL: |
64 | jsonObject = (JSONObject) msg.obj; | 65 | jsonObject = (JSONObject) msg.obj; |
65 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); | 66 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码修改失败,请检查网络是否畅通。"); |
66 | break; | 67 | break; |
67 | case HttpCode.AUTHCODE_SUCESS1: | 68 | case HttpCode.AUTHCODE_SUCESS1: |
68 | jsonObject = (JSONObject) msg.obj; | 69 | jsonObject = (JSONObject) msg.obj; |
69 | status = jsonObject.optString("status"); | 70 | status = jsonObject.optString("status"); |
70 | if (status.equals("100")) { | 71 | if (status.equals("100")) { |
71 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); | 72 | AlertUtils.showToast(ForgotPasswordActivity.this, "验证码发送成功"); |
72 | } | 73 | } |
73 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); | 74 | //AlertUtils.showToast(ForgotPassword.this, jsonObject.optString("message")); |
74 | break; | 75 | break; |
75 | case HttpCode.AUTHCODE_FAIL1: | 76 | case HttpCode.AUTHCODE_FAIL1: |
76 | jsonObject = (JSONObject) msg.obj; | 77 | jsonObject = (JSONObject) msg.obj; |
77 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); | 78 | AlertUtils.showToast(ForgotPasswordActivity.this, jsonObject.optString("验证码发送失败,请检查网络")); |
78 | break; | 79 | break; |
79 | case HttpCode.IS_REFISTER: | 80 | case HttpCode.IS_REFISTER: |
80 | jsonObject = (JSONObject) msg.obj; | 81 | jsonObject = (JSONObject) msg.obj; |
81 | status = jsonObject.getString("status"); | 82 | status = jsonObject.getString("status"); |
82 | if (status.equals("true")) { | 83 | if (status.equals("true")) { |
83 | getauthcode(); | 84 | getauthcode(); |
84 | 85 | ||
85 | } else { | 86 | } else { |
86 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); | 87 | AlertUtils.showToast(ForgotPasswordActivity.this, "该手机号没有注册"); |
87 | } | 88 | } |
88 | break; | 89 | break; |
89 | case 21: | 90 | case 21: |
90 | 91 | ||
91 | if(delayTime<=0){ | 92 | if(delayTime<=0){ |
92 | if(Delaytimer!=null){ | 93 | if(Delaytimer!=null){ |
93 | Delaytimer.cancel(); | 94 | Delaytimer.cancel(); |
94 | } | 95 | } |
95 | forot_pwd_getanthcode.setEnabled(true); | 96 | forot_pwd_getanthcode.setEnabled(true); |
96 | forot_pwd_getanthcode.setClickable(true); | 97 | forot_pwd_getanthcode.setClickable(true); |
97 | forot_pwd_getanthcode.setText("获取验证码"); | 98 | forot_pwd_getanthcode.setText("获取验证码"); |
98 | delayTime=60; | 99 | delayTime=60; |
99 | }else{ | 100 | }else{ |
100 | forot_pwd_getanthcode.setEnabled(false); | 101 | forot_pwd_getanthcode.setEnabled(false); |
101 | forot_pwd_getanthcode.setClickable(false); | 102 | forot_pwd_getanthcode.setClickable(false); |
102 | forot_pwd_getanthcode.setText(delayTime + " s"); | 103 | forot_pwd_getanthcode.setText(delayTime + " s"); |
103 | } | 104 | } |
104 | break; | 105 | break; |
105 | } | 106 | } |
106 | } catch (JSONException e) { | 107 | } catch (JSONException e) { |
107 | e.printStackTrace(); | 108 | e.printStackTrace(); |
108 | } | 109 | } |
109 | } | 110 | } |
110 | }; | 111 | }; |
111 | 112 | ||
112 | @Override | 113 | @Override |
113 | protected void onCreate(Bundle savedInstanceState) { | 114 | protected void onCreate(Bundle savedInstanceState) { |
114 | super.onCreate(savedInstanceState); | 115 | super.onCreate(savedInstanceState); |
115 | setContentView(R.layout.activity_forgetpsword); | 116 | setContentView(R.layout.activity_forgetpsword); |
116 | initView(); | 117 | initView(); |
117 | setLister(); | 118 | setLister(); |
118 | } | 119 | } |
119 | 120 | ||
120 | //获取验证码 | 121 | //获取验证码 |
121 | private void getauthcode() { | 122 | private void getauthcode() { |
122 | forot_pwd_anthcode.requestFocus(); | 123 | forot_pwd_anthcode.requestFocus(); |
123 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); | 124 | HttpManager.getInstance().authCode(typeStr, forot_pwd_phone1, handler, this); |
124 | valiDelay(); | 125 | valiDelay(); |
125 | 126 | ||
126 | } | 127 | } |
127 | 128 | ||
128 | private void initView() { | 129 | private void initView() { |
129 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); | 130 | forot_pwd_phone = (EditText) findViewById(R.id.et_phonenumber); |
130 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); | 131 | forot_pwd_anthcode = (EditText) findViewById(R.id.et_authcode); |
131 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); | 132 | forot_pwd_pwd = (EditText) findViewById(R.id.et_newpassword); |
132 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); | 133 | forot_pwd_pwd2 = (EditText) findViewById(R.id.et_again_newpassword); |
133 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); | 134 | forot_pwd_sub = (Button) findViewById(R.id.btn_ok); |
134 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); | 135 | forot_pwd_getanthcode = (Button) findViewById(R.id.btn_authcode); |
135 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); | 136 | iv_pwd_change = (ImageView) findViewById(R.id.iv_pwd_change); |
136 | back_forgit = (ImageView) findViewById(R.id.cancel); | 137 | back_forgit = (ImageView) findViewById(R.id.cancel); |
137 | } | 138 | } |
138 | 139 | ||
139 | private void setLister() { | 140 | private void setLister() { |
140 | iv_pwd_change.setOnClickListener(this); | 141 | iv_pwd_change.setOnClickListener(this); |
141 | back_forgit.setOnClickListener(this); | 142 | back_forgit.setOnClickListener(this); |
142 | forot_pwd_sub.setOnClickListener(this); | 143 | forot_pwd_sub.setOnClickListener(this); |
143 | forot_pwd_getanthcode.setOnClickListener(this); | 144 | forot_pwd_getanthcode.setOnClickListener(this); |
144 | 145 | ||
145 | } | 146 | } |
146 | 147 | ||
147 | 148 | ||
148 | @Override | 149 | @Override |
149 | public void onClick(View view) { | 150 | public void onClick(View view) { |
150 | switch (view.getId()) { | 151 | switch (view.getId()) { |
151 | case R.id.btn_ok: | 152 | case R.id.btn_ok: |
152 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 153 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
153 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); | 154 | forot_pwd_anthcode1 = forot_pwd_anthcode.getText().toString().trim(); |
154 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); | 155 | forot_pwd_pwd3 = forot_pwd_pwd.getText().toString().trim(); |
155 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); | 156 | forot_pwd_pwd4 = forot_pwd_pwd2.getText().toString().trim(); |
156 | if (TextUtils.isEmpty(forot_pwd_phone1) || | 157 | if (TextUtils.isEmpty(forot_pwd_phone1) || |
157 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { | 158 | TextUtils.isEmpty(forot_pwd_pwd3) || TextUtils.isEmpty(forot_pwd_pwd4)) { |
158 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); | 159 | AlertUtils.showToast(ForgotPasswordActivity.this, "请将必填项填写完整"); |
159 | return; | 160 | return; |
160 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { | 161 | } else if (Judgment.getInstance().isPhoneNum(forot_pwd_phone1)) { |
161 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); | 162 | AlertUtils.showToast(ForgotPasswordActivity.this, "手机号码输入有误"); |
162 | 163 | ||
163 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { | 164 | } else if (forot_pwd_pwd3.length() < 8 || forot_pwd_pwd4.length() < 8) { |
164 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); | 165 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码不能少于8位"); |
165 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { | 166 | } else if (!forot_pwd_pwd3.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER) || !forot_pwd_pwd4.matches(PasswordCheckUtils.PASSWORD_CHAR_AND_NUMBER)) { |
166 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); | 167 | AlertUtils.showToast(ForgotPasswordActivity.this, "密码必须由英文和数字组成"); |
167 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { | 168 | } else if (!forot_pwd_pwd3.equals(forot_pwd_pwd4)) { |
168 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); | 169 | AlertUtils.showToast(ForgotPasswordActivity.this, "两次输入的密码不一致"); |
169 | return; | 170 | return; |
170 | } else { | 171 | } else { |
171 | //忘记密码接口 | 172 | //忘记密码接口 |
172 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); | 173 | HttpManager.getInstance().forgetpassword(this, forot_pwd_phone1, forot_pwd_pwd3, forot_pwd_anthcode1, handler); |
173 | } | 174 | } |
174 | break; | 175 | break; |
175 | case R.id.btn_authcode: | 176 | case R.id.btn_authcode: |
176 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 177 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
177 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { | 178 | if (!PhoneNumCheckUtils.isPhone(forot_pwd_phone1)) { |
178 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); | 179 | AlertUtils.showToast(ForgotPasswordActivity.this, "请输入正确的手机号"); |
179 | } else { | 180 | } else { |
180 | forot_pwd_anthcode.requestFocus(); | 181 | forot_pwd_anthcode.requestFocus(); |
181 | ifregister(); | 182 | ifregister(); |
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
185 | break; | 186 | break; |
186 | case R.id.iv_pwd_change: | 187 | case R.id.iv_pwd_change: |
187 | if (showPassword) {//显示密码 | 188 | if (showPassword) {//显示密码 |
188 | showPassword = !showPassword; | 189 | showPassword = !showPassword; |
189 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); | 190 | iv_pwd_change.setImageResource(R.mipmap.pwd_open); |
190 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); | 191 | forot_pwd_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); |
191 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 192 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
192 | } else {//隐藏密码 | 193 | } else {//隐藏密码 |
193 | showPassword = !showPassword; | 194 | showPassword = !showPassword; |
194 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); | 195 | iv_pwd_change.setImageResource(R.mipmap.pwd_hide); |
195 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); | 196 | forot_pwd_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); |
196 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); | 197 | forot_pwd_pwd.setSelection(forot_pwd_pwd.getText().toString().length()); |
197 | } | 198 | } |
198 | break; | 199 | break; |
199 | 200 | ||
200 | case R.id.cancel: | 201 | case R.id.cancel: |
201 | finish(); | 202 | finish(); |
202 | break; | 203 | break; |
203 | } | 204 | } |
204 | } | 205 | } |
205 | 206 | ||
206 | //是否注册 | 207 | //是否注册 |
207 | private void ifregister() { | 208 | private void ifregister() { |
208 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); | 209 | forot_pwd_phone1 = forot_pwd_phone.getText().toString().trim(); |
209 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); | 210 | HttpManager.getInstance().isregistered(forot_pwd_phone1, handler, this); |
210 | } | 211 | } |
211 | 212 | ||
212 | // 线程类 定时器 | 213 | // 线程类 定时器 |
213 | public void valiDelay() { | 214 | public void valiDelay() { |
214 | 215 | ||
215 | Delaytimer = new java.util.Timer(true); | 216 | Delaytimer = new java.util.Timer(true); |
216 | 217 | ||
217 | 218 | ||
218 | TimerTask task = new TimerTask() { | 219 | TimerTask task = new TimerTask() { |
219 | public void run() { | 220 | public void run() { |
220 | //每次需要执行的代码放到这里面。 | 221 | //每次需要执行的代码放到这里面。 |
221 | delayTime--; | 222 | delayTime--; |
222 | handler.sendEmptyMessage(21); | 223 | handler.sendEmptyMessage(21); |
223 | } | 224 | } |
224 | }; | 225 | }; |
225 | Delaytimer.schedule(task, 1000,1000); | 226 | Delaytimer.schedule(task, 1000,1000); |
226 | } | 227 | } |
227 | } | 228 | } |
228 | 229 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/LoginAndRegisterActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.provider.Settings; | 5 | import android.provider.Settings; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.support.v4.app.FragmentActivity; | ||
8 | import android.support.v4.view.ViewPager; | 9 | import android.support.v4.view.ViewPager; |
9 | import android.support.v7.app.AppCompatActivity; | ||
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | 12 | ||
13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 14 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
15 | import com.hjx.personalcenter.db.SaveParam; | 15 | import com.hjx.personalcenter.db.SaveParam; |
16 | import com.hjx.personalcenter.fragment.LoginFragment; | 16 | import com.hjx.personalcenter.fragment.LoginFragment; |
17 | import com.hjx.personalcenter.fragment.RegisterFragment; | 17 | import com.hjx.personalcenter.fragment.RegisterFragment; |
18 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 18 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; |
19 | import com.hjx.personalcenter.util.NetUtils; | 19 | import com.hjx.personalcenter.util.NetUtils; |
20 | import com.mylhyl.circledialog.CircleDialog; | 20 | import com.mylhyl.circledialog.CircleDialog; |
21 | import com.mylhyl.circledialog.callback.ConfigText; | 21 | import com.mylhyl.circledialog.callback.ConfigText; |
22 | import com.mylhyl.circledialog.params.TextParams; | 22 | import com.mylhyl.circledialog.params.TextParams; |
23 | 23 | ||
24 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
25 | import java.util.Arrays; | 25 | import java.util.Arrays; |
26 | import java.util.List; | 26 | import java.util.List; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 登录和注册 熊巍 | 29 | * 登录和注册 熊巍 |
30 | * Created by h on 2017/8/8. | 30 | * Created by h on 2017/8/8. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | public class LoginAndRegisterActivity extends AppCompatActivity { | 33 | public class LoginAndRegisterActivity extends FragmentActivity { |
34 | private ViewPager viewPager; | 34 | private ViewPager viewPager; |
35 | private SlidingTabLayout tableLayout; | 35 | private SlidingTabLayout tableLayout; |
36 | private List<Fragment> loginlist; | 36 | private List<Fragment> loginlist; |
37 | private LoginAndRegisterAdapter logindapter; | 37 | private LoginAndRegisterAdapter logindapter; |
38 | private List<String> title = Arrays.asList("登录", "注册"); | 38 | private List<String> title = Arrays.asList("登录", "注册"); |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | protected void onCreate(@Nullable Bundle savedInstanceState) { | 41 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
42 | super.onCreate(savedInstanceState); | 42 | super.onCreate(savedInstanceState); |
43 | //检查网络 | 43 | //检查网络 |
44 | boolean isconnect = NetUtils.isNetworkConnected(this); | 44 | boolean isconnect = NetUtils.isNetworkConnected(this); |
45 | if (!isconnect){ | 45 | if (!isconnect){ |
46 | new CircleDialog.Builder(this) | 46 | new CircleDialog.Builder(this) |
47 | .setCanceledOnTouchOutside(false) | 47 | .setCanceledOnTouchOutside(false) |
48 | .setCancelable(false) | 48 | .setCancelable(false) |
49 | .setWidth(0.5f) | 49 | .setWidth(0.5f) |
50 | .configText(new ConfigText() { | 50 | .configText(new ConfigText() { |
51 | @Override | 51 | @Override |
52 | public void onConfig(TextParams params) { | 52 | public void onConfig(TextParams params) { |
53 | params.gravity = Gravity.CENTER; | 53 | params.gravity = Gravity.CENTER; |
54 | params.padding = new int[]{50, 50, 50, 50}; | 54 | params.padding = new int[]{50, 50, 50, 50}; |
55 | } | 55 | } |
56 | }) | 56 | }) |
57 | .setText("当前无网络,请检查网络设置") | 57 | .setText("当前无网络,请检查网络设置") |
58 | .setNegative("继续使用", null) | 58 | .setNegative("继续使用", null) |
59 | .setPositive("设置网络", new View.OnClickListener() { | 59 | .setPositive("设置网络", new View.OnClickListener() { |
60 | @Override | 60 | @Override |
61 | public void onClick(View v) { | 61 | public void onClick(View v) { |
62 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 62 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
63 | startActivity(intent); | 63 | startActivity(intent); |
64 | } | 64 | } |
65 | }) | 65 | }) |
66 | .show(); | 66 | .show(); |
67 | } | 67 | } |
68 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); | 68 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); |
69 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); | 69 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); |
70 | if (type==null){ | 70 | if (type==null){ |
71 | SaveParam.getInstance().saveCustomizeParam(LoginAndRegisterActivity.this, SaveParam.ACCOUNT,"1"); | 71 | SaveParam.getInstance().saveCustomizeParam(LoginAndRegisterActivity.this, SaveParam.ACCOUNT,"1"); |
72 | } | 72 | } |
73 | if ("true".equals(islogin)){ | 73 | if ("true".equals(islogin)){ |
74 | Intent intent = new Intent(); | 74 | Intent intent = new Intent(); |
75 | intent.setClass(this,MainActivity.class); | 75 | intent.setClass(this,MainActivity.class); |
76 | startActivity(intent); | 76 | startActivity(intent); |
77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 77 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
78 | finish(); | 78 | finish(); |
79 | 79 | ||
80 | } | 80 | } |
81 | setContentView(R.layout.activity_loginandregister); | 81 | setContentView(R.layout.activity_loginandregister); |
82 | SysApplication.getInstance().addActivity(this); | 82 | SysApplication.getInstance().addActivity(this); |
83 | initView(); | 83 | initView(); |
84 | initData(); | 84 | initData(); |
85 | setLister(); | 85 | setLister(); |
86 | } | 86 | } |
87 | 87 | ||
88 | private void initView() { | 88 | private void initView() { |
89 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 89 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
90 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 90 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
91 | } | 91 | } |
92 | 92 | ||
93 | private void initData() { | 93 | private void initData() { |
94 | loginlist = new ArrayList<>(); | 94 | loginlist = new ArrayList<>(); |
95 | for (int i = 0; i < title.size(); i++) { | 95 | for (int i = 0; i < title.size(); i++) { |
96 | if (title.get(i).equals("登录")) { | 96 | if (title.get(i).equals("登录")) { |
97 | loginlist.add(LoginFragment.newInstance(i + 1)); | 97 | loginlist.add(LoginFragment.newInstance(i + 1)); |
98 | } else { | 98 | } else { |
99 | loginlist.add(RegisterFragment.newInstance(i + 1)); | 99 | loginlist.add(RegisterFragment.newInstance(i + 1)); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | //设置Tab上的标题 | 104 | //设置Tab上的标题 |
105 | tableLayout.setData(title); | 105 | tableLayout.setData(title); |
106 | //设置关联的ViewPager | 106 | //设置关联的ViewPager |
107 | tableLayout.setViewPager(viewPager, 0); | 107 | tableLayout.setViewPager(viewPager, 0); |
108 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); | 108 | logindapter = new LoginAndRegisterAdapter(loginlist, getSupportFragmentManager()); |
109 | //给ViewPager设置适配器 | 109 | //给ViewPager设置适配器 |
110 | viewPager.setAdapter(logindapter); | 110 | viewPager.setAdapter(logindapter); |
111 | //设置滑动时数据不丢失 | 111 | //设置滑动时数据不丢失 |
112 | viewPager.setOffscreenPageLimit(0); | 112 | viewPager.setOffscreenPageLimit(0); |
113 | //将TabLayout和ViewPager关联起来。 | 113 | //将TabLayout和ViewPager关联起来。 |
114 | } | 114 | } |
115 | 115 | ||
116 | private void setLister() { | 116 | private void setLister() { |
117 | 117 | ||
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | } | 121 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Context; | 3 | import android.content.Context; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Build; | 7 | import android.os.Build; |
8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
9 | import android.os.Handler; | 9 | import android.os.Handler; |
10 | import android.os.Message; | 10 | import android.os.Message; |
11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
13 | import android.support.v4.app.FragmentActivity; | ||
13 | import android.support.v4.content.FileProvider; | 14 | import android.support.v4.content.FileProvider; |
14 | import android.support.v7.app.AppCompatActivity; | ||
15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
17 | import android.util.Log; | 17 | import android.util.Log; |
18 | import android.view.KeyEvent; | 18 | import android.view.KeyEvent; |
19 | import android.view.View; | 19 | import android.view.View; |
20 | import android.widget.GridView; | 20 | import android.widget.GridView; |
21 | import android.widget.ImageView; | 21 | import android.widget.ImageView; |
22 | import android.widget.LinearLayout; | 22 | import android.widget.LinearLayout; |
23 | import android.widget.TextView; | 23 | import android.widget.TextView; |
24 | import android.widget.Toast; | 24 | import android.widget.Toast; |
25 | 25 | ||
26 | import com.facebook.drawee.backends.pipeline.Fresco; | 26 | import com.facebook.drawee.backends.pipeline.Fresco; |
27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 27 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 28 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
29 | import com.facebook.drawee.generic.RoundingParams; | 29 | import com.facebook.drawee.generic.RoundingParams; |
30 | import com.facebook.drawee.interfaces.DraweeController; | 30 | import com.facebook.drawee.interfaces.DraweeController; |
31 | import com.facebook.drawee.view.SimpleDraweeView; | 31 | import com.facebook.drawee.view.SimpleDraweeView; |
32 | import com.google.gson.Gson; | 32 | import com.google.gson.Gson; |
33 | import com.hjx.personalcenter.R; | 33 | import com.hjx.personalcenter.R; |
34 | import com.hjx.personalcenter.adapter.MianGridAdapter; | 34 | import com.hjx.personalcenter.adapter.MianGridAdapter; |
35 | import com.hjx.personalcenter.adapter.VideoAdapter; | 35 | import com.hjx.personalcenter.adapter.VideoAdapter; |
36 | import com.hjx.personalcenter.customdialog.HeadDialog; | 36 | import com.hjx.personalcenter.customdialog.HeadDialog; |
37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 37 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
38 | import com.hjx.personalcenter.db.SaveParam; | 38 | import com.hjx.personalcenter.db.SaveParam; |
39 | import com.hjx.personalcenter.http.HttpCode; | 39 | import com.hjx.personalcenter.http.HttpCode; |
40 | import com.hjx.personalcenter.http.HttpManager; | 40 | import com.hjx.personalcenter.http.HttpManager; |
41 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 41 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
42 | import com.hjx.personalcenter.model.DefautPublishInfo; | 42 | import com.hjx.personalcenter.model.DefautPublishInfo; |
43 | import com.hjx.personalcenter.model.PesonalInfo; | 43 | import com.hjx.personalcenter.model.PesonalInfo; |
44 | import com.hjx.personalcenter.model.SignInfo; | 44 | import com.hjx.personalcenter.model.SignInfo; |
45 | import com.hjx.personalcenter.model.VideoInfo; | 45 | import com.hjx.personalcenter.model.VideoInfo; |
46 | import com.hjx.personalcenter.update.UpdateChecker; | 46 | import com.hjx.personalcenter.update.UpdateChecker; |
47 | import com.hjx.personalcenter.util.AlertUtils; | 47 | import com.hjx.personalcenter.util.AlertUtils; |
48 | import com.hjx.personalcenter.util.BrithdayStar; | 48 | import com.hjx.personalcenter.util.BrithdayStar; |
49 | import com.hjx.personalcenter.util.CropUtils; | 49 | import com.hjx.personalcenter.util.CropUtils; |
50 | import com.hjx.personalcenter.util.DialogPermission; | 50 | import com.hjx.personalcenter.util.DialogPermission; |
51 | import com.hjx.personalcenter.util.FileUtil; | 51 | import com.hjx.personalcenter.util.FileUtil; |
52 | import com.hjx.personalcenter.util.GetDevicesUtil; | 52 | import com.hjx.personalcenter.util.GetDevicesUtil; |
53 | import com.hjx.personalcenter.util.PermissionUtil; | 53 | import com.hjx.personalcenter.util.PermissionUtil; |
54 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 54 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
55 | import com.mylhyl.circledialog.CircleDialog; | 55 | import com.mylhyl.circledialog.CircleDialog; |
56 | import com.mylhyl.circledialog.callback.ConfigInput; | 56 | import com.mylhyl.circledialog.callback.ConfigInput; |
57 | import com.mylhyl.circledialog.params.InputParams; | 57 | import com.mylhyl.circledialog.params.InputParams; |
58 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 58 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
59 | import com.zaaach.toprightmenu.MenuItem; | 59 | import com.zaaach.toprightmenu.MenuItem; |
60 | import com.zaaach.toprightmenu.TopRightMenu; | 60 | import com.zaaach.toprightmenu.TopRightMenu; |
61 | 61 | ||
62 | import org.json.JSONException; | 62 | import org.json.JSONException; |
63 | import org.json.JSONObject; | 63 | import org.json.JSONObject; |
64 | 64 | ||
65 | import java.io.File; | 65 | import java.io.File; |
66 | import java.io.UnsupportedEncodingException; | 66 | import java.io.UnsupportedEncodingException; |
67 | import java.util.ArrayList; | 67 | import java.util.ArrayList; |
68 | import java.util.List; | 68 | import java.util.List; |
69 | 69 | ||
70 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 70 | public class MainActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
71 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex,tv_edit_presoninfo; | 71 | private ImageView iv_imformatioan, iv_setting, iv_sign, iv_sex, tv_edit_presoninfo; |
72 | private TextView tv_sign, | 72 | private TextView tv_sign, |
73 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 73 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
74 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; | 74 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender, tv_yangji; |
75 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass,iv_look_card; | 75 | private TextView linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass, iv_look_card; |
76 | private TopRightMenu mTopRightMenu; | 76 | private TopRightMenu mTopRightMenu; |
77 | private LinearLayout view_novedeo; | 77 | private LinearLayout view_novedeo; |
78 | //水平滑动 | 78 | //水平滑动 |
79 | private RecyclerView mRecyclerView; | 79 | private RecyclerView mRecyclerView; |
80 | private GridView mRecyclerViewpublish; | 80 | private GridView mRecyclerViewpublish; |
81 | private VideoAdapter RecyclerViewadapter; | 81 | private VideoAdapter RecyclerViewadapter; |
82 | private MianGridAdapter RecyclerViewadapterpublish; | 82 | private MianGridAdapter RecyclerViewadapterpublish; |
83 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 83 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
84 | 84 | ||
85 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 85 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
86 | private boolean showIcon = true; | 86 | private boolean showIcon = false; |
87 | private boolean dimBg = true; | 87 | private boolean dimBg = false; |
88 | private boolean needAnim = true; | 88 | private boolean needAnim = true; |
89 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 89 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
90 | private static final int REQUEST_CODE_ALBUM = 2; | 90 | private static final int REQUEST_CODE_ALBUM = 2; |
91 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 91 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
92 | SimpleDraweeView mSimpleDraweeView; | 92 | SimpleDraweeView mSimpleDraweeView; |
93 | private File file; | 93 | private File file; |
94 | private Uri uri; | 94 | private Uri uri; |
95 | Handler handler = new Handler() { | 95 | Handler handler = new Handler() { |
96 | @Override | 96 | @Override |
97 | public void handleMessage(Message msg) { | 97 | public void handleMessage(Message msg) { |
98 | super.handleMessage(msg); | 98 | super.handleMessage(msg); |
99 | switch (msg.what) { | 99 | switch (msg.what) { |
100 | case HttpCode.GETINFO: | 100 | case HttpCode.GETINFO: |
101 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; | 101 | PesonalInfo.DataBean cardinfoBean = (PesonalInfo.DataBean) msg.obj; |
102 | tv_username.setText(cardinfoBean.getNickName()); | 102 | tv_username.setText(cardinfoBean.getNickName()); |
103 | tv_username1.setText(cardinfoBean.getNickName()); | 103 | tv_username1.setText(cardinfoBean.getNickName()); |
104 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 104 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
105 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 105 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
106 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 106 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
107 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 107 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
108 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 108 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
109 | String sex = cardinfoBean.getGender(); | 109 | String sex = cardinfoBean.getGender(); |
110 | if ("0".equals(sex)) { | 110 | if ("0".equals(sex)) { |
111 | tv_sex.setText("男"); | 111 | tv_sex.setText("男"); |
112 | iv_sex.setImageResource(R.mipmap.men); | 112 | iv_sex.setImageResource(R.mipmap.men); |
113 | } else { | 113 | } else { |
114 | tv_sex.setText("女"); | 114 | tv_sex.setText("女"); |
115 | iv_sex.setImageResource(R.mipmap.women); | 115 | iv_sex.setImageResource(R.mipmap.women); |
116 | } | 116 | } |
117 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 117 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
118 | //加载星座 | 118 | //加载星座 |
119 | BrithdayStar brithdayStar = new BrithdayStar(); | 119 | BrithdayStar brithdayStar = new BrithdayStar(); |
120 | if (cardinfoBean.getBirthday() ==null||"".equals(cardinfoBean.getBirthday())) { | 120 | if (cardinfoBean.getBirthday() == null || "".equals(cardinfoBean.getBirthday())) { |
121 | tv_mygad.setText(""); | 121 | tv_mygad.setText(""); |
122 | } else { | 122 | } else { |
123 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); | 123 | String xiongzuo = brithdayStar.getConstellations(cardinfoBean.getBirthday()); |
124 | tv_mygad.setText(xiongzuo); | 124 | tv_mygad.setText(xiongzuo); |
125 | } | 125 | } |
126 | //保存个人信息 | 126 | //保存个人信息 |
127 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTUSERNAME,cardinfoBean.getNickName()); | 127 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTUSERNAME, cardinfoBean.getNickName()); |
128 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTGRADES,cardinfoBean.getGrade().getGradeName()); | 128 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTGRADES, cardinfoBean.getGrade().getGradeName()); |
129 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSCHOOL,cardinfoBean.getSchool().getSchoolName()); | 129 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSCHOOL, cardinfoBean.getSchool().getSchoolName()); |
130 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTCONSTELLATION,cardinfoBean.getBirthday()); | 130 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTCONSTELLATION, cardinfoBean.getBirthday()); |
131 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTSEX,tv_sex.getText().toString()); | 131 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTSEX, tv_sex.getText().toString()); |
132 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTQQ,cardinfoBean.getQq()); | 132 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTQQ, cardinfoBean.getQq()); |
133 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTADRESS,cardinfoBean.getRegion().getRegionName()); | 133 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTADRESS, cardinfoBean.getRegion().getRegionName()); |
134 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ACCOUNTXINGZUO,cardinfoBean.getAddress()); | 134 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ACCOUNTXINGZUO, cardinfoBean.getAddress()); |
135 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.ADRESSID,cardinfoBean.getRegion().getRegionId()); | 135 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.ADRESSID, cardinfoBean.getRegion().getRegionId()); |
136 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.PORTAIT,cardinfoBean.getPortrait()); | 136 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.PORTAIT, cardinfoBean.getPortrait()); |
137 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.MAINSHOOLID, cardinfoBean.getSchool().getSchoolId()); | ||
137 | String graderID = cardinfoBean.getGrade().getGradeId(); | 138 | String graderID = cardinfoBean.getGrade().getGradeId(); |
138 | Log.e("test","nianji"+graderID); | 139 | Log.e("test", "nianji" + graderID); |
139 | try { | 140 | try { |
140 | long auserID = Long.parseLong(graderID); | 141 | long auserID = Long.parseLong(graderID); |
141 | String ss =SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 142 | String ss = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
142 | if ((auserID<8)&&(ss ==null)){ | 143 | if ((auserID < 8) && (ss == null)) { |
143 | Intent intentbroad = new Intent(); | 144 | Intent intentbroad = new Intent(); |
144 | intentbroad.putExtra("info","小学"); | 145 | intentbroad.putExtra("info", "小学"); |
145 | //4、定义广播发送的action | 146 | //4、定义广播发送的action |
146 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 147 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
147 | //5、发送广播 | 148 | //5、发送广播 |
148 | sendBroadcast(intentbroad); | 149 | sendBroadcast(intentbroad); |
149 | Log.i("---", "发送完了"); | 150 | Log.i("---", "发送完了"); |
150 | } | 151 | } |
151 | } catch (NumberFormatException e) { | 152 | } catch (NumberFormatException e) { |
152 | e.printStackTrace(); | 153 | e.printStackTrace(); |
153 | } | 154 | } |
154 | 155 | ||
155 | 156 | ||
156 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); | 157 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.GRADENS, graderID); |
157 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 158 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
158 | //账户类型 | 159 | //账户类型 |
159 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 160 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
160 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | 161 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); |
161 | 162 | ||
162 | try { | 163 | try { |
163 | Object auserID; | 164 | Object auserID; |
164 | int type; | 165 | int type; |
165 | int graderIDs = Integer.parseInt(graderID); | 166 | int graderIDs = Integer.parseInt(graderID); |
166 | if ("2".equals(accounts)) { | 167 | if ("2".equals(accounts)) { |
167 | type = Integer.parseInt(accounts); | 168 | type = Integer.parseInt(accounts); |
168 | auserID = childID; | 169 | auserID = childID; |
169 | } else { | 170 | } else { |
170 | type = Integer.parseInt(accounts); | 171 | type = Integer.parseInt(accounts); |
171 | auserID = Long.parseLong(userID); | 172 | auserID = Long.parseLong(userID); |
172 | } | 173 | } |
173 | //获取版本信息 | 174 | //获取版本信息 |
174 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); | 175 | //Log.e("test","nianji"+graderID+auserID+"sssss"+type); |
175 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); | 176 | HttpManager.getInstance().getpublishinfo(MainActivity.this, auserID, graderIDs, type, handler); |
176 | 177 | ||
177 | } catch (NumberFormatException e) { | 178 | } catch (NumberFormatException e) { |
178 | e.printStackTrace(); | 179 | e.printStackTrace(); |
179 | } | 180 | } |
180 | 181 | ||
181 | break; | 182 | break; |
182 | case HttpCode.SIGN: | 183 | case HttpCode.SIGN: |
183 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; | 184 | SignInfo.DataBean dataBean = (SignInfo.DataBean) msg.obj; |
184 | if (dataBean.getSignature() == null) { | 185 | if (dataBean.getSignature() == null) { |
185 | tv_sign.setText("你还未设置个性签名"); | 186 | tv_sign.setText("你还未设置个性签名"); |
186 | } else { | 187 | } else { |
187 | tv_sign.setText(dataBean.getSignature()); | 188 | tv_sign.setText(dataBean.getSignature()); |
188 | } | 189 | } |
189 | 190 | ||
190 | break; | 191 | break; |
191 | case HttpCode.PUBLISH_SUCESS: | 192 | case HttpCode.PUBLISH_SUCESS: |
192 | defautPublishInfos.clear(); | 193 | defautPublishInfos.clear(); |
193 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 194 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
194 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 195 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
195 | Gson gson = new Gson(); | 196 | Gson gson = new Gson(); |
196 | Log.e("test","(List<DefautPublishInfo.DataBean>) msg.obj"+ gson.toJson( msg.obj)); | 197 | Log.e("test", "(List<DefautPublishInfo.DataBean>) msg.obj" + gson.toJson(msg.obj)); |
197 | SaveParam.getInstance().saveLoginParam(MainActivity.this,SaveParam.VERSIONINTEFACE, gson.toJson( msg.obj)); | 198 | SaveParam.getInstance().saveLoginParam(MainActivity.this, SaveParam.VERSIONINTEFACE, gson.toJson(msg.obj)); |
198 | break; | 199 | break; |
199 | case HttpCode.GETVIDIO_SUCESS: | 200 | case HttpCode.GETVIDIO_SUCESS: |
200 | videoinfo.clear(); | 201 | videoinfo.clear(); |
201 | if (((List<VideoInfo.DataBean>) msg.obj).size()==0) { | 202 | view_novedeo.setVisibility(View.GONE); |
202 | view_novedeo.setVisibility(View.VISIBLE); | 203 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); |
203 | } else { | ||
204 | view_novedeo.setVisibility(View.GONE); | ||
205 | videoinfo.addAll((List<VideoInfo.DataBean>) msg.obj); | ||
206 | } | ||
207 | |||
208 | RecyclerViewadapter.notifyDataSetChanged(); | 204 | RecyclerViewadapter.notifyDataSetChanged(); |
209 | break; | 205 | break; |
210 | case HttpCode.SUCHCARDINFOONE: | 206 | case HttpCode.SUCHCARDINFOONE: |
211 | JSONObject jsonObject; | 207 | JSONObject jsonObject; |
212 | String status; | 208 | String status; |
213 | try { | 209 | try { |
214 | jsonObject = new JSONObject((String) msg.obj); | 210 | jsonObject = new JSONObject((String) msg.obj); |
215 | status = jsonObject.getString("status"); | 211 | status = jsonObject.getString("status"); |
216 | if (status.equals("1")) { | 212 | if (status.equals("1")) { |
217 | tv_yangji.setVisibility(View.GONE); | 213 | tv_yangji.setVisibility(View.GONE); |
218 | iv_look_card.setVisibility(View.VISIBLE); | 214 | iv_look_card.setVisibility(View.VISIBLE); |
219 | } else if (status.equals("2001")) { | 215 | } else if (status.equals("2001")) { |
220 | tv_yangji.setVisibility(View.GONE); | 216 | tv_yangji.setVisibility(View.GONE); |
221 | iv_look_card.setVisibility(View.VISIBLE); | 217 | iv_look_card.setVisibility(View.VISIBLE); |
222 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); | 218 | AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); |
223 | SaveParam.getInstance().clearData(MainActivity.this); | 219 | SaveParam.getInstance().clearData(MainActivity.this); |
224 | Intent settingintent = new Intent(); | 220 | Intent settingintent = new Intent(); |
225 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 221 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
226 | startActivity(settingintent); | 222 | startActivity(settingintent); |
227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 223 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
228 | finish(); | 224 | finish(); |
229 | } else if (status.equals("2002")) { | 225 | } else if (status.equals("2002")) { |
230 | iv_look_card.setVisibility(View.GONE); | 226 | iv_look_card.setVisibility(View.GONE); |
231 | tv_yangji.setVisibility(View.VISIBLE); | 227 | tv_yangji.setVisibility(View.VISIBLE); |
232 | 228 | ||
233 | } else { | 229 | } else { |
234 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); | 230 | AlertUtils.showToast(MainActivity.this, "服务器连接失败"); |
235 | } | 231 | } |
236 | } catch (JSONException e) { | 232 | } catch (JSONException e) { |
237 | e.printStackTrace(); | 233 | e.printStackTrace(); |
238 | } | 234 | } |
239 | 235 | ||
240 | 236 | ||
241 | } | 237 | } |
242 | } | 238 | } |
243 | }; | 239 | }; |
244 | 240 | ||
245 | @Override | 241 | @Override |
246 | protected void onCreate(Bundle savedInstanceState) { | 242 | protected void onCreate(Bundle savedInstanceState) { |
247 | super.onCreate(savedInstanceState); | 243 | super.onCreate(savedInstanceState); |
248 | Fresco.initialize(this); | 244 | Fresco.initialize(this); |
249 | setContentView(R.layout.activity_main); | 245 | setContentView(R.layout.activity_main); |
250 | SysApplication.getInstance().addActivity(this); | 246 | SysApplication.getInstance().addActivity(this); |
251 | initView(); | 247 | initView(); |
252 | initData(); | 248 | initData(); |
253 | initLister(); | 249 | initLister(); |
254 | updateVersion(); | 250 | updateVersion(); |
255 | } | 251 | } |
256 | 252 | ||
257 | //////版本更新 | 253 | //////版本更新 |
258 | private void updateVersion() { | 254 | private void updateVersion() { |
259 | UpdateChecker updateChecker = new UpdateChecker(this); | 255 | UpdateChecker updateChecker = new UpdateChecker(this); |
260 | updateChecker.checkForUpdates(); | 256 | updateChecker.checkForUpdates(); |
261 | 257 | ||
262 | 258 | ||
263 | } | 259 | } |
264 | 260 | ||
265 | private void initView() { | 261 | private void initView() { |
266 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 262 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
267 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); | 263 | iv_look_card = (TextView) findViewById(R.id.iv_look_card); |
268 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); | 264 | tv_edit_presoninfo = (ImageView) findViewById(R.id.tv_edit_presoninfo); |
269 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 265 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
270 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 266 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
271 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 267 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
272 | //头像 | 268 | //头像 |
273 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 269 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
274 | //初始化个人信息 | 270 | //初始化个人信息 |
275 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 271 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
276 | tv_username = (TextView) findViewById(R.id.tv_username); | 272 | tv_username = (TextView) findViewById(R.id.tv_username); |
277 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 273 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
278 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 274 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
279 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 275 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
280 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 276 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
281 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 277 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
282 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 278 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
283 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 279 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
284 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 280 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
285 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); | 281 | tv_yangji = (TextView) findViewById(R.id.tv_yangji); |
286 | //跳转其他应用 | 282 | //跳转其他应用 |
287 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); | 283 | linel_mycuoti = (TextView) findViewById(R.id.linel_mycuoti); |
288 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); | 284 | linel_mynote = (TextView) findViewById(R.id.linel_mynote); |
289 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); | 285 | linel_mycollege = (TextView) findViewById(R.id.linel_mycollege); |
290 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); | 286 | linel_myclass = (TextView) findViewById(R.id.linel_myclass); |
291 | // | 287 | // |
292 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 288 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
293 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); | 289 | mRecyclerViewpublish = (GridView) findViewById(R.id.id_recyclerview_pubish); |
294 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); | 290 | view_novedeo = (LinearLayout) findViewById(R.id.view_novedeo); |
295 | } | 291 | } |
296 | 292 | ||
297 | 293 | ||
298 | private void initData() { | 294 | private void initData() { |
299 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 295 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
300 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 296 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
301 | uri = Uri.fromFile(file); | 297 | uri = Uri.fromFile(file); |
302 | } else { | 298 | } else { |
303 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 299 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
304 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 300 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
305 | } | 301 | } |
306 | //设置布局管理器 | 302 | //设置布局管理器 |
307 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 303 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
308 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 304 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
309 | 305 | ||
310 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 306 | // LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
311 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 307 | // linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
312 | 308 | ||
313 | mRecyclerView.setLayoutManager(linearLayoutManager); | 309 | mRecyclerView.setLayoutManager(linearLayoutManager); |
314 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 310 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
315 | 311 | ||
316 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 312 | // mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
317 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 313 | // mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
318 | 314 | ||
319 | //设置视频适配器 | 315 | //设置视频适配器 |
320 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); | 316 | RecyclerViewadapter = new VideoAdapter(this, videoinfo); |
321 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos,this); | 317 | RecyclerViewadapterpublish = new MianGridAdapter(defautPublishInfos, this); |
322 | 318 | ||
323 | //版本信息适配器 | 319 | //版本信息适配器 |
324 | mRecyclerView.setAdapter(RecyclerViewadapter); | 320 | mRecyclerView.setAdapter(RecyclerViewadapter); |
325 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 321 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
326 | 322 | ||
327 | //判断保卡信息是否为样机 | 323 | //判断保卡信息是否为样机 |
328 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); | 324 | String yangji = SaveParam.getInstance().getLoginParam(this, SaveParam.YANGJI); |
329 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); | 325 | String deviceNumber = GetDevicesUtil.getDevicesInfo(MainActivity.this).getDeviceNumber(); |
330 | if ("1".equals(yangji)) { | 326 | if ("1".equals(yangji)) { |
331 | iv_look_card.setVisibility(View.GONE); | 327 | iv_look_card.setVisibility(View.GONE); |
332 | tv_yangji.setVisibility(View.VISIBLE); | 328 | tv_yangji.setVisibility(View.VISIBLE); |
333 | } else { | 329 | } else { |
334 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); | 330 | HttpManager.getInstance().getcardinfo1(this, deviceNumber, handler); |
335 | 331 | ||
336 | } | 332 | } |
337 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | ||
338 | //获取个性签名 | ||
339 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | ||
340 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | ||
341 | |||
342 | try { | ||
343 | long auserID = 1; | ||
344 | long id = Long.parseLong(userID); | ||
345 | long childssID = Long.parseLong(childsID); | ||
346 | |||
347 | int typeaccount1 = Integer.parseInt(typeaccount); | ||
348 | if (typeaccount1==2){ | ||
349 | auserID =childssID; | ||
350 | }else { | ||
351 | auserID =id; | ||
352 | } | ||
353 | |||
354 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | ||
355 | |||
356 | } catch (NumberFormatException e) { | ||
357 | e.printStackTrace(); | ||
358 | } | ||
359 | 333 | ||
360 | 334 | ||
361 | } | 335 | } |
362 | 336 | ||
363 | private void initLister() { | 337 | private void initLister() { |
364 | iv_imformatioan.setOnClickListener(this); | 338 | iv_imformatioan.setOnClickListener(this); |
365 | iv_look_card.setOnClickListener(this); | 339 | iv_look_card.setOnClickListener(this); |
366 | tv_edit_presoninfo.setOnClickListener(this); | 340 | tv_edit_presoninfo.setOnClickListener(this); |
367 | iv_setting.setOnClickListener(this); | 341 | iv_setting.setOnClickListener(this); |
368 | iv_sign.setOnClickListener(this); | 342 | iv_sign.setOnClickListener(this); |
369 | mSimpleDraweeView.setOnClickListener(this); | 343 | mSimpleDraweeView.setOnClickListener(this); |
370 | linel_mycuoti.setOnClickListener(this); | 344 | linel_mycuoti.setOnClickListener(this); |
371 | linel_mynote.setOnClickListener(this); | 345 | linel_mynote.setOnClickListener(this); |
372 | linel_mycollege.setOnClickListener(this); | 346 | linel_mycollege.setOnClickListener(this); |
373 | linel_myclass.setOnClickListener(this); | 347 | linel_myclass.setOnClickListener(this); |
374 | 348 | ||
375 | } | 349 | } |
376 | 350 | ||
377 | @Override | 351 | @Override |
378 | public void onClick(View v) { | 352 | public void onClick(View v) { |
379 | switch (v.getId()) { | 353 | switch (v.getId()) { |
380 | case R.id.iv_imformatioan: | 354 | case R.id.iv_imformatioan: |
381 | Intent intent = new Intent(); | 355 | Intent intent = new Intent(); |
382 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 356 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
383 | startActivity(intent); | 357 | startActivity(intent); |
384 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 358 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
385 | break; | 359 | break; |
386 | case R.id.iv_look_card: | 360 | case R.id.iv_look_card: |
387 | Intent lookintent = new Intent(); | 361 | Intent lookintent = new Intent(); |
388 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 362 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
389 | startActivity(lookintent); | 363 | startActivity(lookintent); |
390 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 364 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
391 | break; | 365 | break; |
392 | case R.id.tv_edit_presoninfo: | 366 | case R.id.tv_edit_presoninfo: |
393 | Intent editintent = new Intent(); | 367 | Intent editintent = new Intent(); |
394 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 368 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
395 | startActivity(editintent); | 369 | startActivity(editintent); |
396 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 370 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
397 | break; | 371 | break; |
398 | case R.id.iv_head: | 372 | case R.id.iv_head: |
399 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 373 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
400 | break; | 374 | break; |
401 | case R.id.iv_setting: | 375 | case R.id.iv_setting: |
402 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 376 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
403 | List<MenuItem> menuItems = new ArrayList<>(); | 377 | List<MenuItem> menuItems = new ArrayList<>(); |
404 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 378 | menuItems.add(new MenuItem(R.mipmap.blank, " 切换账户")); |
405 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 379 | menuItems.add(new MenuItem(R.mipmap.blank, " 账户管理")); |
406 | mTopRightMenu | 380 | mTopRightMenu |
407 | .setHeight(150) //默认高度480 | 381 | .setHeight(150) //默认高度480 |
408 | .setWidth(320) //默认宽度wrap_content | 382 | .setWidth(180) //默认宽度wrap_content |
409 | .showIcon(showIcon) //显示菜单图标,默认为true | 383 | .showIcon(showIcon) //显示菜单图标,默认为true |
410 | .dimBackground(dimBg) //背景变暗,默认为true | 384 | .dimBackground(dimBg) //背景变暗,默认为true |
411 | .needAnimationStyle(needAnim) //显示动画,默认为true | 385 | .needAnimationStyle(needAnim) //显示动画,默认为true |
412 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 386 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
413 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 387 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
414 | @Override | 388 | @Override |
415 | public void onMenuItemClick(int position) { | 389 | public void onMenuItemClick(int position) { |
416 | switch (position) { | 390 | switch (position) { |
417 | case 0: | 391 | case 0: |
418 | new CircleDialog.Builder(MainActivity.this) | 392 | new CircleDialog.Builder(MainActivity.this) |
419 | .setCanceledOnTouchOutside(false) | 393 | .setCanceledOnTouchOutside(false) |
420 | .setWidth(0.4f) | 394 | .setWidth(0.4f) |
421 | .setCancelable(false) | 395 | .setCancelable(false) |
422 | .setText("您确定要退出,更换其他账号登录吗?") | 396 | .setText("您确定要退出,更换其他账号登录吗?") |
423 | .setNegative("取消", null) | 397 | .setNegative("取消", null) |
424 | .setPositive("确定", new View.OnClickListener() { | 398 | .setPositive("确定", new View.OnClickListener() { |
425 | @Override | 399 | @Override |
426 | public void onClick(View v) { | 400 | public void onClick(View v) { |
427 | String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); | 401 | String graderID = SaveParam.getInstance().getLoginParam(MainActivity.this, SaveParam.GRADENS); |
428 | int graderIDs = Integer.parseInt(graderID); | 402 | int graderIDs = Integer.parseInt(graderID); |
429 | if (graderIDs<8){ | 403 | if (graderIDs < 8) { |
430 | Intent intentbroad = new Intent(); | 404 | Intent intentbroad = new Intent(); |
431 | intentbroad.putExtra("info","小学"); | 405 | intentbroad.putExtra("info", "小学"); |
432 | //4、定义广播发送的action | 406 | //4、定义广播发送的action |
433 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 407 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
434 | //5、发送广播 | 408 | //5、发送广播 |
435 | sendBroadcast(intentbroad); | 409 | sendBroadcast(intentbroad); |
436 | Log.i("---", "发送完了"); | 410 | Log.i("---", "发送完了"); |
437 | } | 411 | } |
438 | //清除数据 | 412 | //清除数据 |
439 | SaveParam.getInstance().clearData(MainActivity.this); | 413 | SaveParam.getInstance().clearData(MainActivity.this); |
440 | Intent settingintent = new Intent(); | 414 | Intent settingintent = new Intent(); |
441 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 415 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
442 | startActivity(settingintent); | 416 | startActivity(settingintent); |
443 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 417 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
444 | finish(); | 418 | finish(); |
445 | } | 419 | } |
446 | }) | 420 | }) |
447 | .show(); | 421 | .show(); |
448 | break; | 422 | break; |
449 | case 1: | 423 | case 1: |
450 | Intent accontMintent = new Intent(); | 424 | Intent accontMintent = new Intent(); |
451 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 425 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
452 | startActivity(accontMintent); | 426 | startActivity(accontMintent); |
453 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 427 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
454 | break; | 428 | break; |
455 | } | 429 | } |
456 | } | 430 | } |
457 | }) | 431 | }) |
458 | .addMenuList(menuItems) | 432 | .addMenuList(menuItems) |
459 | .showAsDropDown(iv_setting, -250, 0); | 433 | .showAsDropDown(iv_setting, -120, 0); |
460 | break; | 434 | break; |
461 | case R.id.iv_sign: | 435 | case R.id.iv_sign: |
462 | new CircleDialog.Builder(this) | 436 | new CircleDialog.Builder(this) |
463 | .setCanceledOnTouchOutside(false) | 437 | .setCanceledOnTouchOutside(false) |
464 | .setCancelable(true) | 438 | .setCancelable(true) |
465 | .setTitle("个性签名") | 439 | .setTitle("个性签名") |
466 | .setInputHint("请输入个性签名") | 440 | .setInputHint("请输入个性签名") |
467 | .setWidth(0.5f) | 441 | .setWidth(0.5f) |
468 | .configInput(new ConfigInput() { | 442 | .configInput(new ConfigInput() { |
469 | @Override | 443 | @Override |
470 | public void onConfig(InputParams params) { | 444 | public void onConfig(InputParams params) { |
471 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 445 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
472 | } | 446 | } |
473 | }) | 447 | }) |
474 | .setNegative("取消", new View.OnClickListener() { | 448 | .setNegative("取消", new View.OnClickListener() { |
475 | @Override | 449 | @Override |
476 | public void onClick(View v) { | 450 | public void onClick(View v) { |
477 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 451 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
478 | } | 452 | } |
479 | }) | 453 | }) |
480 | .setPositiveInput("确定", new OnInputClickListener() { | 454 | .setPositiveInput("确定", new OnInputClickListener() { |
481 | @Override | 455 | @Override |
482 | public void onClick(String text, View v) { | 456 | public void onClick(String text, View v) { |
483 | if (text.equals("")) { | 457 | if (text.equals("")) { |
484 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 458 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
485 | } else { | 459 | } else { |
486 | try { | 460 | try { |
487 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); | 461 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.ACCOUNT); |
488 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); | 462 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this, "userId"); |
463 | String childsID = SaveParam.getInstance().getCustomizeParam(MainActivity.this, SaveParam.CHILDSID); | ||
464 | Object id = null; | ||
489 | long auserID = Long.parseLong(userID); | 465 | long auserID = Long.parseLong(userID); |
490 | int typeaccount1 = Integer.parseInt(typeaccount); | 466 | int typeaccount1 = Integer.parseInt(typeaccount); |
491 | HttpManager.getInstance().changsignature(MainActivity.this, auserID, typeaccount1, text); | 467 | if (typeaccount1 ==2){ |
468 | id =childsID; | ||
469 | }else { | ||
470 | id =auserID; | ||
471 | } | ||
472 | HttpManager.getInstance().changsignature(MainActivity.this, id, typeaccount1, text); | ||
492 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 473 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
493 | } catch (NumberFormatException e) { | 474 | } catch (NumberFormatException e) { |
494 | e.printStackTrace(); | 475 | e.printStackTrace(); |
495 | } | 476 | } |
496 | 477 | ||
497 | tv_sign.setText(text); | 478 | tv_sign.setText(text); |
498 | } | 479 | } |
499 | 480 | ||
500 | } | 481 | } |
501 | }) | 482 | }) |
502 | .show(); | 483 | .show(); |
503 | break; | 484 | break; |
504 | case R.id.linel_mycuoti: | 485 | case R.id.linel_mycuoti: |
505 | // Intent intentbroad = new Intent(); | 486 | // Intent intentbroad = new Intent(); |
506 | // //intentbroad.putExtra("info","小学"); | 487 | // //intentbroad.putExtra("info","小学"); |
507 | // //4、定义广播发送的action | 488 | // //4、定义广播发送的action |
508 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 489 | // intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
509 | // //5、发送广播 | 490 | // //5、发送广播 |
510 | // sendBroadcast(intentbroad); | 491 | // sendBroadcast(intentbroad); |
511 | // Log.i("---", "发送完了"); | 492 | // Log.i("---", "发送完了"); |
512 | break; | 493 | break; |
513 | case R.id.linel_mynote: | 494 | case R.id.linel_mynote: |
514 | // Intent intentbroad1 = new Intent(); | 495 | // Intent intentbroad1 = new Intent(); |
515 | // //intentbroad1.putExtra("info","中学"); | 496 | // //intentbroad1.putExtra("info","中学"); |
516 | // //4、定义广播发送的action | 497 | // //4、定义广播发送的action |
517 | // intentbroad1.setAction("com.ozing.launcher.SWITCH_GRADE"); | 498 | // intentbroad1.setAction("com.ozing.launcher.SWITCH_GRADE"); |
518 | // //5、发送广播 | 499 | // //5、发送广播 |
519 | // sendBroadcast(intentbroad1); | 500 | // sendBroadcast(intentbroad1); |
520 | // Log.i("---", "发送完了"); | 501 | // Log.i("---", "发送完了"); |
521 | break; | 502 | break; |
522 | case R.id.linel_mycollege: | 503 | case R.id.linel_mycollege: |
523 | AlertUtils.showToast(this, "我的收藏 "); | 504 | AlertUtils.showToast(this, "我的收藏 "); |
524 | break; | 505 | break; |
525 | case R.id.linel_myclass: | 506 | case R.id.linel_myclass: |
526 | AlertUtils.showToast(this, "我的班级 "); | 507 | AlertUtils.showToast(this, "我的班级 "); |
527 | break; | 508 | break; |
528 | } | 509 | } |
529 | 510 | ||
530 | } | 511 | } |
531 | 512 | ||
532 | @Override | 513 | @Override |
533 | protected void onPause() { | 514 | protected void onPause() { |
534 | super.onPause(); | 515 | super.onPause(); |
535 | } | 516 | } |
536 | 517 | ||
537 | @Override | 518 | @Override |
538 | protected void onResume() { | 519 | protected void onResume() { |
539 | super.onResume(); | 520 | super.onResume(); |
540 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 521 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
541 | //账户类型 | 522 | //获取个性签名 |
542 | String accounts = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 523 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
524 | String childsID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | ||
525 | |||
543 | try { | 526 | try { |
544 | int graderID; | 527 | Object auserID = 1; |
545 | long auserID = Long.parseLong(userID); | 528 | long id = Long.parseLong(userID); |
546 | int typeaccount1 = Integer.parseInt(accounts); | 529 | int typeaccount1 = Integer.parseInt(typeaccount); |
547 | //获取最近播放视频 | ||
548 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | ||
549 | //获取个人信息 | 530 | //获取个人信息 |
550 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, auserID, typeaccount1, handler); | 531 | HttpManager.getInstance().getpresonalinfo(MainActivity.this, id, typeaccount1, handler); |
551 | 532 | if (typeaccount1 == 2) { | |
533 | auserID = childsID; | ||
534 | } else { | ||
535 | auserID = id; | ||
536 | } | ||
537 | Log.e("test","个性签名的ID"+auserID); | ||
538 | HttpManager.getInstance().getsignatures(MainActivity.this, auserID, typeaccount1, handler); | ||
539 | //获取最近播放视频 | ||
540 | HttpManager.getInstance().getstuyvidioinfo(this, auserID, handler); | ||
552 | 541 | ||
553 | } catch (NumberFormatException e) { | 542 | } catch (NumberFormatException e) { |
554 | e.printStackTrace(); | 543 | e.printStackTrace(); |
555 | } | 544 | } |
556 | 545 | ||
557 | } | 546 | } |
558 | 547 | ||
559 | //回调头像监听 | 548 | //回调头像监听 |
560 | @Override | 549 | @Override |
561 | public void heard(Context context, View v, int headpitiaon) { | 550 | public void heard(Context context, View v, int headpitiaon) { |
562 | String picUrl = ""; | 551 | String picUrl = ""; |
563 | String userID; | 552 | String userID; |
564 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 553 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
565 | if ("2".equals(typeaccount)) { | 554 | if ("2".equals(typeaccount)) { |
566 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 555 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
567 | } else { | 556 | } else { |
568 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 557 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
569 | } | 558 | } |
570 | switch (v.getId()) { | 559 | switch (v.getId()) { |
571 | //选择默认图片 | 560 | //选择默认图片 |
572 | case R.id.oktakephone: | 561 | case R.id.oktakephone: |
573 | if (headpitiaon == 1) { | 562 | if (headpitiaon == 1) { |
574 | mSimpleDraweeView.setImageDrawable(null); | 563 | mSimpleDraweeView.setImageDrawable(null); |
575 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 564 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
576 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 565 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
577 | try { | 566 | try { |
578 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 567 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
579 | } catch (UnsupportedEncodingException e) { | 568 | } catch (UnsupportedEncodingException e) { |
580 | e.printStackTrace(); | 569 | e.printStackTrace(); |
581 | } | 570 | } |
582 | } else if (headpitiaon == 2) { | 571 | } else if (headpitiaon == 2) { |
583 | mSimpleDraweeView.setImageDrawable(null); | 572 | mSimpleDraweeView.setImageDrawable(null); |
584 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 573 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
585 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 574 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
586 | try { | 575 | try { |
587 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 576 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
588 | } catch (UnsupportedEncodingException e) { | 577 | } catch (UnsupportedEncodingException e) { |
589 | e.printStackTrace(); | 578 | e.printStackTrace(); |
590 | } | 579 | } |
591 | } else if (headpitiaon == 3) { | 580 | } else if (headpitiaon == 3) { |
592 | mSimpleDraweeView.setImageDrawable(null); | 581 | mSimpleDraweeView.setImageDrawable(null); |
593 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 582 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
594 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 583 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
595 | try { | 584 | try { |
596 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 585 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
597 | } catch (UnsupportedEncodingException e) { | 586 | } catch (UnsupportedEncodingException e) { |
598 | e.printStackTrace(); | 587 | e.printStackTrace(); |
599 | } | 588 | } |
600 | } else if (headpitiaon == 4) { | 589 | } else if (headpitiaon == 4) { |
601 | mSimpleDraweeView.setImageDrawable(null); | 590 | mSimpleDraweeView.setImageDrawable(null); |
602 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 591 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
603 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 592 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
604 | try { | 593 | try { |
605 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); | 594 | HttpManager.getInstance().headerdeft(this, userID, typeaccount, picUrl); |
606 | } catch (UnsupportedEncodingException e) { | 595 | } catch (UnsupportedEncodingException e) { |
607 | e.printStackTrace(); | 596 | e.printStackTrace(); |
608 | } | 597 | } |
609 | } else { | 598 | } else { |
610 | mSimpleDraweeView.setImageDrawable(null); | 599 | mSimpleDraweeView.setImageDrawable(null); |
611 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); | 600 | mSimpleDraweeView.setImageResource(R.mipmap.header_default); |
612 | ; | 601 | ; |
613 | } | 602 | } |
614 | 603 | ||
615 | break; | 604 | break; |
616 | case R.id.canceltakephone: | 605 | case R.id.canceltakephone: |
617 | 606 | ||
618 | break; | 607 | break; |
619 | //拍摄和相册 | 608 | //拍摄和相册 |
620 | case R.id.take_pic: | 609 | case R.id.take_pic: |
621 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 610 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
622 | uploadAvatarFromPhotoRequest(); | 611 | uploadAvatarFromPhotoRequest(); |
623 | } | 612 | } |
624 | break; | 613 | break; |
625 | case R.id.xiangce: | 614 | case R.id.xiangce: |
626 | uploadAvatarFromAlbumRequest(); | 615 | uploadAvatarFromAlbumRequest(); |
627 | break; | 616 | break; |
628 | 617 | ||
629 | } | 618 | } |
630 | 619 | ||
631 | } | 620 | } |
621 | |||
632 | //照相 | 622 | //照相 |
633 | private void uploadAvatarFromPhotoRequest() { | 623 | private void uploadAvatarFromPhotoRequest() { |
634 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 624 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
635 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 625 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
636 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 626 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
637 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 627 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
638 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 628 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
639 | } | 629 | } |
640 | 630 | ||
641 | //选择图库 | 631 | //选择图库 |
642 | private void uploadAvatarFromAlbumRequest() { | 632 | private void uploadAvatarFromAlbumRequest() { |
643 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 633 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
644 | photoPickerIntent.setType("image/*"); | 634 | photoPickerIntent.setType("image/*"); |
645 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 635 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
646 | } | 636 | } |
647 | 637 | ||
648 | //回掉 | 638 | //回掉 |
649 | @Override | 639 | @Override |
650 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 640 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
651 | super.onActivityResult(requestCode, resultCode, data); | 641 | super.onActivityResult(requestCode, resultCode, data); |
652 | if (resultCode != -1) { | 642 | if (resultCode != -1) { |
653 | return; | 643 | return; |
654 | } | 644 | } |
655 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 645 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
656 | Uri newUri; | 646 | Uri newUri; |
657 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 647 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
658 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 648 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
659 | } else { | 649 | } else { |
660 | newUri = data.getData(); | 650 | newUri = data.getData(); |
661 | } | 651 | } |
662 | if (newUri != null) { | 652 | if (newUri != null) { |
663 | startPhotoZoom(newUri); | 653 | startPhotoZoom(newUri); |
664 | } else { | 654 | } else { |
665 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 655 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
666 | } | 656 | } |
667 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 657 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
668 | //startPhotoZoom(uri); | 658 | //startPhotoZoom(uri); |
669 | uploadAvatarFromPhoto(); | 659 | uploadAvatarFromPhoto(); |
670 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 660 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
671 | uploadAvatarFromPhoto(); | 661 | uploadAvatarFromPhoto(); |
672 | } | 662 | } |
673 | } | 663 | } |
674 | 664 | ||
675 | private void uploadAvatarFromPhoto() { | 665 | private void uploadAvatarFromPhoto() { |
676 | compressAndUploadAvatar(file.getPath()); | 666 | compressAndUploadAvatar(file.getPath()); |
677 | 667 | ||
678 | } | 668 | } |
679 | 669 | ||
680 | private void compressAndUploadAvatar(String fileSrc) { | 670 | private void compressAndUploadAvatar(String fileSrc) { |
681 | 671 | ||
682 | 672 | ||
683 | //上传到服务器 | 673 | //上传到服务器 |
684 | 674 | ||
685 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 675 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
686 | String mimeType = "image/*"; | 676 | String mimeType = "image/*"; |
687 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 677 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
688 | //String fileName = cover.getName(); | 678 | //String fileName = cover.getName(); |
689 | String userID; | 679 | String userID; |
690 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 680 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
691 | if ("2".equals(typeaccount)) { | 681 | if ("2".equals(typeaccount)) { |
692 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); | 682 | userID = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSID); |
693 | } else { | 683 | } else { |
694 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 684 | userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
695 | } | 685 | } |
696 | 686 | ||
697 | //上传头像 | 687 | //上传头像 |
698 | 688 | ||
699 | try { | 689 | try { |
700 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); | 690 | HttpManager.getInstance().header(this, userID, typeaccount, fileSrc); |
701 | } catch (UnsupportedEncodingException e) { | 691 | } catch (UnsupportedEncodingException e) { |
702 | e.printStackTrace(); | 692 | e.printStackTrace(); |
703 | } | 693 | } |
704 | 694 | ||
705 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 695 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
706 | GenericDraweeHierarchy hierarchy = builder | 696 | GenericDraweeHierarchy hierarchy = builder |
707 | .setDesiredAspectRatio(1f) | 697 | .setDesiredAspectRatio(1f) |
708 | .setFailureImage(R.mipmap.header_default) | 698 | .setFailureImage(R.mipmap.header_default) |
709 | //圆形头像 | 699 | //圆形头像 |
710 | .setRoundingParams(RoundingParams.asCircle()) | 700 | .setRoundingParams(RoundingParams.asCircle()) |
711 | .build(); | 701 | .build(); |
712 | 702 | ||
713 | //加载本地图片 | 703 | //加载本地图片 |
714 | Uri uri = Uri.fromFile(cover); | 704 | Uri uri = Uri.fromFile(cover); |
715 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 705 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
716 | .setOldController(mSimpleDraweeView.getController()) | 706 | .setOldController(mSimpleDraweeView.getController()) |
717 | .setUri(uri) | 707 | .setUri(uri) |
718 | .build(); | 708 | .build(); |
719 | mSimpleDraweeView.setHierarchy(hierarchy); | 709 | mSimpleDraweeView.setHierarchy(hierarchy); |
720 | mSimpleDraweeView.setController(controller); | 710 | mSimpleDraweeView.setController(controller); |
721 | 711 | ||
722 | } | 712 | } |
723 | 713 | ||
724 | public void startPhotoZoom(Uri uri) { | 714 | public void startPhotoZoom(Uri uri) { |
725 | Intent intent = new Intent("com.android.camera.action.CROP"); | 715 | Intent intent = new Intent("com.android.camera.action.CROP"); |
726 | intent.setDataAndType(uri, "image/*"); | 716 | intent.setDataAndType(uri, "image/*"); |
727 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 717 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
728 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 718 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
729 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 719 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
730 | intent.putExtra("aspectY", 1);// x:y=1:1 | 720 | intent.putExtra("aspectY", 1);// x:y=1:1 |
731 | // intent.putExtra("outputX", 400);//图片输出大小 | 721 | // intent.putExtra("outputX", 400);//图片输出大小 |
732 | // intent.putExtra("outputY", 400); | 722 | // intent.putExtra("outputY", 400); |
733 | intent.putExtra("output", Uri.fromFile(file)); | 723 | intent.putExtra("output", Uri.fromFile(file)); |
734 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 724 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
735 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 725 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
736 | } | 726 | } |
737 | 727 | ||
738 | @Override | 728 | @Override |
739 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 729 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
740 | switch (requestCode) { | 730 | switch (requestCode) { |
741 | 731 | ||
742 | case PermissionUtil.REQUEST_SHOWCAMERA: | 732 | case PermissionUtil.REQUEST_SHOWCAMERA: |
743 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 733 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
744 | // Permission Granted | 734 | // Permission Granted |
745 | uploadAvatarFromPhotoRequest(); | 735 | uploadAvatarFromPhotoRequest(); |
746 | 736 | ||
747 | } else { | 737 | } else { |
748 | if (!SharedPreferenceMark.getHasShowCamera()) { | 738 | if (!SharedPreferenceMark.getHasShowCamera()) { |
749 | SharedPreferenceMark.setHasShowCamera(true); | 739 | SharedPreferenceMark.setHasShowCamera(true); |
750 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 740 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
751 | 741 | ||
752 | } else { | 742 | } else { |
753 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 743 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
754 | .show(); | 744 | .show(); |
755 | } | 745 | } |
756 | } | 746 | } |
757 | break; | 747 | break; |
758 | default: | 748 | default: |
759 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 749 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
760 | } | 750 | } |
761 | } | 751 | } |
762 | 752 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Application; | 3 | import android.app.Application; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.drawable.Drawable; | 5 | import android.graphics.drawable.Drawable; |
6 | import android.os.Looper; | 6 | import android.os.Looper; |
7 | import android.view.Gravity; | 7 | import android.view.Gravity; |
8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
10 | 10 | ||
11 | import com.facebook.drawee.backends.pipeline.Fresco; | 11 | import com.facebook.drawee.backends.pipeline.Fresco; |
12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.crash.CrashHandler; | 13 | import com.hjx.personalcenter.crash.CrashHandler; |
14 | import com.hjx.personalcenter.util.ImageCache; | 14 | import com.hjx.personalcenter.util.ImageCache; |
15 | import com.squareup.leakcanary.LeakCanary; | ||
16 | import com.tencent.bugly.crashreport.CrashReport; | 15 | import com.tencent.bugly.crashreport.CrashReport; |
17 | 16 | ||
18 | /** | 17 | /** |
19 | * Created by ${yf} on 2017/2/16. | 18 | * Created by ${yf} on 2017/2/16. |
20 | */ | 19 | */ |
21 | 20 | ||
22 | public class MyApplication extends Application { | 21 | public class MyApplication extends Application { |
23 | 22 | ||
24 | private ImageCache mImageCache; | 23 | private ImageCache mImageCache; |
25 | private static Context context; | 24 | private static Context context; |
26 | private static MyApplication instance; | 25 | private static MyApplication instance; |
27 | @Override | 26 | @Override |
28 | public void onCreate() { | 27 | public void onCreate() { |
29 | context = getApplicationContext(); | 28 | context = getApplicationContext(); |
30 | //c初始化内存检测 | 29 | //c初始化内存检测 |
31 | LeakCanary.install(this); | 30 | // LeakCanary.install(this); |
32 | //初始化Fresco | 31 | //初始化Fresco |
33 | Fresco.initialize(this); | 32 | Fresco.initialize(this); |
34 | mImageCache = new ImageCache(); | 33 | mImageCache = new ImageCache(); |
35 | instance = this; | 34 | instance = this; |
36 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); | 35 | CrashReport.initCrashReport(getApplicationContext(), "c2170557a0", false); |
37 | CrashHandler crashHandler = CrashHandler.getInstance(); | 36 | CrashHandler crashHandler = CrashHandler.getInstance(); |
38 | //生成错误日志,上线的时候得放开 | 37 | //生成错误日志,上线的时候得放开 |
39 | //crashHandler.init(getApplicationContext()); | 38 | //crashHandler.init(getApplicationContext()); |
40 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { | 39 | crashHandler.registerHandler(new CrashHandler.ExceptionHandler() { |
41 | 40 | ||
42 | @Override | 41 | @Override |
43 | public boolean handleCrash(final Context context, final Throwable ex) { | 42 | public boolean handleCrash(final Context context, final Throwable ex) { |
44 | new Thread(new Runnable() { | 43 | new Thread(new Runnable() { |
45 | 44 | ||
46 | @Override | 45 | @Override |
47 | public void run() { | 46 | public void run() { |
48 | Looper.prepare(); | 47 | Looper.prepare(); |
49 | System.out.println("bcz = " + ex.toString()); | 48 | System.out.println("bcz = " + ex.toString()); |
50 | Toast toast = new Toast(context); | 49 | Toast toast = new Toast(context); |
51 | TextView tv = new TextView(context); | 50 | TextView tv = new TextView(context); |
52 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); | 51 | tv.setText(" 很抱歉,"+context.getString(R.string.app_name)+"崩溃了,我们会尽快修复."); |
53 | tv.setPadding(10, 10, 10, 10); | 52 | tv.setPadding(10, 10, 10, 10); |
54 | tv.setTextSize(20); | 53 | tv.setTextSize(20); |
55 | tv.setBackgroundResource(R.drawable.black_btn_default); | 54 | tv.setBackgroundResource(R.drawable.black_btn_default); |
56 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); | 55 | tv.setTextColor(context.getResources().getColor(android.R.color.white)); |
57 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); | 56 | Drawable drawable= context.getResources().getDrawable(R.drawable.sorry); |
58 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); | 57 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); |
59 | tv.setCompoundDrawables(drawable,null,null,null); | 58 | tv.setCompoundDrawables(drawable,null,null,null); |
60 | toast.setView(tv); | 59 | toast.setView(tv); |
61 | toast.setGravity(Gravity.CENTER, 0, 0); | 60 | toast.setGravity(Gravity.CENTER, 0, 0); |
62 | toast.setDuration(Toast.LENGTH_LONG); | 61 | toast.setDuration(Toast.LENGTH_LONG); |
63 | toast.show(); | 62 | toast.show(); |
64 | Looper.loop(); | 63 | Looper.loop(); |
65 | } | 64 | } |
66 | }).start(); | 65 | }).start(); |
67 | try { | 66 | try { |
68 | Thread.sleep(1000); | 67 | Thread.sleep(1000); |
69 | } catch (InterruptedException e) { | 68 | } catch (InterruptedException e) { |
70 | // TODO Auto-generated catch block | 69 | // TODO Auto-generated catch block |
71 | e.printStackTrace(); | 70 | e.printStackTrace(); |
72 | } | 71 | } |
73 | return false; | 72 | return false; |
74 | } | 73 | } |
75 | }); | 74 | }); |
76 | super.onCreate(); | 75 | super.onCreate(); |
77 | } | 76 | } |
78 | public ImageCache getImageCache() { | 77 | public ImageCache getImageCache() { |
79 | return mImageCache; | 78 | return mImageCache; |
80 | } | 79 | } |
81 | 80 | ||
82 | public static Context getContext() { | 81 | public static Context getContext() { |
83 | return context; | 82 | return context; |
84 | } | 83 | } |
85 | public static MyApplication getInstance() { | 84 | public static MyApplication getInstance() { |
86 | return instance; | 85 | return instance; |
87 | } | 86 | } |
88 | 87 | ||
89 | } | 88 | } |
90 | 89 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v4.app.FragmentActivity; |
6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | import android.view.KeyEvent; | ||
8 | import android.view.View; | 7 | import android.view.View; |
9 | import android.widget.Button; | 8 | import android.widget.Button; |
10 | import android.widget.EditText; | 9 | import android.widget.EditText; |
11 | import android.widget.TextView; | 10 | import android.widget.TextView; |
12 | 11 | ||
13 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 13 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 14 | import com.hjx.personalcenter.customdialog.CountryDialog; |
16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 15 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 16 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 17 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
19 | import com.hjx.personalcenter.db.Content; | 18 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 21 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CityInfo; | 22 | import com.hjx.personalcenter.model.CityInfo; |
24 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
25 | import com.hjx.personalcenter.model.GradeInfo; | 24 | import com.hjx.personalcenter.model.GradeInfo; |
26 | import com.hjx.personalcenter.model.ProvinceInfo; | 25 | import com.hjx.personalcenter.model.ProvinceInfo; |
27 | import com.hjx.personalcenter.model.SchoolInfo; | 26 | import com.hjx.personalcenter.model.SchoolInfo; |
28 | import com.hjx.personalcenter.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.GetDevicesUtil; | 28 | import com.hjx.personalcenter.util.GetDevicesUtil; |
30 | 29 | ||
31 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
32 | 31 | ||
33 | /** | 32 | /** |
34 | * 填写注册信息 熊巍 | 33 | * 填写注册信息 熊巍 |
35 | * Created by h on 2017/8/9. | 34 | * Created by h on 2017/8/9. |
36 | */ | 35 | */ |
37 | 36 | ||
38 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 37 | public class RegisterInfoActivity extends FragmentActivity implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
39 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 38 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
40 | private EditText et_username; | 39 | private EditText et_username; |
41 | private TextView et_region, et_grade, et_school; | 40 | private TextView et_region, et_grade, et_school; |
42 | private Button btn_ok; | 41 | private Button btn_ok; |
43 | 42 | ||
44 | @Override | 43 | @Override |
45 | protected void onCreate(Bundle savedInstanceState) { | 44 | protected void onCreate(Bundle savedInstanceState) { |
46 | super.onCreate(savedInstanceState); | 45 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_registerinfo); | 46 | setContentView(R.layout.activity_registerinfo); |
48 | SysApplication.getInstance().addActivity(this); | 47 | SysApplication.getInstance().addActivity(this); |
49 | Content.changeinfoflag = true; | 48 | Content.changeinfoflag = true; |
50 | initView(); | 49 | initView(); |
51 | initData(); | 50 | initData(); |
52 | initLister(); | 51 | initLister(); |
53 | } | 52 | } |
54 | 53 | ||
55 | private void initView() { | 54 | private void initView() { |
56 | et_username = (EditText) findViewById(R.id.et_username); | 55 | et_username = (EditText) findViewById(R.id.et_username); |
57 | et_region = (TextView) findViewById(R.id.et_region); | 56 | et_region = (TextView) findViewById(R.id.et_region); |
58 | et_grade = (TextView) findViewById(R.id.et_grade); | 57 | et_grade = (TextView) findViewById(R.id.et_grade); |
59 | et_school = (TextView) findViewById(R.id.et_school); | 58 | et_school = (TextView) findViewById(R.id.et_school); |
60 | btn_ok = (Button) findViewById(R.id.btn_ok); | 59 | btn_ok = (Button) findViewById(R.id.btn_ok); |
61 | 60 | ||
62 | 61 | ||
63 | } | 62 | } |
64 | 63 | ||
65 | private void initData() { | 64 | private void initData() { |
66 | if (Content.accountflag == 2) { | 65 | if (Content.accountflag == 2) { |
67 | btn_ok.setText("提交"); | 66 | btn_ok.setText("提交"); |
68 | 67 | ||
69 | } | 68 | } |
70 | 69 | ||
71 | } | 70 | } |
72 | 71 | ||
73 | private void initLister() { | 72 | private void initLister() { |
74 | et_region.setOnClickListener(this); | 73 | et_region.setOnClickListener(this); |
75 | et_grade.setOnClickListener(this); | 74 | et_grade.setOnClickListener(this); |
76 | et_school.setOnClickListener(this); | 75 | et_school.setOnClickListener(this); |
77 | btn_ok.setOnClickListener(this); | 76 | btn_ok.setOnClickListener(this); |
78 | 77 | ||
79 | 78 | ||
80 | } | 79 | } |
81 | 80 | ||
82 | @Override | 81 | @Override |
83 | public void onClick(View v) { | 82 | public void onClick(View v) { |
84 | String register1 = et_username.getText().toString().trim(); | 83 | String register1 = et_username.getText().toString().trim(); |
85 | String register2 = et_region.getText().toString().trim(); | 84 | String register2 = et_region.getText().toString().trim(); |
86 | String register3 = et_grade.getText().toString().trim(); | 85 | String register3 = et_grade.getText().toString().trim(); |
87 | String register4 = et_school.getText().toString().trim(); | 86 | String register4 = et_school.getText().toString().trim(); |
88 | switch (v.getId()) { | 87 | switch (v.getId()) { |
89 | case R.id.et_region: | 88 | case R.id.et_region: |
90 | et_school.setText(""); | 89 | et_school.setText(""); |
91 | choiseregion(); | 90 | choiseregion(); |
92 | break; | 91 | break; |
93 | case R.id.et_grade: | 92 | case R.id.et_grade: |
94 | et_school.setText(""); | 93 | et_school.setText(""); |
95 | choisegrade(); | 94 | choisegrade(); |
96 | break; | 95 | break; |
97 | case R.id.et_school: | 96 | case R.id.et_school: |
98 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 97 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
99 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 98 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
100 | return; | 99 | return; |
101 | } else { | 100 | } else { |
102 | choiseschool(); | 101 | choiseschool(); |
103 | } | 102 | } |
104 | 103 | ||
105 | break; | 104 | break; |
106 | case R.id.btn_ok: | 105 | case R.id.btn_ok: |
107 | if (TextUtils.isEmpty(register1) || | 106 | if (TextUtils.isEmpty(register1) || |
108 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { | 107 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)) { |
109 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 108 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
110 | return; | 109 | return; |
111 | } else { | 110 | } else { |
112 | String register5 = et_username.getText().toString().trim(); | 111 | String register5 = et_username.getText().toString().trim(); |
113 | String register6 = et_region.getText().toString().trim(); | 112 | String register6 = et_region.getText().toString().trim(); |
114 | String register7 = et_grade.getText().toString().trim(); | 113 | String register7 = et_grade.getText().toString().trim(); |
115 | String register8 = et_school.getText().toString().trim(); | 114 | String register8 = et_school.getText().toString().trim(); |
116 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); | 115 | String grade = SaveParam.getInstance().getLoginParam(this, SaveParam.CHILDSGRADENS); |
117 | if (Content.accountflag == 2) { | 116 | if (Content.accountflag == 2) { |
118 | String accounts = SaveParam.getInstance().getCustomizeParam(RegisterInfoActivity.this,SaveParam.ACCOUNT); | 117 | String accounts = SaveParam.getInstance().getCustomizeParam(RegisterInfoActivity.this,SaveParam.ACCOUNT); |
119 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 118 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
120 | // if ("2".equals(accounts)){ | 119 | // if ("2".equals(accounts)){ |
121 | // grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSGRADENS); | 120 | // grade = SaveParam.getInstance().getCustomizeParam(this, SaveParam.CHILDSGRADENS); |
122 | // } | 121 | // } |
123 | //else { | 122 | //else { |
124 | 123 | ||
125 | // } | 124 | // } |
126 | 125 | ||
127 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); | 126 | String School = SaveParam.getInstance().getLoginParam(this, SaveParam.SCHOOOlID); |
128 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); | 127 | String regionId = SaveParam.getInstance().getsaveCityParam(this, SaveParam.COUNTRY); |
129 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); | 128 | String regionId1 = SaveParam.getInstance().getsaveCityParam(this, SaveParam.CITYS); |
130 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 129 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
131 | if (regionId == null) { | 130 | if (regionId == null) { |
132 | regionId = regionId1; | 131 | regionId = regionId1; |
133 | } | 132 | } |
134 | 133 | ||
135 | try { | 134 | try { |
136 | Object schoolss; | 135 | Object schoolss; |
137 | long auserID = Long.parseLong(userID); | 136 | long auserID = Long.parseLong(userID); |
138 | long grades = Long.parseLong(grade); | 137 | long grades = Long.parseLong(grade); |
139 | if (TextUtils.isEmpty(register8)) { | 138 | if (TextUtils.isEmpty(register8)) { |
140 | schoolss = null; | 139 | schoolss = null; |
141 | } else { | 140 | } else { |
142 | schoolss = Long.parseLong(School); | 141 | schoolss = Long.parseLong(School); |
143 | } | 142 | } |
144 | long regionIds = Long.parseLong(regionId); | 143 | long regionIds = Long.parseLong(regionId); |
145 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", | 144 | HttpManager.getInstance().addchildAccountinfo(RegisterInfoActivity.this, auserID, "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/a00de899-2f6d-43fb-9e30-71883842540e.png", |
146 | register5, grades, schoolss, regionIds, devicenumber, register6); | 145 | register5, grades, schoolss, regionIds, devicenumber, register6); |
147 | 146 | ||
148 | } catch (NumberFormatException e) { | 147 | } catch (NumberFormatException e) { |
149 | e.printStackTrace(); | 148 | e.printStackTrace(); |
150 | } | 149 | } |
151 | 150 | ||
152 | } else { | 151 | } else { |
153 | savedata(); | 152 | savedata(); |
154 | Intent intent = new Intent(); | 153 | Intent intent = new Intent(); |
155 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); | 154 | intent.setClass(RegisterInfoActivity.this, ChoiseTextBookActivity.class); |
156 | startActivity(intent); | 155 | startActivity(intent); |
157 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 156 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
158 | } | 157 | } |
159 | 158 | ||
160 | } | 159 | } |
161 | 160 | ||
162 | break; | 161 | break; |
163 | } | 162 | } |
164 | 163 | ||
165 | } | 164 | } |
166 | 165 | ||
167 | private void savedata() { | 166 | private void savedata() { |
168 | String register9 = et_username.getText().toString().trim(); | 167 | String register9 = et_username.getText().toString().trim(); |
169 | String register10 = et_region.getText().toString().trim(); | 168 | String register10 = et_region.getText().toString().trim(); |
170 | String register11 = et_grade.getText().toString().trim(); | 169 | String register11 = et_grade.getText().toString().trim(); |
171 | String register12 = et_school.getText().toString().trim(); | 170 | String register12 = et_school.getText().toString().trim(); |
172 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); | 171 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register9); |
173 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); | 172 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register10); |
174 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); | 173 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register11); |
175 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); | 174 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register12); |
176 | 175 | ||
177 | } | 176 | } |
178 | 177 | ||
179 | @Override | 178 | @Override |
180 | protected void onResume() { | 179 | protected void onResume() { |
181 | super.onResume(); | 180 | super.onResume(); |
182 | } | 181 | } |
183 | 182 | ||
184 | 183 | ||
185 | //选择地区 | 184 | //选择地区 |
186 | private void choiseregion() { | 185 | private void choiseregion() { |
187 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 186 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
188 | 187 | ||
189 | } | 188 | } |
190 | 189 | ||
191 | //选择年级 | 190 | //选择年级 |
192 | private void choisegrade() { | 191 | private void choisegrade() { |
193 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 192 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
194 | 193 | ||
195 | } | 194 | } |
196 | 195 | ||
197 | //选择学校 | 196 | //选择学校 |
198 | private void choiseschool() { | 197 | private void choiseschool() { |
199 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 198 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
200 | 199 | ||
201 | } | 200 | } |
202 | 201 | ||
203 | 202 | ||
204 | @Override | 203 | @Override |
205 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 204 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
206 | String regionName = data.get(position).getRegionName(); | 205 | String regionName = data.get(position).getRegionName(); |
207 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | 206 | SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); |
208 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 207 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
209 | et_region.setText(""); | 208 | et_region.setText(""); |
210 | et_region.setText(regionName); | 209 | et_region.setText(regionName); |
211 | 210 | ||
212 | } | 211 | } |
213 | 212 | ||
214 | @Override | ||
215 | public boolean onKeyUp(int keyCode, KeyEvent event) { | ||
216 | if (keyCode == KeyEvent.KEYCODE_BACK) { | ||
217 | finish(); | ||
218 | |||
219 | } | ||
220 | return super.onKeyUp(keyCode, event); | ||
221 | } | ||
222 | 213 | ||
223 | @Override | 214 | @Override |
224 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 215 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
225 | String regionName = data.get(position).getName(); | 216 | String regionName = data.get(position).getName(); |
226 | et_grade.setText(regionName); | 217 | et_grade.setText(regionName); |
227 | 218 | ||
228 | } | 219 | } |
229 | 220 | ||
230 | @Override | 221 | @Override |
231 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 222 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
232 | String regionName = data.get(position).getRegionName(); | 223 | String regionName = data.get(position).getRegionName(); |
233 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); | 224 | String provice = SaveParam.getInstance().getLoginParam(this, "sheng"); |
234 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); | 225 | SaveParam.getInstance().saveLoginParam(this, "shi", regionName); |
235 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 226 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
236 | et_region.setText(""); | 227 | et_region.setText(""); |
237 | et_region.setText(provice + regionName); | 228 | et_region.setText(provice + regionName); |
238 | 229 | ||
239 | } | 230 | } |
240 | 231 | ||
241 | @Override | 232 | @Override |
242 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 233 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
243 | String regionName = data.get(position).getRegionName(); | 234 | String regionName = data.get(position).getRegionName(); |
244 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); | 235 | String provices = SaveParam.getInstance().getLoginParam(this, "sheng"); |
245 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); | 236 | String citys = SaveParam.getInstance().getLoginParam(this, "shi"); |
246 | et_region.setText(""); | 237 | et_region.setText(""); |
247 | et_region.setText(provices + citys + regionName); | 238 | et_region.setText(provices + citys + regionName); |
248 | 239 | ||
249 | } | 240 | } |
250 | 241 | ||
251 | @Override | 242 | @Override |
252 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 243 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
253 | String regionName = data.get(position).getSchoolName(); | 244 | String regionName = data.get(position).getSchoolName(); |
254 | et_school.setText(regionName); | 245 | et_school.setText(regionName); |
255 | 246 | ||
256 | } | 247 | } |
257 | } | 248 | } |
258 | 249 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/TheStartPageActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v4.app.FragmentActivity; |
6 | import android.view.KeyEvent; | 6 | import android.view.KeyEvent; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.Button; | 8 | import android.widget.Button; |
9 | 9 | ||
10 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.SaveParam; | 11 | import com.hjx.personalcenter.db.SaveParam; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Created by h on 2017/8/10. | 14 | * Created by h on 2017/8/10. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | public class TheStartPageActivity extends AppCompatActivity implements View.OnClickListener { | 17 | public class TheStartPageActivity extends FragmentActivity implements View.OnClickListener { |
18 | private Button btn_start; | 18 | private Button btn_start; |
19 | @Override | 19 | @Override |
20 | protected void onCreate(Bundle savedInstanceState) { | 20 | protected void onCreate(Bundle savedInstanceState) { |
21 | super.onCreate(savedInstanceState); | 21 | super.onCreate(savedInstanceState); |
22 | setContentView(R.layout.activity_start_page); | 22 | setContentView(R.layout.activity_start_page); |
23 | SysApplication.getInstance().addActivity(this); | 23 | SysApplication.getInstance().addActivity(this); |
24 | initView(); | 24 | initView(); |
25 | initData(); | 25 | initData(); |
26 | initLister(); | 26 | initLister(); |
27 | } | 27 | } |
28 | private void initView() { | 28 | private void initView() { |
29 | btn_start = (Button) findViewById(R.id.btn_start); | 29 | btn_start = (Button) findViewById(R.id.btn_start); |
30 | } | 30 | } |
31 | 31 | ||
32 | private void initData() { | 32 | private void initData() { |
33 | 33 | ||
34 | } | 34 | } |
35 | 35 | ||
36 | private void initLister() { | 36 | private void initLister() { |
37 | btn_start.setOnClickListener(this); | 37 | btn_start.setOnClickListener(this); |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | public void onClick(View v) { | 41 | public void onClick(View v) { |
42 | switch (v.getId()){ | 42 | switch (v.getId()){ |
43 | case R.id.btn_start: | 43 | case R.id.btn_start: |
44 | SaveParam.getInstance().saveLoginParam(this, "login", "true"); | 44 | SaveParam.getInstance().saveLoginParam(this, "login", "true"); |
45 | Intent intent = new Intent(); | 45 | Intent intent = new Intent(); |
46 | intent.setClass(TheStartPageActivity.this,MainActivity.class); | 46 | intent.setClass(TheStartPageActivity.this,MainActivity.class); |
47 | startActivity(intent); | 47 | startActivity(intent); |
48 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 48 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
49 | SysApplication.getInstance().exit(); | 49 | SysApplication.getInstance().exit(); |
50 | break; | 50 | break; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | @Override | 53 | @Override |
54 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 54 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
55 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 55 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
56 | return true; | 56 | return true; |
57 | } | 57 | } |
58 | return super.onKeyDown(keyCode, event); | 58 | return super.onKeyDown(keyCode, event); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
1 | package com.hjx.personalcenter.adapter; | 1 | package com.hjx.personalcenter.adapter; |
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.Intent; | 5 | import android.content.Intent; |
6 | import android.support.v4.app.FragmentActivity; | 6 | import android.support.v4.app.FragmentActivity; |
7 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
8 | import android.util.Log; | ||
8 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
9 | import android.view.View; | 10 | import android.view.View; |
10 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
11 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
13 | import android.widget.TextView; | 14 | import android.widget.TextView; |
14 | 15 | ||
15 | import com.facebook.drawee.view.SimpleDraweeView; | 16 | import com.facebook.drawee.view.SimpleDraweeView; |
16 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 18 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
18 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
19 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
21 | import com.hjx.personalcenter.model.ChildsInfo; | 22 | import com.hjx.personalcenter.model.ChildsInfo; |
22 | import com.hjx.personalcenter.util.GetDevicesUtil; | 23 | import com.hjx.personalcenter.util.GetDevicesUtil; |
23 | import com.mylhyl.circledialog.CircleDialog; | 24 | import com.mylhyl.circledialog.CircleDialog; |
24 | 25 | ||
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
26 | import java.util.List; | 27 | import java.util.List; |
27 | 28 | ||
28 | /** | 29 | /** |
29 | * Created by h on 2017/8/26. | 30 | * Created by h on 2017/8/26. |
30 | */ | 31 | */ |
31 | 32 | ||
32 | public class AccountChildsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { | 33 | public class AccountChildsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { |
33 | private List<ChildsInfo.DataBean> specailList; | 34 | private List<ChildsInfo.DataBean> specailList; |
34 | private LayoutInflater mInflater; | 35 | private LayoutInflater mInflater; |
35 | private Context mContext; | 36 | private Context mContext; |
36 | private static final int BODY_TYPE = 00002; | 37 | private static final int BODY_TYPE = 00002; |
37 | private static final int FOOT_TYPE = 00003; | 38 | private static final int FOOT_TYPE = 00003; |
38 | private int footCount = 1;//尾部个数,后续可以自己拓展 | 39 | private int footCount = 1;//尾部个数,后续可以自己拓展 |
39 | 40 | ||
40 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList, Context context) { | 41 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList, Context context) { |
41 | this.mContext = context; | 42 | this.mContext = context; |
42 | this.specailList = specailList; | 43 | this.specailList = specailList; |
43 | mInflater = LayoutInflater.from(context); | 44 | mInflater = LayoutInflater.from(context); |
44 | } | 45 | } |
45 | 46 | ||
46 | public OnItemClickListener mOnItemClickListener; | 47 | public OnItemClickListener mOnItemClickListener; |
47 | 48 | ||
48 | @Override | 49 | @Override |
49 | public void onClick(View v) { | 50 | public void onClick(View v) { |
50 | if (mOnItemClickListener == null) { | 51 | if (mOnItemClickListener == null) { |
51 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | 52 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); |
52 | } | 53 | } |
53 | 54 | ||
54 | } | 55 | } |
55 | 56 | ||
56 | private int getBodySize() { | 57 | private int getBodySize() { |
57 | return specailList.size(); | 58 | return specailList.size(); |
58 | } | 59 | } |
59 | 60 | ||
60 | private boolean isFoot(int position) { | 61 | private boolean isFoot(int position) { |
61 | return footCount != 0 && (position >= (getBodySize())); | 62 | return footCount != 0 && (position >= (getBodySize())); |
62 | } | 63 | } |
63 | 64 | ||
64 | @Override | 65 | @Override |
65 | public int getItemViewType(int position) { | 66 | public int getItemViewType(int position) { |
66 | if (isFoot(position)) { | 67 | if (isFoot(position)) { |
67 | return FOOT_TYPE; | 68 | return FOOT_TYPE; |
68 | } else { | 69 | } else { |
69 | return BODY_TYPE; | 70 | return BODY_TYPE; |
70 | } | 71 | } |
71 | } | 72 | } |
72 | 73 | ||
73 | public interface OnItemClickListener { | 74 | public interface OnItemClickListener { |
74 | void onItemClick(View view, int position); | 75 | void onItemClick(View view, int position); |
75 | } | 76 | } |
76 | 77 | ||
77 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 78 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
78 | this.mOnItemClickListener = mOnItemClickLitener; | 79 | this.mOnItemClickListener = mOnItemClickLitener; |
79 | } | 80 | } |
80 | 81 | ||
81 | public void setList(List<ChildsInfo.DataBean> list) { | 82 | public void setList(List<ChildsInfo.DataBean> list) { |
82 | this.specailList = list; | 83 | this.specailList = list; |
83 | notifyDataSetChanged(); | 84 | notifyDataSetChanged(); |
84 | } | 85 | } |
85 | 86 | ||
86 | @Override | 87 | @Override |
87 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 88 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
88 | switch (viewType) { | 89 | switch (viewType) { |
89 | case BODY_TYPE: | 90 | case BODY_TYPE: |
90 | return new AccountChildsHolder(mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false)); | 91 | return new AccountChildsHolder(mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false)); |
91 | case FOOT_TYPE: | 92 | case FOOT_TYPE: |
92 | return new FootViewHolder(mInflater.inflate(R.layout.activity_account_management_add, parent, false)); | 93 | return new FootViewHolder(mInflater.inflate(R.layout.activity_account_management_add, parent, false)); |
93 | default: | 94 | default: |
94 | return null; | 95 | return null; |
95 | } | 96 | } |
96 | // View view = ; | 97 | // View view = ; |
97 | // view.setOnClickListener(this); | 98 | // view.setOnClickListener(this); |
98 | // AccountChildsHolder holder = new AccountChildsHolder(view); | 99 | // AccountChildsHolder holder = new AccountChildsHolder(view); |
99 | // return holder; | 100 | // return holder; |
100 | } | 101 | } |
101 | 102 | ||
102 | @Override | 103 | @Override |
103 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | 104 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { |
104 | String account = SaveParam.getInstance().getCustomizeParam(mContext, SaveParam.ACCOUNT); | 105 | String account = SaveParam.getInstance().getCustomizeParam(mContext, SaveParam.ACCOUNT); |
105 | if (holder instanceof AccountChildsHolder) { | 106 | if (holder instanceof AccountChildsHolder) { |
106 | final ChildsInfo.DataBean bean = specailList.get(position); | 107 | final ChildsInfo.DataBean bean = specailList.get(position); |
107 | if (bean != null) { | 108 | if (bean != null) { |
108 | ((AccountChildsHolder) holder).mSimpleDraweeView.setImageURI(bean.getImage()); | 109 | ((AccountChildsHolder) holder).mSimpleDraweeView.setImageURI(bean.getImage()); |
109 | ((AccountChildsHolder) holder).iv_child_name.setText(bean.getName()); | 110 | ((AccountChildsHolder) holder).iv_child_name.setText(bean.getName()); |
110 | ((AccountChildsHolder) holder).iv_child_grade.setText(bean.getGrade()); | 111 | ((AccountChildsHolder) holder).iv_child_grade.setText(bean.getGrade()); |
111 | ((AccountChildsHolder) holder).iv_child_school.setText(bean.getSchool()); | 112 | ((AccountChildsHolder) holder).iv_child_school.setText(bean.getSchool()); |
112 | ((AccountChildsHolder) holder).iv_child_adress.setText(bean.getRegion()); | 113 | ((AccountChildsHolder) holder).iv_child_adress.setText(bean.getRegion()); |
113 | 114 | ||
114 | 115 | ||
115 | if (account.equals("1")) { | 116 | if (account.equals("1")) { |
116 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); | 117 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); |
117 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); | 118 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); |
118 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); | 119 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); |
119 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); | 120 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); |
120 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 121 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
121 | 122 | ||
122 | } else { | 123 | } else { |
123 | if ("已使用".equals(bean.getStatus())) { | 124 | if ("已使用".equals(bean.getStatus())) { |
124 | ((AccountChildsHolder) holder).chang_account.setText("使用中"); | 125 | ((AccountChildsHolder) holder).chang_account.setText("使用中"); |
125 | ((AccountChildsHolder) holder).chang_account.setEnabled(false); | 126 | ((AccountChildsHolder) holder).chang_account.setEnabled(false); |
126 | ((AccountChildsHolder) holder).delete_account.setEnabled(false); | 127 | ((AccountChildsHolder) holder).delete_account.setEnabled(false); |
127 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.VISIBLE); | 128 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.VISIBLE); |
128 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 129 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
129 | } else { | 130 | } else { |
130 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); | 131 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); |
131 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); | 132 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); |
132 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); | 133 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); |
133 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); | 134 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); |
134 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 135 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
135 | } | 136 | } |
136 | } | 137 | } |
137 | ((AccountChildsHolder) holder).delete_account.setOnClickListener(new View.OnClickListener() { | 138 | ((AccountChildsHolder) holder).delete_account.setOnClickListener(new View.OnClickListener() { |
138 | @Override | 139 | @Override |
139 | public void onClick(View v) { | 140 | public void onClick(View v) { |
140 | new CircleDialog.Builder((FragmentActivity) mContext) | 141 | new CircleDialog.Builder((FragmentActivity) mContext) |
141 | .setCanceledOnTouchOutside(false) | 142 | .setCanceledOnTouchOutside(false) |
142 | .setWidth(0.4f) | 143 | .setWidth(0.4f) |
143 | .setCancelable(false) | 144 | .setCancelable(false) |
144 | .setText("您确定删除该子账户?") | 145 | .setText("您确定删除该子账户?") |
145 | .setNegative("取消", null) | 146 | .setNegative("取消", null) |
146 | .setPositive("确定", new View.OnClickListener() { | 147 | .setPositive("确定", new View.OnClickListener() { |
147 | @Override | 148 | @Override |
148 | public void onClick(View v) { | 149 | public void onClick(View v) { |
149 | HttpManager.getInstance().deletechildAccountinfo(mContext, bean.getSubAccountId()); | 150 | HttpManager.getInstance().deletechildAccountinfo(mContext, bean.getSubAccountId()); |
150 | } | 151 | } |
151 | }) | 152 | }) |
152 | .show(); | 153 | .show(); |
153 | 154 | ||
154 | 155 | ||
155 | } | 156 | } |
156 | }); | 157 | }); |
157 | ((AccountChildsHolder) holder).chang_account.setOnClickListener(new View.OnClickListener() { | 158 | ((AccountChildsHolder) holder).chang_account.setOnClickListener(new View.OnClickListener() { |
158 | @Override | 159 | @Override |
159 | public void onClick(View v) { | 160 | public void onClick(View v) { |
160 | new CircleDialog.Builder((FragmentActivity) mContext) | 161 | new CircleDialog.Builder((FragmentActivity) mContext) |
161 | .setCanceledOnTouchOutside(false) | 162 | .setCanceledOnTouchOutside(false) |
162 | .setWidth(0.4f) | 163 | .setWidth(0.4f) |
163 | .setCancelable(false) | 164 | .setCancelable(false) |
164 | .setText("您确定切换为该子账户?") | 165 | .setText("您确定切换为该子账户?") |
165 | .setNegative("取消", null) | 166 | .setNegative("取消", null) |
166 | .setPositive("确定", new View.OnClickListener() { | 167 | .setPositive("确定", new View.OnClickListener() { |
167 | @Override | 168 | @Override |
168 | public void onClick(View v) { | 169 | public void onClick(View v) { |
169 | Content.changgeaccountflag = 2; | 170 | Content.changgeaccountflag = 2; |
171 | String ss = SaveParam.getInstance().getLoginParam(mContext, SaveParam.GRADENS); | ||
172 | try { | ||
173 | int zhugrade = Integer.parseInt(ss); | ||
174 | int zigrade =Integer.parseInt(bean.getGradeId()); | ||
175 | if ((zhugrade < 8)&&(zigrade>=8)||(zhugrade >= 8)&&(zigrade<8)) { | ||
176 | Intent intentbroad = new Intent(); | ||
177 | intentbroad.putExtra("info", "小学"); | ||
178 | //4、定义广播发送的action | ||
179 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | ||
180 | //5、发送广播 | ||
181 | mContext.sendBroadcast(intentbroad); | ||
182 | Log.i("---", "发送完了"); | ||
183 | } | ||
184 | |||
185 | } catch (NumberFormatException e) { | ||
186 | e.printStackTrace(); | ||
187 | } | ||
188 | |||
170 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ACCOUNT, "2"); | 189 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ACCOUNT, "2"); |
171 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSID, bean.getSubAccountId()); | 190 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSID, bean.getSubAccountId()); |
172 | //保存子账号年级id | 191 | //保存子账号年级id |
173 | //SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENS, bean.getGradeId()); | 192 | //SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENS, bean.getGradeId()); |
174 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | 193 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); |
175 | HttpManager.getInstance().changechildAccountinfo(mContext, bean.getSubAccountId(), bean.getParentId(), | 194 | HttpManager.getInstance().changechildAccountinfo(mContext, bean.getSubAccountId(), bean.getParentId(), |
176 | devicenumber, 2); | 195 | devicenumber, 2); |
177 | } | 196 | } |
178 | }) | 197 | }) |
179 | .show(); | 198 | .show(); |
180 | 199 | ||
181 | } | 200 | } |
182 | }); | 201 | }); |
183 | 202 | ||
184 | } | 203 | } |
185 | 204 | ||
186 | } else if (holder instanceof FootViewHolder) { | 205 | } else if (holder instanceof FootViewHolder) { |
187 | ((FootViewHolder) holder).add_account.setOnClickListener(new View.OnClickListener() { | 206 | ((FootViewHolder) holder).add_account.setOnClickListener(new View.OnClickListener() { |
188 | @Override | 207 | @Override |
189 | public void onClick(View v) { | 208 | public void onClick(View v) { |
190 | Content.accountflag = 2; | 209 | Content.accountflag = 2; |
191 | Intent account = new Intent(); | 210 | Intent account = new Intent(); |
192 | account.setClass(mContext, RegisterInfoActivity.class); | 211 | account.setClass(mContext, RegisterInfoActivity.class); |
193 | mContext.startActivity(account); | 212 | mContext.startActivity(account); |
194 | ((Activity) mContext).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 213 | ((Activity) mContext).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
195 | 214 | ||
196 | } | 215 | } |
197 | }); | 216 | }); |
198 | } | 217 | } |
199 | 218 | ||
200 | 219 | ||
201 | } | 220 | } |
202 | 221 | ||
203 | @Override | 222 | @Override |
204 | public int getItemCount() { | 223 | public int getItemCount() { |
205 | 224 | ||
206 | return getBodySize() + footCount; | 225 | return getBodySize() + footCount; |
207 | } | 226 | } |
208 | 227 | ||
209 | private static class AccountChildsHolder extends RecyclerView.ViewHolder { | 228 | private static class AccountChildsHolder extends RecyclerView.ViewHolder { |
210 | ImageView iv_using_pic; | 229 | ImageView iv_using_pic; |
211 | LinearLayout ll_backgrangd; | 230 | LinearLayout ll_backgrangd; |
212 | SimpleDraweeView mSimpleDraweeView; | 231 | SimpleDraweeView mSimpleDraweeView; |
213 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 232 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
214 | delete_account, chang_account; | 233 | delete_account, chang_account; |
215 | 234 | ||
216 | public AccountChildsHolder(View itemView) { | 235 | public AccountChildsHolder(View itemView) { |
217 | super(itemView); | 236 | super(itemView); |
218 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 237 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); |
219 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 238 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
220 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 239 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
221 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 240 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
222 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 241 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
223 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); | 242 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
224 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); | 243 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
225 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); | 244 | iv_using_pic = (ImageView) itemView.findViewById(R.id.iv_using_pic); |
226 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); | 245 | ll_backgrangd = (LinearLayout) itemView.findViewById(R.id.ll_backgrangd); |
227 | 246 | ||
228 | } | 247 | } |
229 | } | 248 | } |
230 | 249 | ||
231 | private static class FootViewHolder extends RecyclerView.ViewHolder { | 250 | private static class FootViewHolder extends RecyclerView.ViewHolder { |
232 | LinearLayout add_account; | 251 | LinearLayout add_account; |
233 | 252 | ||
234 | public FootViewHolder(View itemView) { | 253 | public FootViewHolder(View itemView) { |
235 | super(itemView); | 254 | super(itemView); |
236 | add_account = (LinearLayout) itemView.findViewById(R.id.add_account); | 255 | add_account = (LinearLayout) itemView.findViewById(R.id.add_account); |
237 | } | 256 | } |
238 | } | 257 | } |
239 | } | 258 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.os.Message; | 8 | import android.os.Message; |
9 | import android.text.Editable; | 9 | import android.text.Editable; |
10 | import android.text.TextWatcher; | 10 | import android.text.TextWatcher; |
11 | import android.util.Log; | 11 | import android.util.Log; |
12 | import android.view.Gravity; | 12 | import android.view.Gravity; |
13 | import android.view.LayoutInflater; | 13 | import android.view.LayoutInflater; |
14 | import android.view.View; | 14 | import android.view.View; |
15 | import android.view.ViewGroup; | 15 | import android.view.ViewGroup; |
16 | import android.widget.AdapterView; | 16 | import android.widget.AdapterView; |
17 | import android.widget.EditText; | 17 | import android.widget.EditText; |
18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
19 | import android.widget.ListView; | 19 | import android.widget.ListView; |
20 | 20 | ||
21 | import com.hjx.personalcenter.R; | 21 | import com.hjx.personalcenter.R; |
22 | import com.hjx.personalcenter.adapter.SchoolAdapter; | 22 | import com.hjx.personalcenter.adapter.SchoolAdapter; |
23 | import com.hjx.personalcenter.db.Content; | 23 | import com.hjx.personalcenter.db.Content; |
24 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
25 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
26 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
27 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
28 | import com.hjx.personalcenter.model.SchoolInfo; | 28 | import com.hjx.personalcenter.model.SchoolInfo; |
29 | import com.mylhyl.circledialog.BaseCircleDialog; | 29 | import com.mylhyl.circledialog.BaseCircleDialog; |
30 | import com.mylhyl.circledialog.res.values.CircleDimen; | 30 | import com.mylhyl.circledialog.res.values.CircleDimen; |
31 | 31 | ||
32 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
33 | import java.util.List; | 33 | import java.util.List; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Created by h on 2017/8/21. | 36 | * Created by h on 2017/8/21. |
37 | */ | 37 | */ |
38 | @SuppressLint("ValidFragment") | 38 | @SuppressLint("ValidFragment") |
39 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 39 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
40 | private ListView school_list; | 40 | private ListView school_list; |
41 | private EditText school_sech; | 41 | private EditText school_sech; |
42 | private SchoolAdapter listadapter; | 42 | private SchoolAdapter listadapter; |
43 | private ImageView cance; | 43 | private ImageView cance; |
44 | private View mView; | 44 | private View mView; |
45 | boolean isFilter; | 45 | boolean isFilter; |
46 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); | 46 | ArrayList<SchoolInfo.DataBean> data = new ArrayList<>(); |
47 | private DialogCallBack.SchoolCallBack mCallBack; | 47 | private DialogCallBack.SchoolCallBack mCallBack; |
48 | 48 | ||
49 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { | 49 | // public SchoolListDialog(DialogCallBack.CallBackView callBack) { |
50 | // this.mCallBack = callBack; | 50 | // this.mCallBack = callBack; |
51 | // } | 51 | // } |
52 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { | 52 | public SchoolListDialog(DialogCallBack.SchoolCallBack callBack) { |
53 | this.mCallBack = callBack; | 53 | this.mCallBack = callBack; |
54 | } | 54 | } |
55 | 55 | ||
56 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { | 56 | public static SchoolListDialog getInstance(DialogCallBack.SchoolCallBack mCallBack) { |
57 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); | 57 | SchoolListDialog dialogFragment = new SchoolListDialog(mCallBack); |
58 | dialogFragment.setCanceledBack(true); | 58 | dialogFragment.setCanceledBack(true); |
59 | dialogFragment.setCanceledOnTouchOutside(true); | 59 | dialogFragment.setCanceledOnTouchOutside(true); |
60 | dialogFragment.setRadius(CircleDimen.RADIUS); | 60 | dialogFragment.setRadius(CircleDimen.RADIUS); |
61 | dialogFragment.setWidth(0.5f); | 61 | dialogFragment.setWidth(0.5f); |
62 | dialogFragment.setGravity(Gravity.CENTER); | 62 | dialogFragment.setGravity(Gravity.CENTER); |
63 | dialogFragment.setBackgroundColor(Color.WHITE); | 63 | dialogFragment.setBackgroundColor(Color.WHITE); |
64 | return dialogFragment; | 64 | return dialogFragment; |
65 | } | 65 | } |
66 | 66 | ||
67 | Handler handler = new Handler(){ | 67 | Handler handler = new Handler(){ |
68 | @Override | 68 | @Override |
69 | public void handleMessage(Message msg) { | 69 | public void handleMessage(Message msg) { |
70 | super.handleMessage(msg); | 70 | super.handleMessage(msg); |
71 | switch (msg.what){ | 71 | switch (msg.what){ |
72 | case HttpCode.SCHOOL: | 72 | case HttpCode.SCHOOL: |
73 | data.clear(); | 73 | data.clear(); |
74 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); | 74 | data.addAll( (List<SchoolInfo.DataBean>)msg.obj); |
75 | listadapter.notifyDataSetChanged(); | 75 | listadapter.notifyDataSetChanged(); |
76 | break; | 76 | break; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | }; | 79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | @Override | 82 | @Override |
83 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 83 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
84 | 84 | ||
85 | if (mView == null) { | 85 | if (mView == null) { |
86 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); | 86 | mView = inflater.inflate(R.layout.custom_adilog_school_list, container, false); |
87 | //mCallBack.provinceOnItemClick(context, inflater, container); | 87 | //mCallBack.provinceOnItemClick(context, inflater, container); |
88 | } | 88 | } |
89 | return mView; | 89 | return mView; |
90 | } | 90 | } |
91 | 91 | ||
92 | @Override | 92 | @Override |
93 | public void onActivityCreated(Bundle savedInstanceState) { | 93 | public void onActivityCreated(Bundle savedInstanceState) { |
94 | super.onActivityCreated(savedInstanceState); | 94 | super.onActivityCreated(savedInstanceState); |
95 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); | 95 | school_list = (ListView) getView().findViewById(R.id.listschooladapter); |
96 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); | 96 | school_sech = (EditText) getView().findViewById(R.id.et_school_sech); |
97 | cance = (ImageView) getView().findViewById(R.id.cancel); | 97 | cance = (ImageView) getView().findViewById(R.id.cancel); |
98 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 98 | String citys = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
99 | String country = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ADRESSID); | 99 | String country = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); |
100 | if (country==null){ | 100 | if (country==null){ |
101 | country =citys; | 101 | country =citys; |
102 | } | 102 | } |
103 | String grade; | 103 | String grade; |
104 | if ( Content.changeinfoflag == true){ | 104 | if ( Content.changeinfoflag == true){ |
105 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); | 105 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); |
106 | }else { | 106 | }else { |
107 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 107 | grade=SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
108 | } | 108 | } |
109 | listadapter = new SchoolAdapter(data, getActivity()); | 109 | listadapter = new SchoolAdapter(data, getActivity()); |
110 | school_list.setAdapter(listadapter); | 110 | school_list.setAdapter(listadapter); |
111 | school_list.setOnItemClickListener(this); | 111 | school_list.setOnItemClickListener(this); |
112 | cance.setOnClickListener(new View.OnClickListener() { | 112 | cance.setOnClickListener(new View.OnClickListener() { |
113 | @Override | 113 | @Override |
114 | public void onClick(View v) { | 114 | public void onClick(View v) { |
115 | dismiss(); | 115 | dismiss(); |
116 | } | 116 | } |
117 | }); | 117 | }); |
118 | try { | 118 | try { |
119 | int a = Integer.parseInt(country); | 119 | int a = Integer.parseInt(country); |
120 | int b = Integer.parseInt(grade); | 120 | int b = Integer.parseInt(grade); |
121 | Log.e("test","地区ID"+country+"年级ID"+grade); | 121 | Log.e("test","地区ID"+country+"年级ID"+grade); |
122 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); | 122 | HttpManager.getInstance().getschool(getActivity(),a,b,handler); |
123 | } catch (NumberFormatException e) { | 123 | } catch (NumberFormatException e) { |
124 | e.printStackTrace(); | 124 | e.printStackTrace(); |
125 | } | 125 | } |
126 | intiEditView(); | 126 | intiEditView(); |
127 | 127 | ||
128 | 128 | ||
129 | } | 129 | } |
130 | 130 | ||
131 | private void intiEditView() { | 131 | private void intiEditView() { |
132 | school_sech.addTextChangedListener(new TextWatcher() { | 132 | school_sech.addTextChangedListener(new TextWatcher() { |
133 | @Override | 133 | @Override |
134 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | 134 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||
138 | @Override | 138 | @Override |
139 | public void onTextChanged(CharSequence s, int start, int before, int count) { | 139 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
140 | // mAdapter.getFilter().filter(s); | 140 | // mAdapter.getFilter().filter(s); |
141 | 141 | ||
142 | listadapter.getFilter().filter(s); | 142 | listadapter.getFilter().filter(s); |
143 | } | 143 | } |
144 | 144 | ||
145 | @Override | 145 | @Override |
146 | public void afterTextChanged(Editable s) { | 146 | public void afterTextChanged(Editable s) { |
147 | 147 | ||
148 | } | 148 | } |
149 | }); | 149 | }); |
150 | } | 150 | } |
151 | 151 | ||
152 | @Override | 152 | @Override |
153 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 153 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
154 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); | 154 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SCHOOOlID, ""+data.get(position).getSchoolId()); |
155 | mCallBack.provinceO4nItemClick(data,position,4); | 155 | mCallBack.provinceO4nItemClick(data,position,4); |
156 | dismiss(); | 156 | dismiss(); |
157 | 157 | ||
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 |
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 | public static String GRADERFLAG = "graderflag";//子账号id | 16 | public static String GRADERFLAG = "graderflag";//子账号id |
17 | public static String CHILDSID = "childID";//子账号id | 17 | public static String CHILDSID = "childID";//子账号id |
18 | public static String CHILDSGRADENS = "childs";//子账号年级id | 18 | public static String CHILDSGRADENS = "childs";//子账号年级id |
19 | public static String GRADENS = "gradens";//年级id | 19 | public static String GRADENS = "gradens";//年级id |
20 | public static String SCHOOOlID = "schoolid";//学校id | 20 | public static String SCHOOOlID = "schoolid";//学校id |
21 | //个人信息 | 21 | //个人信息 |
22 | public static String USERNAME = "usernames";//昵称 | 22 | public static String USERNAME = "usernames";//昵称 |
23 | public static String ADRESS = "adress";//地址 | 23 | public static String ADRESS = "adress";//地址 |
24 | public static String GRADES = "gadens";//年级 | 24 | public static String GRADES = "gadens";//年级 |
25 | public static String SCHOOL = "school";//学校 | 25 | public static String SCHOOL = "school";//学校 |
26 | public static String CONSTELLATION = "constellations";//星座 | 26 | public static String CONSTELLATION = "constellations";//星座 |
27 | public static String HEADURL = "headurl";//头像 | 27 | public static String HEADURL = "headurl";//头像 |
28 | 28 | ||
29 | //用户个人信息 | 29 | //用户个人信息 |
30 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 | 30 | public static String ACCOUNTUSERNAME = "accountusernames";//昵称 |
31 | public static String ACCOUNTADRESS = "accountadress";//地址 | 31 | public static String ACCOUNTADRESS = "accountadress";//地址 |
32 | public static String ACCOUNTGRADES = "accountgadens";//年级 | 32 | public static String ACCOUNTGRADES = "accountgadens";//年级 |
33 | public static String ACCOUNTSCHOOL = "accountschool";//学校 | 33 | public static String ACCOUNTSCHOOL = "accountschool";//学校 |
34 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 | 34 | public static String ACCOUNTCONSTELLATION = "accountbthday";//生日 |
35 | public static String ACCOUNTSEX = "accountsex";//性别 | 35 | public static String ACCOUNTSEX = "accountsex";//性别 |
36 | public static String ACCOUNTQQ= "accountqq";//qq | 36 | public static String ACCOUNTQQ= "accountqq";//qq |
37 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 | 37 | public static String ACCOUNTXINGZUO = "accountxingzuo";//详细地址 |
38 | public static String PORTAIT = "portrait";//头像 | 38 | public static String PORTAIT = "portrait";//头像 |
39 | public static String ADRESSID = "adressid";//地址id | 39 | public static String ADRESSID = "adressid";//地址id |
40 | public static String MAINSHOOLID = "mainshoolid";//地址id | ||
40 | 41 | ||
41 | //电子保卡信息 | 42 | //电子保卡信息 |
42 | public static String CARDPHONE = "cardphone";//保卡手机号 | 43 | public static String CARDPHONE = "cardphone";//保卡手机号 |
43 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 | 44 | public static String CUNSTEMNAME = "cunstemname";//客户姓名 |
44 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 | 45 | public static String ADRESSCUNSTEM = "adresscunstem";//客户地址 |
45 | public static String SHOPTIME = "shoptime";//购买时间 | 46 | public static String SHOPTIME = "shoptime";//购买时间 |
46 | public static String SHOPADRESS = "shopadress";//购买地址 | 47 | public static String SHOPADRESS = "shopadress";//购买地址 |
47 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 | 48 | public static String SHOPTLEPHONE = "shoptlephone";//售后电话 |
48 | 49 | ||
49 | //省市区参数、 | 50 | //省市区参数、 |
50 | public static String PROVINCES = "provinces";//省 | 51 | public static String PROVINCES = "provinces";//省 |
51 | public static String CITYS = "citys";//市 | 52 | public static String CITYS = "citys";//市 |
52 | public static String COUNTRY = "country";//区 | 53 | public static String COUNTRY = "country";//区 |
53 | 54 | ||
54 | //账户管理 | 55 | //账户管理 |
55 | public static String ACCOUNT = "account";//账户类型 | 56 | public static String ACCOUNT = "account";//账户类型 |
56 | //科目信息 | 57 | //科目信息 |
57 | public static String SUBJECT = "subject"; | 58 | public static String SUBJECT = "subject"; |
58 | //样机 | 59 | //样机 |
59 | public static String YANGJI = "yangji"; | 60 | public static String YANGJI = "yangji"; |
60 | //图片URL | 61 | //图片URL |
61 | public static String IMGURL = "imgurl"; | 62 | public static String IMGURL = "imgurl"; |
62 | //版本名称 | 63 | //版本名称 |
63 | public static String VERSION = "version"; | 64 | public static String VERSION = "version"; |
64 | //版本信息接口返回值 | 65 | //版本信息接口返回值 |
65 | public static String VERSIONINTEFACE = "versioninterface"; | 66 | public static String VERSIONINTEFACE = "versioninterface"; |
66 | 67 | ||
67 | 68 | ||
68 | public void saveLoginParam(Context context,String spname, String spstr) { | 69 | public void saveLoginParam(Context context,String spname, String spstr) { |
69 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 70 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
70 | Activity.MODE_PRIVATE); | 71 | Activity.MODE_PRIVATE); |
71 | 72 | ||
72 | sp.edit().putString(spname, spstr).commit(); | 73 | sp.edit().putString(spname, spstr).commit(); |
73 | } | 74 | } |
74 | 75 | ||
75 | 76 | ||
76 | public String getLoginParam(Context context,String spname) { | 77 | public String getLoginParam(Context context,String spname) { |
77 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 78 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
78 | Activity.MODE_PRIVATE); | 79 | Activity.MODE_PRIVATE); |
79 | String param = sp.getString(spname, null); | 80 | String param = sp.getString(spname, null); |
80 | return param; | 81 | return param; |
81 | } | 82 | } |
82 | public void clearData(Context context) { | 83 | public void clearData(Context context) { |
83 | SharedPreferences sp = context.getSharedPreferences("loginparam", | 84 | SharedPreferences sp = context.getSharedPreferences("loginparam", |
84 | Activity.MODE_PRIVATE); | 85 | Activity.MODE_PRIVATE); |
85 | sp.edit().clear().commit(); | 86 | sp.edit().clear().commit(); |
86 | } | 87 | } |
87 | 88 | ||
88 | public void saveCustomizeParam(Context context,String spname, String spstr) { | 89 | public void saveCustomizeParam(Context context,String spname, String spstr) { |
89 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 90 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
90 | Activity.MODE_PRIVATE); | 91 | Activity.MODE_PRIVATE); |
91 | 92 | ||
92 | sp.edit().putString(spname, spstr).commit(); | 93 | sp.edit().putString(spname, spstr).commit(); |
93 | 94 | ||
94 | } | 95 | } |
95 | 96 | ||
96 | public String getCustomizeParam(Context context,String spname) { | 97 | public String getCustomizeParam(Context context,String spname) { |
97 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 98 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
98 | Activity.MODE_PRIVATE); | 99 | Activity.MODE_PRIVATE); |
99 | String param = sp.getString(spname, null); | 100 | String param = sp.getString(spname, null); |
100 | return param; | 101 | return param; |
101 | } | 102 | } |
102 | 103 | ||
103 | public void clearCustomizeParam(Context context ){ | 104 | public void clearCustomizeParam(Context context ){ |
104 | SharedPreferences sp = context.getSharedPreferences("presoninfo", | 105 | SharedPreferences sp = context.getSharedPreferences("presoninfo", |
105 | Activity.MODE_PRIVATE); | 106 | Activity.MODE_PRIVATE); |
106 | sp.edit().clear().commit(); | 107 | sp.edit().clear().commit(); |
107 | } | 108 | } |
108 | public void saveCityParam(Context context,String spname, String spstr) { | 109 | public void saveCityParam(Context context,String spname, String spstr) { |
109 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 110 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
110 | Activity.MODE_PRIVATE); | 111 | Activity.MODE_PRIVATE); |
111 | 112 | ||
112 | sp.edit().putString(spname, spstr).commit(); | 113 | sp.edit().putString(spname, spstr).commit(); |
113 | 114 | ||
114 | } | 115 | } |
115 | 116 | ||
116 | public String getsaveCityParam(Context context,String spname) { | 117 | public String getsaveCityParam(Context context,String spname) { |
117 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 118 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
118 | Activity.MODE_PRIVATE); | 119 | Activity.MODE_PRIVATE); |
119 | String param = sp.getString(spname, null); | 120 | String param = sp.getString(spname, null); |
120 | return param; | 121 | return param; |
121 | } | 122 | } |
122 | 123 | ||
123 | public void clearsaveCityParam(Context context ){ | 124 | public void clearsaveCityParam(Context context ){ |
124 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", | 125 | SharedPreferences sp = context.getSharedPreferences("saveCityParam", |
125 | Activity.MODE_PRIVATE); | 126 | Activity.MODE_PRIVATE); |
126 | sp.edit().clear().commit(); | 127 | sp.edit().clear().commit(); |
127 | } | 128 | } |
128 | } | 129 | } |
129 | 130 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.support.v4.view.ViewPager; | 8 | import android.support.v4.view.ViewPager; |
9 | import android.util.Log; | 9 | import android.util.Log; |
10 | import android.view.Gravity; | 10 | import android.view.Gravity; |
11 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
12 | import android.view.View; | 12 | import android.view.View; |
13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 14 | import android.widget.AdapterView; |
15 | import android.widget.EditText; | 15 | import android.widget.EditText; |
16 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
17 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
18 | import android.widget.TextView; | 18 | import android.widget.TextView; |
19 | 19 | ||
20 | import com.bigkoo.pickerview.TimePickerView; | 20 | import com.bigkoo.pickerview.TimePickerView; |
21 | import com.hjx.personalcenter.R; | 21 | import com.hjx.personalcenter.R; |
22 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | 22 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; |
23 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 23 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
24 | import com.hjx.personalcenter.customdialog.CountryDialog; | 24 | import com.hjx.personalcenter.customdialog.CountryDialog; |
25 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 25 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
26 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 26 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
27 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 27 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
28 | import com.hjx.personalcenter.db.Content; | 28 | import com.hjx.personalcenter.db.Content; |
29 | import com.hjx.personalcenter.db.SaveParam; | 29 | import com.hjx.personalcenter.db.SaveParam; |
30 | import com.hjx.personalcenter.http.HttpManager; | 30 | import com.hjx.personalcenter.http.HttpManager; |
31 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 31 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
32 | import com.hjx.personalcenter.model.CityInfo; | 32 | import com.hjx.personalcenter.model.CityInfo; |
33 | import com.hjx.personalcenter.model.CountyInfo; | 33 | import com.hjx.personalcenter.model.CountyInfo; |
34 | import com.hjx.personalcenter.model.GradeInfo; | 34 | import com.hjx.personalcenter.model.GradeInfo; |
35 | import com.hjx.personalcenter.model.ProvinceInfo; | 35 | import com.hjx.personalcenter.model.ProvinceInfo; |
36 | import com.hjx.personalcenter.model.SchoolInfo; | 36 | import com.hjx.personalcenter.model.SchoolInfo; |
37 | import com.hjx.personalcenter.util.AlertUtils; | 37 | import com.hjx.personalcenter.util.AlertUtils; |
38 | import com.hjx.personalcenter.util.GetDevicesUtil; | 38 | import com.hjx.personalcenter.util.GetDevicesUtil; |
39 | import com.mylhyl.circledialog.CircleDialog; | 39 | import com.mylhyl.circledialog.CircleDialog; |
40 | import com.mylhyl.circledialog.callback.ConfigDialog; | 40 | import com.mylhyl.circledialog.callback.ConfigDialog; |
41 | import com.mylhyl.circledialog.params.DialogParams; | 41 | import com.mylhyl.circledialog.params.DialogParams; |
42 | 42 | ||
43 | import org.apache.http.util.TextUtils; | 43 | import org.apache.http.util.TextUtils; |
44 | 44 | ||
45 | import java.text.SimpleDateFormat; | 45 | import java.text.SimpleDateFormat; |
46 | import java.util.ArrayList; | 46 | import java.util.ArrayList; |
47 | import java.util.Date; | 47 | import java.util.Date; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Created by h on 2017/8/12. | 50 | * Created by h on 2017/8/12. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 53 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
54 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 54 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
55 | private View mView; | 55 | private View mView; |
56 | private int type; | 56 | private int type; |
57 | private TimePickerView pvTime; | 57 | private TimePickerView pvTime; |
58 | private LinearLayout tv_version; | 58 | private LinearLayout tv_version; |
59 | 59 | ||
60 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 60 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
61 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; | 61 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; |
62 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; | 62 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
63 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; | 63 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; |
64 | 64 | ||
65 | 65 | ||
66 | public static PresonInfoFragment newInstance(int type) { | 66 | public static PresonInfoFragment newInstance(int type) { |
67 | PresonInfoFragment fragment = new PresonInfoFragment(); | 67 | PresonInfoFragment fragment = new PresonInfoFragment(); |
68 | Bundle bundle = new Bundle(); | 68 | Bundle bundle = new Bundle(); |
69 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 69 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
70 | fragment.setArguments(bundle); | 70 | fragment.setArguments(bundle); |
71 | return fragment; | 71 | return fragment; |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | @Override | 75 | @Override |
76 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 76 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
77 | if (mView == null) { | 77 | if (mView == null) { |
78 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 78 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
79 | Content.changeinfoflag = false; | 79 | Content.changeinfoflag = false; |
80 | initView(mView); | 80 | initView(mView); |
81 | initData(); | 81 | initData(); |
82 | setLister(); | 82 | setLister(); |
83 | initTimePicker(); | 83 | initTimePicker(); |
84 | 84 | ||
85 | 85 | ||
86 | } | 86 | } |
87 | return mView; | 87 | return mView; |
88 | } | 88 | } |
89 | 89 | ||
90 | //初始化 | 90 | //初始化 |
91 | private void initView(View mView) { | 91 | private void initView(View mView) { |
92 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 92 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
93 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 93 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
94 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 94 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
95 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 95 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
96 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 96 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
97 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 97 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
98 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 98 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
99 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 99 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
100 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | 100 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); |
101 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | 101 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); |
102 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | 102 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); |
103 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | 103 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); |
104 | my_school = (ImageView) mView.findViewById(R.id.my_school); | 104 | my_school = (ImageView) mView.findViewById(R.id.my_school); |
105 | sub = (TextView) mView.findViewById(R.id.presonal_sub); | 105 | sub = (TextView) mView.findViewById(R.id.presonal_sub); |
106 | ccancel = (ImageView) mView.findViewById(R.id.cancel); | 106 | ccancel = (ImageView) mView.findViewById(R.id.cancel); |
107 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); | 107 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); |
108 | 108 | ||
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | private void initData() { | 112 | private void initData() { |
113 | //初始化个人信息 | 113 | //初始化个人信息 |
114 | String name = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTUSERNAME); | 114 | String name = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTUSERNAME); |
115 | String adress1 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTADRESS); | 115 | String adress1 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTADRESS); |
116 | String adress2 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO); | 116 | String adress2 = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTXINGZUO); |
117 | String sex = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSEX); | 117 | String sex = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSEX); |
118 | String bithday = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTCONSTELLATION); | 118 | String bithday = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTCONSTELLATION); |
119 | String qq = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTQQ); | 119 | String qq = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTQQ); |
120 | String grader = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTGRADES); | 120 | String grader = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTGRADES); |
121 | String school = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSCHOOL); | 121 | String school = SaveParam.getInstance().getLoginParam(getActivity(),SaveParam.ACCOUNTSCHOOL); |
122 | tv_username1.setText(name); | 122 | tv_username1.setText(name); |
123 | tv_useinfo_qq.setText(qq); | 123 | tv_useinfo_qq.setText(qq); |
124 | tv_sex.setText(sex); | 124 | tv_sex.setText(sex); |
125 | tv_useinfo_birthday.setText(bithday); | 125 | tv_useinfo_birthday.setText(bithday); |
126 | tv_useinfo_gender.setText(grader); | 126 | tv_useinfo_gender.setText(grader); |
127 | tv_useinfo_school.setText(school); | 127 | tv_useinfo_school.setText(school); |
128 | tv_useinfo_adress1.setText(adress2); | 128 | tv_useinfo_adress1.setText(adress2); |
129 | tv_useinfo_adress.setText(adress1); | 129 | tv_useinfo_adress.setText(adress1); |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | private void setLister() { | 136 | private void setLister() { |
137 | tv_sex.setOnClickListener(this); | 137 | tv_sex.setOnClickListener(this); |
138 | tv_useinfo_adress.setOnClickListener(this); | 138 | tv_useinfo_adress.setOnClickListener(this); |
139 | tv_useinfo_birthday.setOnClickListener(this); | 139 | tv_useinfo_birthday.setOnClickListener(this); |
140 | tv_useinfo_school.setOnClickListener(this); | 140 | tv_useinfo_school.setOnClickListener(this); |
141 | tv_useinfo_gender.setOnClickListener(this); | 141 | tv_useinfo_gender.setOnClickListener(this); |
142 | my_adress.setOnClickListener(this); | 142 | my_adress.setOnClickListener(this); |
143 | my_sex.setOnClickListener(this); | 143 | my_sex.setOnClickListener(this); |
144 | my_bthday.setOnClickListener(this); | 144 | my_bthday.setOnClickListener(this); |
145 | my_grade.setOnClickListener(this); | 145 | my_grade.setOnClickListener(this); |
146 | my_school.setOnClickListener(this); | 146 | my_school.setOnClickListener(this); |
147 | sub.setOnClickListener(this); | 147 | sub.setOnClickListener(this); |
148 | tv_version.setOnClickListener(this); | 148 | tv_version.setOnClickListener(this); |
149 | ccancel.setOnClickListener(this); | 149 | ccancel.setOnClickListener(this); |
150 | } | 150 | } |
151 | 151 | ||
152 | @Override | 152 | @Override |
153 | public void onClick(View v) { | 153 | public void onClick(View v) { |
154 | String presonal1 = tv_username1.getText().toString().trim(); | 154 | String presonal1 = tv_username1.getText().toString().trim(); |
155 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 155 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
156 | String presonal3 = tv_sex.getText().toString().trim(); | 156 | String presonal3 = tv_sex.getText().toString().trim(); |
157 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 157 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
158 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 158 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
159 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 159 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
160 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 160 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
161 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 161 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
162 | switch (v.getId()) { | 162 | switch (v.getId()) { |
163 | case R.id.tv_sex: | 163 | case R.id.tv_sex: |
164 | case R.id.my_sex: | 164 | case R.id.my_sex: |
165 | final String[] items = {"男", "女"}; | 165 | final String[] items = {"男", "女"}; |
166 | new CircleDialog.Builder(getActivity()) | 166 | new CircleDialog.Builder(getActivity()) |
167 | .configDialog(new ConfigDialog() { | 167 | .configDialog(new ConfigDialog() { |
168 | @Override | 168 | @Override |
169 | public void onConfig(DialogParams params) { | 169 | public void onConfig(DialogParams params) { |
170 | //增加弹出动画 | 170 | //增加弹出动画 |
171 | params.gravity = Gravity.CENTER; | 171 | params.gravity = Gravity.CENTER; |
172 | } | 172 | } |
173 | }) | 173 | }) |
174 | .setTitle("请选择性别") | 174 | .setTitle("请选择性别") |
175 | .setWidth(0.5f) | 175 | .setWidth(0.5f) |
176 | .setItems(items, new AdapterView.OnItemClickListener() { | 176 | .setItems(items, new AdapterView.OnItemClickListener() { |
177 | @Override | 177 | @Override |
178 | public void onItemClick(AdapterView<?> parent, View view, int | 178 | public void onItemClick(AdapterView<?> parent, View view, int |
179 | position, long id) { | 179 | position, long id) { |
180 | switch (position) { | 180 | switch (position) { |
181 | case 0: | 181 | case 0: |
182 | tv_sex.setText("男"); | 182 | tv_sex.setText("男"); |
183 | break; | 183 | break; |
184 | case 1: | 184 | case 1: |
185 | tv_sex.setText("女"); | 185 | tv_sex.setText("女"); |
186 | break; | 186 | break; |
187 | } | 187 | } |
188 | 188 | ||
189 | } | 189 | } |
190 | }) | 190 | }) |
191 | .show(); | 191 | .show(); |
192 | break; | 192 | break; |
193 | case R.id.tv_useinfo_adress: | 193 | case R.id.tv_useinfo_adress: |
194 | case R.id.my_adress: | 194 | case R.id.my_adress: |
195 | tv_useinfo_school.setText(""); | 195 | tv_useinfo_school.setText(""); |
196 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 196 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
197 | break; | 197 | break; |
198 | case R.id.tv_useinfo_birthday: | 198 | case R.id.tv_useinfo_birthday: |
199 | case R.id.my_bthday: | 199 | case R.id.my_bthday: |
200 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 200 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
201 | break; | 201 | break; |
202 | case R.id.tv_useinfo_school: | 202 | case R.id.tv_useinfo_school: |
203 | case R.id.my_school: | 203 | case R.id.my_school: |
204 | if (TextUtils.isEmpty(presonal4) || | 204 | if (TextUtils.isEmpty(presonal4) || |
205 | TextUtils.isEmpty(presonal7)) { | 205 | TextUtils.isEmpty(presonal7)) { |
206 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 206 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
207 | return; | 207 | return; |
208 | } else { | 208 | } else { |
209 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 209 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | break; | 213 | break; |
214 | case R.id.tv_useinfo_gender: | 214 | case R.id.tv_useinfo_gender: |
215 | case R.id.my_grade: | 215 | case R.id.my_grade: |
216 | tv_useinfo_school.setText(""); | 216 | tv_useinfo_school.setText(""); |
217 | Content.changeinfoflag = true; | 217 | Content.changeinfoflag = true; |
218 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 218 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
219 | break; | 219 | break; |
220 | case R.id.cancel: | 220 | case R.id.cancel: |
221 | getActivity().finish(); | 221 | getActivity().finish(); |
222 | break; | 222 | break; |
223 | case R.id.tv_version: | 223 | case R.id.tv_version: |
224 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | 224 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); |
225 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | 225 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { |
226 | @Override | 226 | @Override |
227 | public void gotoFragment(ViewPager viewPager) { | 227 | public void gotoFragment(ViewPager viewPager) { |
228 | //fragment传递数据 | 228 | //fragment传递数据 |
229 | viewPager.setCurrentItem(1); | 229 | viewPager.setCurrentItem(1); |
230 | } | 230 | } |
231 | }); | 231 | }); |
232 | mainActivity.forSkip(); | 232 | mainActivity.forSkip(); |
233 | break; | 233 | break; |
234 | case R.id.presonal_sub: | 234 | case R.id.presonal_sub: |
235 | Log.e("test", "你提交个人信息"); | 235 | Log.e("test", "你提交个人信息"); |
236 | if (TextUtils.isEmpty(presonal1) || | 236 | if (TextUtils.isEmpty(presonal1) || |
237 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 237 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
238 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 238 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
239 | TextUtils.isEmpty(presonal8)) { | 239 | TextUtils.isEmpty(presonal8)) { |
240 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 240 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
241 | return; | 241 | return; |
242 | } else { | 242 | } else { |
243 | int a = 0, b = 0; | 243 | int a = 0, b = 0; |
244 | int d = 1,gradeold =0; | 244 | int d = 1,gradeold =0; |
245 | Long f ; | ||
245 | Object schoolids; | 246 | Object schoolids; |
246 | Long f = null; | ||
247 | String regionId2 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); | 247 | String regionId2 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.COUNTRY); |
248 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); | 248 | String regionId1 = SaveParam.getInstance().getsaveCityParam(getActivity(), SaveParam.CITYS); |
249 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ADRESSID); | 249 | String regionId = null; |
250 | if (regionId == null ) { | 250 | if (regionId2 ==null&®ionId1==null){ |
251 | if (regionId1!=null){ | 251 | regionId =SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.ADRESSID); |
252 | regionId = regionId1; | 252 | }else { |
253 | if (regionId2==null){ | ||
254 | regionId =regionId1; | ||
253 | }else { | 255 | }else { |
254 | regionId = regionId2; | 256 | regionId =regionId2; |
255 | } | 257 | } |
256 | |||
257 | } | 258 | } |
258 | String gradeolds = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 259 | |
260 | String gradenid =null; | ||
261 | String gradeolds = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CHILDSGRADENS); | ||
259 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 262 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
260 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 263 | if (grade.equals(gradeolds)||gradeolds == null){ |
264 | gradenid =grade; | ||
265 | }else { | ||
266 | gradenid =gradeolds; | ||
267 | } | ||
268 | String schoolid = null; | ||
269 | String mainshoolids = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | ||
270 | String mainschoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.MAINSHOOLID); | ||
271 | if (mainshoolids ==null||mainschoolid.equals(mainshoolids)){ | ||
272 | schoolid =mainschoolid; | ||
273 | }else { | ||
274 | schoolid =mainshoolids; | ||
275 | } | ||
276 | |||
261 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 277 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
262 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 278 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
263 | String childsID = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); | 279 | //String childsID = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); |
264 | 280 | ||
265 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 281 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
266 | String changeinfo = null; | 282 | String changeinfo = null; |
267 | if ("男".equals(presonal3)) { | 283 | if ("男".equals(presonal3)) { |
268 | changeinfo = "male"; | 284 | changeinfo = "male"; |
269 | } else { | 285 | } else { |
270 | changeinfo = "female"; | 286 | changeinfo = "female"; |
271 | } | 287 | } |
272 | try { | 288 | try { |
273 | a = Integer.parseInt(regionId); | 289 | a = Integer.parseInt(regionId); |
274 | b = Integer.parseInt(grade); | 290 | b = Integer.parseInt(gradenid); |
275 | gradeold = Integer.parseInt(gradeolds); | 291 | gradeold = Integer.parseInt(grade); |
276 | if ((gradeold<8&&b>=8)||((gradeold>8&&b<=8))){ | 292 | if ((b<8&&gradeold>=8)||((b>8&&gradeold<=8))){ |
277 | Intent intentbroad = new Intent(); | 293 | Intent intentbroad = new Intent(); |
278 | intentbroad.putExtra("info","小学"); | 294 | intentbroad.putExtra("info","小学"); |
279 | //4、定义广播发送的action | 295 | //4、定义广播发送的action |
280 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); | 296 | intentbroad.setAction("com.ozing.launcher.SWITCH_GRADE"); |
281 | //5、发送广播 | 297 | //5、发送广播 |
282 | getActivity().sendBroadcast(intentbroad); | 298 | getActivity().sendBroadcast(intentbroad); |
283 | Log.i("---", "发送完了"); | 299 | Log.i("---", "发送完了"); |
284 | } | 300 | } |
285 | if (TextUtils.isEmpty(presonal6)) { | 301 | if (TextUtils.isEmpty(presonal6)) { |
286 | schoolids = null; | 302 | schoolids = null; |
287 | } else { | 303 | } else { |
288 | schoolids = Long.parseLong(schoolid); | 304 | schoolids = Long.parseLong(schoolid); |
289 | } | 305 | } |
290 | d = Integer.parseInt(type); | 306 | d = Integer.parseInt(type); |
291 | if (d==2){ | 307 | f = Long.parseLong(userID); |
292 | f = Long.parseLong(childsID); | ||
293 | |||
294 | }else{ | ||
295 | f = Long.parseLong(userID); | ||
296 | } | ||
297 | |||
298 | 308 | ||
299 | //提交个人信息 | 309 | //提交个人信息 |
300 | HttpManager.getInstance().changepresonalinfo(getActivity(), | 310 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
301 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 ,presonal2,devicenumber); | 311 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 ,presonal2,devicenumber); |
302 | 312 | ||
303 | } catch (Exception e) { | 313 | } catch (Exception e) { |
304 | e.printStackTrace(); | 314 | e.printStackTrace(); |
305 | } | 315 | } |
306 | 316 | ||
307 | break; | 317 | break; |
308 | 318 | ||
309 | } | 319 | } |
310 | } | 320 | } |
311 | } | 321 | } |
312 | 322 | ||
313 | //自定义时间选择器 | 323 | //自定义时间选择器 |
314 | private void initTimePicker() { | 324 | private void initTimePicker() { |
315 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 325 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
316 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 326 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
317 | // Calendar selectedDate = Calendar.getInstance(); | 327 | // Calendar selectedDate = Calendar.getInstance(); |
318 | // Calendar startDate = Calendar.getInstance(); | 328 | // Calendar startDate = Calendar.getInstance(); |
319 | // startDate.set(1900, 1, 1); | 329 | // startDate.set(1900, 1, 1); |
320 | // Calendar endDate = Calendar.getInstance(); | 330 | // Calendar endDate = Calendar.getInstance(); |
321 | // endDate.set(2100, 1, 1); | 331 | // endDate.set(2100, 1, 1); |
322 | //时间选择器 | 332 | //时间选择器 |
323 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 333 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
324 | @Override | 334 | @Override |
325 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 335 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
326 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 336 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
327 | /*btn_Time.setText(getTime(date));*/ | 337 | /*btn_Time.setText(getTime(date));*/ |
328 | TextView btn = (TextView) v; | 338 | TextView btn = (TextView) v; |
329 | btn.setText(getTime(date)); | 339 | btn.setText(getTime(date)); |
330 | } | 340 | } |
331 | }) | 341 | }) |
332 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 342 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
333 | .setType(new boolean[]{true, true, true, false, false, false}) | 343 | .setType(new boolean[]{true, true, true, false, false, false}) |
334 | .setLabel("", "", "", "", "", "") | 344 | .setLabel("", "", "", "", "", "") |
335 | .isCenterLabel(false) | 345 | .isCenterLabel(false) |
336 | .setDividerColor(Color.DKGRAY) | 346 | .setDividerColor(Color.DKGRAY) |
337 | .setContentSize(21) | 347 | .setContentSize(21) |
338 | // .setDate(selectedDate) | 348 | // .setDate(selectedDate) |
339 | // .setRangDate(startDate, endDate) | 349 | // .setRangDate(startDate, endDate) |
340 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 350 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
341 | .setDecorView(null) | 351 | .setDecorView(null) |
342 | .setTitleText("出生日期") | 352 | .setTitleText("出生日期") |
343 | .setTitleSize(22) | 353 | .setTitleSize(22) |
344 | .setCancelColor(Color.GRAY) | 354 | .setCancelColor(Color.GRAY) |
345 | .setSubCalSize(22) | 355 | .setSubCalSize(22) |
346 | .setDividerColor(Color.GRAY) | 356 | .setDividerColor(Color.GRAY) |
347 | .setSubmitColor(Color.GRAY) | 357 | .setSubmitColor(Color.GRAY) |
348 | .build(); | 358 | .build(); |
349 | } | 359 | } |
350 | 360 | ||
351 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 361 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
352 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 362 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
353 | return format.format(date); | 363 | return format.format(date); |
354 | } | 364 | } |
355 | 365 | ||
356 | @Override | 366 | @Override |
357 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 367 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
358 | String regionName = data.get(position).getRegionName(); | 368 | String regionName = data.get(position).getRegionName(); |
359 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 369 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
360 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 370 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
361 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 371 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
362 | tv_useinfo_adress.setText(""); | 372 | tv_useinfo_adress.setText(""); |
363 | tv_useinfo_adress.setText(provice + regionName); | 373 | tv_useinfo_adress.setText(provice + regionName); |
364 | 374 | ||
365 | 375 | ||
366 | } | 376 | } |
367 | 377 | ||
368 | @Override | 378 | @Override |
369 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 379 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
370 | String regionName = data.get(position).getRegionName(); | 380 | String regionName = data.get(position).getRegionName(); |
371 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 381 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
372 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 382 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
373 | tv_useinfo_adress.setText(""); | 383 | tv_useinfo_adress.setText(""); |
374 | tv_useinfo_adress.setText(provices + citys + regionName); | 384 | tv_useinfo_adress.setText(provices + citys + regionName); |
375 | 385 | ||
376 | } | 386 | } |
377 | 387 | ||
378 | @Override | 388 | @Override |
379 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 389 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
380 | String regionName = data.get(position).getName(); | 390 | String regionName = data.get(position).getName(); |
381 | tv_useinfo_gender.setText(regionName); | 391 | tv_useinfo_gender.setText(regionName); |
382 | } | 392 | } |
383 | 393 | ||
384 | @Override | 394 | @Override |
385 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 395 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
386 | String regionName = data.get(position).getRegionName(); | 396 | String regionName = data.get(position).getRegionName(); |
387 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 397 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
388 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 398 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
389 | tv_useinfo_adress.setText(""); | 399 | tv_useinfo_adress.setText(""); |
390 | tv_useinfo_adress.setText(regionName); | 400 | tv_useinfo_adress.setText(regionName); |
391 | } | 401 | } |
392 | 402 | ||
393 | @Override | 403 | @Override |
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.view.KeyEvent; | 10 | import android.view.KeyEvent; |
11 | import android.widget.Toast; | 11 | import android.widget.Toast; |
12 | 12 | ||
13 | import com.google.gson.Gson; | 13 | import com.google.gson.Gson; |
14 | import com.google.gson.reflect.TypeToken; | 14 | import com.google.gson.reflect.TypeToken; |
15 | import com.hjx.personalcenter.R; | 15 | import com.hjx.personalcenter.R; |
16 | import com.hjx.personalcenter.activity.BangDingCode; | 16 | import com.hjx.personalcenter.activity.BangDingCode; |
17 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 17 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
18 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 18 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
19 | import com.hjx.personalcenter.db.Content; | 19 | import com.hjx.personalcenter.db.Content; |
20 | import com.hjx.personalcenter.db.SaveParam; | 20 | import com.hjx.personalcenter.db.SaveParam; |
21 | import com.hjx.personalcenter.gson.GsonTool; | 21 | import com.hjx.personalcenter.gson.GsonTool; |
22 | import com.hjx.personalcenter.model.AppVersion; | 22 | import com.hjx.personalcenter.model.AppVersion; |
23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
24 | import com.hjx.personalcenter.model.ChildsInfo; | 24 | import com.hjx.personalcenter.model.ChildsInfo; |
25 | import com.hjx.personalcenter.model.CityInfo; | 25 | import com.hjx.personalcenter.model.CityInfo; |
26 | import com.hjx.personalcenter.model.CountyInfo; | 26 | import com.hjx.personalcenter.model.CountyInfo; |
27 | import com.hjx.personalcenter.model.DefautPublishInfo; | 27 | import com.hjx.personalcenter.model.DefautPublishInfo; |
28 | import com.hjx.personalcenter.model.GradeInfo; | 28 | import com.hjx.personalcenter.model.GradeInfo; |
29 | import com.hjx.personalcenter.model.PesonalInfo; | 29 | import com.hjx.personalcenter.model.PesonalInfo; |
30 | import com.hjx.personalcenter.model.ProvinceInfo; | 30 | import com.hjx.personalcenter.model.ProvinceInfo; |
31 | import com.hjx.personalcenter.model.SchoolInfo; | 31 | import com.hjx.personalcenter.model.SchoolInfo; |
32 | import com.hjx.personalcenter.model.SignInfo; | 32 | import com.hjx.personalcenter.model.SignInfo; |
33 | import com.hjx.personalcenter.model.VersionInfo; | 33 | import com.hjx.personalcenter.model.VersionInfo; |
34 | import com.hjx.personalcenter.model.VideoInfo; | 34 | import com.hjx.personalcenter.model.VideoInfo; |
35 | import com.hjx.personalcenter.util.AlertUtils; | 35 | import com.hjx.personalcenter.util.AlertUtils; |
36 | import com.hjx.personalcenter.util.DialogPermission; | 36 | import com.hjx.personalcenter.util.DialogPermission; |
37 | import com.loopj.android.http.AsyncHttpResponseHandler; | 37 | import com.loopj.android.http.AsyncHttpResponseHandler; |
38 | import com.loopj.android.http.JsonHttpResponseHandler; | 38 | import com.loopj.android.http.JsonHttpResponseHandler; |
39 | import com.loopj.android.http.RequestParams; | 39 | import com.loopj.android.http.RequestParams; |
40 | 40 | ||
41 | import org.apache.http.Header; | 41 | import org.apache.http.Header; |
42 | import org.apache.http.entity.ByteArrayEntity; | 42 | import org.apache.http.entity.ByteArrayEntity; |
43 | import org.apache.http.message.BasicHeader; | 43 | import org.apache.http.message.BasicHeader; |
44 | import org.apache.http.protocol.HTTP; | 44 | import org.apache.http.protocol.HTTP; |
45 | import org.json.JSONException; | 45 | import org.json.JSONException; |
46 | import org.json.JSONObject; | 46 | import org.json.JSONObject; |
47 | 47 | ||
48 | import java.io.File; | 48 | import java.io.File; |
49 | import java.io.FileNotFoundException; | 49 | import java.io.FileNotFoundException; |
50 | import java.io.UnsupportedEncodingException; | 50 | import java.io.UnsupportedEncodingException; |
51 | import java.util.ArrayList; | 51 | import java.util.ArrayList; |
52 | import java.util.List; | 52 | import java.util.List; |
53 | 53 | ||
54 | public class HttpManager { | 54 | public class HttpManager { |
55 | private static HttpManager instance; | 55 | private static HttpManager instance; |
56 | private ProgressDialog mProgress = null; | 56 | private ProgressDialog mProgress = null; |
57 | 57 | ||
58 | public static HttpManager getInstance() { | 58 | public static HttpManager getInstance() { |
59 | if (instance == null) { | 59 | if (instance == null) { |
60 | instance = new HttpManager(); | 60 | instance = new HttpManager(); |
61 | } | 61 | } |
62 | return instance; | 62 | return instance; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | //登录接口 | 66 | //登录接口 |
67 | 67 | ||
68 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 68 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
69 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 69 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
70 | true, true, null); | 70 | true, true, null); |
71 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 71 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
72 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 72 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
73 | @Override | 73 | @Override |
74 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 74 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
75 | closeProgress(); | 75 | closeProgress(); |
76 | Message msg = Message.obtain(); | 76 | Message msg = Message.obtain(); |
77 | msg.what = HttpCode.LOGIN_SUCESS; | 77 | msg.what = HttpCode.LOGIN_SUCESS; |
78 | msg.obj = new String(arg2); | 78 | msg.obj = new String(arg2); |
79 | handler.sendMessage(msg); | 79 | handler.sendMessage(msg); |
80 | 80 | ||
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | @Override | 84 | @Override |
85 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 85 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
86 | closeProgress(); | 86 | closeProgress(); |
87 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 87 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
88 | } | 88 | } |
89 | }); | 89 | }); |
90 | } | 90 | } |
91 | 91 | ||
92 | //注册接口 | 92 | //注册接口 |
93 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 93 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
94 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 94 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
95 | false, true, null); | 95 | false, true, null); |
96 | JSONObject jsonObject = new JSONObject(); | 96 | JSONObject jsonObject = new JSONObject(); |
97 | ByteArrayEntity entity = null; | 97 | ByteArrayEntity entity = null; |
98 | try { | 98 | try { |
99 | jsonObject.put(HttpKey.USERNAME, username); | 99 | jsonObject.put(HttpKey.USERNAME, username); |
100 | jsonObject.put(HttpKey.PASSWORD, password); | 100 | jsonObject.put(HttpKey.PASSWORD, password); |
101 | jsonObject.put(HttpKey.SMSCODE, smscode); | 101 | jsonObject.put(HttpKey.SMSCODE, smscode); |
102 | jsonObject.put(HttpKey.SOURCE, source); | 102 | jsonObject.put(HttpKey.SOURCE, source); |
103 | Log.e("test", "jsonObject" + jsonObject); | 103 | Log.e("test", "jsonObject" + jsonObject); |
104 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 104 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
105 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 105 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
106 | } catch (JSONException e) { | 106 | } catch (JSONException e) { |
107 | e.printStackTrace(); | 107 | e.printStackTrace(); |
108 | } catch (UnsupportedEncodingException e) { | 108 | } catch (UnsupportedEncodingException e) { |
109 | e.printStackTrace(); | 109 | e.printStackTrace(); |
110 | } | 110 | } |
111 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 111 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
112 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 112 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
113 | @Override | 113 | @Override |
114 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 114 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
115 | super.onSuccess(statusCode, headers, response); | 115 | super.onSuccess(statusCode, headers, response); |
116 | closeProgress(); | 116 | closeProgress(); |
117 | Log.e("test", "onSuccess" + response); | 117 | Log.e("test", "onSuccess" + response); |
118 | Message msg = Message.obtain(); | 118 | Message msg = Message.obtain(); |
119 | msg.what = HttpCode.REGISTERED_SUCESS; | 119 | msg.what = HttpCode.REGISTERED_SUCESS; |
120 | msg.obj = response; | 120 | msg.obj = response; |
121 | handler.sendMessage(msg); | 121 | handler.sendMessage(msg); |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | @Override | 125 | @Override |
126 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 126 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
127 | super.onFailure(statusCode, headers, throwable, errorResponse); | 127 | super.onFailure(statusCode, headers, throwable, errorResponse); |
128 | closeProgress(); | 128 | closeProgress(); |
129 | Log.e("test", "onFailure" + errorResponse); | 129 | Log.e("test", "onFailure" + errorResponse); |
130 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 130 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
131 | } | 131 | } |
132 | 132 | ||
133 | }); | 133 | }); |
134 | } | 134 | } |
135 | 135 | ||
136 | //注册验证码 | 136 | //注册验证码 |
137 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 137 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
138 | RequestParams params = new RequestParams(); | 138 | RequestParams params = new RequestParams(); |
139 | params.put(HttpKey.TYPE, type); | 139 | params.put(HttpKey.TYPE, type); |
140 | params.put(HttpKey.MOBIL, mobile); | 140 | params.put(HttpKey.MOBIL, mobile); |
141 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 141 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
142 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 142 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
143 | 143 | ||
144 | @Override | 144 | @Override |
145 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 145 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
146 | Log.e("test", "onSuccess-----" + response); | 146 | Log.e("test", "onSuccess-----" + response); |
147 | Message msg = Message.obtain(); | 147 | Message msg = Message.obtain(); |
148 | msg.what = HttpCode.AUTHCODE_SUCESS; | 148 | msg.what = HttpCode.AUTHCODE_SUCESS; |
149 | msg.obj = response; | 149 | msg.obj = response; |
150 | handler.sendMessage(msg); | 150 | handler.sendMessage(msg); |
151 | } | 151 | } |
152 | 152 | ||
153 | @Override | 153 | @Override |
154 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 154 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
155 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 155 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
156 | } | 156 | } |
157 | }); | 157 | }); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | //手机号是否注册 | 161 | //手机号是否注册 |
162 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 162 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
163 | RequestParams params = new RequestParams(); | 163 | RequestParams params = new RequestParams(); |
164 | params.put(HttpKey.USERNAME, mobile); | 164 | params.put(HttpKey.USERNAME, mobile); |
165 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 165 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
166 | @Override | 166 | @Override |
167 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 167 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
168 | Log.e("test", "isregistered" + response.toString()); | 168 | Log.e("test", "isregistered" + response.toString()); |
169 | Message msg = Message.obtain(); | 169 | Message msg = Message.obtain(); |
170 | msg.what = HttpCode.IS_REFISTER; | 170 | msg.what = HttpCode.IS_REFISTER; |
171 | msg.obj = response; | 171 | msg.obj = response; |
172 | handler.sendMessage(msg); | 172 | handler.sendMessage(msg); |
173 | 173 | ||
174 | } | 174 | } |
175 | 175 | ||
176 | @Override | 176 | @Override |
177 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 177 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
178 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 178 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
179 | 179 | ||
180 | } | 180 | } |
181 | }); | 181 | }); |
182 | } | 182 | } |
183 | 183 | ||
184 | //修改密码 | 184 | //修改密码 |
185 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 185 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
186 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", | 186 | mProgress = DialogPermission.showProgress(context, null, "正在修改密码...", |
187 | false, true, null); | 187 | false, true, null); |
188 | RequestParams params = new RequestParams(); | 188 | RequestParams params = new RequestParams(); |
189 | params.put(HttpKey.USERNAME, username); | 189 | params.put(HttpKey.USERNAME, username); |
190 | params.put(HttpKey.OLDPASS, old_pwd1); | 190 | params.put(HttpKey.OLDPASS, old_pwd1); |
191 | params.put(HttpKey.NEWPASS, newpassword3); | 191 | params.put(HttpKey.NEWPASS, newpassword3); |
192 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 192 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
193 | HttpClient.getInstance().setTimeout(10 * 1000); | 193 | HttpClient.getInstance().setTimeout(10 * 1000); |
194 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 194 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
195 | @Override | 195 | @Override |
196 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 196 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
197 | closeProgress(); | 197 | closeProgress(); |
198 | try { | 198 | try { |
199 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 199 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
200 | String status = jsonObject.optString("status"); | 200 | String status = jsonObject.optString("status"); |
201 | if (status.equals("100")) { | 201 | if (status.equals("100")) { |
202 | Log.e("test", "onSuccess" + new String(bytes)); | 202 | Log.e("test", "onSuccess" + new String(bytes)); |
203 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 203 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
204 | SaveParam.getInstance().clearData((Activity) context); | 204 | SaveParam.getInstance().clearData((Activity) context); |
205 | Intent intent = new Intent(); | 205 | Intent intent = new Intent(); |
206 | intent.setClass(context, LoginAndRegisterActivity.class); | 206 | intent.setClass(context, LoginAndRegisterActivity.class); |
207 | ((Activity) context).startActivity(intent); | 207 | ((Activity) context).startActivity(intent); |
208 | ((Activity) context).finish(); | 208 | ((Activity) context).finish(); |
209 | } else { | 209 | } else { |
210 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 210 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
211 | } | 211 | } |
212 | } catch (JSONException e) { | 212 | } catch (JSONException e) { |
213 | e.printStackTrace(); | 213 | e.printStackTrace(); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | @Override | 217 | @Override |
218 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 218 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
219 | closeProgress(); | 219 | closeProgress(); |
220 | Log.e("test", "onFailure" + new String(bytes)); | 220 | Log.e("test", "onFailure" + new String(bytes)); |
221 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 221 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
222 | } | 222 | } |
223 | }); | 223 | }); |
224 | 224 | ||
225 | } | 225 | } |
226 | 226 | ||
227 | //忘记密码 | 227 | //忘记密码 |
228 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 228 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
229 | RequestParams params = new RequestParams(); | 229 | RequestParams params = new RequestParams(); |
230 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 230 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
231 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 231 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
232 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 232 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
233 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 233 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
234 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 234 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
235 | @Override | 235 | @Override |
236 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 236 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
237 | try { | 237 | try { |
238 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 238 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
239 | String status = jsonObject.optString("status"); | 239 | String status = jsonObject.optString("status"); |
240 | if (status.equals("100")) { | 240 | if (status.equals("100")) { |
241 | Log.e("test", "onSuccess" + new String(bytes)); | 241 | Log.e("test", "onSuccess" + new String(bytes)); |
242 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 242 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
243 | ((Activity) context).finish(); | 243 | ((Activity) context).finish(); |
244 | } else { | 244 | } else { |
245 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 245 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
246 | } | 246 | } |
247 | } catch (JSONException e) { | 247 | } catch (JSONException e) { |
248 | e.printStackTrace(); | 248 | e.printStackTrace(); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | @Override | 252 | @Override |
253 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 253 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
254 | Log.e("test", "onFailure" + new String(bytes)); | 254 | Log.e("test", "onFailure" + new String(bytes)); |
255 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 255 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
256 | } | 256 | } |
257 | }); | 257 | }); |
258 | 258 | ||
259 | } | 259 | } |
260 | 260 | ||
261 | //保存用户登录信息 | 261 | //保存用户登录信息 |
262 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 262 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
263 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 263 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
264 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 264 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
265 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 265 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
266 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 266 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
267 | 267 | ||
268 | 268 | ||
269 | } | 269 | } |
270 | 270 | ||
271 | //提交保卡信息 | 271 | //提交保卡信息 |
272 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 272 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
273 | String buyAddress, String buyTime, String alterSaleCall, | 273 | String buyAddress, String buyTime, String alterSaleCall, |
274 | String productModel, String deviceNumber, String macAddress, | 274 | String productModel, String deviceNumber, String macAddress, |
275 | String mobilePhone) { | 275 | String mobilePhone) { |
276 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 276 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
277 | false, true, null); | 277 | false, true, null); |
278 | RequestParams params = new RequestParams(); | 278 | RequestParams params = new RequestParams(); |
279 | 279 | ||
280 | params.put(HttpKey.USEID, userId); | 280 | params.put(HttpKey.USEID, userId); |
281 | params.put(HttpKey.CUSTOMENAME, customerName); | 281 | params.put(HttpKey.CUSTOMENAME, customerName); |
282 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 282 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
283 | params.put(HttpKey.BUYADREES, buyAddress); | 283 | params.put(HttpKey.BUYADREES, buyAddress); |
284 | params.put(HttpKey.BUYTIME, buyTime); | 284 | params.put(HttpKey.BUYTIME, buyTime); |
285 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 285 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
286 | params.put(HttpKey.PRODUCTMODEL, productModel); | 286 | params.put(HttpKey.PRODUCTMODEL, productModel); |
287 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 287 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
288 | params.put(HttpKey.MACADRESS, macAddress); | 288 | params.put(HttpKey.MACADRESS, macAddress); |
289 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 289 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
290 | 290 | ||
291 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 291 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
292 | 292 | ||
293 | Log.e("test", "params" + params); | 293 | Log.e("test", "params" + params); |
294 | HttpClient.getInstance().setTimeout(5 * 1000); | 294 | HttpClient.getInstance().setTimeout(5 * 1000); |
295 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 295 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
296 | @Override | 296 | @Override |
297 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 297 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
298 | JSONObject jsonObject = null; | 298 | JSONObject jsonObject = null; |
299 | closeProgress(); | 299 | closeProgress(); |
300 | try { | 300 | try { |
301 | jsonObject = new JSONObject(new String(bytes)); | 301 | jsonObject = new JSONObject(new String(bytes)); |
302 | String status = jsonObject.optString("status"); | 302 | String status = jsonObject.optString("status"); |
303 | if (status.equals("1")) { | 303 | if (status.equals("1")) { |
304 | Log.e("test", "onSuccess" + jsonObject); | 304 | Log.e("test", "onSuccess" + jsonObject); |
305 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 305 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
306 | if (Content.cardintentflag == 1) { | 306 | if (Content.cardintentflag == 1) { |
307 | Intent intent = new Intent(); | 307 | Intent intent = new Intent(); |
308 | intent.setClass((Activity) context, TheStartPageActivity.class); | 308 | intent.setClass((Activity) context, TheStartPageActivity.class); |
309 | ((Activity) context).startActivity(intent); | 309 | ((Activity) context).startActivity(intent); |
310 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 310 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
311 | ((Activity) context).finish(); | 311 | ((Activity) context).finish(); |
312 | } else if (Content.cardintentflag == 2) { | 312 | } else if (Content.cardintentflag == 2) { |
313 | Intent intent = new Intent(); | 313 | Intent intent = new Intent(); |
314 | intent.setClass((Activity) context, BangDingCode.class); | 314 | intent.setClass((Activity) context, BangDingCode.class); |
315 | ((Activity) context).startActivity(intent); | 315 | ((Activity) context).startActivity(intent); |
316 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 316 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
317 | ((Activity) context).finish(); | 317 | ((Activity) context).finish(); |
318 | 318 | ||
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | } else { | 322 | } else { |
323 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 323 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
324 | } | 324 | } |
325 | } catch (JSONException e) { | 325 | } catch (JSONException e) { |
326 | e.printStackTrace(); | 326 | e.printStackTrace(); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | } | 330 | } |
331 | 331 | ||
332 | @Override | 332 | @Override |
333 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 333 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
334 | Log.e("test", "onFailure" + (throwable)); | 334 | Log.e("test", "onFailure" + (throwable)); |
335 | closeProgress(); | 335 | closeProgress(); |
336 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 336 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
337 | 337 | ||
338 | } | 338 | } |
339 | }); | 339 | }); |
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | //获取保卡信息 | 343 | //获取保卡信息 |
344 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { | 344 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
345 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 345 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
346 | false, true, null); | 346 | false, true, null); |
347 | HttpClient.getInstance().setTimeout(5 * 1000); | 347 | HttpClient.getInstance().setTimeout(5 * 1000); |
348 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 348 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
349 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 349 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
350 | @Override | 350 | @Override |
351 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 351 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
352 | closeProgress(); | 352 | closeProgress(); |
353 | Log.e("test", "保卡信息" + new String(arg2)); | 353 | Log.e("test", "保卡信息" + new String(arg2)); |
354 | try { | 354 | try { |
355 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 355 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
356 | int status = jsonObject.optInt("status"); | 356 | int status = jsonObject.optInt("status"); |
357 | if (status == 1) { | 357 | if (status == 1) { |
358 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 358 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
359 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 359 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
360 | Message msg = Message.obtain(); | 360 | Message msg = Message.obtain(); |
361 | msg.what = HttpCode.SUCHCARDINFO; | 361 | msg.what = HttpCode.SUCHCARDINFO; |
362 | msg.obj = schoolInfoBeanList; | 362 | msg.obj = schoolInfoBeanList; |
363 | handler.sendMessage(msg); | 363 | handler.sendMessage(msg); |
364 | 364 | ||
365 | 365 | ||
366 | } else { | 366 | } else { |
367 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 367 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
368 | 368 | ||
369 | } | 369 | } |
370 | } catch (JSONException e) { | 370 | } catch (JSONException e) { |
371 | e.printStackTrace(); | 371 | e.printStackTrace(); |
372 | } | 372 | } |
373 | 373 | ||
374 | } | 374 | } |
375 | 375 | ||
376 | @Override | 376 | @Override |
377 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 377 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
378 | closeProgress(); | 378 | closeProgress(); |
379 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 379 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
380 | } | 380 | } |
381 | }); | 381 | }); |
382 | } | 382 | } |
383 | 383 | ||
384 | //获取是否为样机信息 | 384 | //获取是否为样机信息 |
385 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { | 385 | public void getcardinfo1(final Context mContext, String deviceNumber, final Handler handler) { |
386 | HttpClient.getInstance().setTimeout(5 * 1000); | 386 | HttpClient.getInstance().setTimeout(5 * 1000); |
387 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 387 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
388 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 388 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
389 | @Override | 389 | @Override |
390 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 390 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
391 | closeProgress(); | 391 | closeProgress(); |
392 | Log.e("test", "保卡信息" + new String(arg2)); | 392 | Log.e("test", "保卡信息" + new String(arg2)); |
393 | Message msg = Message.obtain(); | 393 | Message msg = Message.obtain(); |
394 | msg.what = HttpCode.SUCHCARDINFOONE; | 394 | msg.what = HttpCode.SUCHCARDINFOONE; |
395 | msg.obj = new String(arg2); | 395 | msg.obj = new String(arg2); |
396 | handler.sendMessage(msg); | 396 | handler.sendMessage(msg); |
397 | 397 | ||
398 | } | 398 | } |
399 | 399 | ||
400 | @Override | 400 | @Override |
401 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 401 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
402 | closeProgress(); | 402 | closeProgress(); |
403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
404 | } | 404 | } |
405 | }); | 405 | }); |
406 | } | 406 | } |
407 | 407 | ||
408 | //修改账户电话 | 408 | //修改账户电话 |
409 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { | 409 | public void changeaccountphone(final Context mContext, long userId, final String username, String authCode) { |
410 | RequestParams params = new RequestParams(); | 410 | RequestParams params = new RequestParams(); |
411 | params.put("userId", userId); | 411 | params.put("userId", userId); |
412 | params.put("username", username); | 412 | params.put("username", username); |
413 | params.put("authCode", authCode); | 413 | params.put("authCode", authCode); |
414 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 414 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
415 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { | 415 | HttpClient.getInstance().post(HttpUrl.chageaccountphoneURL, params, new AsyncHttpResponseHandler() { |
416 | @Override | 416 | @Override |
417 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 417 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
418 | try { | 418 | try { |
419 | Log.e("test", "保卡信息" + new String(bytes)); | 419 | Log.e("test", "保卡信息" + new String(bytes)); |
420 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 420 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
421 | String status = jsonObject.optString("status"); | 421 | String status = jsonObject.optString("status"); |
422 | if (status.equals("1")) { | 422 | if (status.equals("1")) { |
423 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 423 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
424 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); | 424 | SaveParam.getInstance().saveLoginParam(mContext, "username", username); |
425 | ((Activity) mContext).finish(); | 425 | ((Activity) mContext).finish(); |
426 | } else if (status.equals("1001")) { | 426 | } else if (status.equals("1001")) { |
427 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 427 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
428 | } | 428 | } |
429 | else if (status.equals("1006")) { | 429 | else if (status.equals("1006")) { |
430 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); | 430 | AlertUtils.showToast(mContext, "该手机号已存在,请使用其他手机号重新绑定!"); |
431 | } else { | 431 | } else { |
432 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 432 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
433 | } | 433 | } |
434 | } catch (JSONException e) { | 434 | } catch (JSONException e) { |
435 | e.printStackTrace(); | 435 | e.printStackTrace(); |
436 | } | 436 | } |
437 | } | 437 | } |
438 | 438 | ||
439 | @Override | 439 | @Override |
440 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 440 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
441 | Log.e("test", "onFailure" + new String(bytes)); | 441 | Log.e("test", "onFailure" + new String(bytes)); |
442 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 442 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
443 | } | 443 | } |
444 | }); | 444 | }); |
445 | } | 445 | } |
446 | 446 | ||
447 | //修改保卡信息电话 | 447 | //修改保卡信息电话 |
448 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { | 448 | public void changecardinfophone(final Context mContext, String userId, final String customerPhone, String authCode) { |
449 | RequestParams params = new RequestParams(); | 449 | RequestParams params = new RequestParams(); |
450 | params.put("userId", userId); | 450 | params.put("deviceNumber", userId); |
451 | params.put("customerPhone", customerPhone); | 451 | params.put("customerPhone", customerPhone); |
452 | params.put("authCode", authCode); | 452 | params.put("authCode", authCode); |
453 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 453 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
454 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 454 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
455 | @Override | 455 | @Override |
456 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 456 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
457 | try { | 457 | try { |
458 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 458 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
459 | String status = jsonObject.optString("status"); | 459 | String status = jsonObject.optString("status"); |
460 | if (status.equals("1")) { | 460 | if (status.equals("1")) { |
461 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 461 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
462 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 462 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
463 | ((Activity) mContext).finish(); | 463 | ((Activity) mContext).finish(); |
464 | } else if (status.equals("1001")) { | 464 | } else if (status.equals("1001")) { |
465 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 465 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
466 | } else { | 466 | } else { |
467 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 467 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
468 | } | 468 | } |
469 | } catch (JSONException e) { | 469 | } catch (JSONException e) { |
470 | e.printStackTrace(); | 470 | e.printStackTrace(); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
474 | @Override | 474 | @Override |
475 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 475 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
476 | Log.e("test", "onFailure" + new String(bytes)); | 476 | Log.e("test", "onFailure" + new String(bytes)); |
477 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 477 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
478 | } | 478 | } |
479 | }); | 479 | }); |
480 | } | 480 | } |
481 | 481 | ||
482 | //修改保卡信息地址 | 482 | //修改保卡信息地址 |
483 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 483 | public void changecardadressinfo(final Context mContext, String userId, final String customerPhone, String authCode, final String customerAddress) { |
484 | RequestParams params = new RequestParams(); | 484 | RequestParams params = new RequestParams(); |
485 | params.put("userId", userId); | 485 | params.put("deviceNumber", userId); |
486 | params.put("customerPhone", customerPhone); | 486 | params.put("customerPhone", customerPhone); |
487 | params.put("authCode", authCode); | 487 | params.put("authCode", authCode); |
488 | params.put("customerAddress", customerAddress); | 488 | params.put("customerAddress", customerAddress); |
489 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 489 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
490 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 490 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
491 | @Override | 491 | @Override |
492 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 492 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
493 | try { | 493 | try { |
494 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 494 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
495 | String status = jsonObject.optString("status"); | 495 | String status = jsonObject.optString("status"); |
496 | if (status.equals("1")) { | 496 | if (status.equals("1")) { |
497 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 497 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
498 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 498 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
499 | ((Activity) mContext).finish(); | 499 | ((Activity) mContext).finish(); |
500 | } else { | 500 | } else { |
501 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 501 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
502 | } | 502 | } |
503 | } catch (JSONException e) { | 503 | } catch (JSONException e) { |
504 | e.printStackTrace(); | 504 | e.printStackTrace(); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | @Override | 508 | @Override |
509 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 509 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
510 | Log.e("test", "onFailure" + new String(bytes)); | 510 | Log.e("test", "onFailure" + new String(bytes)); |
511 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 511 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
512 | } | 512 | } |
513 | }); | 513 | }); |
514 | } | 514 | } |
515 | 515 | ||
516 | //验证是否保卡信息 | 516 | //验证是否保卡信息 |
517 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { | 517 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
518 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 518 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
519 | false, true, null); | 519 | false, true, null); |
520 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 520 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
521 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 521 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
522 | @Override | 522 | @Override |
523 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 523 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
524 | Log.e("test", "验证保卡" + new String(arg2)); | 524 | Log.e("test", "验证保卡" + new String(arg2)); |
525 | closeProgress(); | 525 | closeProgress(); |
526 | Message msg = Message.obtain(); | 526 | Message msg = Message.obtain(); |
527 | msg.what = HttpCode.CHECKCARD; | 527 | msg.what = HttpCode.CHECKCARD; |
528 | msg.obj = new String(arg2); | 528 | msg.obj = new String(arg2); |
529 | handler.sendMessage(msg); | 529 | handler.sendMessage(msg); |
530 | 530 | ||
531 | 531 | ||
532 | } | 532 | } |
533 | 533 | ||
534 | @Override | 534 | @Override |
535 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 535 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
536 | closeProgress(); | 536 | closeProgress(); |
537 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 537 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
538 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 538 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
539 | } | 539 | } |
540 | }); | 540 | }); |
541 | } | 541 | } |
542 | 542 | ||
543 | ///获取年级 | 543 | ///获取年级 |
544 | public void getgrade(final Context mContext, final Handler handler) { | 544 | public void getgrade(final Context mContext, final Handler handler) { |
545 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 545 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
546 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 546 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
547 | @Override | 547 | @Override |
548 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 548 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
549 | Log.e("test", "年级" + new String(arg2)); | 549 | Log.e("test", "年级" + new String(arg2)); |
550 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 550 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
551 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 551 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
552 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 552 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
553 | String name = gradeInfo.getData().get(i).getName(); | 553 | String name = gradeInfo.getData().get(i).getName(); |
554 | int id = gradeInfo.getData().get(i).getId(); | 554 | int id = gradeInfo.getData().get(i).getId(); |
555 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 555 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
556 | for (int j = 0; j < gradeinfoList.size(); j++) { | 556 | for (int j = 0; j < gradeinfoList.size(); j++) { |
557 | String secondname = gradeinfoList.get(j).getName(); | 557 | String secondname = gradeinfoList.get(j).getName(); |
558 | int secondid = gradeinfoList.get(j).getId(); | 558 | int secondid = gradeinfoList.get(j).getId(); |
559 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 559 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
560 | dataBean.setName(secondname); | 560 | dataBean.setName(secondname); |
561 | dataBean.setId(secondid); | 561 | dataBean.setId(secondid); |
562 | gradeInfoLists.add(dataBean); | 562 | gradeInfoLists.add(dataBean); |
563 | } | 563 | } |
564 | 564 | ||
565 | } | 565 | } |
566 | 566 | ||
567 | Message message = Message.obtain(); | 567 | Message message = Message.obtain(); |
568 | message.what = HttpCode.GRADER; | 568 | message.what = HttpCode.GRADER; |
569 | message.obj = gradeInfoLists; | 569 | message.obj = gradeInfoLists; |
570 | handler.sendMessage(message); | 570 | handler.sendMessage(message); |
571 | 571 | ||
572 | 572 | ||
573 | } | 573 | } |
574 | 574 | ||
575 | @Override | 575 | @Override |
576 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 576 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
577 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 577 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
578 | } | 578 | } |
579 | }); | 579 | }); |
580 | } | 580 | } |
581 | 581 | ||
582 | /** | 582 | /** |
583 | * 获取学校 | 583 | * 获取学校 |
584 | * | 584 | * |
585 | * @param mContext | 585 | * @param mContext |
586 | * @param regionId | 586 | * @param regionId |
587 | * @param gradeId | 587 | * @param gradeId |
588 | * @param handler | 588 | * @param handler |
589 | */ | 589 | */ |
590 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 590 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
591 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 591 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
592 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 592 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
593 | @Override | 593 | @Override |
594 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 594 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
595 | Log.e("test", "学校" + new String(arg2)); | 595 | Log.e("test", "学校" + new String(arg2)); |
596 | try { | 596 | try { |
597 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 597 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
598 | int status = jsonObject.optInt("status"); | 598 | int status = jsonObject.optInt("status"); |
599 | if (status == 1) { | 599 | if (status == 1) { |
600 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 600 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
601 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 601 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
602 | Message message = Message.obtain(); | 602 | Message message = Message.obtain(); |
603 | message.what = HttpCode.SCHOOL; | 603 | message.what = HttpCode.SCHOOL; |
604 | message.obj = schoolInfoBeanList; | 604 | message.obj = schoolInfoBeanList; |
605 | handler.sendMessage(message); | 605 | handler.sendMessage(message); |
606 | 606 | ||
607 | 607 | ||
608 | } else { | 608 | } else { |
609 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 609 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
610 | 610 | ||
611 | } | 611 | } |
612 | } catch (JSONException e) { | 612 | } catch (JSONException e) { |
613 | e.printStackTrace(); | 613 | e.printStackTrace(); |
614 | } | 614 | } |
615 | 615 | ||
616 | } | 616 | } |
617 | 617 | ||
618 | @Override | 618 | @Override |
619 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 619 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
620 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 620 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
621 | } | 621 | } |
622 | }); | 622 | }); |
623 | } | 623 | } |
624 | 624 | ||
625 | 625 | ||
626 | /** | 626 | /** |
627 | * 获取个人信息 | 627 | * 获取个人信息 |
628 | * | 628 | * |
629 | * @param mContext | 629 | * @param mContext |
630 | * @param userId | 630 | * @param userId |
631 | * @param handler | 631 | * @param handler |
632 | */ | 632 | */ |
633 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 633 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
634 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 634 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
635 | // false, true, null); | 635 | // false, true, null); |
636 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 636 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
637 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 637 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
638 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 638 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
639 | @Override | 639 | @Override |
640 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 640 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
641 | closeProgress(); | 641 | closeProgress(); |
642 | Log.e("test", "个人信息" + new String(arg2)); | 642 | Log.e("test", "个人信息" + new String(arg2)); |
643 | try { | 643 | try { |
644 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 644 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
645 | int status = jsonObject.optInt("status"); | 645 | int status = jsonObject.optInt("status"); |
646 | if (status == 1) { | 646 | if (status == 1) { |
647 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 647 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
648 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 648 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
649 | Message message = Message.obtain(); | 649 | Message message = Message.obtain(); |
650 | message.what = HttpCode.GETINFO; | 650 | message.what = HttpCode.GETINFO; |
651 | message.obj = pesonalInfoBeanList; | 651 | message.obj = pesonalInfoBeanList; |
652 | handler.sendMessage(message); | 652 | handler.sendMessage(message); |
653 | 653 | ||
654 | 654 | ||
655 | } else { | 655 | } else { |
656 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 656 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
657 | 657 | ||
658 | } | 658 | } |
659 | } catch (JSONException e) { | 659 | } catch (JSONException e) { |
660 | e.printStackTrace(); | 660 | e.printStackTrace(); |
661 | } | 661 | } |
662 | 662 | ||
663 | 663 | ||
664 | } | 664 | } |
665 | 665 | ||
666 | @Override | 666 | @Override |
667 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 667 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
668 | closeProgress(); | 668 | closeProgress(); |
669 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 669 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
670 | } | 670 | } |
671 | }); | 671 | }); |
672 | } | 672 | } |
673 | 673 | ||
674 | //修改个人信息 | 674 | //修改个人信息 |
675 | public void changepresonalinfo(final Context mContext, Long id, int type | 675 | public void changepresonalinfo(final Context mContext, Long id, int type |
676 | , String name, String birthday, int gradeId, long regionId, | 676 | , String name, String birthday, int gradeId, long regionId, |
677 | Object schoolId, String qq, String gender | 677 | Object schoolId, String qq, String gender |
678 | , String regionName,String address, String devicenumber) throws UnsupportedEncodingException { | 678 | , String regionName, String address, String devicenumber) throws UnsupportedEncodingException { |
679 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 679 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
680 | false, true, null); | 680 | false, true, null); |
681 | RequestParams params = new RequestParams(); | 681 | RequestParams params = new RequestParams(); |
682 | 682 | ||
683 | params.put(HttpKey.USEID, id); | 683 | params.put(HttpKey.USEID, id); |
684 | params.put(HttpKey.TYPE, type); | 684 | params.put(HttpKey.TYPE, type); |
685 | params.put(HttpKey.NAME, name); | 685 | params.put(HttpKey.NAME, name); |
686 | params.put(HttpKey.BIRDays, birthday); | 686 | params.put(HttpKey.BIRDays, birthday); |
687 | params.put(HttpKey.GRADE, gradeId); | 687 | params.put(HttpKey.GRADE, gradeId); |
688 | params.put(HttpKey.REGION, regionId); | 688 | params.put(HttpKey.REGION, regionId); |
689 | params.put(HttpKey.SCHOOL, schoolId); | 689 | params.put(HttpKey.SCHOOL, schoolId); |
690 | params.put(HttpKey.QQ, qq); | 690 | params.put(HttpKey.QQ, qq); |
691 | params.put(HttpKey.GENDER, gender); | 691 | params.put(HttpKey.GENDER, gender); |
692 | params.put(HttpKey.REGIONNAME, regionName); | 692 | params.put(HttpKey.REGIONNAME, regionName); |
693 | params.put(HttpKey.ADDDRESS, address); | 693 | params.put(HttpKey.ADDDRESS, address); |
694 | params.put(HttpKey.DEVINUMBER, devicenumber); | 694 | params.put(HttpKey.DEVINUMBER, devicenumber); |
695 | Log.e("test", "个人信息" + params); | 695 | Log.e("test", "个人信息" + params); |
696 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 696 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
697 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 697 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
698 | @Override | 698 | @Override |
699 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 699 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
700 | super.onSuccess(statusCode, headers, response); | 700 | super.onSuccess(statusCode, headers, response); |
701 | closeProgress(); | 701 | closeProgress(); |
702 | String status = response.optString("status"); | 702 | String status = response.optString("status"); |
703 | if (status.equals("1")) { | 703 | if (status.equals("1")) { |
704 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 704 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
705 | ((Activity) mContext).finish(); | 705 | ((Activity) mContext).finish(); |
706 | } else { | 706 | } else { |
707 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 707 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
708 | } | 708 | } |
709 | 709 | ||
710 | } | 710 | } |
711 | 711 | ||
712 | @Override | 712 | @Override |
713 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 713 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
714 | super.onFailure(statusCode, headers, throwable, errorResponse); | 714 | super.onFailure(statusCode, headers, throwable, errorResponse); |
715 | closeProgress(); | 715 | closeProgress(); |
716 | Log.e("test", "onFailure" + errorResponse); | 716 | Log.e("test", "onFailure" + errorResponse); |
717 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 717 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
718 | } | 718 | } |
719 | 719 | ||
720 | }); | 720 | }); |
721 | } | 721 | } |
722 | 722 | ||
723 | //提交注册信息 | 723 | //提交注册信息 |
724 | public void subregisterinfo(final Context mContext, Long userId | 724 | public void subregisterinfo(final Context mContext, Long userId |
725 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, | 725 | , String name, int gradeId, long regionId, String regionName, Object schoolId, String chinese, |
726 | String math, String english, String physics, String chemistry, | 726 | String math, String english, String physics, String chemistry, |
727 | String history, String geography, String political, String biology, String science, final Handler handler) { | 727 | String history, String geography, String political, String biology, String science, final Handler handler) { |
728 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 728 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
729 | false, true, null); | 729 | false, true, null); |
730 | RequestParams params = new RequestParams(); | 730 | RequestParams params = new RequestParams(); |
731 | 731 | ||
732 | params.put(HttpKey.USEID, userId); | 732 | params.put(HttpKey.USEID, userId); |
733 | params.put(HttpKey.NAME, name); | 733 | params.put(HttpKey.NAME, name); |
734 | params.put(HttpKey.GRADE, gradeId); | 734 | params.put(HttpKey.GRADE, gradeId); |
735 | params.put(HttpKey.REGION, regionId); | 735 | params.put(HttpKey.REGION, regionId); |
736 | params.put(HttpKey.SCHOOL, schoolId); | 736 | params.put(HttpKey.SCHOOL, schoolId); |
737 | params.put(HttpKey.REGIONNAME, regionName); | 737 | params.put(HttpKey.REGIONNAME, regionName); |
738 | params.put(HttpKey.MATH, math); | 738 | params.put(HttpKey.MATH, math); |
739 | params.put(HttpKey.ENGLISH, english); | 739 | params.put(HttpKey.ENGLISH, english); |
740 | params.put(HttpKey.CHINESE, chinese); | 740 | params.put(HttpKey.CHINESE, chinese); |
741 | params.put(HttpKey.PHYSICES, physics); | 741 | params.put(HttpKey.PHYSICES, physics); |
742 | params.put(HttpKey.CHEMISTRY, chemistry); | 742 | params.put(HttpKey.CHEMISTRY, chemistry); |
743 | params.put(HttpKey.HISTIRY, history); | 743 | params.put(HttpKey.HISTIRY, history); |
744 | params.put(HttpKey.GEOGRAPHY, geography); | 744 | params.put(HttpKey.GEOGRAPHY, geography); |
745 | params.put(HttpKey.POLITICAL, political); | 745 | params.put(HttpKey.POLITICAL, political); |
746 | params.put(HttpKey.BIOLOGY, biology); | 746 | params.put(HttpKey.BIOLOGY, biology); |
747 | params.put(HttpKey.SCIENCE, science); | 747 | params.put(HttpKey.SCIENCE, science); |
748 | 748 | ||
749 | Log.e("test", "注册信息" + params); | 749 | Log.e("test", "注册信息" + params); |
750 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 750 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
751 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 751 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
752 | @Override | 752 | @Override |
753 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 753 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
754 | super.onSuccess(statusCode, headers, response); | 754 | super.onSuccess(statusCode, headers, response); |
755 | closeProgress(); | 755 | closeProgress(); |
756 | Message message = Message.obtain(); | 756 | Message message = Message.obtain(); |
757 | message.what = HttpCode.REGISTERINFO_SUCESS; | 757 | message.what = HttpCode.REGISTERINFO_SUCESS; |
758 | message.obj = new String(String.valueOf(response)); | 758 | message.obj = new String(String.valueOf(response)); |
759 | handler.sendMessage(message); | 759 | handler.sendMessage(message); |
760 | 760 | ||
761 | } | 761 | } |
762 | 762 | ||
763 | @Override | 763 | @Override |
764 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 764 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
765 | super.onFailure(statusCode, headers, throwable, errorResponse); | 765 | super.onFailure(statusCode, headers, throwable, errorResponse); |
766 | closeProgress(); | 766 | closeProgress(); |
767 | Log.e("test", "onFailure" + errorResponse); | 767 | Log.e("test", "onFailure" + errorResponse); |
768 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 768 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
769 | } | 769 | } |
770 | 770 | ||
771 | }); | 771 | }); |
772 | } | 772 | } |
773 | 773 | ||
774 | //修改版本信息 | 774 | //修改版本信息 |
775 | public void changepublishinfo(final Context mContext, String userId, String chinese, | 775 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
776 | String math, String english, String physics, String chemistry, | 776 | String math, String english, String physics, String chemistry, |
777 | String history, String geography, String political, String biology, String science) { | 777 | String history, String geography, String political, String biology, String science) { |
778 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", | 778 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存版本信息...", |
779 | false, true, null); | 779 | false, true, null); |
780 | RequestParams params = new RequestParams(); | 780 | RequestParams params = new RequestParams(); |
781 | params.put(HttpKey.USEID, userId); | 781 | params.put(HttpKey.USEID, userId); |
782 | params.put(HttpKey.CHINESE, chinese); | 782 | params.put(HttpKey.CHINESE, chinese); |
783 | params.put(HttpKey.MATH, math); | 783 | params.put(HttpKey.MATH, math); |
784 | params.put(HttpKey.ENGLISH, english); | 784 | params.put(HttpKey.ENGLISH, english); |
785 | params.put(HttpKey.PHYSICES, physics); | 785 | params.put(HttpKey.PHYSICES, physics); |
786 | params.put(HttpKey.CHEMISTRY, chemistry); | 786 | params.put(HttpKey.CHEMISTRY, chemistry); |
787 | params.put(HttpKey.HISTIRY, history); | 787 | params.put(HttpKey.HISTIRY, history); |
788 | params.put(HttpKey.GEOGRAPHY, geography); | 788 | params.put(HttpKey.GEOGRAPHY, geography); |
789 | params.put(HttpKey.POLITICAL, political); | 789 | params.put(HttpKey.POLITICAL, political); |
790 | params.put(HttpKey.BIOLOGY, biology); | 790 | params.put(HttpKey.BIOLOGY, biology); |
791 | params.put(HttpKey.SCIENCE, science); | 791 | params.put(HttpKey.SCIENCE, science); |
792 | 792 | ||
793 | Log.e("test", "版本信息信息" + params); | 793 | Log.e("test", "版本信息信息" + params); |
794 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 794 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
795 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 795 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
796 | @Override | 796 | @Override |
797 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 797 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
798 | super.onSuccess(statusCode, headers, response); | 798 | super.onSuccess(statusCode, headers, response); |
799 | closeProgress(); | 799 | closeProgress(); |
800 | String status = response.optString("status"); | 800 | String status = response.optString("status"); |
801 | if (status.equals("1")) { | 801 | if (status.equals("1")) { |
802 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 802 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
803 | ((Activity) mContext).finish(); | 803 | ((Activity) mContext).finish(); |
804 | } else { | 804 | } else { |
805 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 805 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
806 | } | 806 | } |
807 | 807 | ||
808 | } | 808 | } |
809 | 809 | ||
810 | @Override | 810 | @Override |
811 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 811 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
812 | super.onFailure(statusCode, headers, throwable, errorResponse); | 812 | super.onFailure(statusCode, headers, throwable, errorResponse); |
813 | closeProgress(); | 813 | closeProgress(); |
814 | Log.e("test", "onFailure" + errorResponse); | 814 | Log.e("test", "onFailure" + errorResponse); |
815 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 815 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
816 | } | 816 | } |
817 | 817 | ||
818 | }); | 818 | }); |
819 | } | 819 | } |
820 | 820 | ||
821 | //修改个性签名 | 821 | //修改个性签名 |
822 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 822 | public void changsignature(final Context mContext, Object userId, int type, final String signature) { |
823 | RequestParams params = new RequestParams(); | 823 | RequestParams params = new RequestParams(); |
824 | params.put("userId", userId); | 824 | params.put("userId", userId); |
825 | params.put("type", type); | 825 | params.put("type", type); |
826 | params.put("signature", signature); | 826 | params.put("signature", signature); |
827 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 827 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
828 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 828 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
829 | @Override | 829 | @Override |
830 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 830 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
831 | try { | 831 | try { |
832 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 832 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
833 | String status = jsonObject.optString("status"); | 833 | String status = jsonObject.optString("status"); |
834 | if (status.equals("1")) { | 834 | if (status.equals("1")) { |
835 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 835 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
836 | } else { | 836 | } else { |
837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 837 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
838 | } | 838 | } |
839 | } catch (JSONException e) { | 839 | } catch (JSONException e) { |
840 | e.printStackTrace(); | 840 | e.printStackTrace(); |
841 | } | 841 | } |
842 | } | 842 | } |
843 | 843 | ||
844 | @Override | 844 | @Override |
845 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 845 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
846 | //Log.e("test", "onFailure" + new String(bytes)); | 846 | //Log.e("test", "onFailure" + new String(bytes)); |
847 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 847 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
848 | } | 848 | } |
849 | }); | 849 | }); |
850 | } | 850 | } |
851 | 851 | ||
852 | /** | 852 | /** |
853 | * 获取个性签名 | 853 | * 获取个性签名 |
854 | * | 854 | * |
855 | * @param mContext | 855 | * @param mContext |
856 | * @param userId | 856 | * @param userId |
857 | * @param handler | 857 | * @param handler |
858 | */ | 858 | */ |
859 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 859 | public void getsignatures(final Context mContext, Object userId, int type, final Handler handler) { |
860 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 860 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
861 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 861 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
862 | @Override | 862 | @Override |
863 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 863 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
864 | Log.e("test", "个性签名" + new String(arg2)); | 864 | Log.e("test", "个性签名" + new String(arg2)); |
865 | try { | 865 | try { |
866 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 866 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
867 | int status = jsonObject.optInt("status"); | 867 | int status = jsonObject.optInt("status"); |
868 | if (status == 1) { | 868 | if (status == 1) { |
869 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 869 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
870 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 870 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
871 | Message message = Message.obtain(); | 871 | Message message = Message.obtain(); |
872 | message.what = HttpCode.SIGN; | 872 | message.what = HttpCode.SIGN; |
873 | message.obj = signInfoBeanList; | 873 | message.obj = signInfoBeanList; |
874 | handler.sendMessage(message); | 874 | handler.sendMessage(message); |
875 | 875 | ||
876 | 876 | ||
877 | } else if (status == 1000) { | 877 | } else if (status == 1000) { |
878 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 878 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
879 | 879 | ||
880 | } else { | 880 | } else { |
881 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 881 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
882 | } | 882 | } |
883 | } catch (JSONException e) { | 883 | } catch (JSONException e) { |
884 | e.printStackTrace(); | 884 | e.printStackTrace(); |
885 | } | 885 | } |
886 | 886 | ||
887 | 887 | ||
888 | } | 888 | } |
889 | 889 | ||
890 | @Override | 890 | @Override |
891 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 891 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
892 | //Log.e("test", "失败原因" + arg3); | 892 | //Log.e("test", "失败原因" + arg3); |
893 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 893 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
894 | } | 894 | } |
895 | }); | 895 | }); |
896 | } | 896 | } |
897 | 897 | ||
898 | /** | 898 | /** |
899 | * 用户反馈 | 899 | * 用户反馈 |
900 | * | 900 | * |
901 | * @param mContext | 901 | * @param mContext |
902 | * @param userId | 902 | * @param userId |
903 | * @param content | 903 | * @param content |
904 | * @param contact | 904 | * @param contact |
905 | * @param imgs | 905 | * @param imgs |
906 | * @param feedtype | 906 | * @param feedtype |
907 | * @throws UnsupportedEncodingException | 907 | * @throws UnsupportedEncodingException |
908 | */ | 908 | */ |
909 | public void feedback(final Context mContext, String userId, String content, | 909 | public void feedback(final Context mContext, String userId, String content, |
910 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 910 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
911 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 911 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
912 | false, true, null); | 912 | false, true, null); |
913 | File file = new File(imgs); | 913 | File file = new File(imgs); |
914 | RequestParams params = new RequestParams(); | 914 | RequestParams params = new RequestParams(); |
915 | try { | 915 | try { |
916 | params.put("userId", userId); | 916 | params.put("userId", userId); |
917 | params.put("content", content); | 917 | params.put("content", content); |
918 | params.put("contact", contact); | 918 | params.put("contact", contact); |
919 | if (file.exists() && file.length() > 0) { | 919 | if (file.exists() && file.length() > 0) { |
920 | params.put("imgs", file); | 920 | params.put("imgs", file); |
921 | } | 921 | } |
922 | params.put("feedtype", feedtype); | 922 | params.put("feedtype", feedtype); |
923 | } catch (FileNotFoundException e) { | 923 | } catch (FileNotFoundException e) { |
924 | e.printStackTrace(); | 924 | e.printStackTrace(); |
925 | } | 925 | } |
926 | Log.e("test", "onSuccess" + params); | 926 | Log.e("test", "onSuccess" + params); |
927 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 927 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
928 | @Override | 928 | @Override |
929 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 929 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
930 | closeProgress(); | 930 | closeProgress(); |
931 | Log.e("test", "onSuccess" + new String(bytes)); | 931 | Log.e("test", "onSuccess" + new String(bytes)); |
932 | try { | 932 | try { |
933 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 933 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
934 | String status = jsonObject.optString("status"); | 934 | String status = jsonObject.optString("status"); |
935 | if (status.equals("1")) { | 935 | if (status.equals("1")) { |
936 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 936 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
937 | ((Activity) mContext).finish(); | 937 | ((Activity) mContext).finish(); |
938 | } else { | 938 | } else { |
939 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 939 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
940 | } | 940 | } |
941 | } catch (JSONException e) { | 941 | } catch (JSONException e) { |
942 | e.printStackTrace(); | 942 | e.printStackTrace(); |
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
946 | @Override | 946 | @Override |
947 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 947 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
948 | closeProgress(); | 948 | closeProgress(); |
949 | //Log.e("test", "错误信息" + new String(bytes)); | 949 | //Log.e("test", "错误信息" + new String(bytes)); |
950 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 950 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
951 | 951 | ||
952 | } | 952 | } |
953 | }); | 953 | }); |
954 | 954 | ||
955 | } | 955 | } |
956 | 956 | ||
957 | /** | 957 | /** |
958 | * 查询子账户信息 | 958 | * 查询子账户信息 |
959 | * | 959 | * |
960 | * @param mContext | 960 | * @param mContext |
961 | * @param userId | 961 | * @param userId |
962 | * @param handler | 962 | * @param handler |
963 | */ | 963 | */ |
964 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 964 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
965 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 965 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
966 | false, true, null); | 966 | false, true, null); |
967 | 967 | ||
968 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 968 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
969 | HttpClient.getInstance().setTimeout(5 * 1000); | 969 | HttpClient.getInstance().setTimeout(5 * 1000); |
970 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 970 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
971 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 971 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
972 | @Override | 972 | @Override |
973 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 973 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
974 | closeProgress(); | 974 | closeProgress(); |
975 | Log.e("test", "子账户信息" + new String(arg2)); | 975 | Log.e("test", "子账户信息" + new String(arg2)); |
976 | try { | 976 | try { |
977 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 977 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
978 | int status = jsonObject.optInt("status"); | 978 | int status = jsonObject.optInt("status"); |
979 | if (status == 1) { | 979 | if (status == 1) { |
980 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 980 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
981 | Log.e("test", "子账户信息" + childsInfo); | 981 | Log.e("test", "子账户信息" + childsInfo); |
982 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 982 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
983 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 983 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
984 | Message msg = Message.obtain(); | 984 | Message msg = Message.obtain(); |
985 | msg.what = HttpCode.CHILDS_SUCESS; | 985 | msg.what = HttpCode.CHILDS_SUCESS; |
986 | msg.obj = schoolInfoBeanList; | 986 | msg.obj = schoolInfoBeanList; |
987 | handler.sendMessage(msg); | 987 | handler.sendMessage(msg); |
988 | 988 | ||
989 | } else { | 989 | } else { |
990 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 990 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
991 | 991 | ||
992 | } | 992 | } |
993 | } catch (JSONException e) { | 993 | } catch (JSONException e) { |
994 | e.printStackTrace(); | 994 | e.printStackTrace(); |
995 | 995 | ||
996 | } | 996 | } |
997 | 997 | ||
998 | } | 998 | } |
999 | 999 | ||
1000 | @Override | 1000 | @Override |
1001 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1001 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1002 | closeProgress(); | 1002 | closeProgress(); |
1003 | // Log.e("test", "错误信息" + new String(arg2)); | 1003 | // Log.e("test", "错误信息" + new String(arg2)); |
1004 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1004 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1005 | } | 1005 | } |
1006 | }); | 1006 | }); |
1007 | 1007 | ||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /** | 1010 | /** |
1011 | * 删除子账户信息 | 1011 | * 删除子账户信息 |
1012 | * | 1012 | * |
1013 | * @param mContext | 1013 | * @param mContext |
1014 | * @param subAccountId | 1014 | * @param subAccountId |
1015 | */ | 1015 | */ |
1016 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 1016 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
1017 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 1017 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
1018 | false, true, null); | 1018 | false, true, null); |
1019 | HttpClient.getInstance().setTimeout(5 * 1000); | 1019 | HttpClient.getInstance().setTimeout(5 * 1000); |
1020 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1020 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1021 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 1021 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
1022 | @Override | 1022 | @Override |
1023 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1023 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1024 | closeProgress(); | 1024 | closeProgress(); |
1025 | Log.e("test", "子账户信息" + new String(arg2)); | 1025 | Log.e("test", "子账户信息" + new String(arg2)); |
1026 | try { | 1026 | try { |
1027 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1027 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1028 | int status = jsonObject.optInt("status"); | 1028 | int status = jsonObject.optInt("status"); |
1029 | if (status == 1) { | 1029 | if (status == 1) { |
1030 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 1030 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
1031 | ((Activity) mContext).finish(); | 1031 | ((Activity) mContext).finish(); |
1032 | } else { | 1032 | } else { |
1033 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 1033 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
1034 | 1034 | ||
1035 | } | 1035 | } |
1036 | } catch (JSONException e) { | 1036 | } catch (JSONException e) { |
1037 | e.printStackTrace(); | 1037 | e.printStackTrace(); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | @Override | 1042 | @Override |
1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1044 | closeProgress(); | 1044 | closeProgress(); |
1045 | Log.e("test", "错误信息" + new String(arg2)); | 1045 | Log.e("test", "错误信息" + new String(arg2)); |
1046 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1046 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1047 | } | 1047 | } |
1048 | }); | 1048 | }); |
1049 | 1049 | ||
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | /** | 1052 | /** |
1053 | * 添加子账户信息 | 1053 | * 添加子账户信息 |
1054 | */ | 1054 | */ |
1055 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 1055 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
1056 | String name, final Long grade, Object school, Long region | 1056 | String name, final Long grade, Object school, Long region |
1057 | , String deviceNumber, String regionName) { | 1057 | , String deviceNumber, String regionName) { |
1058 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 1058 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
1059 | false, true, null); | 1059 | false, true, null); |
1060 | RequestParams params = new RequestParams(); | 1060 | RequestParams params = new RequestParams(); |
1061 | 1061 | ||
1062 | params.put(HttpKey.PARENTID, parentId); | 1062 | params.put(HttpKey.PARENTID, parentId); |
1063 | params.put(HttpKey.IMAGE, image); | 1063 | params.put(HttpKey.IMAGE, image); |
1064 | params.put(HttpKey.NAME, name); | 1064 | params.put(HttpKey.NAME, name); |
1065 | params.put(HttpKey.GRADE, grade); | 1065 | params.put(HttpKey.GRADE, grade); |
1066 | params.put(HttpKey.SCHOOL, school); | 1066 | params.put(HttpKey.SCHOOL, school); |
1067 | params.put(HttpKey.REGION, region); | 1067 | params.put(HttpKey.REGION, region); |
1068 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1068 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
1069 | params.put(HttpKey.REGIONNAME, regionName); | 1069 | params.put(HttpKey.REGIONNAME, regionName); |
1070 | 1070 | ||
1071 | Log.e("test", "子账户信息" + params); | 1071 | Log.e("test", "子账户信息" + params); |
1072 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1072 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1073 | HttpClient.getInstance().setTimeout(5 * 1000); | 1073 | HttpClient.getInstance().setTimeout(5 * 1000); |
1074 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1074 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1075 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1075 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
1076 | @Override | 1076 | @Override |
1077 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1077 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1078 | closeProgress(); | 1078 | closeProgress(); |
1079 | 1079 | ||
1080 | Log.e("test", "子账户信息" + new String(arg2)); | 1080 | Log.e("test", "子账户信息" + new String(arg2)); |
1081 | try { | 1081 | try { |
1082 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1082 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1083 | int status = jsonObject.optInt("status"); | 1083 | int status = jsonObject.optInt("status"); |
1084 | if (status == 1) { | 1084 | if (status == 1) { |
1085 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1085 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
1086 | ((Activity) mContext).finish(); | 1086 | ((Activity) mContext).finish(); |
1087 | } else { | 1087 | } else { |
1088 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1088 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
1089 | 1089 | ||
1090 | } | 1090 | } |
1091 | } catch (JSONException e) { | 1091 | } catch (JSONException e) { |
1092 | e.printStackTrace(); | 1092 | e.printStackTrace(); |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | @Override | 1097 | @Override |
1098 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1098 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1099 | closeProgress(); | 1099 | closeProgress(); |
1100 | Log.e("test", "错误信息" + new String(arg2)); | 1100 | Log.e("test", "错误信息" + new String(arg2)); |
1101 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1101 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1102 | } | 1102 | } |
1103 | }); | 1103 | }); |
1104 | 1104 | ||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | /** | 1107 | /** |
1108 | * 切换子账户信息 | 1108 | * 切换子账户信息 |
1109 | * | 1109 | * |
1110 | * @param mContext | 1110 | * @param mContext |
1111 | * @param subAccountId | 1111 | * @param subAccountId |
1112 | */ | 1112 | */ |
1113 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1113 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
1114 | , String deviceNumber, int type) { | 1114 | , String deviceNumber, int type) { |
1115 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1115 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1116 | false, true, null); | 1116 | false, true, null); |
1117 | HttpClient.getInstance().setTimeout(5 * 1000); | 1117 | HttpClient.getInstance().setTimeout(5 * 1000); |
1118 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1118 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1119 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1119 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
1120 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1120 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
1121 | @Override | 1121 | @Override |
1122 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1122 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1123 | closeProgress(); | 1123 | closeProgress(); |
1124 | Log.e("test", "子账户信息" + new String(arg2)); | 1124 | Log.e("test", "子账户信息" + new String(arg2)); |
1125 | try { | 1125 | try { |
1126 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1126 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1127 | int status = jsonObject.optInt("status"); | 1127 | int status = jsonObject.optInt("status"); |
1128 | if (status == 1) { | 1128 | if (status == 1) { |
1129 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1129 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
1130 | ((Activity) mContext).finish(); | 1130 | ((Activity) mContext).finish(); |
1131 | 1131 | ||
1132 | } else { | 1132 | } else { |
1133 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1133 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
1134 | 1134 | ||
1135 | } | 1135 | } |
1136 | } catch (JSONException e) { | 1136 | } catch (JSONException e) { |
1137 | e.printStackTrace(); | 1137 | e.printStackTrace(); |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | @Override | 1142 | @Override |
1143 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1143 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1144 | closeProgress(); | 1144 | closeProgress(); |
1145 | //Log.e("test", "错误信息" + new String(arg2)); | 1145 | //Log.e("test", "错误信息" + new String(arg2)); |
1146 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1146 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1147 | } | 1147 | } |
1148 | }); | 1148 | }); |
1149 | 1149 | ||
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | /** | 1152 | /** |
1153 | * 切换主账户信息 | 1153 | * 切换主账户信息 |
1154 | * | 1154 | * |
1155 | * @param mContext | 1155 | * @param mContext |
1156 | * @param type | 1156 | * @param type |
1157 | */ | 1157 | */ |
1158 | public void Accountinfo(final Context mContext, long userId | 1158 | public void Accountinfo(final Context mContext, long userId |
1159 | , String deviceNumber, int type) { | 1159 | , String deviceNumber, int type) { |
1160 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1160 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
1161 | false, true, null); | 1161 | false, true, null); |
1162 | HttpClient.getInstance().setTimeout(5 * 1000); | 1162 | HttpClient.getInstance().setTimeout(5 * 1000); |
1163 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1163 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1164 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1164 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
1165 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1165 | + "&type=" + type, new AsyncHttpResponseHandler() { |
1166 | @Override | 1166 | @Override |
1167 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1167 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1168 | closeProgress(); | 1168 | closeProgress(); |
1169 | Log.e("test", "子账户信息" + new String(arg2)); | 1169 | Log.e("test", "子账户信息" + new String(arg2)); |
1170 | try { | 1170 | try { |
1171 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1171 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1172 | int status = jsonObject.optInt("status"); | 1172 | int status = jsonObject.optInt("status"); |
1173 | if (status == 1) { | 1173 | if (status == 1) { |
1174 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1174 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
1175 | ((Activity) mContext).finish(); | 1175 | ((Activity) mContext).finish(); |
1176 | 1176 | ||
1177 | } else { | 1177 | } else { |
1178 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1178 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
1179 | 1179 | ||
1180 | } | 1180 | } |
1181 | } catch (JSONException e) { | 1181 | } catch (JSONException e) { |
1182 | e.printStackTrace(); | 1182 | e.printStackTrace(); |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | @Override | 1187 | @Override |
1188 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1188 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1189 | closeProgress(); | 1189 | closeProgress(); |
1190 | Log.e("test", "错误信息" + new String(arg2)); | 1190 | Log.e("test", "错误信息" + new String(arg2)); |
1191 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1191 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1192 | } | 1192 | } |
1193 | }); | 1193 | }); |
1194 | 1194 | ||
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | /** | 1197 | /** |
1198 | * 头像拍张 | 1198 | * 头像拍张 |
1199 | * | 1199 | * |
1200 | * @param mContext | 1200 | * @param mContext |
1201 | * @param userId | 1201 | * @param userId |
1202 | * @param img | 1202 | * @param img |
1203 | * @throws UnsupportedEncodingException | 1203 | * @throws UnsupportedEncodingException |
1204 | */ | 1204 | */ |
1205 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1205 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
1206 | File file = new File(img); | 1206 | File file = new File(img); |
1207 | if (file.exists() && file.length() > 0) { | 1207 | if (file.exists() && file.length() > 0) { |
1208 | RequestParams params = new RequestParams(); | 1208 | RequestParams params = new RequestParams(); |
1209 | try { | 1209 | try { |
1210 | params.put("userId", userId); | 1210 | params.put("userId", userId); |
1211 | params.put("type", type); | 1211 | params.put("type", type); |
1212 | params.put("img", file); | 1212 | params.put("img", file); |
1213 | } catch (FileNotFoundException e) { | 1213 | } catch (FileNotFoundException e) { |
1214 | e.printStackTrace(); | 1214 | e.printStackTrace(); |
1215 | } | 1215 | } |
1216 | Log.e("test", "params" + params); | 1216 | Log.e("test", "params" + params); |
1217 | HttpClient.getInstance().setTimeout(5 * 1000); | 1217 | HttpClient.getInstance().setTimeout(5 * 1000); |
1218 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1218 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
1219 | @Override | 1219 | @Override |
1220 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1220 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1221 | Log.e("test", "onSuccess" + new String(bytes)); | 1221 | Log.e("test", "onSuccess" + new String(bytes)); |
1222 | try { | 1222 | try { |
1223 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1223 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1224 | String status = jsonObject.optString("status"); | 1224 | String status = jsonObject.optString("status"); |
1225 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1225 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
1226 | String imagUrl = jsonObject1.optString("imgUrl"); | 1226 | String imagUrl = jsonObject1.optString("imgUrl"); |
1227 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1227 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
1228 | if (status.equals("1")) { | 1228 | if (status.equals("1")) { |
1229 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1229 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1230 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1230 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); |
1231 | } else { | 1231 | } else { |
1232 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1232 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1233 | } | 1233 | } |
1234 | } catch (JSONException e) { | 1234 | } catch (JSONException e) { |
1235 | e.printStackTrace(); | 1235 | e.printStackTrace(); |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | @Override | 1239 | @Override |
1240 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1240 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1241 | closeProgress(); | 1241 | closeProgress(); |
1242 | Log.e("test", "错误信息" + new String(bytes)); | 1242 | Log.e("test", "错误信息" + new String(bytes)); |
1243 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1243 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1244 | 1244 | ||
1245 | } | 1245 | } |
1246 | }); | 1246 | }); |
1247 | } else { | 1247 | } else { |
1248 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1248 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
1249 | } | 1249 | } |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | /** | 1252 | /** |
1253 | * 头像默认 | 1253 | * 头像默认 |
1254 | * | 1254 | * |
1255 | * @param mContext | 1255 | * @param mContext |
1256 | * @param userId | 1256 | * @param userId |
1257 | * @param | 1257 | * @param |
1258 | * @throws UnsupportedEncodingException | 1258 | * @throws UnsupportedEncodingException |
1259 | */ | 1259 | */ |
1260 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { | 1260 | public void headerdeft(final Context mContext, String userId, String type, String defaultImg) throws UnsupportedEncodingException { |
1261 | RequestParams params = new RequestParams(); | 1261 | RequestParams params = new RequestParams(); |
1262 | params.put("userId", userId); | 1262 | params.put("userId", userId); |
1263 | params.put("type", type); | 1263 | params.put("type", type); |
1264 | params.put("defaultImg", defaultImg); | 1264 | params.put("defaultImg", defaultImg); |
1265 | Log.e("test", "params" + params); | 1265 | Log.e("test", "params" + params); |
1266 | HttpClient.getInstance().setTimeout(5 * 1000); | 1266 | HttpClient.getInstance().setTimeout(5 * 1000); |
1267 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1267 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
1268 | @Override | 1268 | @Override |
1269 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1269 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1270 | Log.e("test", "onSuccess" + new String(bytes)); | 1270 | Log.e("test", "onSuccess" + new String(bytes)); |
1271 | try { | 1271 | try { |
1272 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1272 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1273 | String status = jsonObject.optString("status"); | 1273 | String status = jsonObject.optString("status"); |
1274 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); | 1274 | JSONObject jsonObject1 = jsonObject.getJSONObject("data"); |
1275 | String imagUrl = jsonObject1.optString("imgUrl"); | 1275 | String imagUrl = jsonObject1.optString("imgUrl"); |
1276 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); | 1276 | SaveParam.getInstance().saveLoginParam(mContext, SaveParam.HEADURL, imagUrl); |
1277 | if (status.equals("1")) { | 1277 | if (status.equals("1")) { |
1278 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1278 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1279 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); | 1279 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.PORTAIT,imagUrl); |
1280 | } else { | 1280 | } else { |
1281 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1281 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1282 | } | 1282 | } |
1283 | } catch (JSONException e) { | 1283 | } catch (JSONException e) { |
1284 | e.printStackTrace(); | 1284 | e.printStackTrace(); |
1285 | } | 1285 | } |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | @Override | 1288 | @Override |
1289 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1289 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1290 | closeProgress(); | 1290 | closeProgress(); |
1291 | Log.e("test", "错误信息" + new String(bytes)); | 1291 | Log.e("test", "错误信息" + new String(bytes)); |
1292 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1292 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1293 | 1293 | ||
1294 | } | 1294 | } |
1295 | }); | 1295 | }); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | /** | 1298 | /** |
1299 | * 检查注册信息是否完整 | 1299 | * 检查注册信息是否完整 |
1300 | * | 1300 | * |
1301 | * @param mContext | 1301 | * @param mContext |
1302 | * @param userId | 1302 | * @param userId |
1303 | */ | 1303 | */ |
1304 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1304 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
1305 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1305 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
1306 | false, true, null); | 1306 | false, true, null); |
1307 | HttpClient.getInstance().setTimeout(5 * 1000); | 1307 | HttpClient.getInstance().setTimeout(5 * 1000); |
1308 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1308 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1309 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1309 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
1310 | @Override | 1310 | @Override |
1311 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1311 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1312 | closeProgress(); | 1312 | closeProgress(); |
1313 | Log.e("test", "注册信息" + new String(arg2)); | 1313 | Log.e("test", "注册信息" + new String(arg2)); |
1314 | Message msg = Message.obtain(); | 1314 | Message msg = Message.obtain(); |
1315 | msg.what = HttpCode.REGISTER_SUCESS; | 1315 | msg.what = HttpCode.REGISTER_SUCESS; |
1316 | msg.obj = new String(arg2); | 1316 | msg.obj = new String(arg2); |
1317 | handler.sendMessage(msg); | 1317 | handler.sendMessage(msg); |
1318 | 1318 | ||
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | @Override | 1321 | @Override |
1322 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1322 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1323 | closeProgress(); | 1323 | closeProgress(); |
1324 | // Log.e("test", "错误信息" + new String(arg2)); | 1324 | // Log.e("test", "错误信息" + new String(arg2)); |
1325 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1325 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1326 | 1326 | ||
1327 | } | 1327 | } |
1328 | }); | 1328 | }); |
1329 | 1329 | ||
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | /** | 1332 | /** |
1333 | * 获取最近学习视频 | 1333 | * 获取最近学习视频 |
1334 | * | 1334 | * |
1335 | * @param mContext | 1335 | * @param mContext |
1336 | * @param userId | 1336 | * @param userId |
1337 | */ | 1337 | */ |
1338 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { | 1338 | public void getstuyvidioinfo(final Context mContext, Object userId, final Handler handler) { |
1339 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1339 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
1340 | false, true, null); | 1340 | false, true, null); |
1341 | HttpClient.getInstance().setTimeout(5 * 1000); | 1341 | HttpClient.getInstance().setTimeout(5 * 1000); |
1342 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1342 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1343 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | 1343 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId, new AsyncHttpResponseHandler() { |
1344 | @Override | 1344 | @Override |
1345 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1345 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1346 | closeProgress(); | 1346 | closeProgress(); |
1347 | Log.e("test", "近学习视频" + new String(arg2)); | 1347 | Log.e("test", "近学习视频" + new String(arg2)); |
1348 | try { | 1348 | try { |
1349 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1349 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1350 | int status = jsonObject.optInt("status"); | 1350 | int status = jsonObject.optInt("status"); |
1351 | if (status == 1) { | 1351 | if (status == 1) { |
1352 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1352 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
1353 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1353 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
1354 | Message msg = Message.obtain(); | 1354 | Message msg = Message.obtain(); |
1355 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1355 | msg.what = HttpCode.GETVIDIO_SUCESS; |
1356 | msg.obj = schoolInfoBeanList; | 1356 | msg.obj = schoolInfoBeanList; |
1357 | handler.sendMessage(msg); | 1357 | handler.sendMessage(msg); |
1358 | 1358 | ||
1359 | } else { | 1359 | } else if (status == 1000){ |
1360 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1360 | //AlertUtils.showToast(mContext, "暂无最近学习视频!"); |
1361 | 1361 | ||
1362 | }else { | ||
1363 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | ||
1362 | } | 1364 | } |
1363 | } catch (JSONException e) { | 1365 | } catch (JSONException e) { |
1364 | e.printStackTrace(); | 1366 | e.printStackTrace(); |
1365 | 1367 | ||
1366 | } | 1368 | } |
1367 | 1369 | ||
1368 | } | 1370 | } |
1369 | 1371 | ||
1370 | @Override | 1372 | @Override |
1371 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1373 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1372 | closeProgress(); | 1374 | closeProgress(); |
1373 | // Log.e("test", "错误信息" + new String(arg2)); | 1375 | // Log.e("test", "错误信息" + new String(arg2)); |
1374 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1376 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1375 | 1377 | ||
1376 | } | 1378 | } |
1377 | }); | 1379 | }); |
1378 | 1380 | ||
1379 | } | 1381 | } |
1380 | 1382 | ||
1381 | 1383 | ||
1382 | /** | 1384 | /** |
1383 | * 系统升级 | 1385 | * 系统升级 |
1384 | * | 1386 | * |
1385 | * @param mContext | 1387 | * @param mContext |
1386 | * @param pid appName | 1388 | * @param pid appName |
1387 | */ | 1389 | */ |
1388 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1390 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1389 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1391 | // mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
1390 | // false, true, null); | 1392 | // false, true, null); |
1391 | HttpClient.getInstance().setTimeout(5 * 1000); | 1393 | HttpClient.getInstance().setTimeout(5 * 1000); |
1392 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1394 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1393 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1395 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1394 | @Override | 1396 | @Override |
1395 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1397 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1396 | //closeProgress(); | 1398 | //closeProgress(); |
1397 | Log.e("test", "版本升级信息" + new String(arg2)); | 1399 | Log.e("test", "版本升级信息" + new String(arg2)); |
1398 | Gson gson = new Gson(); | 1400 | Gson gson = new Gson(); |
1399 | List<AppVersion> applist = gson.fromJson(new String(arg2), | 1401 | List<AppVersion> applist = gson.fromJson(new String(arg2), |
1400 | new TypeToken<List<AppVersion>>() {}.getType()); | 1402 | new TypeToken<List<AppVersion>>() {}.getType()); |
1401 | Log.e("test", "版本升级信息" + applist); | 1403 | Log.e("test", "版本升级信息" + applist); |
1402 | Message msg = Message.obtain(); | 1404 | Message msg = Message.obtain(); |
1403 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1405 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1404 | msg.obj = applist; | 1406 | msg.obj = applist; |
1405 | handler.sendMessage(msg); | 1407 | handler.sendMessage(msg); |
1406 | 1408 | ||
1407 | 1409 | ||
1408 | 1410 | ||
1409 | } | 1411 | } |
1410 | 1412 | ||
1411 | @Override | 1413 | @Override |
1412 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1414 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1413 | //closeProgress(); | 1415 | //closeProgress(); |
1414 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1416 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1415 | } | 1417 | } |
1416 | }); | 1418 | }); |
1417 | 1419 | ||
1418 | } | 1420 | } |
1419 | 1421 | ||
1420 | //版本信息 | 1422 | //版本信息 |
1421 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { | 1423 | public void versioninfo(final Context mContext, String subjectName, final Handler handler) { |
1422 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1424 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1423 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { | 1425 | HttpClient.getInstance().get(HttpUrl.getversionURL + "?subjectName=" + subjectName, new AsyncHttpResponseHandler() { |
1424 | @Override | 1426 | @Override |
1425 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1427 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1426 | Log.e("test", "版本信息" + new String(arg2)); | 1428 | Log.e("test", "版本信息" + new String(arg2)); |
1427 | try { | 1429 | try { |
1428 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1430 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1429 | int status = jsonObject.optInt("status"); | 1431 | int status = jsonObject.optInt("status"); |
1430 | if (status == 1) { | 1432 | if (status == 1) { |
1431 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1433 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
1432 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1434 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
1433 | Message message = Message.obtain(); | 1435 | Message message = Message.obtain(); |
1434 | message.what = HttpCode.VERSION_SUCESS; | 1436 | message.what = HttpCode.VERSION_SUCESS; |
1435 | message.obj = versionInfoList; | 1437 | message.obj = versionInfoList; |
1436 | handler.sendMessage(message); | 1438 | handler.sendMessage(message); |
1437 | 1439 | ||
1438 | } else if (status == 1000) { | 1440 | } else if (status == 1000) { |
1439 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1441 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
1440 | 1442 | ||
1441 | } else { | 1443 | } else { |
1442 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1444 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1443 | } | 1445 | } |
1444 | } catch (JSONException e) { | 1446 | } catch (JSONException e) { |
1445 | e.printStackTrace(); | 1447 | e.printStackTrace(); |
1446 | } | 1448 | } |
1447 | 1449 | ||
1448 | 1450 | ||
1449 | } | 1451 | } |
1450 | 1452 | ||
1451 | @Override | 1453 | @Override |
1452 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1454 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1453 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1455 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1454 | } | 1456 | } |
1455 | }); | 1457 | }); |
1456 | } | 1458 | } |
1457 | 1459 | ||
1458 | 1460 | ||
1459 | ///省级接口 | 1461 | ///省级接口 |
1460 | public void provices(final Context mContext, final Handler handler) { | 1462 | public void provices(final Context mContext, final Handler handler) { |
1461 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1463 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1462 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1464 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
1463 | @Override | 1465 | @Override |
1464 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1466 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1465 | Log.e("test", "省" + new String(arg2)); | 1467 | Log.e("test", "省" + new String(arg2)); |
1466 | try { | 1468 | try { |
1467 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1469 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1468 | int status = jsonObject.optInt("status"); | 1470 | int status = jsonObject.optInt("status"); |
1469 | if (status == 100) { | 1471 | if (status == 100) { |
1470 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1472 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1471 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1473 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1472 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1474 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1473 | Message message = Message.obtain(); | 1475 | Message message = Message.obtain(); |
1474 | message.what = HttpCode.PROVICES; | 1476 | message.what = HttpCode.PROVICES; |
1475 | message.obj = provincesBeanList; | 1477 | message.obj = provincesBeanList; |
1476 | handler.sendMessage(message); | 1478 | handler.sendMessage(message); |
1477 | 1479 | ||
1478 | 1480 | ||
1479 | } else { | 1481 | } else { |
1480 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1482 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1481 | 1483 | ||
1482 | } | 1484 | } |
1483 | } catch (JSONException e) { | 1485 | } catch (JSONException e) { |
1484 | e.printStackTrace(); | 1486 | e.printStackTrace(); |
1485 | } | 1487 | } |
1486 | 1488 | ||
1487 | 1489 | ||
1488 | } | 1490 | } |
1489 | 1491 | ||
1490 | @Override | 1492 | @Override |
1491 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1493 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1492 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1494 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1493 | } | 1495 | } |
1494 | }); | 1496 | }); |
1495 | } | 1497 | } |
1496 | 1498 | ||
1497 | //获取版本信息接口 | 1499 | //获取版本信息接口 |
1498 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { | 1500 | public void getpublishinfo(final Context mContext, Object userId, int gradeId, int type, final Handler handler) { |
1499 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1501 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1500 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { | 1502 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId + "&gradeId=" + gradeId + "&type=" + type, new AsyncHttpResponseHandler() { |
1501 | @Override | 1503 | @Override |
1502 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1504 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1503 | Log.e("test", "获取版本信息接口" + new String(arg2)); | 1505 | Log.e("test", "获取版本信息接口" + new String(arg2)); |
1504 | try { | 1506 | try { |
1505 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1507 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1506 | int status = jsonObject.optInt("status"); | 1508 | int status = jsonObject.optInt("status"); |
1507 | if (status == 1) { | 1509 | if (status == 1) { |
1508 | Gson gson = new Gson(); | 1510 | Gson gson = new Gson(); |
1509 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1511 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
1510 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1512 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
1511 | Message message = Message.obtain(); | 1513 | Message message = Message.obtain(); |
1512 | message.what = HttpCode.PUBLISH_SUCESS; | 1514 | message.what = HttpCode.PUBLISH_SUCESS; |
1513 | message.obj = defautPublishInfoBeanList; | 1515 | message.obj = defautPublishInfoBeanList; |
1514 | handler.sendMessage(message); | 1516 | handler.sendMessage(message); |
1515 | 1517 | ||
1516 | } else { | 1518 | } else { |
1517 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1519 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1518 | 1520 | ||
1519 | } | 1521 | } |
1520 | } catch (JSONException e) { | 1522 | } catch (JSONException e) { |
1521 | e.printStackTrace(); | 1523 | e.printStackTrace(); |
1522 | } | 1524 | } |
1523 | 1525 | ||
1524 | 1526 | ||
1525 | } | 1527 | } |
1526 | 1528 | ||
1527 | @Override | 1529 | @Override |
1528 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1530 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1529 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1531 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1530 | } | 1532 | } |
1531 | }); | 1533 | }); |
1532 | } | 1534 | } |
1533 | 1535 | ||
1534 | 1536 | ||
1535 | //市级接口 | 1537 | //市级接口 |
1536 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1538 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1537 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1539 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1538 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1540 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1539 | @Override | 1541 | @Override |
1540 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1542 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1541 | Log.e("test", "市" + new String(arg2)); | 1543 | Log.e("test", "市" + new String(arg2)); |
1542 | try { | 1544 | try { |
1543 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1545 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1544 | int status = jsonObject.optInt("status"); | 1546 | int status = jsonObject.optInt("status"); |
1545 | if (status == 100) { | 1547 | if (status == 100) { |
1546 | Gson gson = new Gson(); | 1548 | Gson gson = new Gson(); |
1547 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1549 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1548 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1550 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1549 | Message message = Message.obtain(); | 1551 | Message message = Message.obtain(); |
1550 | message.what = HttpCode.CITYS; | 1552 | message.what = HttpCode.CITYS; |
1551 | message.obj = cityInfoBeanList; | 1553 | message.obj = cityInfoBeanList; |
1552 | handler.sendMessage(message); | 1554 | handler.sendMessage(message); |
1553 | 1555 | ||
1554 | } else { | 1556 | } else { |
1555 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1557 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1556 | 1558 | ||
1557 | } | 1559 | } |
1558 | } catch (JSONException e) { | 1560 | } catch (JSONException e) { |
1559 | e.printStackTrace(); | 1561 | e.printStackTrace(); |
1560 | } | 1562 | } |
1561 | 1563 | ||
1562 | 1564 | ||
1563 | } | 1565 | } |
1564 | 1566 | ||
1565 | @Override | 1567 | @Override |
1566 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1568 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1567 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1569 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1568 | } | 1570 | } |
1569 | }); | 1571 | }); |
1570 | } | 1572 | } |
1571 | 1573 | ||
1572 | //区县级接口 | 1574 | //区县级接口 |
1573 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1575 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1574 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1576 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1575 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1577 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
1576 | @Override | 1578 | @Override |
1577 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1579 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1578 | Log.e("test", "区" + new String(arg2)); | 1580 | Log.e("test", "区" + new String(arg2)); |
1579 | try { | 1581 | try { |
1580 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1582 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1581 | int status = jsonObject.optInt("status"); | 1583 | int status = jsonObject.optInt("status"); |
1582 | if (status == 100) { | 1584 | if (status == 100) { |
1583 | Gson gson = new Gson(); | 1585 | Gson gson = new Gson(); |
1584 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1586 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1585 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1587 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1586 | Message message = Message.obtain(); | 1588 | Message message = Message.obtain(); |
1587 | message.what = HttpCode.COUNTRY; | 1589 | message.what = HttpCode.COUNTRY; |
1588 | message.obj = countyInfoInfoBeanList; | 1590 | message.obj = countyInfoInfoBeanList; |
1589 | handler.sendMessage(message); | 1591 | handler.sendMessage(message); |
1590 | } else { | 1592 | } else { |
1591 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1593 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1592 | 1594 | ||
1593 | } | 1595 | } |
1594 | } catch (JSONException e) { | 1596 | } catch (JSONException e) { |
1595 | e.printStackTrace(); | 1597 | e.printStackTrace(); |
1596 | } | 1598 | } |
1597 | 1599 | ||
1598 | 1600 | ||
1599 | } | 1601 | } |
1600 | 1602 | ||
1601 | @Override | 1603 | @Override |
1602 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1604 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1603 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1605 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1604 | } | 1606 | } |
1605 | }); | 1607 | }); |
1606 | } | 1608 | } |
1607 | 1609 | ||
1608 | 1610 | ||
1609 | private void closeProgress() { | 1611 | private void closeProgress() { |
1610 | try { | 1612 | try { |
1611 | if (mProgress != null) { | 1613 | if (mProgress != null) { |
1612 | mProgress.dismiss(); | 1614 | mProgress.dismiss(); |
1613 | mProgress = null; | 1615 | mProgress = null; |
1614 | } | 1616 | } |
1615 | } catch (Exception e) { | 1617 | } catch (Exception e) { |
1616 | e.printStackTrace(); | 1618 | e.printStackTrace(); |
1617 | } | 1619 | } |
1618 | } | 1620 | } |
1619 | 1621 | ||
1620 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 1622 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
1621 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 1623 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
1622 | 1624 | ||
1623 | HttpManager.getInstance().closeProgress(); | 1625 | HttpManager.getInstance().closeProgress(); |
1624 | } | 1626 | } |
1625 | 1627 | ||
1626 | return false; | 1628 | return false; |
1627 | 1629 | ||
1628 | } | 1630 | } |
1629 | 1631 | ||
1630 | } | 1632 | } |
1631 | 1633 |
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 | import com.hjx.personalcenter.BuildConfig; | ||
4 | |||
3 | /** | 5 | /** |
4 | * Created by h on 2017/8/15. | 6 | * Created by h on 2017/8/15. |
5 | */ | 7 | */ |
6 | 8 | ||
7 | public class HttpUrl { | 9 | public class HttpUrl { |
8 | private final static String Enviroment = "DEVELOPMENT"; | 10 | private final static String Enviroment = "DEVELOPMENT"; |
9 | 11 | //BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; | |
10 | public static String GetDomain(){ | 12 | public static String GetDomain(){ |
11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; | 13 | return BuildConfig.BUILD_TYPE.equals("release") ? "http://boss.hjx.com" : "http://boss.test.hjx.com" ; |
12 | } | 14 | } |
13 | 15 | ||
14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 16 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 | 17 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
16 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 18 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 19 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 20 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 21 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 22 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 23 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 24 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 25 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 26 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 27 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 28 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 29 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 30 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | 31 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 |
30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 | 32 | public static String getpresonalinfo=GetDomain()+"/personal/get";//获取个人信息 |
31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | 33 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | 34 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | 35 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 |
34 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 | 36 | public static String childUserURL=GetDomain()+"/childUser/info";//获取子账户信息 |
35 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 | 37 | public static String deletechildUserURL=GetDomain()+"/childUser/delete";//删除子账户 |
36 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 | 38 | public static String addchildUserURL=GetDomain()+"/childUser/addChildUser";//添加子账户 |
37 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 | 39 | public static String changechildUserURL=GetDomain()+"/childUser/update";//切换子账户 |
38 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 | 40 | public static String updateappURL=GetDomain()+"/general/release/version";//系统升级 |
39 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 | 41 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 |
40 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 | 42 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 |
41 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 | 43 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 |
42 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 | 44 | public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 |
43 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 | 45 | public static String getpublishURL=GetDomain()+"/userPress/info";//获取版本信息 |
44 | public static String getvidioURL=GetDomain()+"/personal/video/recent";//获取最近学习视频 | 46 | public static String getvidioURL=GetDomain()+"/personal/video/recent";//获取最近学习视频 |
45 | public static String submitregisterURL=GetDomain()+"/register/extrainfo/submit";//提交注册信息 | 47 | public static String submitregisterURL=GetDomain()+"/register/extrainfo/submit";//提交注册信息 |
46 | public static String chagepublishURL=GetDomain()+"/userPress/update";//修改版本信息 | 48 | public static String chagepublishURL=GetDomain()+"/userPress/update";//修改版本信息 |
47 | public static String chageaccountphoneURL=GetDomain()+"/electronicCard/updateUserNameByUserId";//修改账户绑定 | 49 | public static String chageaccountphoneURL=GetDomain()+"/electronicCard/updateUserNameByUserId";//修改账户绑定 |
48 | 50 | ||
49 | 51 | ||
50 | 52 | ||
51 | 53 | ||
52 | 54 | ||
53 | 55 | ||
54 | } | 56 | } |
55 | 57 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/SignInfo.java
1 | package com.hjx.personalcenter.model; | 1 | package com.hjx.personalcenter.model; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Created by h on 2017/8/23. | 6 | * Created by h on 2017/8/23. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | public class SignInfo implements Serializable{ | 9 | public class SignInfo implements Serializable{ |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * status : 1 | 12 | * status : 1 |
13 | * pageSize : 0 | 13 | * pageSize : 0 |
14 | * data : {"userId":222222222243,"signature":"广告广告广告费"} | 14 | * data : {"userId":222222222243,"signature":"广告广告广告费"} |
15 | * msg : success | 15 | * msg : success |
16 | * pageNum : 0 | 16 | * pageNum : 0 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | private int status; | 19 | private int status; |
20 | private int pageSize; | 20 | private int pageSize; |
21 | private DataBean data; | 21 | private DataBean data; |
22 | private String msg; | 22 | private String msg; |
23 | private int pageNum; | 23 | private int pageNum; |
24 | 24 | ||
25 | public int getStatus() { | 25 | public int getStatus() { |
26 | return status; | 26 | return status; |
27 | } | 27 | } |
28 | 28 | ||
29 | public void setStatus(int status) { | 29 | public void setStatus(int status) { |
30 | this.status = status; | 30 | this.status = status; |
31 | } | 31 | } |
32 | 32 | ||
33 | public int getPageSize() { | 33 | public int getPageSize() { |
34 | return pageSize; | 34 | return pageSize; |
35 | } | 35 | } |
36 | 36 | ||
37 | public void setPageSize(int pageSize) { | 37 | public void setPageSize(int pageSize) { |
38 | this.pageSize = pageSize; | 38 | this.pageSize = pageSize; |
39 | } | 39 | } |
40 | 40 | ||
41 | public DataBean getData() { | 41 | public DataBean getData() { |
42 | return data; | 42 | return data; |
43 | } | 43 | } |
44 | 44 | ||
45 | public void setData(DataBean data) { | 45 | public void setData(DataBean data) { |
46 | this.data = data; | 46 | this.data = data; |
47 | } | 47 | } |
48 | 48 | ||
49 | public String getMsg() { | 49 | public String getMsg() { |
50 | return msg; | 50 | return msg; |
51 | } | 51 | } |
52 | 52 | ||
53 | public void setMsg(String msg) { | 53 | public void setMsg(String msg) { |
54 | this.msg = msg; | 54 | this.msg = msg; |
55 | } | 55 | } |
56 | 56 | ||
57 | public int getPageNum() { | 57 | public int getPageNum() { |
58 | return pageNum; | 58 | return pageNum; |
59 | } | 59 | } |
60 | 60 | ||
61 | public void setPageNum(int pageNum) { | 61 | public void setPageNum(int pageNum) { |
62 | this.pageNum = pageNum; | 62 | this.pageNum = pageNum; |
63 | } | 63 | } |
64 | 64 | ||
65 | public static class DataBean { | 65 | public static class DataBean { |
66 | /** | 66 | /** |
67 | * userId : 222222222243 | 67 | * userId : 222222222243 |
68 | * signature : 广告广告广告费 | 68 | * signature : 广告广告广告费 |
69 | */ | 69 | */ |
70 | 70 | ||
71 | private long userId; | 71 | private String userId; |
72 | private String signature; | 72 | private String signature; |
73 | 73 | ||
74 | public long getUserId() { | 74 | public String getUserId() { |
75 | return userId; | 75 | return userId; |
76 | } | 76 | } |
77 | 77 | ||
78 | public void setUserId(long userId) { | 78 | public void setUserId(String userId) { |
79 | this.userId = userId; | 79 | this.userId = userId; |
80 | } | 80 | } |
81 | 81 | ||
82 | public String getSignature() { | 82 | public String getSignature() { |
83 | return signature; | 83 | return signature; |
84 | } | 84 | } |
85 | 85 | ||
86 | public void setSignature(String signature) { | 86 | public void setSignature(String signature) { |
87 | this.signature = signature; | 87 | this.signature = signature; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 |
PersonalCenter/app/src/main/res/layout/activity_account_management_add.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:orientation="vertical" | 3 | android:orientation="vertical" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent"> | 5 | android:layout_height="match_parent"> |
6 | <LinearLayout | 6 | <LinearLayout |
7 | android:id="@+id/add_account" | 7 | android:id="@+id/add_account" |
8 | android:layout_width="400dp" | 8 | android:layout_width="400dp" |
9 | android:layout_height="165dp" | 9 | android:layout_height="158dp" |
10 | android:layout_alignParentRight="true" | 10 | android:layout_alignParentRight="true" |
11 | android:layout_marginRight="20dp" | 11 | android:layout_marginRight="20dp" |
12 | android:background="@drawable/corcle_black_bg" | 12 | android:background="@drawable/corcle_black_bg" |
13 | android:gravity="center"> | 13 | android:gravity="center"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
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:src="@mipmap/jia" /> | 18 | android:src="@mipmap/jia" /> |
19 | 19 | ||
20 | </LinearLayout> | 20 | </LinearLayout> |
21 | 21 | ||
22 | </LinearLayout> | 22 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_electroniccard_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:background="@color/login_text_blue" | 12 | android:background="@color/login_text_blue" |
13 | android:minHeight="50dp"> | 13 | android:minHeight="50dp"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/iv_card_back" | 16 | android:id="@+id/iv_card_back" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
19 | android:layout_centerVertical="true" | 19 | android:layout_centerVertical="true" |
20 | android:paddingLeft="20dp" | 20 | android:paddingLeft="20dp" |
21 | android:paddingRight="20dp" | 21 | android:paddingRight="20dp" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:text="@string/change_electroniccard_info_fill" | 29 | android:text="@string/change_electroniccard_info_fill" |
30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
32 | </RelativeLayout> | 32 | </RelativeLayout> |
33 | 33 | ||
34 | <ImageView | 34 | <ImageView |
35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
37 | android:layout_gravity="center" | 37 | android:layout_gravity="center" |
38 | android:layout_marginTop="20dp" | 38 | android:layout_marginTop="20dp" |
39 | android:src="@mipmap/change_info_icon" /> | 39 | android:src="@mipmap/change_info_icon" /> |
40 | 40 | ||
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:layout_width="wrap_content" | 42 | android:layout_width="wrap_content" |
43 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
44 | android:layout_marginTop="60dp" | 44 | android:layout_marginTop="60dp" |
45 | android:orientation="horizontal"> | 45 | android:orientation="horizontal"> |
46 | 46 | ||
47 | <View | 47 | <View |
48 | android:layout_width="450dp" | 48 | android:layout_width="450dp" |
49 | android:layout_height="0.7dp" | 49 | android:layout_height="0.7dp" |
50 | android:layout_marginLeft="150dp" | 50 | android:layout_marginLeft="150dp" |
51 | android:background="@color/cutoff_line"> | 51 | android:background="@color/cutoff_line"> |
52 | 52 | ||
53 | </View> | 53 | </View> |
54 | 54 | ||
55 | <View | 55 | <View |
56 | android:layout_width="450dp" | 56 | android:layout_width="450dp" |
57 | android:layout_height="0.7dp" | 57 | android:layout_height="0.7dp" |
58 | android:layout_marginLeft="80dp" | 58 | android:layout_marginLeft="80dp" |
59 | android:background="@color/cutoff_line"> | 59 | android:background="@color/cutoff_line"> |
60 | 60 | ||
61 | </View> | 61 | </View> |
62 | 62 | ||
63 | 63 | ||
64 | </LinearLayout> | 64 | </LinearLayout> |
65 | 65 | ||
66 | <LinearLayout | 66 | <LinearLayout |
67 | android:layout_width="match_parent" | 67 | android:layout_width="match_parent" |
68 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
69 | android:layout_marginLeft="200dp" | 69 | android:layout_marginLeft="200dp" |
70 | android:gravity="center_vertical" | 70 | android:gravity="center_vertical" |
71 | android:orientation="horizontal"> | 71 | android:orientation="horizontal"> |
72 | 72 | ||
73 | <LinearLayout | 73 | <LinearLayout |
74 | android:layout_width="0dp" | 74 | android:layout_width="0dp" |
75 | android:layout_height="80dp" | 75 | android:layout_height="80dp" |
76 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | android:gravity="center_vertical"> | 77 | android:gravity="center_vertical" |
78 | android:focusable="true" | ||
79 | android:focusableInTouchMode="true"> | ||
78 | 80 | ||
79 | <TextView | 81 | <TextView |
80 | android:layout_width="wrap_content" | 82 | android:layout_width="wrap_content" |
81 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
82 | android:text="客户姓名" | 84 | android:text="客户姓名" |
83 | android:textSize="22sp" /> | 85 | android:textSize="22sp" /> |
84 | 86 | ||
85 | <EditText | 87 | <EditText |
86 | android:id="@+id/et_edit_username" | 88 | android:id="@+id/et_edit_username" |
87 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
88 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
89 | android:layout_marginLeft="50dp" | 91 | android:layout_marginLeft="50dp" |
90 | android:background="@null" | 92 | android:background="@null" |
91 | android:textColor="@color/electronic_text" | 93 | android:padding="20dp" |
94 | android:textColor="@color/login_text_black" | ||
92 | android:hint="请输入" | 95 | android:hint="请输入" |
93 | android:textSize="22sp" /> | 96 | android:textSize="22sp" /> |
94 | 97 | ||
95 | </LinearLayout> | 98 | </LinearLayout> |
96 | 99 | ||
97 | <LinearLayout | 100 | <LinearLayout |
98 | android:layout_width="0dp" | 101 | android:layout_width="0dp" |
99 | android:layout_height="80dp" | 102 | android:layout_height="80dp" |
100 | android:layout_weight="1" | 103 | android:layout_weight="1" |
101 | android:gravity="center_vertical"> | 104 | android:gravity="center_vertical"> |
102 | 105 | ||
103 | <TextView | 106 | <TextView |
104 | android:layout_width="150dp" | 107 | android:layout_width="150dp" |
105 | android:layout_height="wrap_content" | 108 | android:layout_height="wrap_content" |
106 | android:text="购买地址" | 109 | android:text="购买地址" |
107 | android:textSize="22sp" /> | 110 | android:textSize="22sp" /> |
108 | 111 | ||
109 | <TextView | 112 | <TextView |
110 | android:id="@+id/tv_edit_adress_shop" | 113 | android:id="@+id/tv_edit_adress_shop" |
111 | android:layout_width="wrap_content" | 114 | android:layout_width="wrap_content" |
112 | android:layout_height="wrap_content" | 115 | android:layout_height="wrap_content" |
113 | android:layout_marginLeft="20dp" | 116 | android:layout_marginLeft="20dp" |
114 | android:textColor="@color/electronic_text" | 117 | android:padding="20dp" |
118 | android:textColor="@color/login_text_black" | ||
115 | android:hint="请选择地区" | 119 | android:hint="请选择地区" |
116 | android:textSize="22sp" /> | 120 | android:textSize="22sp" /> |
117 | 121 | ||
118 | <ImageView | 122 | <ImageView |
119 | android:id="@+id/shopdizhi" | 123 | android:id="@+id/shopdizhi" |
120 | android:layout_width="wrap_content" | 124 | android:layout_width="wrap_content" |
121 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
126 | android:padding="20dp" | ||
122 | android:layout_marginLeft="60dp" | 127 | android:layout_marginLeft="60dp" |
123 | android:src="@mipmap/xiajiantou"> | 128 | android:src="@mipmap/xiajiantou"> |
124 | 129 | ||
125 | </ImageView> | 130 | </ImageView> |
126 | </LinearLayout> | 131 | </LinearLayout> |
127 | 132 | ||
128 | </LinearLayout> | 133 | </LinearLayout> |
129 | 134 | ||
130 | <LinearLayout | 135 | <LinearLayout |
131 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
132 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
133 | android:orientation="horizontal"> | 138 | android:orientation="horizontal"> |
134 | 139 | ||
135 | <View | 140 | <View |
136 | android:layout_width="450dp" | 141 | android:layout_width="450dp" |
137 | android:layout_height="0.7dp" | 142 | android:layout_height="0.7dp" |
138 | android:layout_marginLeft="150dp" | 143 | android:layout_marginLeft="150dp" |
139 | android:background="@color/cutoff_line"> | 144 | android:background="@color/cutoff_line"> |
140 | 145 | ||
141 | </View> | 146 | </View> |
142 | 147 | ||
143 | <View | 148 | <View |
144 | android:layout_width="450dp" | 149 | android:layout_width="450dp" |
145 | android:layout_height="0.7dp" | 150 | android:layout_height="0.7dp" |
146 | android:layout_marginLeft="80dp" | 151 | android:layout_marginLeft="80dp" |
147 | android:background="@color/cutoff_line"> | 152 | android:background="@color/cutoff_line"> |
148 | 153 | ||
149 | </View> | 154 | </View> |
150 | 155 | ||
151 | 156 | ||
152 | </LinearLayout> | 157 | </LinearLayout> |
153 | 158 | ||
154 | <LinearLayout | 159 | <LinearLayout |
155 | android:layout_width="match_parent" | 160 | android:layout_width="match_parent" |
156 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
157 | android:layout_marginLeft="200dp" | 162 | android:layout_marginLeft="200dp" |
158 | android:gravity="center_vertical" | 163 | android:gravity="center_vertical" |
159 | android:orientation="horizontal"> | 164 | android:orientation="horizontal"> |
160 | 165 | ||
161 | <LinearLayout | 166 | <LinearLayout |
162 | android:layout_width="0dp" | 167 | android:layout_width="0dp" |
163 | android:layout_height="80dp" | 168 | android:layout_height="80dp" |
164 | android:layout_weight="1" | 169 | android:layout_weight="1" |
165 | android:gravity="center_vertical"> | 170 | android:gravity="center_vertical"> |
166 | 171 | ||
167 | <TextView | 172 | <TextView |
168 | android:layout_width="wrap_content" | 173 | android:layout_width="wrap_content" |
169 | android:layout_height="wrap_content" | 174 | android:layout_height="wrap_content" |
170 | android:text="客户地址" | 175 | android:text="客户地址" |
171 | android:textSize="22sp" /> | 176 | android:textSize="22sp" /> |
172 | 177 | ||
173 | <TextView | 178 | <TextView |
174 | android:id="@+id/tv_edit_adress_custem" | 179 | android:id="@+id/tv_edit_adress_custem" |
175 | android:layout_width="wrap_content" | 180 | android:layout_width="wrap_content" |
176 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
177 | android:layout_marginLeft="50dp" | 182 | android:layout_marginLeft="50dp" |
178 | android:textColor="@color/electronic_text" | 183 | android:textColor="@color/login_text_black" |
179 | android:hint="请选择地区" | 184 | android:hint="请选择地区" |
185 | android:padding="20dp" | ||
180 | android:textSize="22sp" /> | 186 | android:textSize="22sp" /> |
181 | 187 | ||
182 | <ImageView | 188 | <ImageView |
183 | android:id="@+id/cunstomdizhi" | 189 | android:id="@+id/cunstomdizhi" |
184 | android:layout_width="wrap_content" | 190 | android:layout_width="wrap_content" |
185 | android:layout_height="wrap_content" | 191 | android:layout_height="wrap_content" |
186 | android:layout_marginLeft="60dp" | 192 | android:layout_marginLeft="60dp" |
193 | android:padding="20dp" | ||
187 | android:src="@mipmap/xiajiantou"> | 194 | android:src="@mipmap/xiajiantou"> |
188 | 195 | ||
189 | </ImageView> | 196 | </ImageView> |
190 | 197 | ||
191 | 198 | ||
192 | </LinearLayout> | 199 | </LinearLayout> |
193 | 200 | ||
194 | <LinearLayout | 201 | <LinearLayout |
195 | android:layout_width="0dp" | 202 | android:layout_width="0dp" |
196 | android:layout_height="80dp" | 203 | android:layout_height="80dp" |
197 | android:layout_weight="1" | 204 | android:layout_weight="1" |
198 | android:gravity="center_vertical"> | 205 | android:gravity="center_vertical"> |
199 | 206 | ||
200 | <TextView | 207 | <TextView |
201 | android:layout_width="150dp" | 208 | android:layout_width="150dp" |
202 | android:layout_height="wrap_content" | 209 | android:layout_height="wrap_content" |
203 | android:text=" " | 210 | android:text=" " |
204 | android:textColor="@color/white" | 211 | android:textColor="@color/white" |
205 | android:textSize="22sp" /> | 212 | android:textSize="22sp" /> |
206 | 213 | ||
207 | <EditText | 214 | <EditText |
208 | android:id="@+id/et_edit_store" | 215 | android:id="@+id/et_edit_store" |
209 | android:layout_width="wrap_content" | 216 | android:layout_width="wrap_content" |
210 | android:layout_height="wrap_content" | 217 | android:layout_height="wrap_content" |
211 | android:layout_marginLeft="20dp" | 218 | android:layout_marginLeft="20dp" |
212 | android:background="@null" | 219 | android:background="@null" |
213 | android:textColor="@color/electronic_text" | 220 | android:padding="20dp" |
221 | android:textColor="@color/login_text_black" | ||
214 | android:hint="请输入商店名称" | 222 | android:hint="请输入商店名称" |
215 | android:textSize="22sp" /> | 223 | android:textSize="22sp" /> |
216 | 224 | ||
217 | </LinearLayout> | 225 | </LinearLayout> |
218 | 226 | ||
219 | </LinearLayout> | 227 | </LinearLayout> |
220 | 228 | ||
221 | <LinearLayout | 229 | <LinearLayout |
222 | android:layout_width="wrap_content" | 230 | android:layout_width="wrap_content" |
223 | android:layout_height="wrap_content" | 231 | android:layout_height="wrap_content" |
224 | 232 | ||
225 | android:orientation="horizontal"> | 233 | android:orientation="horizontal"> |
226 | 234 | ||
227 | <View | 235 | <View |
228 | android:layout_width="450dp" | 236 | android:layout_width="450dp" |
229 | android:layout_height="0.7dp" | 237 | android:layout_height="0.7dp" |
230 | android:layout_marginLeft="150dp" | 238 | android:layout_marginLeft="150dp" |
231 | android:background="@color/cutoff_line"> | 239 | android:background="@color/cutoff_line"> |
232 | 240 | ||
233 | </View> | 241 | </View> |
234 | 242 | ||
235 | <View | 243 | <View |
236 | android:layout_width="450dp" | 244 | android:layout_width="450dp" |
237 | android:layout_height="0.7dp" | 245 | android:layout_height="0.7dp" |
238 | android:layout_marginLeft="80dp" | 246 | android:layout_marginLeft="80dp" |
239 | android:background="@color/cutoff_line"> | 247 | android:background="@color/cutoff_line"> |
240 | 248 | ||
241 | </View> | 249 | </View> |
242 | 250 | ||
243 | 251 | ||
244 | </LinearLayout> | 252 | </LinearLayout> |
245 | 253 | ||
246 | <LinearLayout | 254 | <LinearLayout |
247 | android:layout_width="match_parent" | 255 | android:layout_width="match_parent" |
248 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
249 | android:layout_marginLeft="200dp" | 257 | android:layout_marginLeft="200dp" |
250 | android:gravity="center_vertical" | 258 | android:gravity="center_vertical" |
251 | android:orientation="horizontal"> | 259 | android:orientation="horizontal"> |
252 | 260 | ||
253 | <LinearLayout | 261 | <LinearLayout |
254 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
255 | android:layout_height="80dp" | 263 | android:layout_height="80dp" |
256 | android:layout_weight="1" | 264 | android:layout_weight="1" |
257 | android:gravity="center_vertical"> | 265 | android:gravity="center_vertical"> |
258 | 266 | ||
259 | <TextView | 267 | <TextView |
260 | android:layout_width="wrap_content" | 268 | android:layout_width="wrap_content" |
261 | android:layout_height="wrap_content" | 269 | android:layout_height="wrap_content" |
262 | android:text=" " | 270 | android:text=" " |
263 | android:textColor="@color/white" | 271 | android:textColor="@color/white" |
264 | android:textSize="22sp" /> | 272 | android:textSize="22sp" /> |
265 | 273 | ||
266 | <EditText | 274 | <EditText |
267 | android:id="@+id/et_edit_adress_detail" | 275 | android:id="@+id/et_edit_adress_detail" |
268 | android:layout_width="wrap_content" | 276 | android:layout_width="wrap_content" |
269 | android:layout_height="wrap_content" | 277 | android:layout_height="wrap_content" |
270 | android:layout_marginLeft="100dp" | 278 | android:layout_marginLeft="100dp" |
271 | android:background="@null" | 279 | android:background="@null" |
272 | android:textColor="@color/electronic_text" | 280 | android:padding="20dp" |
281 | android:textColor="@color/login_text_black" | ||
273 | android:hint="请输入详细地址" | 282 | android:hint="请输入详细地址" |
274 | android:textSize="22sp" /> | 283 | android:textSize="22sp" /> |
275 | 284 | ||
276 | </LinearLayout> | 285 | </LinearLayout> |
277 | 286 | ||
278 | <LinearLayout | 287 | <LinearLayout |
279 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
280 | android:layout_height="80dp" | 289 | android:layout_height="80dp" |
281 | android:layout_weight="1" | 290 | android:layout_weight="1" |
282 | android:gravity="center_vertical"> | 291 | android:gravity="center_vertical"> |
283 | 292 | ||
284 | <TextView | 293 | <TextView |
285 | android:layout_width="150dp" | 294 | android:layout_width="150dp" |
286 | android:layout_height="wrap_content" | 295 | android:layout_height="wrap_content" |
287 | android:text="本地售后电话" | 296 | android:text="本地售后电话" |
288 | android:textSize="22sp" /> | 297 | android:textSize="22sp" /> |
289 | 298 | ||
290 | <EditText | 299 | <EditText |
291 | android:id="@+id/et_edit_telphone" | 300 | android:id="@+id/et_edit_telphone" |
292 | android:layout_width="wrap_content" | 301 | android:layout_width="wrap_content" |
293 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
303 | android:padding="20dp" | ||
294 | android:layout_marginLeft="20dp" | 304 | android:layout_marginLeft="20dp" |
295 | android:background="@null" | 305 | android:background="@null" |
296 | android:textColor="@color/electronic_text" | 306 | android:textColor="@color/login_text_black" |
297 | android:hint="请输入" | 307 | android:hint="请输入" |
298 | android:textSize="22sp" /> | 308 | android:textSize="22sp" /> |
299 | </LinearLayout> | 309 | </LinearLayout> |
300 | 310 | ||
301 | </LinearLayout> | 311 | </LinearLayout> |
302 | 312 | ||
303 | <LinearLayout | 313 | <LinearLayout |
304 | android:layout_width="wrap_content" | 314 | android:layout_width="wrap_content" |
305 | android:layout_height="wrap_content" | 315 | android:layout_height="wrap_content" |
306 | 316 | ||
307 | android:orientation="horizontal"> | 317 | android:orientation="horizontal"> |
308 | 318 | ||
309 | <View | 319 | <View |
310 | android:layout_width="450dp" | 320 | android:layout_width="450dp" |
311 | android:layout_height="0.7dp" | 321 | android:layout_height="0.7dp" |
312 | android:layout_marginLeft="150dp" | 322 | android:layout_marginLeft="150dp" |
313 | android:background="@color/cutoff_line"> | 323 | android:background="@color/cutoff_line"> |
314 | 324 | ||
315 | </View> | 325 | </View> |
316 | 326 | ||
317 | <View | 327 | <View |
318 | android:layout_width="450dp" | 328 | android:layout_width="450dp" |
319 | android:layout_height="0.7dp" | 329 | android:layout_height="0.7dp" |
320 | android:layout_marginLeft="80dp" | 330 | android:layout_marginLeft="80dp" |
321 | android:background="@color/cutoff_line"> | 331 | android:background="@color/cutoff_line"> |
322 | 332 | ||
323 | </View> | 333 | </View> |
324 | 334 | ||
325 | 335 | ||
326 | </LinearLayout> | 336 | </LinearLayout> |
327 | 337 | ||
328 | <LinearLayout | 338 | <LinearLayout |
329 | android:layout_width="match_parent" | 339 | android:layout_width="match_parent" |
330 | android:layout_height="wrap_content" | 340 | android:layout_height="wrap_content" |
331 | android:layout_marginLeft="200dp" | 341 | android:layout_marginLeft="200dp" |
332 | android:gravity="center_vertical" | 342 | android:gravity="center_vertical" |
333 | android:orientation="horizontal"> | 343 | android:orientation="horizontal"> |
334 | 344 | ||
335 | <LinearLayout | 345 | <LinearLayout |
336 | android:id="@+id/lineL_buy_time" | 346 | android:id="@+id/lineL_buy_time" |
337 | android:layout_width="0dp" | 347 | android:layout_width="0dp" |
338 | android:layout_height="80dp" | 348 | android:layout_height="80dp" |
339 | android:layout_weight="1" | 349 | android:layout_weight="1" |
340 | android:gravity="center_vertical"> | 350 | android:gravity="center_vertical"> |
341 | 351 | ||
342 | <TextView | 352 | <TextView |
343 | android:layout_width="wrap_content" | 353 | android:layout_width="wrap_content" |
344 | android:layout_height="wrap_content" | 354 | android:layout_height="wrap_content" |
345 | android:text="购买时间" | 355 | android:text="购买时间" |
346 | android:textSize="22sp" /> | 356 | android:textSize="22sp" /> |
347 | 357 | ||
348 | <TextView | 358 | <TextView |
349 | android:id="@+id/tv_buy_time" | 359 | android:id="@+id/tv_buy_time" |
350 | android:layout_width="wrap_content" | 360 | android:layout_width="wrap_content" |
351 | android:layout_height="wrap_content" | 361 | android:layout_height="wrap_content" |
362 | android:textColor="@color/login_text_black" | ||
352 | android:layout_marginLeft="50dp" | 363 | android:layout_marginLeft="50dp" |
353 | android:hint="请选择时间" | 364 | android:hint="请选择时间" |
354 | android:textSize="22sp" /> | 365 | android:textSize="22sp" /> |
355 | 366 | ||
356 | </LinearLayout> | 367 | </LinearLayout> |
357 | 368 | ||
358 | </LinearLayout> | 369 | </LinearLayout> |
359 | 370 | ||
360 | <LinearLayout | 371 | <LinearLayout |
361 | android:layout_width="wrap_content" | 372 | android:layout_width="wrap_content" |
362 | android:layout_height="wrap_content" | 373 | android:layout_height="wrap_content" |
363 | android:orientation="horizontal"> | 374 | android:orientation="horizontal"> |
364 | 375 | ||
365 | <View | 376 | <View |
366 | android:layout_width="450dp" | 377 | android:layout_width="450dp" |
367 | android:layout_height="0.7dp" | 378 | android:layout_height="0.7dp" |
368 | android:layout_marginLeft="150dp" | 379 | android:layout_marginLeft="150dp" |
369 | android:background="@color/cutoff_line"> | 380 | android:background="@color/cutoff_line"> |
370 | 381 | ||
371 | </View> | 382 | </View> |
372 | 383 | ||
373 | 384 | ||
374 | </LinearLayout> | 385 | </LinearLayout> |
375 | 386 | ||
376 | <Button | 387 | <Button |
377 | android:id="@+id/btn_change_info" | 388 | android:id="@+id/btn_change_info" |
378 | style="@style/button_login_register_style" | 389 | style="@style/button_login_register_style" |
379 | android:layout_marginLeft="200dp" | 390 | android:layout_marginLeft="200dp" |
380 | android:layout_marginRight="200dp" | 391 | android:layout_marginRight="200dp" |
381 | android:layout_marginTop="80dp" | 392 | android:layout_marginTop="80dp" |
382 | android:text="@string/string_regist_next" /> | 393 | android:text="@string/string_regist_next" /> |
383 | 394 | ||
384 | 395 | ||
385 | </LinearLayout> | 396 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_feedback.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 | xmlns:fresco="http://schemas.android.com/tools" | 3 | xmlns:fresco="http://schemas.android.com/tools" |
4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | android:background="@color/backgerangde_laout"> | 7 | android:background="@color/backgerangde_laout"> |
8 | <RelativeLayout | 8 | <RelativeLayout |
9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
13 | 13 | ||
14 | <ImageView | 14 | <ImageView |
15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
20 | android:src="@mipmap/title_back" /> | 20 | android:src="@mipmap/title_back" /> |
21 | 21 | ||
22 | <TextView | 22 | <TextView |
23 | android:id="@+id/menu_title" | 23 | android:id="@+id/menu_title" |
24 | android:layout_width="wrap_content" | 24 | android:layout_width="wrap_content" |
25 | android:layout_height="match_parent" | 25 | android:layout_height="match_parent" |
26 | android:layout_centerInParent="true" | 26 | android:layout_centerInParent="true" |
27 | android:gravity="center_vertical" | 27 | android:gravity="center_vertical" |
28 | android:text="意见反馈" | 28 | android:text="意见反馈" |
29 | android:textColor="@android:color/white" | 29 | android:textColor="@android:color/white" |
30 | android:textSize="22sp" /> | 30 | android:textSize="22sp" /> |
31 | <TextView | 31 | <TextView |
32 | android:id="@+id/feedback_sub" | 32 | android:id="@+id/feedback_sub" |
33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
34 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
35 | android:paddingLeft="20dp" | 35 | android:paddingLeft="20dp" |
36 | android:paddingRight="20dp" | 36 | android:paddingRight="20dp" |
37 | android:gravity="center_vertical" | 37 | android:gravity="center_vertical" |
38 | android:layout_alignParentRight="true" | 38 | android:layout_alignParentRight="true" |
39 | android:text="提交" | 39 | android:text="提交" |
40 | android:textColor="@android:color/white" | 40 | android:textColor="@android:color/white" |
41 | android:textSize="22sp" /> | 41 | android:textSize="22sp" /> |
42 | 42 | ||
43 | 43 | ||
44 | </RelativeLayout> | 44 | </RelativeLayout> |
45 | <EditText | 45 | <EditText |
46 | android:id="@+id/feedback_content" | 46 | android:id="@+id/feedback_content" |
47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
48 | android:layout_height="250dp" | 48 | android:layout_height="250dp" |
49 | android:hint="@string/feedback" | 49 | android:hint="@string/feedback" |
50 | android:textColor="@color/electronic_text" | 50 | android:textColor="@color/electronic_text" |
51 | android:textSize="18sp" | 51 | android:textSize="18sp" |
52 | android:textScaleX="1" | 52 | android:textScaleX="1" |
53 | android:padding="20dp" | 53 | android:padding="20dp" |
54 | android:gravity="top" | 54 | android:gravity="top" |
55 | android:background="@color/white"/> | 55 | android:background="@color/white"/> |
56 | <LinearLayout | 56 | <LinearLayout |
57 | android:id="@+id/take_phone" | 57 | android:id="@+id/take_phone" |
58 | android:layout_width="match_parent" | 58 | android:layout_width="match_parent" |
59 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
60 | android:background="@color/white"> | 60 | android:background="@color/white"> |
61 | <ImageView | 61 | <ImageView |
62 | android:id="@+id/iv_take" | 62 | android:id="@+id/iv_take" |
63 | android:layout_margin="20dp" | 63 | android:layout_margin="20dp" |
64 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
65 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
66 | android:src="@mipmap/feedback_take_phone"/> | 66 | android:src="@mipmap/feedback_take_phone"/> |
67 | 67 | ||
68 | <com.facebook.drawee.view.SimpleDraweeView | 68 | <com.facebook.drawee.view.SimpleDraweeView |
69 | android:id="@+id/show_iv" | 69 | android:id="@+id/show_iv" |
70 | android:layout_width="54dp" | 70 | android:layout_width="54dp" |
71 | android:layout_height="54dp" | 71 | android:layout_height="54dp" |
72 | android:layout_gravity="center" | 72 | android:layout_gravity="center" |
73 | fresco:placeholderImage="@mipmap/title_back" | 73 | fresco:placeholderImage="@mipmap/title_back" |
74 | fresco:roundAsCircle="true" | 74 | fresco:roundAsCircle="true" |
75 | fresco:placeholderImageScaleType="fitCenter" /> | 75 | fresco:placeholderImageScaleType="fitCenter" /> |
76 | 76 | ||
77 | </LinearLayout> | 77 | </LinearLayout> |
78 | <EditText | 78 | <EditText |
79 | android:id="@+id/feedback_phone" | 79 | android:id="@+id/feedback_phone" |
80 | android:layout_width="match_parent" | 80 | android:layout_width="match_parent" |
81 | android:layout_marginTop="20dp" | 81 | android:layout_marginTop="20dp" |
82 | android:background="@color/white" | 82 | android:background="@color/white" |
83 | android:hint="@string/qq" | 83 | android:hint="@string/qq" |
84 | android:inputType="number" | 84 | android:inputType="number" |
85 | android:padding="20dp" | 85 | android:padding="20dp" |
86 | android:layout_height="60dp" /> | 86 | android:layout_height="wrap_content" /> |
87 | <TextView | 87 | <TextView |
88 | android:layout_width="match_parent" | 88 | android:layout_width="match_parent" |
89 | android:text="@string/hint" | 89 | android:text="@string/hint" |
90 | android:padding="20dp" | 90 | android:padding="20dp" |
91 | android:textSize="18sp" | 91 | android:textSize="18sp" |
92 | android:layout_height="wrap_content" /> | 92 | android:layout_height="wrap_content" /> |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | </LinearLayout> | 96 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_loginandregister.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 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | android:id="@android:id/tabhost" | 4 | android:id="@android:id/tabhost" |
5 | android:layout_width="fill_parent" | 5 | android:layout_width="fill_parent" |
6 | android:layout_height="fill_parent" | 6 | android:layout_height="fill_parent" |
7 | android:background="@color/white" | 7 | android:background="@color/white"> |
8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> | ||
9 | 8 | ||
10 | 9 | ||
11 | <ImageView | 10 | <ImageView |
12 | android:id="@+id/iv_logo" | 11 | android:id="@+id/iv_logo" |
13 | android:layout_width="wrap_content" | 12 | android:layout_width="wrap_content" |
14 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
15 | android:layout_centerHorizontal="true" | 14 | android:layout_centerHorizontal="true" |
16 | android:layout_marginTop="55dp" | 15 | android:layout_marginTop="55dp" |
17 | android:layout_marginBottom="0dp" | 16 | android:layout_marginBottom="0dp" |
18 | android:src="@mipmap/logo" /> | 17 | android:src="@mipmap/logo" /> |
19 | 18 | ||
20 | <LinearLayout | 19 | <LinearLayout |
21 | android:layout_width="wrap_content" | 20 | android:layout_width="wrap_content" |
22 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
23 | android:layout_below="@+id/iv_logo" | 22 | android:layout_below="@+id/iv_logo" |
24 | android:orientation="vertical"> | 23 | android:orientation="vertical"> |
25 | 24 | ||
26 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout | 25 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout |
27 | android:id="@+id/TabLayout_id" | 26 | android:id="@+id/TabLayout_id" |
28 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
29 | android:layout_height="50dp"> | 28 | android:layout_height="50dp"> |
30 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> | 29 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> |
31 | 30 | ||
32 | <android.support.v4.view.ViewPager | 31 | <android.support.v4.view.ViewPager |
33 | android:id="@+id/viewpager_login" | 32 | android:id="@+id/viewpager_login" |
34 | android:layout_width="match_parent" | 33 | android:layout_width="match_parent" |
35 | android:layout_height="match_parent" | 34 | android:layout_height="match_parent" |
36 | android:background="@color/white" /> | 35 | android:background="@color/white" /> |
37 | </LinearLayout> | 36 | </LinearLayout> |
38 | 37 | ||
39 | </RelativeLayout> | 38 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/activity_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
6 | android:background="@color/white" | 6 | android:background="@color/white" |
7 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
8 | 8 | ||
9 | <RelativeLayout | 9 | <RelativeLayout |
10 | android:id="@+id/title" | 10 | android:id="@+id/title" |
11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
12 | android:layout_height="50dp" | 12 | android:layout_height="50dp" |
13 | android:background="@color/login_text_blue"> | 13 | android:background="@color/login_text_blue"> |
14 | 14 | ||
15 | <ImageView | 15 | <ImageView |
16 | android:id="@+id/cancel" | 16 | android:id="@+id/cancel" |
17 | android:layout_width="wrap_content" | 17 | android:layout_width="wrap_content" |
18 | android:layout_height="match_parent" | 18 | android:layout_height="match_parent" |
19 | android:paddingLeft="20dp" | 19 | android:paddingLeft="20dp" |
20 | android:paddingRight="20dp" | 20 | android:paddingRight="20dp" |
21 | android:visibility="gone" | 21 | android:visibility="gone" |
22 | android:src="@mipmap/title_back" /> | 22 | android:src="@mipmap/title_back" /> |
23 | 23 | ||
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/menu_title" | 25 | android:id="@+id/menu_title" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="match_parent" | 27 | android:layout_height="match_parent" |
28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
29 | android:gravity="center_vertical" | 29 | android:gravity="center_vertical" |
30 | android:text="@string/titel_preson" | 30 | android:text="@string/titel_preson" |
31 | android:textColor="@android:color/white" | 31 | android:textColor="@android:color/white" |
32 | android:textSize="22sp" /> | 32 | android:textSize="22sp" /> |
33 | 33 | ||
34 | <ImageView | 34 | <ImageView |
35 | android:id="@+id/iv_setting" | 35 | android:id="@+id/iv_setting" |
36 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
37 | android:layout_height="match_parent" | 37 | android:layout_height="match_parent" |
38 | android:layout_marginRight="10dp" | 38 | android:layout_marginRight="10dp" |
39 | android:layout_toLeftOf="@+id/iv_skin" | 39 | android:layout_toLeftOf="@+id/iv_skin" |
40 | android:gravity="center_vertical" | 40 | android:gravity="center_vertical" |
41 | android:padding="10dp" | 41 | android:padding="10dp" |
42 | android:src="@mipmap/shezhi1" | 42 | android:src="@mipmap/shezhi1" |
43 | android:textColor="@android:color/white" | 43 | android:textColor="@android:color/white" |
44 | android:textSize="22sp" /> | 44 | android:textSize="22sp" /> |
45 | 45 | ||
46 | <ImageView | 46 | <ImageView |
47 | android:id="@+id/iv_skin" | 47 | android:id="@+id/iv_skin" |
48 | android:layout_width="wrap_content" | 48 | android:layout_width="wrap_content" |
49 | android:layout_height="match_parent" | 49 | android:layout_height="match_parent" |
50 | android:layout_marginRight="10dp" | 50 | android:layout_marginRight="10dp" |
51 | android:layout_toLeftOf="@+id/iv_imformatioan" | 51 | android:layout_toLeftOf="@+id/iv_imformatioan" |
52 | android:gravity="center_vertical" | 52 | android:gravity="center_vertical" |
53 | android:padding="10dp" | 53 | android:padding="10dp" |
54 | android:src="@mipmap/pifu" | 54 | android:src="@mipmap/pifu" |
55 | android:textColor="@android:color/white" | 55 | android:textColor="@android:color/white" |
56 | android:visibility="gone" | 56 | android:visibility="gone" |
57 | android:textSize="22sp" /> | 57 | android:textSize="22sp" /> |
58 | 58 | ||
59 | <ImageView | 59 | <ImageView |
60 | android:id="@+id/iv_imformatioan" | 60 | android:id="@+id/iv_imformatioan" |
61 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
62 | android:layout_height="match_parent" | 62 | android:layout_height="match_parent" |
63 | android:layout_alignParentRight="true" | 63 | android:layout_alignParentRight="true" |
64 | android:layout_marginRight="10dp" | 64 | android:layout_marginRight="10dp" |
65 | android:gravity="center_vertical" | 65 | android:gravity="center_vertical" |
66 | android:padding="10dp" | 66 | android:padding="10dp" |
67 | android:src="@mipmap/fankui1" | 67 | android:src="@mipmap/fankui1" |
68 | android:textColor="@android:color/white" | 68 | android:textColor="@android:color/white" |
69 | android:textSize="22sp" /> | 69 | android:textSize="22sp" /> |
70 | 70 | ||
71 | 71 | ||
72 | </RelativeLayout> | 72 | </RelativeLayout> |
73 | 73 | ||
74 | <LinearLayout | 74 | <LinearLayout |
75 | android:layout_width="match_parent" | 75 | android:layout_width="match_parent" |
76 | android:layout_height="match_parent"> | 76 | android:layout_height="match_parent"> |
77 | 77 | ||
78 | <LinearLayout | 78 | <LinearLayout |
79 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
80 | android:layout_height="match_parent" | 80 | android:layout_height="match_parent" |
81 | android:layout_weight="1.5" | 81 | android:layout_weight="1.5" |
82 | android:orientation="vertical"> | 82 | android:orientation="vertical"> |
83 | <RelativeLayout | 83 | <RelativeLayout |
84 | android:layout_width="wrap_content" | 84 | android:layout_width="wrap_content" |
85 | android:layout_height="250sp" | 85 | android:layout_height="250sp" |
86 | android:background="@mipmap/head_bg"> | 86 | android:background="@mipmap/head_bg"> |
87 | 87 | ||
88 | <LinearLayout | 88 | <LinearLayout |
89 | android:id="@+id/ssss" | 89 | android:id="@+id/ssss" |
90 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
91 | android:layout_height="wrap_content" | 91 | android:layout_height="wrap_content" |
92 | android:layout_marginTop="28dp" | 92 | android:layout_marginTop="28dp" |
93 | android:gravity="center" | 93 | android:gravity="center" |
94 | android:orientation="horizontal"> | 94 | android:orientation="horizontal"> |
95 | <com.facebook.drawee.view.SimpleDraweeView | 95 | <com.facebook.drawee.view.SimpleDraweeView |
96 | android:id="@+id/iv_head" | 96 | android:id="@+id/iv_head" |
97 | android:layout_width="65dp" | 97 | android:layout_width="65dp" |
98 | android:layout_height="65dp" | 98 | android:layout_height="65dp" |
99 | fresco:placeholderImage="@mipmap/header_default" | 99 | fresco:placeholderImage="@mipmap/header_default" |
100 | fresco:roundAsCircle="true" | 100 | fresco:roundAsCircle="true" |
101 | fresco:placeholderImageScaleType="fitCenter" /> | 101 | fresco:placeholderImageScaleType="fitCenter" /> |
102 | 102 | ||
103 | <TextView | 103 | <TextView |
104 | android:layout_width="wrap_content" | 104 | android:layout_width="wrap_content" |
105 | android:layout_height="wrap_content" | 105 | android:layout_height="wrap_content" |
106 | android:layout_marginLeft="18dp" | 106 | android:layout_marginLeft="18dp" |
107 | android:layout_marginTop="20dp" | 107 | android:layout_marginTop="20dp" |
108 | android:background="@drawable/corcle_blue_bg" | 108 | android:background="@drawable/corcle_blue_bg" |
109 | android:paddingLeft="5dp" | 109 | android:paddingLeft="5dp" |
110 | android:paddingRight="5dp" | 110 | android:paddingRight="5dp" |
111 | android:gravity="center_vertical" | 111 | android:gravity="center_vertical" |
112 | android:text="签到" | 112 | android:text="签到" |
113 | android:textColor="@color/login_text_blue" | 113 | android:textColor="@color/login_text_blue" |
114 | android:visibility="gone" | 114 | android:visibility="gone" |
115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
116 | 116 | ||
117 | </LinearLayout> | 117 | </LinearLayout> |
118 | 118 | ||
119 | <LinearLayout | 119 | <LinearLayout |
120 | android:id="@+id/sssssss" | 120 | android:id="@+id/sssssss" |
121 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
122 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" |
123 | android:layout_marginLeft="20dp" | 123 | android:layout_marginLeft="20dp" |
124 | android:layout_below="@id/ssss" | 124 | android:layout_below="@id/ssss" |
125 | android:layout_marginTop="20dp" | 125 | android:layout_marginTop="20dp" |
126 | android:gravity="center" | 126 | android:gravity="center" |
127 | android:orientation="horizontal"> | 127 | android:orientation="horizontal"> |
128 | 128 | ||
129 | <TextView | 129 | <TextView |
130 | android:id="@+id/tv_username" | 130 | android:id="@+id/tv_username" |
131 | android:layout_width="wrap_content" | 131 | android:layout_width="wrap_content" |
132 | android:layout_height="wrap_content" | 132 | android:layout_height="wrap_content" |
133 | android:text="" | 133 | android:text="" |
134 | android:textSize="20sp" /> | 134 | android:textSize="20sp" /> |
135 | <TextView | 135 | <TextView |
136 | android:id="@+id/tv_yangji" | 136 | android:id="@+id/tv_yangji" |
137 | android:layout_marginLeft="5dp" | 137 | android:layout_marginLeft="5dp" |
138 | android:layout_width="wrap_content" | 138 | android:layout_width="wrap_content" |
139 | android:layout_height="wrap_content" | 139 | android:layout_height="wrap_content" |
140 | android:text="(样机)" | 140 | android:text="(样机)" |
141 | android:textSize="20dp" | 141 | android:textSize="20dp" |
142 | android:visibility="gone"/> | 142 | android:visibility="gone"/> |
143 | 143 | ||
144 | <ImageView | 144 | <ImageView |
145 | android:id="@+id/iv_sex" | 145 | android:id="@+id/iv_sex" |
146 | android:layout_width="wrap_content" | 146 | android:layout_width="wrap_content" |
147 | android:layout_height="wrap_content" | 147 | android:layout_height="wrap_content" |
148 | android:layout_gravity="center_vertical" | 148 | android:layout_gravity="center_vertical" |
149 | android:layout_marginLeft="5dp" | 149 | android:layout_marginLeft="5dp" |
150 | android:src="@mipmap/men" /> | 150 | android:src="@mipmap/men" /> |
151 | 151 | ||
152 | </LinearLayout> | 152 | </LinearLayout> |
153 | 153 | ||
154 | <LinearLayout | 154 | <LinearLayout |
155 | android:layout_below="@id/sssssss" | 155 | android:layout_below="@id/sssssss" |
156 | android:layout_width="match_parent" | 156 | android:layout_width="match_parent" |
157 | android:layout_height="wrap_content" | 157 | android:layout_height="wrap_content" |
158 | android:layout_marginLeft="20dp" | 158 | android:layout_marginLeft="20dp" |
159 | android:layout_marginTop="10dp" | 159 | android:layout_marginTop="10dp" |
160 | android:gravity="center" | 160 | android:gravity="center" |
161 | android:orientation="horizontal"> | 161 | android:orientation="horizontal"> |
162 | 162 | ||
163 | <TextView | 163 | <TextView |
164 | android:id="@+id/tv_sign" | 164 | android:id="@+id/tv_sign" |
165 | android:layout_height="wrap_content" | 165 | android:layout_height="wrap_content" |
166 | android:layout_width="wrap_content" | 166 | android:layout_width="wrap_content" |
167 | android:hint="请输入个性签名" | 167 | android:hint="请输入个性签名" |
168 | android:maxLines="3" | 168 | android:maxLines="3" |
169 | android:maxLength="40" | 169 | android:maxLength="40" |
170 | android:ellipsize="end" | 170 | android:ellipsize="end" |
171 | android:textSize="16sp" /> | 171 | android:textSize="16sp" /> |
172 | 172 | ||
173 | <ImageView | 173 | <ImageView |
174 | android:id="@+id/iv_sign" | 174 | android:id="@+id/iv_sign" |
175 | android:layout_width="wrap_content" | 175 | android:layout_width="wrap_content" |
176 | android:layout_height="wrap_content" | 176 | android:layout_height="wrap_content" |
177 | android:padding="10dp" | 177 | android:padding="10dp" |
178 | android:src="@mipmap/qianming" /> | 178 | android:src="@mipmap/qianming" /> |
179 | 179 | ||
180 | 180 | ||
181 | </LinearLayout> | 181 | </LinearLayout> |
182 | </RelativeLayout> | 182 | </RelativeLayout> |
183 | <View | 183 | <View |
184 | android:layout_width="match_parent" | 184 | android:layout_width="match_parent" |
185 | android:layout_height="0.7dp" | 185 | android:layout_height="0.7dp" |
186 | android:background="@color/cutoff_line"> | 186 | android:background="@color/cutoff_line"> |
187 | 187 | ||
188 | </View> | 188 | </View> |
189 | 189 | ||
190 | <LinearLayout | 190 | <LinearLayout |
191 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
192 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
193 | android:orientation="vertical"> | 193 | android:orientation="vertical"> |
194 | 194 | ||
195 | <LinearLayout | 195 | <LinearLayout |
196 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
197 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
198 | android:gravity="center_vertical" | 198 | android:gravity="center_vertical" |
199 | android:orientation="horizontal"> | 199 | android:orientation="horizontal"> |
200 | 200 | ||
201 | <ImageView | 201 | <ImageView |
202 | android:layout_width="0dp" | 202 | android:layout_width="0dp" |
203 | android:layout_height="wrap_content" | 203 | android:layout_height="wrap_content" |
204 | android:layout_weight="1" | 204 | android:layout_weight="1" |
205 | android:paddingTop="20dp" | 205 | android:paddingTop="20dp" |
206 | android:paddingBottom="20dp" | 206 | android:paddingBottom="20dp" |
207 | android:src="@mipmap/wodecuoti1" /> | 207 | android:src="@mipmap/wodecuoti1" /> |
208 | 208 | ||
209 | <TextView | 209 | <TextView |
210 | android:id="@+id/linel_mycuoti" | 210 | android:id="@+id/linel_mycuoti" |
211 | android:layout_width="0dp" | 211 | android:layout_width="0dp" |
212 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
213 | android:layout_weight="1" | 213 | android:layout_weight="1" |
214 | android:paddingTop="20dp" | 214 | android:paddingTop="20dp" |
215 | android:paddingBottom="20dp" | 215 | android:paddingBottom="20dp" |
216 | android:text="我的错题" | 216 | android:text="我的错题" |
217 | android:textSize="20sp" /> | 217 | android:textSize="20sp" /> |
218 | <View | 218 | <View |
219 | android:layout_width="1dp" | 219 | android:layout_width="1dp" |
220 | android:layout_height="match_parent" | 220 | android:layout_height="match_parent" |
221 | android:background="@color/cutoff_line"> | 221 | android:background="@color/cutoff_line"> |
222 | 222 | ||
223 | </View> | 223 | </View> |
224 | 224 | ||
225 | <ImageView | 225 | <ImageView |
226 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
228 | android:layout_weight="1" | 228 | android:layout_weight="1" |
229 | android:paddingTop="20dp" | 229 | android:paddingTop="20dp" |
230 | android:paddingBottom="20dp" | 230 | android:paddingBottom="20dp" |
231 | android:src="@mipmap/wodebiji1" /> | 231 | android:src="@mipmap/wodebiji1" /> |
232 | <TextView | 232 | <TextView |
233 | android:id="@+id/linel_mynote" | 233 | android:id="@+id/linel_mynote" |
234 | android:layout_width="0dp" | 234 | android:layout_width="0dp" |
235 | android:layout_height="wrap_content" | 235 | android:layout_height="wrap_content" |
236 | android:layout_weight="1" | 236 | android:layout_weight="1" |
237 | android:paddingTop="20dp" | 237 | android:paddingTop="20dp" |
238 | android:paddingBottom="20dp" | 238 | android:paddingBottom="20dp" |
239 | android:text="我的笔记" | 239 | android:text="我的笔记" |
240 | android:textSize="20sp" /> | 240 | android:textSize="20sp" /> |
241 | 241 | ||
242 | </LinearLayout> | 242 | </LinearLayout> |
243 | <View | 243 | <View |
244 | android:layout_width="match_parent" | 244 | android:layout_width="match_parent" |
245 | android:layout_height="1dp" | 245 | android:layout_height="1dp" |
246 | android:background="@color/cutoff_line"> | 246 | android:background="@color/cutoff_line"> |
247 | 247 | ||
248 | </View> | 248 | </View> |
249 | <LinearLayout | 249 | <LinearLayout |
250 | android:layout_width="match_parent" | 250 | android:layout_width="match_parent" |
251 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
252 | android:gravity="center_vertical" | 252 | android:gravity="center_vertical" |
253 | android:orientation="horizontal"> | 253 | android:orientation="horizontal"> |
254 | 254 | ||
255 | <ImageView | 255 | <ImageView |
256 | android:layout_width="0dp" | 256 | android:layout_width="0dp" |
257 | android:layout_height="wrap_content" | 257 | android:layout_height="wrap_content" |
258 | android:layout_weight="1" | 258 | android:layout_weight="1" |
259 | android:paddingTop="20dp" | 259 | android:paddingTop="20dp" |
260 | android:paddingBottom="20dp" | 260 | android:paddingBottom="20dp" |
261 | android:src="@mipmap/wodeshoucang" /> | 261 | android:src="@mipmap/wodeshoucang" /> |
262 | 262 | ||
263 | <TextView | 263 | <TextView |
264 | android:id="@+id/linel_mycollege" | 264 | android:id="@+id/linel_mycollege" |
265 | android:layout_width="0dp" | 265 | android:layout_width="0dp" |
266 | android:layout_height="wrap_content" | 266 | android:layout_height="wrap_content" |
267 | android:layout_weight="1" | 267 | android:layout_weight="1" |
268 | android:paddingTop="20dp" | 268 | android:paddingTop="20dp" |
269 | android:paddingBottom="20dp" | 269 | android:paddingBottom="20dp" |
270 | android:text="我的收藏" | 270 | android:text="我的收藏" |
271 | android:textSize="20sp" /> | 271 | android:textSize="20sp" /> |
272 | <View | 272 | <View |
273 | android:layout_width="1dp" | 273 | android:layout_width="1dp" |
274 | android:layout_height="match_parent" | 274 | android:layout_height="match_parent" |
275 | android:background="@color/cutoff_line"> | 275 | android:background="@color/cutoff_line"> |
276 | 276 | ||
277 | </View> | 277 | </View> |
278 | 278 | ||
279 | <ImageView | 279 | <ImageView |
280 | android:layout_width="0dp" | 280 | android:layout_width="0dp" |
281 | android:layout_height="wrap_content" | 281 | android:layout_height="wrap_content" |
282 | android:layout_weight="1" | 282 | android:layout_weight="1" |
283 | android:paddingTop="20dp" | 283 | android:paddingTop="20dp" |
284 | android:paddingBottom="20dp" | 284 | android:paddingBottom="20dp" |
285 | android:src="@mipmap/wodebanji1" /> | 285 | android:src="@mipmap/wodebanji1" /> |
286 | <TextView | 286 | <TextView |
287 | android:id="@+id/linel_myclass" | 287 | android:id="@+id/linel_myclass" |
288 | android:layout_width="0dp" | 288 | android:layout_width="0dp" |
289 | android:layout_height="wrap_content" | 289 | android:layout_height="wrap_content" |
290 | android:layout_weight="1" | 290 | android:layout_weight="1" |
291 | android:text="我的班级" | 291 | android:text="我的班级" |
292 | android:paddingTop="20dp" | 292 | android:paddingTop="20dp" |
293 | android:paddingBottom="20dp" | 293 | android:paddingBottom="20dp" |
294 | android:textSize="20sp" /> | 294 | android:textSize="20sp" /> |
295 | 295 | ||
296 | </LinearLayout> | 296 | </LinearLayout> |
297 | 297 | ||
298 | <View | 298 | <View |
299 | android:layout_width="match_parent" | 299 | android:layout_width="match_parent" |
300 | android:layout_height="0.7dp" | 300 | android:layout_height="0.7dp" |
301 | android:background="@color/cutoff_line"> | 301 | android:background="@color/cutoff_line"> |
302 | 302 | ||
303 | </View> | 303 | </View> |
304 | 304 | ||
305 | </LinearLayout> | 305 | </LinearLayout> |
306 | <TextView | 306 | <TextView |
307 | android:id="@+id/iv_look_card" | 307 | android:id="@+id/iv_look_card" |
308 | android:layout_width="wrap_content" | 308 | android:layout_width="wrap_content" |
309 | android:layout_height="wrap_content" | 309 | android:layout_height="wrap_content" |
310 | android:padding="10dp" | 310 | android:padding="10dp" |
311 | android:layout_gravity="center" | 311 | android:layout_gravity="center" |
312 | android:layout_marginTop="120dp" | 312 | android:layout_marginTop="120dp" |
313 | android:text="查看电子保卡" /> | 313 | android:text="查看电子保卡" /> |
314 | 314 | ||
315 | <LinearLayout | 315 | <LinearLayout |
316 | android:layout_width="match_parent" | 316 | android:layout_width="match_parent" |
317 | android:layout_height="match_parent" | 317 | android:layout_height="100dp" |
318 | android:background="@mipmap/xiaoguanggao"> | 318 | android:background="@mipmap/xiaoguanggao"> |
319 | 319 | ||
320 | </LinearLayout> | 320 | </LinearLayout> |
321 | 321 | ||
322 | 322 | ||
323 | </LinearLayout> | 323 | </LinearLayout> |
324 | 324 | ||
325 | 325 | ||
326 | <View | 326 | <View |
327 | android:layout_width="0.7dp" | 327 | android:layout_width="0.7dp" |
328 | android:layout_height="match_parent" | 328 | android:layout_height="match_parent" |
329 | android:background="@color/cutoff_line"> | 329 | android:background="@color/cutoff_line"> |
330 | 330 | ||
331 | </View> | 331 | </View> |
332 | 332 | ||
333 | <LinearLayout | 333 | <LinearLayout |
334 | android:layout_width="0dp" | 334 | android:layout_width="0dp" |
335 | android:layout_height="match_parent" | 335 | android:layout_height="match_parent" |
336 | android:layout_weight="2.5" | 336 | android:layout_weight="2.5" |
337 | android:orientation="vertical"> | 337 | android:orientation="vertical"> |
338 | 338 | ||
339 | <LinearLayout | 339 | <LinearLayout |
340 | android:layout_width="match_parent" | 340 | android:layout_width="match_parent" |
341 | android:layout_height="wrap_content" | 341 | android:layout_height="wrap_content" |
342 | android:layout_margin="10dp" | 342 | android:layout_margin="10dp" |
343 | android:gravity="center_vertical" | 343 | android:gravity="center_vertical" |
344 | android:orientation="horizontal"> | 344 | android:orientation="horizontal"> |
345 | 345 | ||
346 | <View | 346 | <View |
347 | android:layout_width="5dp" | 347 | android:layout_width="5dp" |
348 | android:layout_height="20dp" | 348 | android:layout_height="20dp" |
349 | android:background="@color/login_text_blue"> | 349 | android:background="@color/login_text_blue"> |
350 | 350 | ||
351 | </View> | 351 | </View> |
352 | 352 | ||
353 | <TextView | 353 | <TextView |
354 | android:layout_width="0dp" | 354 | android:layout_width="0dp" |
355 | android:layout_height="wrap_content" | 355 | android:layout_height="wrap_content" |
356 | android:layout_marginLeft="5dp" | 356 | android:layout_marginLeft="5dp" |
357 | android:layout_weight="5" | 357 | android:layout_weight="5" |
358 | android:text="个人信息" | 358 | android:text="个人信息" |
359 | android:textSize="22sp" /> | 359 | android:textSize="22sp" /> |
360 | 360 | ||
361 | <TextView | 361 | <TextView |
362 | android:layout_width="0dp" | 362 | android:layout_width="0dp" |
363 | android:layout_height="wrap_content" | 363 | android:layout_height="wrap_content" |
364 | android:layout_marginLeft="10dp" | 364 | android:layout_marginLeft="10dp" |
365 | android:layout_weight="0.1" | 365 | android:layout_weight="0.1" |
366 | android:text="" | 366 | android:text="" |
367 | android:textSize="18sp" /> | 367 | android:textSize="18sp" /> |
368 | 368 | ||
369 | <ImageView | 369 | <ImageView |
370 | android:id="@+id/tv_edit_presoninfo" | 370 | android:id="@+id/tv_edit_presoninfo" |
371 | android:padding="10dp" | 371 | android:padding="10dp" |
372 | android:layout_width="0dp" | 372 | android:layout_width="0dp" |
373 | android:layout_height="wrap_content" | 373 | android:layout_height="wrap_content" |
374 | android:layout_weight="0.4" | 374 | android:layout_weight="0.4" |
375 | android:src="@mipmap/gerenxinxibianji" /> | 375 | android:src="@mipmap/gerenxinxibianji" /> |
376 | 376 | ||
377 | 377 | ||
378 | </LinearLayout> | 378 | </LinearLayout> |
379 | 379 | ||
380 | <LinearLayout | 380 | <LinearLayout |
381 | android:layout_width="match_parent" | 381 | android:layout_width="match_parent" |
382 | android:layout_height="wrap_content" | 382 | android:layout_height="wrap_content" |
383 | android:layout_marginLeft="50dp" | 383 | android:layout_marginLeft="50dp" |
384 | android:orientation="vertical"> | 384 | android:orientation="vertical"> |
385 | 385 | ||
386 | <LinearLayout | 386 | <LinearLayout |
387 | android:layout_width="match_parent" | 387 | android:layout_width="match_parent" |
388 | android:layout_height="wrap_content" | 388 | android:layout_height="wrap_content" |
389 | android:gravity="center_vertical" | 389 | android:gravity="center_vertical" |
390 | android:orientation="horizontal"> | 390 | android:orientation="horizontal"> |
391 | 391 | ||
392 | <TextView | 392 | <TextView |
393 | android:layout_width="0dp" | 393 | android:layout_width="0dp" |
394 | android:layout_height="wrap_content" | 394 | android:layout_height="wrap_content" |
395 | android:textColor="@color/login_edittext_hint" | 395 | android:textColor="@color/login_edittext_hint" |
396 | android:layout_weight="1" | 396 | android:layout_weight="1" |
397 | android:text="昵称" | 397 | android:text="昵称" |
398 | android:textSize="20sp" /> | 398 | android:textSize="20sp" /> |
399 | 399 | ||
400 | <TextView | 400 | <TextView |
401 | android:id="@+id/tv_username1" | 401 | android:id="@+id/tv_username1" |
402 | android:layout_width="0dp" | 402 | android:layout_width="0dp" |
403 | android:layout_height="wrap_content" | 403 | android:layout_height="wrap_content" |
404 | android:layout_weight="2" | 404 | android:layout_weight="2" |
405 | android:hint="未填写" | 405 | android:hint="未填写" |
406 | android:textSize="20sp" /> | 406 | android:textSize="20sp" /> |
407 | 407 | ||
408 | <TextView | 408 | <TextView |
409 | android:layout_width="1dp" | 409 | android:layout_width="1dp" |
410 | android:layout_height="wrap_content" | 410 | android:layout_height="wrap_content" |
411 | android:layout_weight="1" | 411 | android:layout_weight="1" |
412 | android:textColor="@color/login_edittext_hint" | 412 | android:textColor="@color/login_edittext_hint" |
413 | android:text="星座" | 413 | android:text="星座" |
414 | android:textSize="20sp" /> | 414 | android:textSize="20sp" /> |
415 | 415 | ||
416 | <TextView | 416 | <TextView |
417 | android:id="@+id/tv_mygad" | 417 | android:id="@+id/tv_mygad" |
418 | android:layout_width="0dp" | 418 | android:layout_width="0dp" |
419 | android:layout_height="wrap_content" | 419 | android:layout_height="wrap_content" |
420 | android:layout_weight="2" | 420 | android:layout_weight="2" |
421 | android:hint="未填写" | 421 | android:hint="未填写" |
422 | android:textSize="20sp" /> | 422 | android:textSize="20sp" /> |
423 | </LinearLayout> | 423 | </LinearLayout> |
424 | 424 | ||
425 | <LinearLayout | 425 | <LinearLayout |
426 | android:layout_width="match_parent" | 426 | android:layout_width="match_parent" |
427 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
428 | android:layout_marginTop="15dp" | 428 | android:layout_marginTop="15dp" |
429 | android:gravity="center_vertical" | 429 | android:gravity="center_vertical" |
430 | android:orientation="horizontal"> | 430 | android:orientation="horizontal"> |
431 | 431 | ||
432 | <TextView | 432 | <TextView |
433 | android:layout_width="0dp" | 433 | android:layout_width="0dp" |
434 | android:layout_height="wrap_content" | 434 | android:layout_height="wrap_content" |
435 | android:textColor="@color/login_edittext_hint" | 435 | android:textColor="@color/login_edittext_hint" |
436 | android:layout_weight="1" | 436 | android:layout_weight="1" |
437 | android:text="性别" | 437 | android:text="性别" |
438 | android:textSize="20sp" /> | 438 | android:textSize="20sp" /> |
439 | 439 | ||
440 | <TextView | 440 | <TextView |
441 | android:id="@+id/tv_sex" | 441 | android:id="@+id/tv_sex" |
442 | android:layout_width="0dp" | 442 | android:layout_width="0dp" |
443 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
444 | android:layout_weight="2" | 444 | android:layout_weight="2" |
445 | android:hint="未填写" | 445 | android:hint="未填写" |
446 | android:textSize="20sp" /> | 446 | android:textSize="20sp" /> |
447 | 447 | ||
448 | <TextView | 448 | <TextView |
449 | android:layout_width="1dp" | 449 | android:layout_width="1dp" |
450 | android:layout_height="wrap_content" | 450 | android:layout_height="wrap_content" |
451 | android:textColor="@color/login_edittext_hint" | 451 | android:textColor="@color/login_edittext_hint" |
452 | android:layout_weight="1" | 452 | android:layout_weight="1" |
453 | android:text="地区" | 453 | android:text="地区" |
454 | android:textSize="20sp" /> | 454 | android:textSize="20sp" /> |
455 | 455 | ||
456 | <TextView | 456 | <TextView |
457 | android:id="@+id/tv_useinfo_adress" | 457 | android:id="@+id/tv_useinfo_adress" |
458 | android:layout_width="0dp" | 458 | android:layout_width="0dp" |
459 | android:layout_height="wrap_content" | 459 | android:layout_height="wrap_content" |
460 | android:layout_weight="2" | 460 | android:layout_weight="2" |
461 | android:hint="未填写" | 461 | android:hint="未填写" |
462 | android:maxLines="2" | 462 | android:maxLines="2" |
463 | android:ellipsize="end" | 463 | android:ellipsize="end" |
464 | android:textSize="20sp" /> | 464 | android:textSize="20sp" /> |
465 | </LinearLayout> | 465 | </LinearLayout> |
466 | 466 | ||
467 | <LinearLayout | 467 | <LinearLayout |
468 | android:layout_width="match_parent" | 468 | android:layout_width="match_parent" |
469 | android:layout_height="wrap_content" | 469 | android:layout_height="wrap_content" |
470 | android:layout_marginTop="15dp" | 470 | android:layout_marginTop="15dp" |
471 | android:gravity="center_vertical" | 471 | android:gravity="center_vertical" |
472 | android:orientation="horizontal"> | 472 | android:orientation="horizontal"> |
473 | 473 | ||
474 | <TextView | 474 | <TextView |
475 | android:layout_width="0dp" | 475 | android:layout_width="0dp" |
476 | android:layout_height="wrap_content" | 476 | android:layout_height="wrap_content" |
477 | android:layout_weight="1" | 477 | android:layout_weight="1" |
478 | android:text="生日" | 478 | android:text="生日" |
479 | android:textColor="@color/login_edittext_hint" | 479 | android:textColor="@color/login_edittext_hint" |
480 | 480 | ||
481 | android:textSize="20sp" /> | 481 | android:textSize="20sp" /> |
482 | 482 | ||
483 | <TextView | 483 | <TextView |
484 | android:id="@+id/tv_useinfo_birthday" | 484 | android:id="@+id/tv_useinfo_birthday" |
485 | android:layout_width="0dp" | 485 | android:layout_width="0dp" |
486 | android:layout_height="wrap_content" | 486 | android:layout_height="wrap_content" |
487 | android:layout_weight="2" | 487 | android:layout_weight="2" |
488 | android:hint="未填写" | 488 | android:hint="未填写" |
489 | android:textSize="20sp" /> | 489 | android:textSize="20sp" /> |
490 | 490 | ||
491 | <TextView | 491 | <TextView |
492 | android:layout_width="1dp" | 492 | android:layout_width="1dp" |
493 | android:layout_height="wrap_content" | 493 | android:layout_height="wrap_content" |
494 | android:layout_weight="1" | 494 | android:layout_weight="1" |
495 | android:textColor="@color/login_edittext_hint" | 495 | android:textColor="@color/login_edittext_hint" |
496 | 496 | ||
497 | android:text="学校" | 497 | android:text="学校" |
498 | android:textSize="20sp" /> | 498 | android:textSize="20sp" /> |
499 | 499 | ||
500 | <TextView | 500 | <TextView |
501 | android:id="@+id/tv_useinfo_school" | 501 | android:id="@+id/tv_useinfo_school" |
502 | android:layout_width="0dp" | 502 | android:layout_width="0dp" |
503 | android:layout_height="wrap_content" | 503 | android:layout_height="wrap_content" |
504 | android:layout_weight="2" | 504 | android:layout_weight="2" |
505 | android:hint="未填写" | 505 | android:hint="未填写" |
506 | android:textSize="20sp" /> | 506 | android:textSize="20sp" /> |
507 | </LinearLayout> | 507 | </LinearLayout> |
508 | 508 | ||
509 | <LinearLayout | 509 | <LinearLayout |
510 | android:layout_width="match_parent" | 510 | android:layout_width="match_parent" |
511 | android:layout_height="wrap_content" | 511 | android:layout_height="wrap_content" |
512 | android:layout_marginTop="15dp" | 512 | android:layout_marginTop="15dp" |
513 | android:gravity="center_vertical" | 513 | android:gravity="center_vertical" |
514 | android:orientation="horizontal"> | 514 | android:orientation="horizontal"> |
515 | 515 | ||
516 | <TextView | 516 | <TextView |
517 | android:layout_width="0dp" | 517 | android:layout_width="0dp" |
518 | android:layout_height="wrap_content" | 518 | android:layout_height="wrap_content" |
519 | android:layout_weight="1" | 519 | android:layout_weight="1" |
520 | android:textColor="@color/login_edittext_hint" | 520 | android:textColor="@color/login_edittext_hint" |
521 | android:text=" Q Q" | 521 | android:text=" Q Q" |
522 | android:textSize="20sp" /> | 522 | android:textSize="20sp" /> |
523 | 523 | ||
524 | <TextView | 524 | <TextView |
525 | android:id="@+id/tv_useinfo_qq" | 525 | android:id="@+id/tv_useinfo_qq" |
526 | android:layout_width="0dp" | 526 | android:layout_width="0dp" |
527 | android:layout_height="wrap_content" | 527 | android:layout_height="wrap_content" |
528 | android:layout_weight="2" | 528 | android:layout_weight="2" |
529 | android:hint="未填写" | 529 | android:hint="未填写" |
530 | android:textSize="20sp" /> | 530 | android:textSize="20sp" /> |
531 | 531 | ||
532 | <TextView | 532 | <TextView |
533 | android:layout_width="1dp" | 533 | android:layout_width="1dp" |
534 | android:layout_height="wrap_content" | 534 | android:layout_height="wrap_content" |
535 | android:layout_weight="1" | 535 | android:layout_weight="1" |
536 | android:text="年级" | 536 | android:text="年级" |
537 | android:textColor="@color/login_edittext_hint" | 537 | android:textColor="@color/login_edittext_hint" |
538 | 538 | ||
539 | android:textSize="20sp" /> | 539 | android:textSize="20sp" /> |
540 | 540 | ||
541 | <TextView | 541 | <TextView |
542 | android:id="@+id/tv_useinfo_gender" | 542 | android:id="@+id/tv_useinfo_gender" |
543 | android:layout_width="0dp" | 543 | android:layout_width="0dp" |
544 | android:layout_height="wrap_content" | 544 | android:layout_height="wrap_content" |
545 | android:layout_weight="2" | 545 | android:layout_weight="2" |
546 | android:hint="未填写" | 546 | android:hint="未填写" |
547 | android:textSize="20sp" /> | 547 | android:textSize="20sp" /> |
548 | </LinearLayout> | 548 | </LinearLayout> |
549 | 549 | ||
550 | 550 | ||
551 | </LinearLayout> | 551 | </LinearLayout> |
552 | <View | 552 | <View |
553 | android:layout_width="match_parent" | 553 | android:layout_width="match_parent" |
554 | android:layout_height="0.7dp" | 554 | android:layout_height="0.7dp" |
555 | android:layout_marginTop="40dp" | 555 | android:layout_marginTop="40dp" |
556 | android:background="@color/cutoff_line"> | 556 | android:background="@color/cutoff_line"> |
557 | 557 | ||
558 | </View> | 558 | </View> |
559 | <LinearLayout | 559 | <LinearLayout |
560 | android:layout_width="match_parent" | 560 | android:layout_width="match_parent" |
561 | android:layout_height="wrap_content" | 561 | android:layout_height="wrap_content" |
562 | android:layout_margin="10dp" | 562 | android:layout_margin="10dp" |
563 | android:gravity="center_vertical" | 563 | android:gravity="center_vertical" |
564 | android:orientation="horizontal"> | 564 | android:orientation="horizontal"> |
565 | 565 | ||
566 | <View | 566 | <View |
567 | android:layout_width="5dp" | 567 | android:layout_width="5dp" |
568 | android:layout_height="20dp" | 568 | android:layout_height="20dp" |
569 | android:layout_marginTop="10dp" | 569 | android:layout_marginTop="10dp" |
570 | android:background="@color/login_text_blue"> | 570 | android:background="@color/login_text_blue"> |
571 | 571 | ||
572 | </View> | 572 | </View> |
573 | 573 | ||
574 | <TextView | 574 | <TextView |
575 | android:layout_width="wrap_content" | 575 | android:layout_width="wrap_content" |
576 | android:layout_height="wrap_content" | 576 | android:layout_height="wrap_content" |
577 | android:layout_marginTop="10dp" | ||
577 | android:layout_marginLeft="5dp" | 578 | android:layout_marginLeft="5dp" |
578 | android:text="版本信息" | 579 | android:text="版本信息" |
579 | android:textSize="22sp" /> | 580 | android:textSize="22sp" /> |
580 | 581 | ||
581 | </LinearLayout> | 582 | </LinearLayout> |
582 | 583 | ||
583 | <LinearLayout | 584 | <LinearLayout |
584 | android:layout_width="wrap_content" | 585 | android:layout_width="wrap_content" |
585 | android:layout_height="wrap_content" | 586 | android:layout_height="wrap_content" |
586 | android:orientation="vertical" | 587 | android:orientation="vertical" |
587 | android:gravity="center"> | 588 | android:gravity="center"> |
588 | 589 | ||
589 | 590 | ||
590 | <GridView | 591 | <GridView |
591 | android:id="@+id/id_recyclerview_pubish" | 592 | android:id="@+id/id_recyclerview_pubish" |
592 | android:layout_margin="3dp" | 593 | android:layout_margin="3dp" |
593 | android:layout_width="match_parent" | 594 | android:layout_width="match_parent" |
594 | android:layout_height="wrap_content" | 595 | android:layout_height="wrap_content" |
595 | android:gravity="center_vertical" | 596 | android:gravity="center_vertical" |
596 | android:verticalSpacing="20dp" | 597 | android:verticalSpacing="20dp" |
597 | android:numColumns="5"> | 598 | android:numColumns="5"> |
598 | 599 | ||
599 | </GridView> | 600 | </GridView> |
600 | 601 | ||
601 | 602 | ||
602 | </LinearLayout> | 603 | </LinearLayout> |
603 | 604 | ||
604 | 605 | ||
605 | </LinearLayout> | 606 | </LinearLayout> |
606 | <LinearLayout | 607 | <LinearLayout |
607 | android:layout_width="0dp" | 608 | android:layout_width="0dp" |
608 | android:layout_height="match_parent" | 609 | android:layout_height="match_parent" |
609 | android:layout_weight="1" | 610 | android:layout_weight="1" |
610 | android:background="@color/bgstudy_laout" | 611 | android:background="@color/bgstudy_laout" |
611 | android:orientation="vertical"> | 612 | android:orientation="vertical"> |
612 | <LinearLayout | 613 | <LinearLayout |
613 | android:layout_width="match_parent" | 614 | android:layout_width="match_parent" |
614 | android:layout_height="wrap_content" | 615 | android:layout_height="wrap_content" |
615 | android:layout_margin="20dp" | 616 | android:layout_margin="20dp" |
616 | android:gravity="center_vertical" | 617 | android:gravity="center_vertical" |
617 | android:orientation="horizontal"> | 618 | android:orientation="horizontal"> |
618 | 619 | ||
619 | <View | 620 | <View |
620 | android:layout_width="5dp" | 621 | android:layout_width="5dp" |
621 | android:layout_height="20dp" | 622 | android:layout_height="20dp" |
622 | android:background="@color/login_text_blue"> | 623 | android:background="@color/login_text_blue"> |
623 | 624 | ||
624 | </View> | 625 | </View> |
625 | 626 | ||
626 | <TextView | 627 | <TextView |
627 | android:layout_width="wrap_content" | 628 | android:layout_width="wrap_content" |
628 | android:layout_height="wrap_content" | 629 | android:layout_height="wrap_content" |
629 | android:layout_marginLeft="5dp" | 630 | android:layout_marginLeft="5dp" |
630 | android:text="最近学习" | 631 | android:text="最近学习" |
631 | android:textSize="22sp" /> | 632 | android:textSize="22sp" /> |
632 | 633 | ||
633 | </LinearLayout> | 634 | </LinearLayout> |
634 | 635 | ||
635 | <LinearLayout | 636 | <LinearLayout |
636 | android:layout_width="match_parent" | 637 | android:layout_width="match_parent" |
637 | android:layout_height="match_parent" | 638 | android:layout_height="match_parent" |
638 | android:gravity="center" | 639 | android:gravity="center" |
639 | android:orientation="vertical" | 640 | android:orientation="vertical" |
640 | > | 641 | > |
641 | <LinearLayout | 642 | <LinearLayout |
642 | android:id="@+id/view_novedeo" | 643 | android:id="@+id/view_novedeo" |
643 | android:layout_width="match_parent" | 644 | android:layout_width="match_parent" |
644 | android:layout_height="match_parent" | 645 | android:layout_height="match_parent" |
645 | android:gravity="center" | 646 | android:gravity="center" |
646 | android:orientation="vertical" | 647 | android:orientation="vertical"> |
647 | android:visibility="gone"> | ||
648 | <ImageView | 648 | <ImageView |
649 | android:layout_width="wrap_content" | 649 | android:layout_width="wrap_content" |
650 | android:layout_height="wrap_content" | 650 | android:layout_height="wrap_content" |
651 | android:src="@mipmap/nostudy"/> | 651 | android:src="@mipmap/nostudy"/> |
652 | <TextView | 652 | <TextView |
653 | android:layout_width="wrap_content" | 653 | android:layout_width="wrap_content" |
654 | android:layout_height="wrap_content" | 654 | android:layout_height="wrap_content" |
655 | android:layout_marginTop="20dp" | 655 | android:layout_marginTop="20dp" |
656 | android:text="小主人最近还没有学习哦" | 656 | android:text="小主人最近还没有学习哦" |
657 | android:textSize="14sp" /> | 657 | android:textSize="14sp" /> |
658 | <TextView | 658 | <TextView |
659 | android:layout_width="wrap_content" | 659 | android:layout_width="wrap_content" |
660 | android:layout_height="wrap_content" | 660 | android:layout_height="wrap_content" |
661 | android:text="快去学习吧" | 661 | android:text="快去学习吧" |
662 | android:textSize="14sp" /> | 662 | android:textSize="14sp" /> |
663 | </LinearLayout> | 663 | </LinearLayout> |
664 | <android.support.v7.widget.RecyclerView | 664 | <android.support.v7.widget.RecyclerView |
665 | android:id="@+id/id_recyclerview_horizontal" | 665 | android:id="@+id/id_recyclerview_horizontal" |
666 | android:layout_width="wrap_content" | 666 | android:layout_width="wrap_content" |
667 | android:layout_height="wrap_content" | 667 | android:layout_height="wrap_content" |
668 | android:scrollbars="none" /> | 668 | android:scrollbars="none" /> |
669 | </LinearLayout> | 669 | </LinearLayout> |
670 | 670 | ||
671 | </LinearLayout> | 671 | </LinearLayout> |
672 | 672 | ||
673 | 673 | ||
674 | </LinearLayout> | 674 | </LinearLayout> |
675 | 675 | ||
676 | 676 | ||
677 | </LinearLayout> | 677 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_presonal_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/card_view" | 3 | android:id="@+id/card_view" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | <RelativeLayout | 7 | <RelativeLayout |
8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="50dp" | 10 | android:layout_height="50dp" |
11 | android:background="@color/login_text_blue"> | 11 | android:background="@color/login_text_blue"> |
12 | 12 | ||
13 | <ImageView | 13 | <ImageView |
14 | android:id="@+id/cancel" | 14 | android:id="@+id/cancel" |
15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
16 | android:layout_height="match_parent" | 16 | android:layout_height="match_parent" |
17 | android:paddingLeft="20dp" | 17 | android:paddingLeft="20dp" |
18 | android:paddingRight="20dp" | 18 | android:paddingRight="20dp" |
19 | android:src="@mipmap/title_back" /> | 19 | android:src="@mipmap/title_back" /> |
20 | 20 | ||
21 | <TextView | 21 | <TextView |
22 | android:id="@+id/menu_title" | 22 | android:id="@+id/menu_title" |
23 | android:layout_width="wrap_content" | 23 | android:layout_width="wrap_content" |
24 | android:layout_height="match_parent" | 24 | android:layout_height="match_parent" |
25 | android:layout_centerInParent="true" | 25 | android:layout_centerInParent="true" |
26 | android:gravity="center_vertical" | 26 | android:gravity="center_vertical" |
27 | android:text="@string/changge_preson" | 27 | android:text="@string/changge_preson" |
28 | android:textColor="@android:color/white" | 28 | android:textColor="@android:color/white" |
29 | android:textSize="22sp" /> | 29 | android:textSize="22sp" /> |
30 | <TextView | 30 | <TextView |
31 | android:id="@+id/presonal_sub" | 31 | android:id="@+id/presonal_sub" |
32 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
33 | android:layout_height="match_parent" | 33 | android:layout_height="match_parent" |
34 | android:paddingLeft="20dp" | 34 | android:paddingLeft="20dp" |
35 | android:paddingRight="20dp" | 35 | android:paddingRight="20dp" |
36 | android:gravity="center_vertical" | 36 | android:gravity="center_vertical" |
37 | android:layout_alignParentRight="true" | 37 | android:layout_alignParentRight="true" |
38 | android:text="保存" | 38 | android:text="保存" |
39 | android:textColor="@android:color/white" | 39 | android:textColor="@android:color/white" |
40 | android:textSize="22sp" /> | 40 | android:textSize="22sp" /> |
41 | 41 | ||
42 | 42 | ||
43 | </RelativeLayout> | 43 | </RelativeLayout> |
44 | 44 | ||
45 | 45 | ||
46 | <LinearLayout | 46 | <LinearLayout |
47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
49 | android:layout_marginTop="50dp" | 49 | android:layout_marginTop="50dp" |
50 | android:orientation="horizontal"> | 50 | android:orientation="horizontal"> |
51 | <LinearLayout | 51 | <LinearLayout |
52 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
53 | android:layout_weight="1" | 53 | android:layout_weight="1" |
54 | android:gravity="right" | 54 | android:gravity="right" |
55 | android:layout_marginRight="50dp" | 55 | android:layout_marginRight="50dp" |
56 | android:orientation="vertical" | 56 | android:orientation="vertical" |
57 | android:layout_height="match_parent"> | 57 | android:layout_height="match_parent"> |
58 | <TextView | 58 | <TextView |
59 | android:id="@+id/tv_presonal" | 59 | android:id="@+id/tv_presonal" |
60 | android:layout_width="wrap_content" | 60 | android:layout_width="wrap_content" |
61 | android:layout_height="wrap_content" | 61 | android:layout_height="wrap_content" |
62 | android:textSize="22sp" | 62 | android:textSize="22sp" |
63 | android:textColor="@color/login_edittext_pressed" | 63 | android:textColor="@color/login_edittext_pressed" |
64 | android:text="个人信息"/> | 64 | android:text="个人信息"/> |
65 | <View | 65 | <View |
66 | android:layout_width="90dp" | 66 | android:layout_width="90dp" |
67 | android:layout_height="3dp" | 67 | android:layout_height="3dp" |
68 | android:layout_marginTop="5dp" | 68 | android:layout_marginTop="5dp" |
69 | android:background="@color/login_edittext_pressed" | 69 | android:background="@color/login_edittext_pressed" |
70 | /> | 70 | /> |
71 | 71 | ||
72 | 72 | ||
73 | </LinearLayout> | 73 | </LinearLayout> |
74 | <LinearLayout | 74 | <LinearLayout |
75 | android:id="@+id/tv_version" | 75 | android:id="@+id/tv_version" |
76 | android:layout_width="0dp" | 76 | android:layout_width="0dp" |
77 | android:layout_weight="1" | 77 | android:layout_weight="1" |
78 | android:gravity="left" | 78 | android:gravity="left" |
79 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
80 | android:layout_height="match_parent"> | 80 | android:layout_height="match_parent"> |
81 | <TextView | 81 | <TextView |
82 | android:textSize="22sp" | 82 | android:textSize="22sp" |
83 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
85 | android:text="版本信息"/> | 85 | android:text="版本信息"/> |
86 | 86 | ||
87 | </LinearLayout> | 87 | </LinearLayout> |
88 | 88 | ||
89 | </LinearLayout> | 89 | </LinearLayout> |
90 | 90 | ||
91 | 91 | ||
92 | <LinearLayout | 92 | <LinearLayout |
93 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
94 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
95 | android:layout_marginTop="80dp" | 95 | android:layout_marginTop="80dp" |
96 | android:orientation="horizontal"> | 96 | android:orientation="horizontal"> |
97 | 97 | ||
98 | <View | 98 | <View |
99 | android:layout_width="450dp" | 99 | android:layout_width="450dp" |
100 | android:layout_height="0.7dp" | 100 | android:layout_height="0.7dp" |
101 | android:layout_marginLeft="150dp" | 101 | android:layout_marginLeft="150dp" |
102 | android:background="@color/cutoff_line"> | 102 | android:background="@color/cutoff_line"> |
103 | 103 | ||
104 | </View> | 104 | </View> |
105 | 105 | ||
106 | <View | 106 | <View |
107 | android:layout_width="450dp" | 107 | android:layout_width="450dp" |
108 | android:layout_height="0.7dp" | 108 | android:layout_height="0.7dp" |
109 | android:layout_marginLeft="80dp" | 109 | android:layout_marginLeft="80dp" |
110 | android:background="@color/cutoff_line"> | 110 | android:background="@color/cutoff_line"> |
111 | 111 | ||
112 | </View> | 112 | </View> |
113 | 113 | ||
114 | 114 | ||
115 | </LinearLayout> | 115 | </LinearLayout> |
116 | 116 | ||
117 | <LinearLayout | 117 | <LinearLayout |
118 | android:layout_width="match_parent" | 118 | android:layout_width="match_parent" |
119 | android:layout_height="wrap_content" | 119 | android:layout_height="wrap_content" |
120 | android:layout_marginLeft="200dp" | 120 | android:layout_marginLeft="200dp" |
121 | android:gravity="center_vertical" | 121 | android:gravity="center_vertical" |
122 | android:orientation="horizontal"> | 122 | android:orientation="horizontal"> |
123 | 123 | ||
124 | <LinearLayout | 124 | <LinearLayout |
125 | android:layout_width="0dp" | 125 | android:layout_width="0dp" |
126 | android:layout_height="80dp" | 126 | android:layout_height="80dp" |
127 | android:layout_weight="1" | 127 | android:layout_weight="1" |
128 | android:gravity="center_vertical"> | 128 | android:gravity="center_vertical" |
129 | android:focusable="true" | ||
130 | android:focusableInTouchMode="true"> | ||
129 | 131 | ||
130 | <TextView | 132 | <TextView |
131 | android:layout_width="wrap_content" | 133 | android:layout_width="wrap_content" |
132 | android:layout_height="wrap_content" | 134 | android:layout_height="wrap_content" |
133 | android:text="昵称" | 135 | android:text="昵称" |
136 | android:textColor="@color/electronic_text" | ||
134 | android:textSize="22sp" /> | 137 | android:textSize="22sp" /> |
135 | 138 | ||
136 | <EditText | 139 | <EditText |
137 | android:id="@+id/tv_username1" | 140 | android:id="@+id/tv_username1" |
138 | android:layout_width="wrap_content" | 141 | android:layout_width="wrap_content" |
139 | android:layout_height="wrap_content" | 142 | android:layout_height="wrap_content" |
140 | android:layout_marginLeft="50dp" | 143 | android:layout_marginLeft="50dp" |
141 | android:textColor="@color/login_text_black" | 144 | android:textColor="@color/login_text_black" |
142 | android:background="@null" | 145 | android:background="@null" |
143 | android:hint="请输入12个以内的中文或英文字符" | 146 | android:hint="请输入12个以内的中文或英文字符" |
144 | android:textSize="22sp" /> | 147 | android:textSize="22sp" /> |
145 | 148 | ||
146 | </LinearLayout> | 149 | </LinearLayout> |
147 | 150 | ||
148 | <LinearLayout | 151 | <LinearLayout |
149 | android:layout_width="0dp" | 152 | android:layout_width="0dp" |
150 | android:layout_height="80dp" | 153 | android:layout_height="80dp" |
151 | android:layout_weight="1" | 154 | android:layout_weight="1" |
152 | android:gravity="center_vertical"> | 155 | android:gravity="center_vertical"> |
153 | 156 | ||
154 | <TextView | 157 | <TextView |
155 | android:layout_width="wrap_content" | 158 | android:layout_width="wrap_content" |
156 | android:layout_height="wrap_content" | 159 | android:layout_height="wrap_content" |
157 | android:text="地区" | 160 | android:text="地区" |
161 | android:textColor="@color/electronic_text" | ||
158 | android:textSize="22sp" /> | 162 | android:textSize="22sp" /> |
159 | 163 | ||
160 | <TextView | 164 | <TextView |
161 | android:id="@+id/tv_useinfo_adress" | 165 | android:id="@+id/tv_useinfo_adress" |
162 | android:layout_width="wrap_content" | 166 | android:layout_width="wrap_content" |
163 | android:layout_height="wrap_content" | 167 | android:layout_height="wrap_content" |
164 | android:layout_marginLeft="50dp" | 168 | android:layout_marginLeft="50dp" |
169 | android:textColor="@color/login_text_black" | ||
165 | android:hint="请选择" | 170 | android:hint="请选择" |
166 | android:textSize="22sp" /> | 171 | android:textSize="22sp" /> |
167 | 172 | ||
168 | <ImageView | 173 | <ImageView |
169 | android:id="@+id/my_adress" | 174 | android:id="@+id/my_adress" |
170 | android:padding="20dp" | 175 | android:padding="20dp" |
171 | android:layout_width="wrap_content" | 176 | android:layout_width="wrap_content" |
172 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
173 | android:layout_marginLeft="150dp" | 178 | android:layout_marginLeft="150dp" |
174 | android:src="@mipmap/xiajiantou"> | 179 | android:src="@mipmap/xiajiantou"> |
175 | 180 | ||
176 | </ImageView> | 181 | </ImageView> |
177 | </LinearLayout> | 182 | </LinearLayout> |
178 | 183 | ||
179 | </LinearLayout> | 184 | </LinearLayout> |
180 | 185 | ||
181 | <LinearLayout | 186 | <LinearLayout |
182 | android:layout_width="wrap_content" | 187 | android:layout_width="wrap_content" |
183 | android:layout_height="wrap_content" | 188 | android:layout_height="wrap_content" |
184 | android:orientation="horizontal"> | 189 | android:orientation="horizontal"> |
185 | 190 | ||
186 | <View | 191 | <View |
187 | android:layout_width="450dp" | 192 | android:layout_width="450dp" |
188 | android:layout_height="0.7dp" | 193 | android:layout_height="0.7dp" |
189 | android:layout_marginLeft="150dp" | 194 | android:layout_marginLeft="150dp" |
190 | android:background="@color/cutoff_line"> | 195 | android:background="@color/cutoff_line"> |
191 | 196 | ||
192 | </View> | 197 | </View> |
193 | 198 | ||
194 | <View | 199 | <View |
195 | android:layout_width="450dp" | 200 | android:layout_width="450dp" |
196 | android:layout_height="0.7dp" | 201 | android:layout_height="0.7dp" |
197 | android:layout_marginLeft="80dp" | 202 | android:layout_marginLeft="80dp" |
198 | android:background="@color/cutoff_line"> | 203 | android:background="@color/cutoff_line"> |
199 | 204 | ||
200 | </View> | 205 | </View> |
201 | 206 | ||
202 | 207 | ||
203 | </LinearLayout> | 208 | </LinearLayout> |
204 | 209 | ||
205 | <LinearLayout | 210 | <LinearLayout |
206 | android:layout_width="match_parent" | 211 | android:layout_width="match_parent" |
207 | android:layout_height="wrap_content" | 212 | android:layout_height="wrap_content" |
208 | android:layout_marginLeft="200dp" | 213 | android:layout_marginLeft="200dp" |
209 | android:gravity="center_vertical" | 214 | android:gravity="center_vertical" |
210 | android:orientation="horizontal"> | 215 | android:orientation="horizontal"> |
211 | 216 | ||
212 | <LinearLayout | 217 | <LinearLayout |
213 | android:layout_width="0dp" | 218 | android:layout_width="0dp" |
214 | android:layout_height="80dp" | 219 | android:layout_height="80dp" |
215 | android:layout_weight="1" | 220 | android:layout_weight="1" |
216 | android:gravity="center_vertical"> | 221 | android:gravity="center_vertical"> |
217 | 222 | ||
218 | <TextView | 223 | <TextView |
219 | android:layout_width="wrap_content" | 224 | android:layout_width="wrap_content" |
220 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
221 | android:text="性别" | 226 | android:text="性别" |
227 | android:textColor="@color/electronic_text" | ||
222 | android:textSize="22sp" /> | 228 | android:textSize="22sp" /> |
223 | 229 | ||
224 | <TextView | 230 | <TextView |
225 | android:id="@+id/tv_sex" | 231 | android:id="@+id/tv_sex" |
226 | android:layout_width="wrap_content" | 232 | android:layout_width="wrap_content" |
227 | android:layout_height="wrap_content" | 233 | android:layout_height="wrap_content" |
228 | android:layout_marginLeft="50dp" | 234 | android:layout_marginLeft="50dp" |
235 | android:textColor="@color/login_text_black" | ||
229 | android:hint="请选择" | 236 | android:hint="请选择" |
230 | android:textSize="22sp" /> | 237 | android:textSize="22sp" /> |
231 | 238 | ||
232 | <ImageView | 239 | <ImageView |
233 | android:id="@+id/my_sex" | 240 | android:id="@+id/my_sex" |
234 | android:padding="20dp" | 241 | android:padding="20dp" |
235 | android:layout_width="wrap_content" | 242 | android:layout_width="wrap_content" |
236 | android:layout_height="wrap_content" | 243 | android:layout_height="wrap_content" |
237 | android:layout_marginLeft="150dp" | 244 | android:layout_marginLeft="150dp" |
238 | android:src="@mipmap/xiajiantou"> | 245 | android:src="@mipmap/xiajiantou"> |
239 | 246 | ||
240 | </ImageView> | 247 | </ImageView> |
241 | 248 | ||
242 | 249 | ||
243 | </LinearLayout> | 250 | </LinearLayout> |
244 | 251 | ||
245 | <LinearLayout | 252 | <LinearLayout |
246 | android:layout_width="0dp" | 253 | android:layout_width="0dp" |
247 | android:layout_height="80dp" | 254 | android:layout_height="80dp" |
248 | android:layout_weight="1" | 255 | android:layout_weight="1" |
249 | android:gravity="center_vertical"> | 256 | android:gravity="center_vertical"> |
250 | 257 | ||
251 | <TextView | 258 | <TextView |
252 | android:layout_width="wrap_content" | 259 | android:layout_width="wrap_content" |
253 | android:layout_height="wrap_content" | 260 | android:layout_height="wrap_content" |
254 | android:text=" " | 261 | android:text=" " |
255 | android:textColor="@color/white" | 262 | android:textColor="@color/white" |
256 | android:textSize="22sp" /> | 263 | android:textSize="22sp" /> |
257 | 264 | ||
258 | <EditText | 265 | <EditText |
259 | android:id="@+id/tv_useinfo_adress1" | 266 | android:id="@+id/tv_useinfo_adress1" |
260 | android:layout_width="wrap_content" | 267 | android:layout_width="wrap_content" |
261 | android:layout_height="wrap_content" | 268 | android:layout_height="wrap_content" |
262 | android:layout_marginLeft="50dp" | 269 | android:layout_marginLeft="50dp" |
263 | android:textColor="@color/login_text_black" | 270 | android:textColor="@color/login_text_black" |
264 | android:background="@null" | 271 | android:background="@null" |
265 | android:hint="请输入详细地址" | 272 | android:hint="请输入详细地址" |
266 | android:textSize="22sp" /> | 273 | android:textSize="22sp" /> |
267 | 274 | ||
268 | </LinearLayout> | 275 | </LinearLayout> |
269 | 276 | ||
270 | </LinearLayout> | 277 | </LinearLayout> |
271 | 278 | ||
272 | <LinearLayout | 279 | <LinearLayout |
273 | android:layout_width="wrap_content" | 280 | android:layout_width="wrap_content" |
274 | android:layout_height="wrap_content" | 281 | android:layout_height="wrap_content" |
275 | 282 | ||
276 | android:orientation="horizontal"> | 283 | android:orientation="horizontal"> |
277 | 284 | ||
278 | <View | 285 | <View |
279 | android:layout_width="450dp" | 286 | android:layout_width="450dp" |
280 | android:layout_height="0.7dp" | 287 | android:layout_height="0.7dp" |
281 | android:layout_marginLeft="150dp" | 288 | android:layout_marginLeft="150dp" |
282 | android:background="@color/cutoff_line"> | 289 | android:background="@color/cutoff_line"> |
283 | 290 | ||
284 | </View> | 291 | </View> |
285 | 292 | ||
286 | <View | 293 | <View |
287 | android:layout_width="450dp" | 294 | android:layout_width="450dp" |
288 | android:layout_height="0.7dp" | 295 | android:layout_height="0.7dp" |
289 | android:layout_marginLeft="80dp" | 296 | android:layout_marginLeft="80dp" |
290 | android:background="@color/cutoff_line"> | 297 | android:background="@color/cutoff_line"> |
291 | 298 | ||
292 | </View> | 299 | </View> |
293 | 300 | ||
294 | 301 | ||
295 | </LinearLayout> | 302 | </LinearLayout> |
296 | 303 | ||
297 | <LinearLayout | 304 | <LinearLayout |
298 | android:layout_width="match_parent" | 305 | android:layout_width="match_parent" |
299 | android:layout_height="wrap_content" | 306 | android:layout_height="wrap_content" |
300 | android:layout_marginLeft="200dp" | 307 | android:layout_marginLeft="200dp" |
301 | android:gravity="center_vertical" | 308 | android:gravity="center_vertical" |
302 | android:orientation="horizontal"> | 309 | android:orientation="horizontal"> |
303 | 310 | ||
304 | 311 | ||
305 | <LinearLayout | 312 | <LinearLayout |
306 | android:layout_width="0dp" | 313 | android:layout_width="0dp" |
307 | android:layout_height="80dp" | 314 | android:layout_height="80dp" |
308 | android:layout_weight="1" | 315 | android:layout_weight="1" |
309 | android:gravity="center_vertical"> | 316 | android:gravity="center_vertical"> |
310 | 317 | ||
311 | <TextView | 318 | <TextView |
312 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
313 | android:layout_height="wrap_content" | 320 | android:layout_height="wrap_content" |
314 | android:text="生日" | 321 | android:text="生日" |
322 | android:textColor="@color/electronic_text" | ||
315 | android:textSize="22sp" /> | 323 | android:textSize="22sp" /> |
316 | 324 | ||
317 | <TextView | 325 | <TextView |
318 | android:id="@+id/tv_useinfo_birthday" | 326 | android:id="@+id/tv_useinfo_birthday" |
319 | android:layout_width="wrap_content" | 327 | android:layout_width="wrap_content" |
320 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
321 | android:layout_marginLeft="50dp" | 329 | android:layout_marginLeft="50dp" |
322 | android:hint="请选择" | 330 | android:hint="请选择" |
331 | android:textColor="@color/login_text_black" | ||
323 | android:textSize="22sp" /> | 332 | android:textSize="22sp" /> |
324 | 333 | ||
325 | <ImageView | 334 | <ImageView |
326 | android:id="@+id/my_bthday" | 335 | android:id="@+id/my_bthday" |
327 | android:padding="20dp" | 336 | android:padding="20dp" |
328 | android:layout_width="wrap_content" | 337 | android:layout_width="wrap_content" |
329 | android:layout_height="wrap_content" | 338 | android:layout_height="wrap_content" |
330 | android:layout_marginLeft="150dp" | 339 | android:layout_marginLeft="150dp" |
340 | android:textColor="@color/login_text_black" | ||
331 | android:src="@mipmap/xiajiantou"/> | 341 | android:src="@mipmap/xiajiantou"/> |
332 | </LinearLayout> | 342 | </LinearLayout> |
333 | <LinearLayout | 343 | <LinearLayout |
334 | android:layout_width="0dp" | 344 | android:layout_width="0dp" |
335 | android:layout_height="80dp" | 345 | android:layout_height="80dp" |
336 | android:layout_weight="1" | 346 | android:layout_weight="1" |
337 | android:gravity="center_vertical"> | 347 | android:gravity="center_vertical"> |
338 | 348 | ||
339 | <TextView | 349 | <TextView |
340 | android:layout_width="wrap_content" | 350 | android:layout_width="wrap_content" |
341 | android:layout_height="wrap_content" | 351 | android:layout_height="wrap_content" |
342 | android:text="年级" | 352 | android:text="年级" |
353 | android:textColor="@color/electronic_text" | ||
343 | android:textSize="22sp" /> | 354 | android:textSize="22sp" /> |
344 | 355 | ||
345 | <TextView | 356 | <TextView |
346 | android:id="@+id/tv_useinfo_gender" | 357 | android:id="@+id/tv_useinfo_gender" |
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_marginLeft="50dp" | 360 | android:layout_marginLeft="50dp" |
350 | android:hint="请选择" | 361 | android:hint="请选择" |
362 | android:textColor="@color/login_text_black" | ||
351 | android:textSize="22sp" /> | 363 | android:textSize="22sp" /> |
352 | 364 | ||
353 | <ImageView | 365 | <ImageView |
354 | android:id="@+id/my_grade" | 366 | android:id="@+id/my_grade" |
355 | android:padding="20dp" | 367 | android:padding="20dp" |
356 | android:layout_width="wrap_content" | 368 | android:layout_width="wrap_content" |
357 | android:layout_height="wrap_content" | 369 | android:layout_height="wrap_content" |
358 | android:layout_marginLeft="150dp" | 370 | android:layout_marginLeft="150dp" |
359 | android:src="@mipmap/xiajiantou"/> | 371 | android:src="@mipmap/xiajiantou"/> |
360 | </LinearLayout> | 372 | </LinearLayout> |
361 | 373 | ||
362 | </LinearLayout> | 374 | </LinearLayout> |
363 | 375 | ||
364 | <LinearLayout | 376 | <LinearLayout |
365 | android:layout_width="wrap_content" | 377 | android:layout_width="wrap_content" |
366 | android:layout_height="wrap_content" | 378 | android:layout_height="wrap_content" |
367 | 379 | ||
368 | android:orientation="horizontal"> | 380 | android:orientation="horizontal"> |
369 | 381 | ||
370 | <View | 382 | <View |
371 | android:layout_width="450dp" | 383 | android:layout_width="450dp" |
372 | android:layout_height="0.7dp" | 384 | android:layout_height="0.7dp" |
373 | android:layout_marginLeft="150dp" | 385 | android:layout_marginLeft="150dp" |
374 | android:background="@color/cutoff_line"> | 386 | android:background="@color/cutoff_line"> |
375 | 387 | ||
376 | </View> | 388 | </View> |
377 | 389 | ||
378 | <View | 390 | <View |
379 | android:layout_width="450dp" | 391 | android:layout_width="450dp" |
380 | android:layout_height="0.7dp" | 392 | android:layout_height="0.7dp" |
381 | android:layout_marginLeft="80dp" | 393 | android:layout_marginLeft="80dp" |
382 | android:background="@color/cutoff_line"> | 394 | android:background="@color/cutoff_line"> |
383 | 395 | ||
384 | </View> | 396 | </View> |
385 | 397 | ||
386 | 398 | ||
387 | </LinearLayout> | 399 | </LinearLayout> |
388 | 400 | ||
389 | <LinearLayout | 401 | <LinearLayout |
390 | android:layout_width="match_parent" | 402 | android:layout_width="match_parent" |
391 | android:layout_height="wrap_content" | 403 | android:layout_height="wrap_content" |
392 | android:layout_marginLeft="200dp" | 404 | android:layout_marginLeft="200dp" |
393 | android:gravity="center_vertical" | 405 | android:gravity="center_vertical" |
394 | android:orientation="horizontal"> | 406 | android:orientation="horizontal"> |
395 | 407 | ||
396 | <LinearLayout | 408 | <LinearLayout |
397 | android:id="@+id/lineL_buy_time" | 409 | android:id="@+id/lineL_buy_time" |
398 | android:layout_width="0dp" | 410 | android:layout_width="0dp" |
399 | android:layout_height="80dp" | 411 | android:layout_height="80dp" |
400 | android:layout_weight="1" | 412 | android:layout_weight="1" |
401 | android:gravity="center_vertical"> | 413 | android:gravity="center_vertical"> |
402 | 414 | ||
403 | <TextView | 415 | <TextView |
404 | android:layout_width="wrap_content" | 416 | android:layout_width="wrap_content" |
405 | android:layout_height="wrap_content" | 417 | android:layout_height="wrap_content" |
406 | android:text="Q Q" | 418 | android:text="Q Q" |
419 | android:textColor="@color/electronic_text" | ||
407 | android:textSize="22sp" /> | 420 | android:textSize="22sp" /> |
408 | 421 | ||
409 | <EditText | 422 | <EditText |
410 | android:id="@+id/tv_useinfo_qq" | 423 | android:id="@+id/tv_useinfo_qq" |
411 | android:layout_width="wrap_content" | 424 | android:layout_width="wrap_content" |
412 | android:layout_height="wrap_content" | 425 | android:layout_height="wrap_content" |
413 | android:layout_marginLeft="50dp" | 426 | android:layout_marginLeft="50dp" |
414 | android:background="@null" | 427 | android:background="@null" |
415 | android:textColor="@color/login_text_black" | 428 | android:textColor="@color/login_text_black" |
416 | android:hint="请输入" | 429 | android:hint="请输入" |
417 | android:textSize="22sp" /> | 430 | android:textSize="22sp" /> |
418 | 431 | ||
419 | </LinearLayout> | 432 | </LinearLayout> |
420 | 433 | ||
421 | <LinearLayout | 434 | <LinearLayout |
422 | android:layout_width="0dp" | 435 | android:layout_width="0dp" |
423 | android:layout_height="80dp" | 436 | android:layout_height="80dp" |
424 | android:layout_weight="1" | 437 | android:layout_weight="1" |
425 | 438 | ||
426 | android:gravity="center_vertical"> | 439 | android:gravity="center_vertical"> |
427 | 440 | ||
428 | <TextView | 441 | <TextView |
429 | android:layout_width="wrap_content" | 442 | android:layout_width="wrap_content" |
430 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
431 | android:text="学校" | 444 | android:text="学校" |
445 | android:textColor="@color/electronic_text" | ||
432 | android:textSize="22sp" /> | 446 | android:textSize="22sp" /> |
433 | 447 | ||
434 | <TextView | 448 | <TextView |
435 | android:id="@+id/tv_useinfo_school" | 449 | android:id="@+id/tv_useinfo_school" |
436 | android:layout_width="wrap_content" | 450 | android:layout_width="wrap_content" |
437 | android:layout_height="wrap_content" | 451 | android:layout_height="wrap_content" |
438 | android:layout_marginLeft="50dp" | 452 | android:layout_marginLeft="50dp" |
439 | android:hint="请选择" | 453 | android:hint="请选择" |
454 | android:textColor="@color/login_text_black" | ||
440 | android:textSize="22sp" /> | 455 | android:textSize="22sp" /> |
441 | 456 | ||
442 | <ImageView | 457 | <ImageView |
443 | android:id="@+id/my_school" | 458 | android:id="@+id/my_school" |
444 | android:padding="20dp" | 459 | android:padding="20dp" |
445 | android:layout_width="wrap_content" | 460 | android:layout_width="wrap_content" |
446 | android:layout_height="wrap_content" | 461 | android:layout_height="wrap_content" |
447 | android:layout_marginLeft="150dp" | 462 | android:layout_marginLeft="150dp" |
448 | android:src="@mipmap/xiajiantou"> | 463 | android:src="@mipmap/xiajiantou"> |
449 | 464 | ||
450 | </ImageView> | 465 | </ImageView> |
451 | </LinearLayout> | 466 | </LinearLayout> |
452 | 467 | ||
453 | </LinearLayout> | 468 | </LinearLayout> |
454 | 469 | ||
455 | <LinearLayout | 470 | <LinearLayout |
456 | android:layout_width="wrap_content" | 471 | android:layout_width="wrap_content" |
457 | android:layout_height="wrap_content" | 472 | android:layout_height="wrap_content" |
458 | android:orientation="horizontal"> | 473 | android:orientation="horizontal"> |
459 | 474 | ||
460 | <View | 475 | <View |
461 | android:layout_width="450dp" | 476 | android:layout_width="450dp" |
462 | android:layout_height="0.7dp" | 477 | android:layout_height="0.7dp" |
463 | android:layout_marginLeft="150dp" | 478 | android:layout_marginLeft="150dp" |
464 | android:background="@color/cutoff_line"> | 479 | android:background="@color/cutoff_line"> |
465 | 480 | ||
466 | </View> | 481 | </View> |
467 | 482 | ||
468 | <View | 483 | <View |
469 | android:layout_width="450dp" | 484 | android:layout_width="450dp" |
470 | android:layout_height="0.7dp" | 485 | android:layout_height="0.7dp" |
471 | android:layout_marginLeft="80dp" | 486 | android:layout_marginLeft="80dp" |
472 | android:background="@color/cutoff_line"> | 487 | android:background="@color/cutoff_line"> |
473 | 488 | ||
474 | </View> | 489 | </View> |
475 | 490 | ||
476 | 491 | ||
477 | </LinearLayout> | 492 | </LinearLayout> |
478 | 493 | ||
479 | </LinearLayout> | 494 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes.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 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 3 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
4 | android:orientation="vertical" | 4 | android:orientation="vertical" |
5 | android:layout_marginLeft="10dp" | 5 | android:layout_marginLeft="10dp" |
6 | android:layout_width="wrap_content" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
8 | android:gravity="center"> | 8 | android:gravity="center"> |
9 | 9 | ||
10 | 10 | ||
11 | <com.facebook.drawee.view.SimpleDraweeView | 11 | <com.facebook.drawee.view.SimpleDraweeView |
12 | android:id="@+id/image_publish" | 12 | android:id="@+id/image_publish" |
13 | android:layout_width="120dp" | 13 | android:layout_width="180dp" |
14 | android:layout_height="100dp" | 14 | android:layout_height="120dp" |
15 | android:layout_gravity="center" | 15 | android:layout_gravity="center" |
16 | android:background="@drawable/corcle_black_bg" | 16 | android:background="@drawable/corcle_black_bg" |
17 | fresco:placeholderImage="@mipmap/header_default" | 17 | fresco:placeholderImage="@mipmap/header_default" |
18 | fresco:roundAsCircle="true" | ||
19 | fresco:placeholderImageScaleType="fitCenter" /> | 18 | fresco:placeholderImageScaleType="fitCenter" /> |
20 | 19 | ||
21 | <TextView | 20 | <TextView |
22 | android:id="@+id/subject" | 21 | android:id="@+id/subject" |
23 | android:layout_marginTop="5dp" | 22 | android:layout_marginTop="5dp" |
24 | android:textSize="18sp" | 23 | android:textSize="18sp" |
25 | android:layout_width="100dp" | 24 | android:layout_width="160dp" |
26 | android:layout_height="wrap_content" | 25 | android:layout_height="wrap_content" |
27 | android:width="100dp" | 26 | android:width="100dp" |
28 | android:singleLine="true" | 27 | android:singleLine="true" |
29 | android:gravity="center" | 28 | android:gravity="center" |
30 | android:ellipsize="end" | 29 | android:ellipsize="end" |
31 | android:textColor="@color/login_text_black" | 30 | android:textColor="@color/login_text_black" |
32 | android:text="" | 31 | android:text="" |
33 | /> | 32 | /> |
34 | 33 | ||
35 | </LinearLayout> | 34 | </LinearLayout> |
PersonalCenter/app/src/main/res/mipmap-xhdpi/icon.png
3.75 KB
PersonalCenter/app/src/main/res/values/styles.xml
1 | <resources> | 1 | <resources> |
2 | 2 | ||
3 | <!-- Base application theme. --> | 3 | <!-- Base application theme. --> |
4 | <style name="AppTheme" parent="Theme.AppCompat"> | 4 | <style name="AppTheme" parent="Theme.AppCompat"> |
5 | <!-- Customize your theme here. --> | 5 | <!-- Customize your theme here. --> |
6 | <item name="colorPrimary">@color/colorPrimary</item> | 6 | <item name="colorPrimary">@color/colorPrimary</item> |
7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | 7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
8 | <item name="colorAccent">@color/colorAccent</item> | 8 | <item name="colorAccent">@color/colorAccent</item> |
9 | </style> | 9 | </style> |
10 | 10 | ||
11 | <style name="login_register_edit_style"> | 11 | <style name="login_register_edit_style"> |
12 | <item name="android:textSize">19sp</item> | 12 | <item name="android:textSize">19sp</item> |
13 | <item name="android:singleLine">true</item> | 13 | <item name="android:singleLine">true</item> |
14 | <item name="android:background">@drawable/selector_edittext_bg</item> | 14 | <item name="android:background">@drawable/selector_edittext_bg</item> |
15 | <item name="android:layout_width">match_parent</item> | 15 | <item name="android:layout_width">match_parent</item> |
16 | <item name="android:layout_height">wrap_content</item> | 16 | <item name="android:layout_height">wrap_content</item> |
17 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 17 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
18 | <item name="android:padding">10dp</item> | 18 | <item name="android:padding">10dp</item> |
19 | </style> | 19 | </style> |
20 | 20 | ||
21 | <style name="login_register_edit_rect_style"> | 21 | <style name="login_register_edit_rect_style"> |
22 | <item name="android:textSize">19sp</item> | 22 | <item name="android:textSize">19sp</item> |
23 | <item name="android:singleLine">true</item> | 23 | <item name="android:singleLine">true</item> |
24 | <item name="android:background">@drawable/selector_edittext_rect_bg</item> | 24 | <item name="android:background">@drawable/selector_edittext_rect_bg</item> |
25 | <item name="android:layout_width">match_parent</item> | 25 | <item name="android:layout_width">match_parent</item> |
26 | <item name="android:layout_height">wrap_content</item> | 26 | <item name="android:layout_height">wrap_content</item> |
27 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 27 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
28 | <item name="android:paddingRight">10dp</item> | 28 | <item name="android:paddingRight">10dp</item> |
29 | <item name="android:paddingTop">10dp</item> | 29 | <item name="android:paddingTop">10dp</item> |
30 | <item name="android:paddingLeft">10dp</item> | 30 | <item name="android:paddingLeft">10dp</item> |
31 | <item name="android:paddingBottom">12dp</item> | 31 | <item name="android:paddingBottom">12dp</item> |
32 | </style> | 32 | </style> |
33 | 33 | ||
34 | <style name="login_register_btn_authcode_rect_style"> | 34 | <style name="login_register_btn_authcode_rect_style"> |
35 | <item name="android:textSize">19sp</item> | 35 | <item name="android:textSize">19sp</item> |
36 | <item name="android:singleLine">true</item> | 36 | <item name="android:singleLine">true</item> |
37 | <item name="android:background">@drawable/btn_rect_normal</item> | 37 | <item name="android:background">@drawable/btn_rect_normal</item> |
38 | <item name="android:layout_width">match_parent</item> | 38 | <item name="android:layout_width">match_parent</item> |
39 | <item name="android:layout_height">wrap_content</item> | 39 | <item name="android:layout_height">wrap_content</item> |
40 | <item name="android:textColorHint">@color/login_edittext_hint</item> | 40 | <item name="android:textColorHint">@color/login_edittext_hint</item> |
41 | <item name="android:padding">10dp</item> | 41 | <item name="android:padding">10dp</item> |
42 | </style> | 42 | </style> |
43 | <style name="text_login_register_style" > | 43 | <style name="text_login_register_style" > |
44 | <item name="android:layout_width">wrap_content</item> | 44 | <item name="android:layout_width">wrap_content</item> |
45 | <item name="android:layout_height">wrap_content</item> | 45 | <item name="android:layout_height">wrap_content</item> |
46 | <item name="android:textSize">22sp</item> | 46 | <item name="android:textSize">22sp</item> |
47 | <item name="android:gravity">center</item> | 47 | <item name="android:gravity">center</item> |
48 | <item name="android:padding">10dp</item> | 48 | <item name="android:padding">10dp</item> |
49 | |||
49 | </style> | 50 | </style> |
50 | <style name="button_login_register_style"> | 51 | <style name="button_login_register_style" parent="@style/Widget.AppCompat.Button.Borderless"> |
51 | <item name="android:layout_width">match_parent</item> | 52 | <item name="android:layout_width">match_parent</item> |
52 | <item name="android:layout_height">wrap_content</item> | 53 | <item name="android:layout_height">wrap_content</item> |
53 | <item name="android:background">@drawable/selector_blue_btn_bg</item> | 54 | <item name="android:background">@drawable/selector_blue_btn_bg</item> |
54 | <item name="android:textSize">23sp</item> | 55 | <item name="android:textSize">23sp</item> |
55 | |||
56 | <item name="android:gravity">center</item> | 56 | <item name="android:gravity">center</item> |
57 | <item name="android:padding">10dp</item> | 57 | <item name="android:padding">10dp</item> |
58 | <item name="android:textColor">@android:color/white</item> | 58 | <item name="android:textColor">@android:color/white</item> |
59 | </style> | 59 | </style> |
60 | <style name="text_forget_pwd_style" > | 60 | <style name="text_forget_pwd_style" > |
61 | <item name="android:layout_width">wrap_content</item> | 61 | <item name="android:layout_width">wrap_content</item> |
62 | <item name="android:layout_height">wrap_content</item> | 62 | <item name="android:layout_height">wrap_content</item> |
63 | <item name="android:textSize">18sp</item> | 63 | <item name="android:textSize">18sp</item> |
64 | <item name="android:gravity">center</item> | 64 | <item name="android:gravity">center</item> |
65 | <item name="android:padding">8dp</item> | 65 | <item name="android:padding">8dp</item> |
66 | </style> | 66 | </style> |
67 | <style name="registererrhint_style"> | 67 | <style name="registererrhint_style"> |
68 | <item name="android:textSize">14dip</item> | 68 | <item name="android:textSize">14dip</item> |
69 | <item name="android:layout_width">match_parent</item> | 69 | <item name="android:layout_width">match_parent</item> |
70 | <item name="android:layout_height">wrap_content</item> | 70 | <item name="android:layout_height">wrap_content</item> |
71 | <item name="android:textColor">@color/error_hint</item> | 71 | <item name="android:textColor">@color/error_hint</item> |
72 | <item name="android:layout_marginTop">5dip</item> | 72 | <item name="android:layout_marginTop">5dip</item> |
73 | </style> | 73 | </style> |
74 | <style name="iv_pwd_change_style"> | 74 | <style name="iv_pwd_change_style"> |
75 | <item name="android:layout_width">wrap_content</item> | 75 | <item name="android:layout_width">wrap_content</item> |
76 | <item name="android:layout_height">wrap_content</item> | 76 | <item name="android:layout_height">wrap_content</item> |
77 | <item name="android:background">@mipmap/pwd_hide</item> | 77 | <item name="android:background">@mipmap/pwd_hide</item> |
78 | <item name="android:layout_alignParentRight">true</item> | 78 | <item name="android:layout_alignParentRight">true</item> |
79 | <item name="android:layout_centerVertical">true</item> | 79 | <item name="android:layout_centerVertical">true</item> |
80 | <item name="android:layout_marginRight">15dp</item> | 80 | <item name="android:layout_marginRight">15dp</item> |
81 | </style> | 81 | </style> |
82 | <style name="dialogWindowAnim" parent="android:Animation" mce_bogus="1"> | 82 | <style name="dialogWindowAnim" parent="android:Animation" mce_bogus="1"> |
83 | <item name="android:windowEnterAnimation">@anim/dialog_enter_anim</item> | 83 | <item name="android:windowEnterAnimation">@anim/dialog_enter_anim</item> |
84 | <item name="android:windowExitAnimation">@anim/dialog_exit_anim</item> | 84 | <item name="android:windowExitAnimation">@anim/dialog_exit_anim</item> |
85 | </style> | 85 | </style> |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | </resources> | 90 | </resources> |