Commit 1671ec5d6dd3951b631357c73de0362ef95d0916
1 parent
7b3114a64f
Exists in
master
个人中心bug修复
Showing
24 changed files
with
458 additions
and
241 deletions
Show diff stats
PersonalCenter/.idea/misc.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="EntryPointsManager"> | 3 | <component name="EntryPointsManager"> |
4 | <entry_points version="2.0" /> | 4 | <entry_points version="2.0" /> |
5 | </component> | 5 | </component> |
6 | <component name="NullableNotNullManager"> | 6 | <component name="NullableNotNullManager"> |
7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | 7 | <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> |
8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | 8 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
9 | <option name="myNullables"> | 9 | <option name="myNullables"> |
10 | <value> | 10 | <value> |
11 | <list size="4"> | 11 | <list size="4"> |
12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | 12 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | 13 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | 14 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> |
15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | 15 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> |
16 | </list> | 16 | </list> |
17 | </value> | 17 | </value> |
18 | </option> | 18 | </option> |
19 | <option name="myNotNulls"> | 19 | <option name="myNotNulls"> |
20 | <value> | 20 | <value> |
21 | <list size="4"> | 21 | <list size="4"> |
22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | 22 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> |
23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | 23 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> |
24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | 24 | <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> |
25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | 25 | <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> |
26 | </list> | 26 | </list> |
27 | </value> | 27 | </value> |
28 | </option> | 28 | </option> |
29 | </component> | 29 | </component> |
30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | 30 | <component name="ProjectLevelVcsManager" settingsEditedManually="false"> |
31 | <OptionsSetting value="true" id="Add" /> | 31 | <OptionsSetting value="true" id="Add" /> |
32 | <OptionsSetting value="true" id="Remove" /> | 32 | <OptionsSetting value="true" id="Remove" /> |
33 | <OptionsSetting value="true" id="Checkout" /> | 33 | <OptionsSetting value="true" id="Checkout" /> |
34 | <OptionsSetting value="true" id="Update" /> | 34 | <OptionsSetting value="true" id="Update" /> |
35 | <OptionsSetting value="true" id="Status" /> | 35 | <OptionsSetting value="true" id="Status" /> |
36 | <OptionsSetting value="true" id="Edit" /> | 36 | <OptionsSetting value="true" id="Edit" /> |
37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
39 | </component> | 39 | </component> |
40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | </component> | 42 | </component> |
43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
44 | <option name="id" value="Android" /> | 44 | <option name="id" value="Android" /> |
45 | </component> | 45 | </component> |
46 | </project> | 46 | </project> |
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.v7.app.AppCompatActivity; |
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.view.View; | 10 | import android.view.View; |
11 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
13 | import android.widget.TextView; | 13 | import android.widget.TextView; |
14 | 14 | ||
15 | import com.facebook.drawee.view.SimpleDraweeView; | 15 | import com.facebook.drawee.view.SimpleDraweeView; |
16 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; | 17 | import com.hjx.personalcenter.adapter.AccountChildsAdapter; |
18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 18 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
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.http.HttpCode; | 21 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 22 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
24 | import com.hjx.personalcenter.util.AlertUtils; | 24 | import com.hjx.personalcenter.util.AlertUtils; |
25 | import com.hjx.personalcenter.util.GetDevicesUtil; | 25 | import com.hjx.personalcenter.util.GetDevicesUtil; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 账户管理 熊巍 | 31 | * 账户管理 熊巍 |
32 | * Created by h on 2017/8/12. | 32 | * Created by h on 2017/8/12. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { | 35 | public class AccountManagementActivity extends AppCompatActivity implements View.OnClickListener { |
36 | private TextView changbangding, changpassword, usernames, | 36 | private TextView changbangding, changpassword, usernames, |
37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; | 37 | tv_username, tv_grade, tv_school, tv_adress, tv_changzhu; |
38 | private ImageView iv_useing, cancel; | 38 | private ImageView iv_useing, cancel; |
39 | private SimpleDraweeView mSimpleDraweeView; | 39 | private SimpleDraweeView mSimpleDraweeView; |
40 | private RecyclerView listview; | 40 | private RecyclerView listview; |
41 | private LinearLayout add_accunt, ll_zhu_backgrangd; | 41 | private LinearLayout add_accunt, ll_zhu_backgrangd; |
42 | private AccountChildsAdapter childsAdapter; | 42 | private AccountChildsAdapter childsAdapter; |
43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); | 43 | private ArrayList<ChildsInfo.DataBean> data = new ArrayList<>(); |
44 | Handler handler = new Handler() { | 44 | Handler handler = new Handler() { |
45 | @Override | 45 | @Override |
46 | public void handleMessage(Message msg) { | 46 | public void handleMessage(Message msg) { |
47 | super.handleMessage(msg); | 47 | super.handleMessage(msg); |
48 | switch (msg.what) { | 48 | switch (msg.what) { |
49 | case HttpCode.CHILDS_SUCESS: | 49 | case HttpCode.CHILDS_SUCESS: |
50 | ChildsInfo childsInfo = new ChildsInfo(); | 50 | ChildsInfo childsInfo = new ChildsInfo(); |
51 | if (childsInfo.getStatus()==1000) { | 51 | if (childsInfo.getStatus()==1000) { |
52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); | 52 | String names =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.USERNAME); |
53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); | 53 | String adress =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.ADRESS); |
54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); | 54 | String grades =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.GRADES); |
55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); | 55 | String schools =SaveParam.getInstance().getLoginParam(AccountManagementActivity.this, SaveParam.SCHOOL); |
56 | tv_username.setText(names); | 56 | tv_username.setText(names); |
57 | tv_grade.setText(grades); | 57 | tv_grade.setText(grades); |
58 | tv_school.setText(schools); | 58 | tv_school.setText(schools); |
59 | tv_adress.setText(adress); | 59 | tv_adress.setText(adress); |
60 | tv_changzhu.setText("使用中"); | 60 | tv_changzhu.setText("使用中"); |
61 | tv_changzhu.setEnabled(false); | 61 | tv_changzhu.setEnabled(false); |
62 | iv_useing.setVisibility(View.VISIBLE); | 62 | iv_useing.setVisibility(View.VISIBLE); |
63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 63 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
64 | //mSimpleDraweeView.setImageURI(phote); | 64 | //mSimpleDraweeView.setImageURI(phote); |
65 | 65 | ||
66 | } else { | 66 | } else { |
67 | String name = null; | 67 | String name = null; |
68 | String grade = null; | 68 | String grade = null; |
69 | String school = null; | 69 | String school = null; |
70 | String addr = null; | 70 | String addr = null; |
71 | String phote = null; | 71 | String phote = null; |
72 | String subAccountId = null; | 72 | String subAccountId = null; |
73 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); | 73 | List<ChildsInfo.DataBean> childList = new ArrayList<>(); |
74 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; | 74 | List<ChildsInfo.DataBean> list = (List<ChildsInfo.DataBean>) msg.obj; |
75 | for (int i = 0; i < list.size(); i++) { | 75 | for (int i = 0; i < list.size(); i++) { |
76 | int type = list.get(i).getType(); | 76 | int type = list.get(i).getType(); |
77 | if (type == 1) { | 77 | if (type == 1) { |
78 | name = list.get(i).getName(); | 78 | name = list.get(i).getName(); |
79 | grade = list.get(i).getGrade(); | 79 | grade = list.get(i).getGrade(); |
80 | school = list.get(i).getSchool(); | 80 | school = list.get(i).getSchool(); |
81 | addr = list.get(i).getRegion(); | 81 | addr = list.get(i).getRegion(); |
82 | phote = list.get(i).getImage(); | 82 | phote = list.get(i).getImage(); |
83 | subAccountId = list.get(i).getSubAccountId(); | 83 | subAccountId = list.get(i).getSubAccountId(); |
84 | } else if (type == 2) { | 84 | } else if (type == 2) { |
85 | childList.add(list.get(i)); | 85 | childList.add(list.get(i)); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | tv_username.setText(name); | 88 | tv_username.setText(name); |
89 | tv_grade.setText(grade); | 89 | tv_grade.setText(grade); |
90 | tv_school.setText(school); | 90 | tv_school.setText(school); |
91 | tv_adress.setText(addr); | 91 | tv_adress.setText(addr); |
92 | mSimpleDraweeView.setImageURI(phote); | 92 | mSimpleDraweeView.setImageURI(phote); |
93 | data.clear(); | 93 | data.clear(); |
94 | data.addAll(childList); | 94 | data.addAll(childList); |
95 | childsAdapter.notifyDataSetChanged(); | 95 | childsAdapter.notifyDataSetChanged(); |
96 | } | 96 | } |
97 | break; | 97 | break; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | }; | 100 | }; |
101 | 101 | ||
102 | @Override | 102 | @Override |
103 | protected void onCreate(Bundle savedInstanceState) { | 103 | protected void onCreate(Bundle savedInstanceState) { |
104 | super.onCreate(savedInstanceState); | 104 | super.onCreate(savedInstanceState); |
105 | setContentView(R.layout.activity_account_management); | 105 | setContentView(R.layout.activity_account_management); |
106 | SysApplication.getInstance().addActivity(this); | 106 | SysApplication.getInstance().addActivity(this); |
107 | 107 | ||
108 | initView(); | 108 | initView(); |
109 | initData(); | 109 | initData(); |
110 | initLister(); | 110 | initLister(); |
111 | } | 111 | } |
112 | 112 | ||
113 | private void initView() { | 113 | private void initView() { |
114 | changbangding = (TextView) findViewById(R.id.changBangding); | 114 | changbangding = (TextView) findViewById(R.id.changBangding); |
115 | changpassword = (TextView) findViewById(R.id.changpassword); | 115 | changpassword = (TextView) findViewById(R.id.changpassword); |
116 | usernames = (TextView) findViewById(R.id.cunt_username); | 116 | usernames = (TextView) findViewById(R.id.cunt_username); |
117 | tv_username = (TextView) findViewById(R.id.tv_account_name); | 117 | tv_username = (TextView) findViewById(R.id.tv_account_name); |
118 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); | 118 | tv_grade = (TextView) findViewById(R.id.tv_account_grade); |
119 | tv_school = (TextView) findViewById(R.id.tv_account_school); | 119 | tv_school = (TextView) findViewById(R.id.tv_account_school); |
120 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); | 120 | tv_adress = (TextView) findViewById(R.id.tv_account_adress); |
121 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); | 121 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.tv_account_head); |
122 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); | 122 | iv_useing = (ImageView) findViewById(R.id.iv_shiyongzhong); |
123 | cancel = (ImageView) findViewById(R.id.cancel); | 123 | cancel = (ImageView) findViewById(R.id.cancel); |
124 | add_accunt = (LinearLayout) findViewById(R.id.add_account); | ||
125 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); | 124 | ll_zhu_backgrangd = (LinearLayout) findViewById(R.id.ll_zhu_backgrangd); |
126 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); | 125 | tv_changzhu = (TextView) findViewById(R.id.change_zhu_account); |
127 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 126 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
128 | } | 127 | } |
129 | 128 | ||
130 | private void initData() { | 129 | private void initData() { |
131 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 130 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
132 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); | 131 | String account = SaveParam.getInstance().getCustomizeParam(this, SaveParam.ACCOUNT); |
133 | usernames.setText(cunt_username); | 132 | usernames.setText(cunt_username); |
134 | 133 | ||
135 | if (account.equals("1")) { | 134 | if (account.equals("1")) { |
136 | tv_changzhu.setText("使用中"); | 135 | tv_changzhu.setText("使用中"); |
137 | tv_changzhu.setEnabled(false); | 136 | tv_changzhu.setEnabled(false); |
138 | iv_useing.setVisibility(View.VISIBLE); | 137 | iv_useing.setVisibility(View.VISIBLE); |
139 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 138 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
140 | } else { | 139 | } else { |
141 | 140 | ||
142 | tv_changzhu.setText("切换主账户"); | 141 | tv_changzhu.setText("切换主账户"); |
143 | tv_changzhu.setEnabled(true); | 142 | tv_changzhu.setEnabled(true); |
144 | iv_useing.setVisibility(View.GONE); | 143 | iv_useing.setVisibility(View.GONE); |
145 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 144 | ll_zhu_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
146 | } | 145 | } |
147 | 146 | ||
148 | 147 | ||
149 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 148 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
150 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 149 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
151 | listview.setLayoutManager(linearLayoutManager); | 150 | listview.setLayoutManager(linearLayoutManager); |
152 | childsAdapter = new AccountChildsAdapter(data, this); | 151 | childsAdapter = new AccountChildsAdapter(data, this); |
153 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); | 152 | listview.addItemDecoration(new RecyclerViewSpaceItem(10)); |
154 | listview.setAdapter(childsAdapter); | 153 | listview.setAdapter(childsAdapter); |
155 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { | 154 | childsAdapter.setOnItemClickListener(new AccountChildsAdapter.OnItemClickListener() { |
156 | @Override | 155 | @Override |
157 | public void onItemClick(View view, int position) { | 156 | public void onItemClick(View view, int position) { |
158 | 157 | ||
159 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); | 158 | AlertUtils.showToast(AccountManagementActivity.this, "你点击了" + data.get(position)); |
160 | } | 159 | } |
161 | }); | 160 | }); |
162 | 161 | ||
163 | } | 162 | } |
164 | 163 | ||
165 | 164 | ||
166 | private void initLister() { | 165 | private void initLister() { |
167 | changbangding.setOnClickListener(this); | 166 | changbangding.setOnClickListener(this); |
168 | changpassword.setOnClickListener(this); | 167 | changpassword.setOnClickListener(this); |
169 | cancel.setOnClickListener(this); | 168 | cancel.setOnClickListener(this); |
170 | add_accunt.setOnClickListener(this); | ||
171 | tv_changzhu.setOnClickListener(this); | 169 | tv_changzhu.setOnClickListener(this); |
172 | 170 | ||
173 | 171 | ||
174 | } | 172 | } |
175 | 173 | ||
176 | @Override | 174 | @Override |
177 | public void onClick(View v) { | 175 | public void onClick(View v) { |
178 | switch (v.getId()) { | 176 | switch (v.getId()) { |
179 | case R.id.changBangding: | 177 | case R.id.changBangding: |
180 | Content.authcodeflag = 1; | 178 | Content.authcodeflag = 1; |
181 | Intent changebangding = new Intent(); | 179 | Intent changebangding = new Intent(); |
182 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); | 180 | changebangding.setClass(AccountManagementActivity.this, ElectronicCardValidationActivity.class); |
183 | startActivity(changebangding); | 181 | startActivity(changebangding); |
184 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 182 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
185 | break; | 183 | break; |
186 | case R.id.changpassword: | 184 | case R.id.changpassword: |
187 | Intent changpwd = new Intent(); | 185 | Intent changpwd = new Intent(); |
188 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); | 186 | changpwd.setClass(AccountManagementActivity.this, ChangePasswordActivity.class); |
189 | startActivity(changpwd); | 187 | startActivity(changpwd); |
190 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 188 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
191 | break; | 189 | break; |
192 | case R.id.add_account: | ||
193 | Content.accountflag =2; | ||
194 | Intent account = new Intent(); | ||
195 | account.setClass(AccountManagementActivity.this, RegisterInfoActivity.class); | ||
196 | startActivity(account); | ||
197 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
198 | |||
199 | break; | ||
200 | case R.id.change_zhu_account: | 190 | case R.id.change_zhu_account: |
201 | Content.changgeaccountflag = 1; | 191 | Content.changgeaccountflag = 1; |
202 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 192 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
203 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); | 193 | SaveParam.getInstance().saveCustomizeParam(this, SaveParam.ACCOUNT, "1"); |
204 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 194 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
205 | try { | 195 | try { |
206 | long auserID = Long.parseLong(userID); | 196 | long auserID = Long.parseLong(userID); |
207 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, | 197 | HttpManager.getInstance().Accountinfo(AccountManagementActivity.this, auserID, |
208 | devicenumber, 1); | 198 | devicenumber, 1); |
209 | 199 | ||
210 | } catch (NumberFormatException e) { | 200 | } catch (NumberFormatException e) { |
211 | e.printStackTrace(); | 201 | e.printStackTrace(); |
212 | } | 202 | } |
213 | 203 | ||
214 | 204 | ||
215 | break; | 205 | break; |
216 | case R.id.cancel: | 206 | case R.id.cancel: |
217 | finish(); | 207 | finish(); |
218 | break; | 208 | break; |
219 | 209 | ||
220 | } | 210 | } |
221 | 211 | ||
222 | } | 212 | } |
223 | 213 | ||
224 | @Override | 214 | @Override |
225 | protected void onResume() { | 215 | protected void onResume() { |
226 | super.onResume(); | 216 | super.onResume(); |
227 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 217 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
228 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 218 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
229 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); | 219 | String cunt_username = SaveParam.getInstance().getLoginParam(this, "username"); |
230 | usernames.setText(cunt_username); | 220 | usernames.setText(cunt_username); |
231 | try { | 221 | try { |
232 | long auserID = Long.parseLong(userID); | 222 | long auserID = Long.parseLong(userID); |
233 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); | 223 | HttpManager.getInstance().getchildAccountinfo(this, auserID, devicenumber, handler); |
234 | 224 | ||
235 | } catch (NumberFormatException e) { | 225 | } catch (NumberFormatException e) { |
236 | e.printStackTrace(); | 226 | e.printStackTrace(); |
237 | } | 227 | } |
238 | } | 228 | } |
239 | } | 229 | } |
240 | 230 |
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.view.ViewPager; | 5 | import android.support.v4.view.ViewPager; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
7 | import android.view.View; | ||
8 | import android.widget.ImageView; | ||
9 | import android.widget.TextView; | ||
10 | 7 | ||
11 | import com.hjx.personalcenter.R; | 8 | import com.hjx.personalcenter.R; |
12 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 9 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; |
13 | import com.hjx.personalcenter.fragment.PresonInfoFragment; | 10 | import com.hjx.personalcenter.fragment.PresonInfoFragment; |
14 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; | 11 | import com.hjx.personalcenter.fragment.VersionsInfoFragment; |
15 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | ||
16 | 12 | ||
17 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
18 | import java.util.Arrays; | 14 | import java.util.Arrays; |
19 | import java.util.List; | 15 | import java.util.List; |
20 | 16 | ||
21 | /** | 17 | /** |
22 | * Created by h on 2017/8/12. | 18 | * Created by h on 2017/8/12. |
23 | */ | 19 | */ |
24 | 20 | ||
25 | public class ChangePresonalInfoActivity extends AppCompatActivity { | 21 | public class ChangePresonalInfoActivity extends AppCompatActivity { |
26 | private ViewPager viewPager; | 22 | private ViewPager viewPager; |
27 | private SlidingTabLayout tableLayout; | 23 | // private SlidingTabLayout tableLayout; |
28 | private TextView subsave; | ||
29 | private ImageView cancel; | ||
30 | private List<Fragment> presoninfo; | 24 | private List<Fragment> presoninfo; |
31 | private LoginAndRegisterAdapter presoninfodapter; | 25 | private LoginAndRegisterAdapter presoninfodapter; |
26 | public interface Fragment2Fragment{ | ||
27 | public void gotoFragment(ViewPager viewPager); | ||
28 | } | ||
29 | private Fragment2Fragment fragment2Fragment; | ||
30 | public void setFragment2Fragment(Fragment2Fragment fragment2Fragment){ | ||
31 | this.fragment2Fragment = fragment2Fragment; | ||
32 | } | ||
33 | public void forSkip(){ | ||
34 | if(fragment2Fragment!=null){ | ||
35 | fragment2Fragment.gotoFragment(viewPager); | ||
36 | } | ||
37 | } | ||
32 | private List<String> title = Arrays.asList("个人信息", "版本信息"); | 38 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
33 | @Override | 39 | @Override |
34 | protected void onCreate(Bundle savedInstanceState) { | 40 | protected void onCreate(Bundle savedInstanceState) { |
35 | super.onCreate(savedInstanceState); | 41 | super.onCreate(savedInstanceState); |
36 | setContentView(R.layout.activity_change_preson_info); | 42 | setContentView(R.layout.activity_change_preson_info); |
37 | SysApplication.getInstance().addActivity(this); | 43 | SysApplication.getInstance().addActivity(this); |
38 | initView(); | 44 | initView(); |
39 | initData(); | 45 | initData(); |
40 | 46 | ||
41 | } | 47 | } |
42 | private void initView() { | 48 | private void initView() { |
43 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); | 49 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
44 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); | 50 | //tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
45 | } | 51 | } |
46 | 52 | ||
47 | private void initData() { | 53 | private void initData() { |
48 | presoninfo = new ArrayList<>(); | 54 | presoninfo = new ArrayList<>(); |
49 | for (int i = 0; i < title.size(); i++) { | 55 | for (int i = 0; i < title.size(); i++) { |
50 | if (title.get(i).equals("个人信息")) { | 56 | if (title.get(i).equals("个人信息")) { |
51 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); | 57 | presoninfo.add(PresonInfoFragment.newInstance(i + 1)); |
52 | } else { | 58 | } else { |
53 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); | 59 | presoninfo.add(VersionsInfoFragment.newInstance(i + 1)); |
54 | } | 60 | } |
55 | } | 61 | } |
56 | 62 | ||
57 | 63 | ||
58 | //设置Tab上的标题 | 64 | //设置Tab上的标题 |
59 | tableLayout.setData(title); | 65 | //tableLayout.setData(title); |
60 | //设置关联的ViewPager | 66 | //设置关联的ViewPager |
61 | tableLayout.setViewPager(viewPager, 0); | 67 | //tableLayout.setViewPager(viewPager, 0); |
62 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); | 68 | presoninfodapter = new LoginAndRegisterAdapter(presoninfo, getSupportFragmentManager()); |
63 | //给ViewPager设置适配器 | 69 | //给ViewPager设置适配器 |
64 | viewPager.setAdapter(presoninfodapter); | 70 | viewPager.setAdapter(presoninfodapter); |
65 | //设置滑动时数据不丢失 | 71 | //设置滑动时数据不丢失 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.util.Log; | 8 | import android.util.Log; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.AdapterView; | 10 | import android.widget.AdapterView; |
11 | import android.widget.Button; | 11 | import android.widget.Button; |
12 | import android.widget.GridView; | 12 | import android.widget.GridView; |
13 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
16 | 16 | ||
17 | import com.facebook.drawee.view.SimpleDraweeView; | 17 | import com.facebook.drawee.view.SimpleDraweeView; |
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.adapter.GridAdapter; | 19 | import com.hjx.personalcenter.adapter.GridAdapter; |
20 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 20 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
21 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 21 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
22 | import com.hjx.personalcenter.db.SaveParam; | 22 | import com.hjx.personalcenter.db.SaveParam; |
23 | import com.hjx.personalcenter.http.HttpCode; | 23 | import com.hjx.personalcenter.http.HttpCode; |
24 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
26 | import com.hjx.personalcenter.model.DefautPublishInfo; | 26 | import com.hjx.personalcenter.model.DefautPublishInfo; |
27 | import com.hjx.personalcenter.model.VersionInfo; | 27 | import com.hjx.personalcenter.model.VersionInfo; |
28 | import com.hjx.personalcenter.util.AlertUtils; | 28 | import com.hjx.personalcenter.util.AlertUtils; |
29 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
29 | 30 | ||
30 | import org.json.JSONException; | 31 | import org.json.JSONException; |
31 | import org.json.JSONObject; | 32 | import org.json.JSONObject; |
32 | 33 | ||
33 | import java.util.ArrayList; | 34 | import java.util.ArrayList; |
34 | import java.util.List; | 35 | import java.util.List; |
35 | 36 | ||
36 | /** | 37 | /** |
37 | * 选择教材 | 38 | * 选择教材 |
38 | * Created by h on 2017/8/10. | 39 | * Created by h on 2017/8/10. |
39 | */ | 40 | */ |
40 | 41 | ||
41 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { | 42 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener, DialogCallBack.VersionCallBack { |
42 | private GridView gridView; | 43 | private GridView gridView; |
43 | private Button btn_ok; | 44 | private Button btn_ok; |
44 | private ImageView cancel; | 45 | private ImageView cancel; |
45 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 46 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
46 | private GridAdapter sim_adapter; | 47 | private GridAdapter sim_adapter; |
47 | private SimpleDraweeView simpleDraweeView; | 48 | private SimpleDraweeView simpleDraweeView; |
48 | private TextView publish; | 49 | private TextView publish; |
49 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | 50 | private String chinese, math, english, physics, chemistry, history, geography, political, biology, science; |
50 | 51 | ||
51 | 52 | ||
52 | Handler handler = new Handler() { | 53 | Handler handler = new Handler() { |
53 | @Override | 54 | @Override |
54 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
55 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
56 | JSONObject jsonObject; | 57 | JSONObject jsonObject; |
57 | String status; | 58 | String status; |
58 | switch (msg.what) { | 59 | switch (msg.what) { |
59 | case HttpCode.CHECKCARD: | 60 | case HttpCode.CHECKCARD: |
60 | try { | 61 | try { |
61 | jsonObject = new JSONObject((String) msg.obj); | 62 | jsonObject = new JSONObject((String) msg.obj); |
62 | status = jsonObject.optString("status"); | 63 | status = jsonObject.optString("status"); |
63 | if (status.equals("1")) { | 64 | if (status.equals("1")) { |
64 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); | 65 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您已经填写了保卡信息,请到主界面确认您的保卡信息是否正确!"); |
65 | Intent intent = new Intent(); | 66 | Intent intent = new Intent(); |
66 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); | 67 | intent.setClass(ChoiseTextBookActivity.this, TheStartPageActivity.class); |
67 | ChoiseTextBookActivity.this.startActivity(intent); | 68 | ChoiseTextBookActivity.this.startActivity(intent); |
68 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 69 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
69 | } else if (status.equals("2001")) { | 70 | } else if (status.equals("2001")) { |
70 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); | 71 | ElectronicCardDialog.getInstance().show(getSupportFragmentManager(), "ElectronicCardDialog"); |
71 | } | 72 | } |
72 | 73 | ||
73 | } catch (JSONException e) { | 74 | } catch (JSONException e) { |
74 | e.printStackTrace(); | 75 | e.printStackTrace(); |
75 | } | 76 | } |
76 | 77 | ||
77 | break; | 78 | break; |
78 | case HttpCode.PUBLISH_SUCESS: | 79 | case HttpCode.PUBLISH_SUCESS: |
79 | defautPublishInfos.clear(); | 80 | defautPublishInfos.clear(); |
80 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 81 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
81 | sim_adapter.notifyDataSetChanged(); | 82 | sim_adapter.notifyDataSetChanged(); |
82 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 83 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
83 | String subject = defautPublishInfos.get(i).getSubject(); | 84 | String subject = defautPublishInfos.get(i).getSubject(); |
84 | if (subject.equals("语文")) { | 85 | if (subject.equals("语文")) { |
85 | chinese = defautPublishInfos.get(i).getPress(); | 86 | chinese = defautPublishInfos.get(i).getPress(); |
86 | } else if (subject.equals("数学")) { | 87 | } else if (subject.equals("数学")) { |
87 | math = defautPublishInfos.get(i).getPress(); | 88 | math = defautPublishInfos.get(i).getPress(); |
88 | } else if (subject.equals("英语")) { | 89 | } else if (subject.equals("英语")) { |
89 | english = defautPublishInfos.get(i).getPress(); | 90 | english = defautPublishInfos.get(i).getPress(); |
90 | } else if (subject.equals("物理")) { | 91 | } else if (subject.equals("物理")) { |
91 | physics = defautPublishInfos.get(i).getPress(); | 92 | physics = defautPublishInfos.get(i).getPress(); |
92 | } else if (subject.equals("化学")) { | 93 | } else if (subject.equals("化学")) { |
93 | chemistry = defautPublishInfos.get(i).getPress(); | 94 | chemistry = defautPublishInfos.get(i).getPress(); |
94 | } else if (subject.equals("历史")) { | 95 | } else if (subject.equals("历史")) { |
95 | history = defautPublishInfos.get(i).getPress(); | 96 | history = defautPublishInfos.get(i).getPress(); |
96 | } else if (subject.equals("地理")) { | 97 | } else if (subject.equals("地理")) { |
97 | geography = defautPublishInfos.get(i).getPress(); | 98 | geography = defautPublishInfos.get(i).getPress(); |
98 | } else if (subject.equals("政治")) { | 99 | } else if (subject.equals("政治")) { |
99 | political = defautPublishInfos.get(i).getPress(); | 100 | political = defautPublishInfos.get(i).getPress(); |
100 | }else if (subject.equals("生物")) { | 101 | } else if (subject.equals("生物")) { |
101 | biology = defautPublishInfos.get(i).getPress(); | 102 | biology = defautPublishInfos.get(i).getPress(); |
102 | }else if (subject.equals("科学")) { | 103 | } else if (subject.equals("科学")) { |
103 | science = defautPublishInfos.get(i).getPress(); | 104 | science = defautPublishInfos.get(i).getPress(); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | break; | 107 | break; |
107 | case HttpCode.REGISTERINFO_SUCESS: | 108 | case HttpCode.REGISTERINFO_SUCESS: |
108 | try { | 109 | try { |
109 | jsonObject = new JSONObject((String) msg.obj); | 110 | jsonObject = new JSONObject((String) msg.obj); |
110 | String statusregister = jsonObject.optString("status"); | 111 | String statusregister = jsonObject.optString("status"); |
111 | if (statusregister.equals("1")) { | 112 | if (statusregister.equals("1")) { |
112 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); | 113 | Toast.makeText(ChoiseTextBookActivity.this, "注册信息上传成功", Toast.LENGTH_LONG).show(); |
113 | String userID = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, "userId"); | 114 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ChoiseTextBookActivity.this).getDeviceNumber(); |
114 | try { | 115 | if (deviceNumber == null) { |
115 | if (userID == null) { | 116 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
116 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 117 | |
117 | 118 | } else { | |
118 | } else { | 119 | //验证保卡信息 |
119 | long auserID = Long.parseLong(userID); | 120 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, deviceNumber, handler); |
120 | //验证保卡信息 | ||
121 | HttpManager.getInstance().cardinfocheck(ChoiseTextBookActivity.this, auserID, handler); | ||
122 | } | ||
123 | |||
124 | } catch (NumberFormatException e) { | ||
125 | e.printStackTrace(); | ||
126 | } | 121 | } |
127 | 122 | ||
128 | } else { | 123 | } else { |
129 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); | 124 | AlertUtils.showToast(ChoiseTextBookActivity.this, "您好,服务器异常,请稍后重试"); |
130 | } | 125 | } |
131 | } catch (JSONException e) { | 126 | } catch (JSONException e) { |
132 | e.printStackTrace(); | 127 | e.printStackTrace(); |
133 | } | 128 | } |
134 | 129 | ||
135 | 130 | ||
136 | break; | 131 | break; |
137 | 132 | ||
138 | } | 133 | } |
139 | 134 | ||
140 | } | 135 | } |
141 | }; | 136 | }; |
142 | 137 | ||
143 | @Override | 138 | @Override |
144 | protected void onCreate(Bundle savedInstanceState) { | 139 | protected void onCreate(Bundle savedInstanceState) { |
145 | super.onCreate(savedInstanceState); | 140 | super.onCreate(savedInstanceState); |
146 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 141 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
147 | String graderid = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); | 142 | String graderid = SaveParam.getInstance().getCustomizeParam(this, SaveParam.GRADENS); |
143 | String accounts = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this,SaveParam.ACCOUNT); | ||
148 | try { | 144 | try { |
149 | long auserID = Long.parseLong(userID); | 145 | long auserID = Long.parseLong(userID); |
150 | int graderID = Integer.parseInt(graderid); | 146 | int graderID = Integer.parseInt(graderid); |
147 | int accountss = Integer.parseInt(accounts); | ||
151 | //获取版本信息 | 148 | //获取版本信息 |
152 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID, handler); | 149 | HttpManager.getInstance().getpublishinfo(this, auserID, graderID,accountss, handler); |
153 | 150 | ||
154 | } catch (NumberFormatException e) { | 151 | } catch (NumberFormatException e) { |
155 | e.printStackTrace(); | 152 | e.printStackTrace(); |
156 | } | 153 | } |
157 | setContentView(R.layout.activity_choisetextbook); | 154 | setContentView(R.layout.activity_choisetextbook); |
158 | SysApplication.getInstance().addActivity(this); | 155 | SysApplication.getInstance().addActivity(this); |
159 | initView(); | 156 | initView(); |
160 | initData(); | 157 | initData(); |
161 | initLister(); | 158 | initLister(); |
162 | } | 159 | } |
163 | 160 | ||
164 | private void initView() { | 161 | private void initView() { |
165 | gridView = (GridView) findViewById(R.id.grideview); | 162 | gridView = (GridView) findViewById(R.id.grideview); |
166 | cancel = (ImageView) findViewById(R.id.cancel); | 163 | cancel = (ImageView) findViewById(R.id.cancel); |
167 | btn_ok = (Button) findViewById(R.id.btn_ok); | 164 | btn_ok = (Button) findViewById(R.id.btn_ok); |
168 | } | 165 | } |
169 | 166 | ||
170 | private void initData() { | 167 | private void initData() { |
171 | sim_adapter = new GridAdapter(defautPublishInfos, this); | 168 | sim_adapter = new GridAdapter(defautPublishInfos, this); |
172 | //配置适配器 | 169 | //配置适配器 |
173 | gridView.setAdapter(sim_adapter); | 170 | gridView.setAdapter(sim_adapter); |
174 | 171 | ||
175 | } | 172 | } |
176 | 173 | ||
177 | private void initLister() { | 174 | private void initLister() { |
178 | btn_ok.setOnClickListener(this); | 175 | btn_ok.setOnClickListener(this); |
179 | cancel.setOnClickListener(this); | 176 | cancel.setOnClickListener(this); |
180 | gridView.setOnItemClickListener(this); | 177 | gridView.setOnItemClickListener(this); |
181 | 178 | ||
182 | } | 179 | } |
183 | 180 | ||
184 | @Override | 181 | @Override |
185 | public void onClick(View v) { | 182 | public void onClick(View v) { |
186 | switch (v.getId()) { | 183 | switch (v.getId()) { |
187 | case R.id.btn_ok: | 184 | case R.id.btn_ok: |
188 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 185 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); |
189 | String regionId = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); | 186 | String regionId = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.COUNTRY); |
190 | String regionId1 = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CITYS); | 187 | String regionId1 = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.CITYS); |
191 | if (regionId == null) { | 188 | if (regionId == null) { |
192 | regionId = regionId1; | 189 | regionId = regionId1; |
193 | } | 190 | } |
194 | String grade = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this, SaveParam.GRADENS); | 191 | String grade = SaveParam.getInstance().getCustomizeParam(ChoiseTextBookActivity.this, SaveParam.GRADENS); |
195 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); | 192 | String schoolid = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.SCHOOOlID); |
196 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); | 193 | String name = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.USERNAME); |
197 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); | 194 | String regeionname = SaveParam.getInstance().getLoginParam(ChoiseTextBookActivity.this, SaveParam.ADRESS); |
198 | 195 | ||
199 | try { | 196 | try { |
200 | if (userID == null) { | 197 | if (userID == null) { |
201 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); | 198 | AlertUtils.showToast(ChoiseTextBookActivity.this, "连接超时请重新登录!"); |
202 | 199 | ||
203 | } else { | 200 | } else { |
204 | Object schoolID; | 201 | Object schoolID; |
205 | long auserID = Long.parseLong(userID); | 202 | long auserID = Long.parseLong(userID); |
206 | int gradeID = Integer.parseInt(grade); | 203 | int gradeID = Integer.parseInt(grade); |
207 | long regionID = Long.parseLong(regionId); | 204 | long regionID = Long.parseLong(regionId); |
208 | if (schoolid == null) { | 205 | if (schoolid == null) { |
209 | schoolID = null; | 206 | schoolID = null; |
210 | } else { | 207 | } else { |
211 | schoolID = Long.parseLong(schoolid); | 208 | schoolID = Long.parseLong(schoolid); |
212 | } | 209 | } |
213 | 210 | ||
214 | //提交注册信息 | 211 | //提交注册信息 |
215 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, | 212 | HttpManager.getInstance().subregisterinfo(ChoiseTextBookActivity.this, auserID, |
216 | name, gradeID, regionID, regeionname, schoolID, math,english, chinese,physics,chemistry,history,geography,political,biology,science, handler); | 213 | name, gradeID, regionID, regeionname, schoolID, math, english, chinese, physics, chemistry, history, geography, political, biology, science, handler); |
217 | } | 214 | } |
218 | 215 | ||
219 | } catch (NumberFormatException e) { | 216 | } catch (NumberFormatException e) { |
220 | e.printStackTrace(); | 217 | e.printStackTrace(); |
221 | } | 218 | } |
222 | 219 | ||
223 | break; | 220 | break; |
224 | case R.id.cancel: | 221 | case R.id.cancel: |
225 | finish(); | 222 | finish(); |
226 | break; | 223 | break; |
227 | } | 224 | } |
228 | 225 | ||
229 | } | 226 | } |
230 | 227 | ||
231 | @Override | 228 | @Override |
232 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 229 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
233 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 230 | SaveParam.getInstance().saveLoginParam(this, SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
234 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); | 231 | VerSionDialog.getInstance(this).show(getSupportFragmentManager(), "VerSionDialog"); |
235 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 232 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
236 | publish = (TextView) view.findViewById(R.id.tv_publish); | 233 | publish = (TextView) view.findViewById(R.id.tv_publish); |
237 | 234 | ||
238 | } | 235 | } |
239 | 236 | ||
240 | @Override | 237 | @Override |
241 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 238 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
242 | String imageurl = data.get(position).getPressCover(); | 239 | String imageurl = data.get(position).getPressCover(); |
243 | String publishs = data.get(position).getPressName(); | 240 | String publishs = data.get(position).getPressName(); |
244 | simpleDraweeView.setImageURI(imageurl); | 241 | simpleDraweeView.setImageURI(imageurl); |
245 | publish.setText(publishs); | 242 | publish.setText(publishs); |
246 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); | 243 | String subject = SaveParam.getInstance().getLoginParam(this, SaveParam.SUBJECT); |
247 | Log.e("test", "选择的科目" + subject); | 244 | Log.e("test", "选择的科目" + subject); |
248 | if ("语文".equals(subject)) { | 245 | if ("语文".equals(subject)) { |
249 | chinese = publishs; | 246 | chinese = publishs; |
250 | } else if ("数学".equals(subject)) { | 247 | } else if ("数学".equals(subject)) { |
251 | math = publishs; | 248 | math = publishs; |
252 | }else if ("英语".equals(subject)) { | 249 | } else if ("英语".equals(subject)) { |
253 | english = publishs; | 250 | english = publishs; |
254 | }else if ("物理".equals(subject)) { | 251 | } else if ("物理".equals(subject)) { |
255 | physics = publishs; | 252 | physics = publishs; |
256 | }else if ("化学".equals(subject)) { | 253 | } else if ("化学".equals(subject)) { |
257 | chemistry = publishs; | 254 | chemistry = publishs; |
258 | }else if ("历史".equals(subject)) { | 255 | } else if ("历史".equals(subject)) { |
259 | history = publishs; | 256 | history = publishs; |
260 | }else if ("地理".equals(subject)) { | 257 | } else if ("地理".equals(subject)) { |
261 | geography = publishs; | 258 | geography = publishs; |
262 | }else if ("政治".equals(subject)) { | 259 | } else if ("政治".equals(subject)) { |
263 | political = publishs; | 260 | political = publishs; |
264 | }else if ("生物".equals(subject)) { | 261 | } else if ("生物".equals(subject)) { |
265 | biology = publishs; | 262 | biology = publishs; |
266 | }else if ("科学".equals(subject)) { | 263 | } else if ("科学".equals(subject)) { |
267 | science = publishs; | 264 | science = publishs; |
268 | } | 265 | } |
269 | 266 |
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.content.Intent; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
5 | import android.support.v7.app.AppCompatActivity; | 4 | import android.support.v7.app.AppCompatActivity; |
6 | import android.view.View; | 5 | import android.view.View; |
7 | import android.widget.Button; | 6 | import android.widget.Button; |
8 | import android.widget.ImageView; | 7 | import android.widget.ImageView; |
9 | import android.widget.TextView; | 8 | import android.widget.TextView; |
10 | 9 | ||
11 | import com.hjx.personalcenter.R; | 10 | import com.hjx.personalcenter.R; |
11 | import com.hjx.personalcenter.db.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 AppCompatActivity 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"); | ||
73 | long auserID = 0; | ||
72 | switch (v.getId()){ | 74 | switch (v.getId()){ |
73 | case R.id.btn_finish: | 75 | case R.id.btn_finish: |
74 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 76 | Content.cardintentflag =1; |
75 | long auserID = 0; | ||
76 | try { | 77 | try { |
77 | auserID = Long.parseLong(userID); | 78 | auserID = Long.parseLong(userID); |
78 | } catch (NumberFormatException e) { | 79 | } catch (NumberFormatException e) { |
79 | e.printStackTrace(); | 80 | e.printStackTrace(); |
80 | } | 81 | } |
81 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | 82 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), |
82 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | 83 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), |
83 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | 84 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), |
84 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | 85 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), |
85 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | 86 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); |
86 | break; | 87 | break; |
87 | case R.id.btn_bangding: | 88 | case R.id.btn_bangding: |
88 | Intent intent = new Intent(); | 89 | Content.cardintentflag =2; |
89 | intent.setClass(ElectronicCardInfoOKActivity.this, BangDingCode.class); | 90 | try { |
90 | startActivity(intent); | 91 | auserID = Long.parseLong(userID); |
91 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 92 | } catch (NumberFormatException e) { |
93 | e.printStackTrace(); | ||
94 | } | ||
95 | HttpManager.getInstance().subcardinfo(this,auserID,usename.getText().toString().trim(), | ||
96 | customer_address.getText().toString().trim(),shopadress.getText().toString().trim(), | ||
97 | shoptime.getText().toString().trim(),tlePhone.getText().toString().trim(), | ||
98 | deviceModel.getText().toString().trim(),deviceNumber.getText().toString().trim(), | ||
99 | mac_adress.getText().toString().trim(),phone.getText().toString().trim()); | ||
92 | 100 | ||
93 | break; | 101 | break; |
94 | case R.id.cancel: | 102 | case R.id.cancel: |
95 | finish(); | 103 | finish(); |
96 | break; | 104 | break; |
97 | } | 105 | } |
98 | } | 106 | } |
99 | 107 | ||
100 | 108 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardLookInfoActivity.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.content.Intent; | 3 | import android.content.Intent; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.os.Handler; | 5 | import android.os.Handler; |
6 | import android.os.Message; | 6 | import android.os.Message; |
7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
8 | import android.view.View; | 8 | import android.view.View; |
9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
10 | import android.widget.TextView; | 10 | import android.widget.TextView; |
11 | 11 | ||
12 | import com.hjx.personalcenter.R; | 12 | import com.hjx.personalcenter.R; |
13 | import com.hjx.personalcenter.db.Content; | 13 | import com.hjx.personalcenter.db.Content; |
14 | import com.hjx.personalcenter.db.SaveParam; | ||
15 | import com.hjx.personalcenter.http.HttpCode; | 14 | import com.hjx.personalcenter.http.HttpCode; |
16 | import com.hjx.personalcenter.http.HttpManager; | 15 | import com.hjx.personalcenter.http.HttpManager; |
17 | import com.hjx.personalcenter.model.CardInfo; | 16 | import com.hjx.personalcenter.model.CardInfo; |
18 | import com.hjx.personalcenter.util.AlertUtils; | 17 | import com.hjx.personalcenter.util.AlertUtils; |
18 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
19 | 19 | ||
20 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Created by h on 2017/8/11. | 23 | * Created by h on 2017/8/11. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener { | 26 | public class ElectronicCardLookInfoActivity extends AppCompatActivity implements View.OnClickListener { |
27 | private ImageView iv_last_step; | 27 | private ImageView iv_last_step; |
28 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, | 28 | private TextView usename, deviceModel, customer_address, mac_adress, shoptime, deviceNumber, |
29 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change; | 29 | shopadress, phone, tlePhone, tv_card_adress_change, tv_card_phone_change; |
30 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); | 30 | private ArrayList<CardInfo.DataBean> data = new ArrayList<>(); |
31 | 31 | ||
32 | Handler handler = new Handler() { | 32 | Handler handler = new Handler() { |
33 | @Override | 33 | @Override |
34 | public void handleMessage(Message msg) { | 34 | public void handleMessage(Message msg) { |
35 | super.handleMessage(msg); | 35 | super.handleMessage(msg); |
36 | switch (msg.what) { | 36 | switch (msg.what) { |
37 | 37 | ||
38 | case HttpCode.SUCHCARDINFO: | 38 | case HttpCode.SUCHCARDINFO: |
39 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; | 39 | CardInfo.DataBean cardinfoBean = (CardInfo.DataBean) msg.obj; |
40 | if (cardinfoBean != null) { | 40 | if (cardinfoBean != null) { |
41 | //获取设备信息 | 41 | //获取设备信息 |
42 | deviceModel.setText(cardinfoBean.getProductModel()); | 42 | deviceModel.setText(cardinfoBean.getProductModel()); |
43 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); | 43 | deviceNumber.setText(cardinfoBean.getDeviceNumber()); |
44 | mac_adress.setText(cardinfoBean.getMacAddress()); | 44 | mac_adress.setText(cardinfoBean.getMacAddress()); |
45 | //获取保卡信息 | 45 | //获取保卡信息 |
46 | usename.setText(cardinfoBean.getCustomerName()); | 46 | usename.setText(cardinfoBean.getCustomerName()); |
47 | customer_address.setText(cardinfoBean.getCustomerAddress()); | 47 | customer_address.setText(cardinfoBean.getCustomerAddress()); |
48 | shoptime.setText(cardinfoBean.getBuyTime()); | 48 | shoptime.setText(cardinfoBean.getBuyTime()); |
49 | shopadress.setText(cardinfoBean.getBuyAddress()); | 49 | shopadress.setText(cardinfoBean.getBuyAddress()); |
50 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); | 50 | tlePhone.setText(cardinfoBean.getAlterSaleCall()); |
51 | phone.setText(cardinfoBean.getMobilePhone()); | 51 | phone.setText(cardinfoBean.getMobilePhone()); |
52 | }else { | 52 | }else { |
53 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); | 53 | AlertUtils.showToast(ElectronicCardLookInfoActivity.this,"您的机器还没有保卡信息,请重新登录"); |
54 | } | 54 | } |
55 | 55 | ||
56 | break; | 56 | break; |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | } | 60 | } |
61 | }; | 61 | }; |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | protected void onCreate(Bundle savedInstanceState) { | 64 | protected void onCreate(Bundle savedInstanceState) { |
65 | super.onCreate(savedInstanceState); | 65 | super.onCreate(savedInstanceState); |
66 | setContentView(R.layout.activity_electronic_look_cardinfo); | 66 | setContentView(R.layout.activity_electronic_look_cardinfo); |
67 | SysApplication.getInstance().addActivity(this); | 67 | SysApplication.getInstance().addActivity(this); |
68 | initView(); | 68 | initView(); |
69 | initData(); | 69 | initData(); |
70 | initLister(); | 70 | initLister(); |
71 | } | 71 | } |
72 | 72 | ||
73 | @Override | 73 | @Override |
74 | protected void onResume() { | 74 | protected void onResume() { |
75 | super.onResume(); | 75 | super.onResume(); |
76 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | 76 | String deviceNumber = GetDevicesUtil.getDevicesInfo(ElectronicCardLookInfoActivity.this).getDeviceNumber(); |
77 | try { | 77 | HttpManager.getInstance().getcardinfo(this, deviceNumber, handler); |
78 | Long a = Long.parseLong(userID); | ||
79 | HttpManager.getInstance().getcardinfo(this, a, handler); | ||
80 | } catch (NumberFormatException e) { | ||
81 | e.printStackTrace(); | ||
82 | } | ||
83 | } | 78 | } |
84 | 79 | ||
85 | private void initView() { | 80 | private void initView() { |
86 | usename = (TextView) findViewById(R.id.iv_card_username); | 81 | usename = (TextView) findViewById(R.id.iv_card_username); |
87 | iv_last_step = (ImageView) findViewById(R.id.cancel); | 82 | iv_last_step = (ImageView) findViewById(R.id.cancel); |
88 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); | 83 | deviceModel = (TextView) findViewById(R.id.tv_card_deviceModel); |
89 | customer_address = (TextView) findViewById(R.id.tv_card_adress); | 84 | customer_address = (TextView) findViewById(R.id.tv_card_adress); |
90 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); | 85 | mac_adress = (TextView) findViewById(R.id.tv_card_mac); |
91 | shoptime = (TextView) findViewById(R.id.tv_card_time); | 86 | shoptime = (TextView) findViewById(R.id.tv_card_time); |
92 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); | 87 | deviceNumber = (TextView) findViewById(R.id.tv_card_deviceNumber); |
93 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); | 88 | shopadress = (TextView) findViewById(R.id.tv_card_shopAdress); |
94 | phone = (TextView) findViewById(R.id.tv_card_phone); | 89 | phone = (TextView) findViewById(R.id.tv_card_phone); |
95 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); | 90 | tlePhone = (TextView) findViewById(R.id.tv_card_tleNember); |
96 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); | 91 | tv_card_adress_change = (TextView) findViewById(R.id.tv_card_adress_change); |
97 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); | 92 | tv_card_phone_change = (TextView) findViewById(R.id.tv_card_phone_change); |
98 | } | 93 | } |
99 | 94 | ||
100 | private void initData() { | 95 | private void initData() { |
101 | 96 | ||
102 | // //获取设备信息 | 97 | // //获取设备信息 |
103 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); | 98 | // deviceModel.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceModel()); |
104 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); | 99 | // deviceNumber.setText(GetDevicesUtil.getDevicesInfo(this).getDeviceNumber()); |
105 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); | 100 | // mac_adress.setText(GetDevicesUtil.getDevicesInfo(this).getMac()); |
106 | // //获取保卡信息 | 101 | // //获取保卡信息 |
107 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); | 102 | // usename.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CUNSTEMNAME)); |
108 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); | 103 | // customer_address.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.ADRESSCUNSTEM)); |
109 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); | 104 | // shoptime.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTIME)); |
110 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); | 105 | // shopadress.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPADRESS)); |
111 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); | 106 | // tlePhone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.SHOPTLEPHONE)); |
112 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); | 107 | // phone.setText(SaveParam.getInstance().getCustomizeParam(this,SaveParam.CARDPHONE)); |
113 | 108 | ||
114 | 109 | ||
115 | } | 110 | } |
116 | 111 | ||
117 | private void initLister() { | 112 | private void initLister() { |
118 | tv_card_adress_change.setOnClickListener(this); | 113 | tv_card_adress_change.setOnClickListener(this); |
119 | tv_card_phone_change.setOnClickListener(this); | 114 | tv_card_phone_change.setOnClickListener(this); |
120 | iv_last_step.setOnClickListener(this); | 115 | iv_last_step.setOnClickListener(this); |
121 | } | 116 | } |
122 | 117 | ||
123 | @Override | 118 | @Override |
124 | public void onClick(View v) { | 119 | public void onClick(View v) { |
125 | switch (v.getId()) { | 120 | switch (v.getId()) { |
126 | case R.id.tv_card_adress_change: | 121 | case R.id.tv_card_adress_change: |
127 | Intent intent = new Intent(); | 122 | Intent intent = new Intent(); |
128 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); | 123 | intent.setClass(this, ChangeElectronicCardAdressInfoActivity.class); |
129 | startActivity(intent); | 124 | startActivity(intent); |
130 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 125 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
131 | 126 | ||
132 | break; | 127 | break; |
133 | case R.id.tv_card_phone_change: | 128 | case R.id.tv_card_phone_change: |
134 | Content.authcodeflag = 2; | 129 | Content.authcodeflag = 2; |
135 | Intent intent1 = new Intent(); | 130 | Intent intent1 = new Intent(); |
136 | intent1.setClass(this, ElectronicCardValidationActivity.class); | 131 | intent1.setClass(this, ElectronicCardValidationActivity.class); |
137 | startActivity(intent1); | 132 | startActivity(intent1); |
138 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 133 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
139 | 134 | ||
140 | 135 | ||
141 | break; | 136 | break; |
142 | case R.id.cancel: | 137 | case R.id.cancel: |
143 | finish(); | 138 | finish(); |
144 | break; | 139 | break; |
145 | } | 140 | } |
146 | } | 141 | } |
147 | 142 | ||
148 | } | 143 | } |
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.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
14 | import android.support.v7.app.AppCompatActivity; | 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.view.KeyEvent; | 18 | import android.view.KeyEvent; |
18 | import android.view.View; | 19 | import android.view.View; |
19 | import android.widget.ImageView; | 20 | import android.widget.ImageView; |
20 | import android.widget.LinearLayout; | 21 | import android.widget.LinearLayout; |
21 | import android.widget.TextView; | 22 | import android.widget.TextView; |
22 | import android.widget.Toast; | 23 | import android.widget.Toast; |
23 | 24 | ||
24 | import com.facebook.drawee.backends.pipeline.Fresco; | 25 | import com.facebook.drawee.backends.pipeline.Fresco; |
25 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 26 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
26 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 27 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
27 | import com.facebook.drawee.generic.RoundingParams; | 28 | import com.facebook.drawee.generic.RoundingParams; |
28 | import com.facebook.drawee.interfaces.DraweeController; | 29 | import com.facebook.drawee.interfaces.DraweeController; |
29 | import com.facebook.drawee.view.SimpleDraweeView; | 30 | import com.facebook.drawee.view.SimpleDraweeView; |
30 | import com.hjx.personalcenter.R; | 31 | import com.hjx.personalcenter.R; |
31 | import com.hjx.personalcenter.adapter.GalleryAdapter; | 32 | import com.hjx.personalcenter.adapter.GalleryAdapter; |
32 | import com.hjx.personalcenter.adapter.VideoAdapter; | 33 | import com.hjx.personalcenter.adapter.VideoAdapter; |
33 | import com.hjx.personalcenter.customdialog.HeadDialog; | 34 | import com.hjx.personalcenter.customdialog.HeadDialog; |
34 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; | 35 | import com.hjx.personalcenter.customdialog.RecyclerViewSpaceItem; |
35 | import com.hjx.personalcenter.db.SaveParam; | 36 | import com.hjx.personalcenter.db.SaveParam; |
36 | import com.hjx.personalcenter.http.HttpCode; | 37 | import com.hjx.personalcenter.http.HttpCode; |
37 | import com.hjx.personalcenter.http.HttpManager; | 38 | import com.hjx.personalcenter.http.HttpManager; |
38 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 39 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
39 | import com.hjx.personalcenter.model.DefautPublishInfo; | 40 | import com.hjx.personalcenter.model.DefautPublishInfo; |
40 | import com.hjx.personalcenter.model.PesonalInfo; | 41 | import com.hjx.personalcenter.model.PesonalInfo; |
41 | import com.hjx.personalcenter.model.SignInfo; | 42 | import com.hjx.personalcenter.model.SignInfo; |
42 | import com.hjx.personalcenter.model.VideoInfo; | 43 | import com.hjx.personalcenter.model.VideoInfo; |
43 | import com.hjx.personalcenter.update.UpdateChecker; | 44 | import com.hjx.personalcenter.update.UpdateChecker; |
44 | import com.hjx.personalcenter.util.AlertUtils; | 45 | import com.hjx.personalcenter.util.AlertUtils; |
45 | import com.hjx.personalcenter.util.CropUtils; | 46 | import com.hjx.personalcenter.util.CropUtils; |
46 | import com.hjx.personalcenter.util.DialogPermission; | 47 | import com.hjx.personalcenter.util.DialogPermission; |
47 | import com.hjx.personalcenter.util.FileUtil; | 48 | import com.hjx.personalcenter.util.FileUtil; |
49 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
48 | import com.hjx.personalcenter.util.PermissionUtil; | 50 | import com.hjx.personalcenter.util.PermissionUtil; |
49 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 51 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
50 | import com.mylhyl.circledialog.CircleDialog; | 52 | import com.mylhyl.circledialog.CircleDialog; |
51 | import com.mylhyl.circledialog.callback.ConfigInput; | 53 | import com.mylhyl.circledialog.callback.ConfigInput; |
52 | import com.mylhyl.circledialog.params.InputParams; | 54 | import com.mylhyl.circledialog.params.InputParams; |
53 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 55 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
54 | import com.zaaach.toprightmenu.MenuItem; | 56 | import com.zaaach.toprightmenu.MenuItem; |
55 | import com.zaaach.toprightmenu.TopRightMenu; | 57 | import com.zaaach.toprightmenu.TopRightMenu; |
56 | 58 | ||
57 | import java.io.File; | 59 | import java.io.File; |
58 | import java.io.UnsupportedEncodingException; | 60 | import java.io.UnsupportedEncodingException; |
59 | import java.util.ArrayList; | 61 | import java.util.ArrayList; |
60 | import java.util.List; | 62 | import java.util.List; |
61 | 63 | ||
62 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 64 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
63 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 65 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
64 | private TextView tv_edit_presoninfo, tv_sign, | 66 | private TextView tv_edit_presoninfo, tv_sign, |
65 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 67 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
66 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 68 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
67 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 69 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
68 | private TopRightMenu mTopRightMenu; | 70 | private TopRightMenu mTopRightMenu; |
69 | //水平滑动 | 71 | //水平滑动 |
70 | private RecyclerView mRecyclerView; | 72 | private RecyclerView mRecyclerView; |
71 | private RecyclerView mRecyclerViewpublish; | 73 | private RecyclerView mRecyclerViewpublish; |
72 | private VideoAdapter RecyclerViewadapter; | 74 | private VideoAdapter RecyclerViewadapter; |
73 | private GalleryAdapter RecyclerViewadapterpublish; | 75 | private GalleryAdapter RecyclerViewadapterpublish; |
74 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 76 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
75 | 77 | ||
76 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); | 78 | private ArrayList<VideoInfo.DataBean> videoinfo = new ArrayList<>(); |
77 | private boolean showIcon = true; | 79 | private boolean showIcon = true; |
78 | private boolean dimBg = true; | 80 | private boolean dimBg = true; |
79 | private boolean needAnim = true; | 81 | private boolean needAnim = true; |
80 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 82 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
81 | private static final int REQUEST_CODE_ALBUM = 2; | 83 | private static final int REQUEST_CODE_ALBUM = 2; |
82 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 84 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
83 | SimpleDraweeView mSimpleDraweeView; | 85 | SimpleDraweeView mSimpleDraweeView; |
84 | private File file; | 86 | private File file; |
85 | private Uri uri; | 87 | private Uri uri; |
86 | Handler handler = new Handler(){ | 88 | Handler handler = new Handler(){ |
87 | @Override | 89 | @Override |
88 | public void handleMessage(Message msg) { | 90 | public void handleMessage(Message msg) { |
89 | super.handleMessage(msg); | 91 | super.handleMessage(msg); |
90 | switch (msg.what){ | 92 | switch (msg.what){ |
91 | case HttpCode.GETINFO: | 93 | case HttpCode.GETINFO: |
92 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 94 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
93 | tv_username.setText(cardinfoBean.getNickName()); | 95 | tv_username.setText(cardinfoBean.getNickName()); |
94 | tv_username1.setText(cardinfoBean.getNickName()); | 96 | tv_username1.setText(cardinfoBean.getNickName()); |
95 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 97 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
96 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 98 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
97 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 99 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
98 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 100 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
99 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 101 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
100 | String sex = cardinfoBean.getGender(); | 102 | String sex = cardinfoBean.getGender(); |
101 | if ("0".equals(sex)){ | 103 | if ("0".equals(sex)){ |
102 | tv_sex.setText("男"); | 104 | tv_sex.setText("男"); |
103 | iv_sex.setImageResource(R.mipmap.men); | 105 | iv_sex.setImageResource(R.mipmap.men); |
104 | }else { | 106 | }else { |
105 | tv_sex.setText("女"); | 107 | tv_sex.setText("女"); |
106 | iv_sex.setImageResource(R.mipmap.women); | 108 | iv_sex.setImageResource(R.mipmap.women); |
107 | } | 109 | } |
108 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); | 110 | mSimpleDraweeView.setImageURI(cardinfoBean.getPortrait()); |
109 | String graderID =cardinfoBean.getGrade().getGradeId(); | 111 | String graderID =cardinfoBean.getGrade().getGradeId(); |
110 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 112 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
113 | //账户类型 | ||
114 | String accounts = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); | ||
115 | String childID = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.CHILDSID); | ||
111 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, ""+graderID); | 116 | SaveParam.getInstance().saveCustomizeParam(MainActivity.this, SaveParam.GRADENS, ""+graderID); |
112 | try { | 117 | try { |
113 | long auserID = Long.parseLong(userID); | 118 | Object auserID; |
119 | int type; | ||
114 | int graderIDs =Integer.parseInt(graderID); | 120 | int graderIDs =Integer.parseInt(graderID); |
121 | if ("2".equals(accounts)){ | ||
122 | type=Integer.parseInt(accounts); | ||
123 | auserID =childID; | ||
124 | }else { | ||
125 | type =Integer.parseInt(accounts); | ||
126 | auserID =Long.parseLong(userID); | ||
127 | } | ||
115 | //获取版本信息 | 128 | //获取版本信息 |
116 | HttpManager.getInstance().getpublishinfo(MainActivity.this,auserID,graderIDs,handler); | 129 | HttpManager.getInstance().getpublishinfo(MainActivity.this,auserID,graderIDs,type,handler); |
117 | 130 | ||
118 | } catch (NumberFormatException e) { | 131 | } catch (NumberFormatException e) { |
119 | e.printStackTrace(); | 132 | e.printStackTrace(); |
120 | } | 133 | } |
121 | 134 | ||
122 | break; | 135 | break; |
123 | case HttpCode.SIGN: | 136 | case HttpCode.SIGN: |
124 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 137 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
125 | if (dataBean.getSignature()==null){ | 138 | if (dataBean.getSignature()==null){ |
126 | tv_sign.setText("你还未设置个性签名"); | 139 | tv_sign.setText("你还未设置个性签名"); |
127 | }else { | 140 | }else { |
128 | tv_sign.setText(dataBean.getSignature()); | 141 | tv_sign.setText(dataBean.getSignature()); |
129 | } | 142 | } |
130 | 143 | ||
131 | break; | 144 | break; |
132 | case HttpCode.PUBLISH_SUCESS: | 145 | case HttpCode.PUBLISH_SUCESS: |
133 | defautPublishInfos.clear(); | 146 | defautPublishInfos.clear(); |
134 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); | 147 | defautPublishInfos.addAll( (List<DefautPublishInfo.DataBean>)msg.obj); |
135 | RecyclerViewadapterpublish.notifyDataSetChanged(); | 148 | RecyclerViewadapterpublish.notifyDataSetChanged(); |
136 | break; | 149 | break; |
137 | case HttpCode.GETVIDIO_SUCESS: | 150 | case HttpCode.GETVIDIO_SUCESS: |
138 | videoinfo.clear(); | 151 | videoinfo.clear(); |
139 | videoinfo.addAll( (List<VideoInfo.DataBean>)msg.obj); | 152 | videoinfo.addAll( (List<VideoInfo.DataBean>)msg.obj); |
140 | RecyclerViewadapter.notifyDataSetChanged(); | 153 | RecyclerViewadapter.notifyDataSetChanged(); |
141 | break; | 154 | break; |
142 | } | 155 | } |
143 | } | 156 | } |
144 | }; | 157 | }; |
145 | 158 | ||
146 | @Override | 159 | @Override |
147 | protected void onCreate(Bundle savedInstanceState) { | 160 | protected void onCreate(Bundle savedInstanceState) { |
148 | super.onCreate(savedInstanceState); | 161 | super.onCreate(savedInstanceState); |
149 | Fresco.initialize(this); | 162 | Fresco.initialize(this); |
150 | setContentView(R.layout.activity_main); | 163 | setContentView(R.layout.activity_main); |
151 | SysApplication.getInstance().addActivity(this); | 164 | SysApplication.getInstance().addActivity(this); |
152 | initView(); | 165 | initView(); |
153 | initData(); | 166 | initData(); |
154 | initLister(); | 167 | initLister(); |
155 | updateVersion(); | 168 | updateVersion(); |
156 | // String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); | 169 | String devicenumber = GetDevicesUtil.getDevicesInfo(this).getDeviceNumber(); |
157 | // Log.e("test","......."+devicenumber); | 170 | String model = GetDevicesUtil.getDevicesInfo(this).getDeviceModel(); |
171 | Log.e("test","......."+devicenumber+model); | ||
158 | } | 172 | } |
159 | //////版本更新 | 173 | //////版本更新 |
160 | private void updateVersion() { | 174 | private void updateVersion() { |
161 | UpdateChecker updateChecker = new UpdateChecker(this); | 175 | UpdateChecker updateChecker = new UpdateChecker(this); |
162 | updateChecker.checkForUpdates(); | 176 | updateChecker.checkForUpdates(); |
163 | 177 | ||
164 | 178 | ||
165 | } | 179 | } |
166 | 180 | ||
167 | private void initView() { | 181 | private void initView() { |
168 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 182 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
169 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 183 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
170 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 184 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
171 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 185 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
172 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 186 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
173 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 187 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
174 | //头像 | 188 | //头像 |
175 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 189 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
176 | //初始化个人信息 | 190 | //初始化个人信息 |
177 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 191 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
178 | tv_username = (TextView) findViewById(R.id.tv_username); | 192 | tv_username = (TextView) findViewById(R.id.tv_username); |
179 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 193 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
180 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 194 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
181 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 195 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
182 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 196 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
183 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 197 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
184 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 198 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
185 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 199 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
186 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 200 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
187 | //跳转其他应用 | 201 | //跳转其他应用 |
188 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 202 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
189 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 203 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
190 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 204 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
191 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 205 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
192 | // | 206 | // |
193 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 207 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
194 | mRecyclerViewpublish =(RecyclerView) findViewById(R.id.id_recyclerview_pubish); | 208 | mRecyclerViewpublish =(RecyclerView) findViewById(R.id.id_recyclerview_pubish); |
195 | 209 | ||
196 | } | 210 | } |
197 | 211 | ||
198 | 212 | ||
199 | private void initData() { | 213 | private void initData() { |
200 | //设置布局管理器 | 214 | //设置布局管理器 |
201 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 215 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
202 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 216 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
203 | 217 | ||
204 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); | 218 | LinearLayoutManager linearLayoutManagerpublish = new LinearLayoutManager(this); |
205 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); | 219 | linearLayoutManagerpublish.setOrientation(LinearLayoutManager.HORIZONTAL); |
206 | 220 | ||
207 | mRecyclerView.setLayoutManager(linearLayoutManager); | 221 | mRecyclerView.setLayoutManager(linearLayoutManager); |
208 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); | 222 | mRecyclerView.addItemDecoration(new RecyclerViewSpaceItem(10)); |
209 | 223 | ||
210 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); | 224 | mRecyclerViewpublish.setLayoutManager(linearLayoutManagerpublish); |
211 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); | 225 | mRecyclerViewpublish.addItemDecoration(new RecyclerViewSpaceItem(10)); |
212 | 226 | ||
213 | //设置视频适配器 | 227 | //设置视频适配器 |
214 | RecyclerViewadapter = new VideoAdapter(this,videoinfo); | 228 | RecyclerViewadapter = new VideoAdapter(this,videoinfo); |
215 | RecyclerViewadapterpublish= new GalleryAdapter(this,defautPublishInfos); | 229 | RecyclerViewadapterpublish= new GalleryAdapter(this,defautPublishInfos); |
216 | 230 | ||
217 | //版本信息适配器 | 231 | //版本信息适配器 |
218 | mRecyclerView.setAdapter(RecyclerViewadapter); | 232 | mRecyclerView.setAdapter(RecyclerViewadapter); |
219 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); | 233 | mRecyclerViewpublish.setAdapter(RecyclerViewadapterpublish); |
220 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 234 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
221 | //获取个性签名 | 235 | //获取个性签名 |
222 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 236 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
223 | try { | 237 | try { |
224 | long auserID = Long.parseLong(userID); | 238 | long auserID = Long.parseLong(userID); |
225 | int typeaccount1=Integer.parseInt(typeaccount); | 239 | int typeaccount1=Integer.parseInt(typeaccount); |
226 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); | 240 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,typeaccount1,handler); |
227 | 241 | ||
228 | } catch (NumberFormatException e) { | 242 | } catch (NumberFormatException e) { |
229 | e.printStackTrace(); | 243 | e.printStackTrace(); |
230 | } | 244 | } |
231 | 245 | ||
232 | //初始化图片 | 246 | //初始化图片 |
233 | // file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 247 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
234 | // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 248 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
235 | // uri = Uri.fromFile(file); | 249 | uri = Uri.fromFile(file); |
236 | // } else { | 250 | } else { |
237 | // //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 251 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
238 | // uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 252 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
239 | // } | 253 | } |
240 | 254 | ||
241 | } | 255 | } |
242 | 256 | ||
243 | private void initLister() { | 257 | private void initLister() { |
244 | iv_imformatioan.setOnClickListener(this); | 258 | iv_imformatioan.setOnClickListener(this); |
245 | iv_look_card.setOnClickListener(this); | 259 | iv_look_card.setOnClickListener(this); |
246 | tv_edit_presoninfo.setOnClickListener(this); | 260 | tv_edit_presoninfo.setOnClickListener(this); |
247 | iv_setting.setOnClickListener(this); | 261 | iv_setting.setOnClickListener(this); |
248 | iv_sign.setOnClickListener(this); | 262 | iv_sign.setOnClickListener(this); |
249 | mSimpleDraweeView.setOnClickListener(this); | 263 | mSimpleDraweeView.setOnClickListener(this); |
250 | linel_mycuoti.setOnClickListener(this); | 264 | linel_mycuoti.setOnClickListener(this); |
251 | linel_mynote.setOnClickListener(this); | 265 | linel_mynote.setOnClickListener(this); |
252 | linel_mycollege.setOnClickListener(this); | 266 | linel_mycollege.setOnClickListener(this); |
253 | linel_myclass.setOnClickListener(this); | 267 | linel_myclass.setOnClickListener(this); |
254 | 268 | ||
255 | } | 269 | } |
256 | 270 | ||
257 | @Override | 271 | @Override |
258 | public void onClick(View v) { | 272 | public void onClick(View v) { |
259 | switch (v.getId()) { | 273 | switch (v.getId()) { |
260 | case R.id.iv_imformatioan: | 274 | case R.id.iv_imformatioan: |
261 | Intent intent = new Intent(); | 275 | Intent intent = new Intent(); |
262 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 276 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
263 | startActivity(intent); | 277 | startActivity(intent); |
264 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 278 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
265 | break; | 279 | break; |
266 | case R.id.iv_look_card: | 280 | case R.id.iv_look_card: |
267 | Intent lookintent = new Intent(); | 281 | Intent lookintent = new Intent(); |
268 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 282 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
269 | startActivity(lookintent); | 283 | startActivity(lookintent); |
270 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 284 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
271 | break; | 285 | break; |
272 | case R.id.tv_edit_presoninfo: | 286 | case R.id.tv_edit_presoninfo: |
273 | Intent editintent = new Intent(); | 287 | Intent editintent = new Intent(); |
274 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 288 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
275 | startActivity(editintent); | 289 | startActivity(editintent); |
276 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 290 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
277 | break; | 291 | break; |
278 | case R.id.iv_head: | 292 | case R.id.iv_head: |
279 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 293 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
280 | break; | 294 | break; |
281 | case R.id.iv_setting: | 295 | case R.id.iv_setting: |
282 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 296 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
283 | List<MenuItem> menuItems = new ArrayList<>(); | 297 | List<MenuItem> menuItems = new ArrayList<>(); |
284 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 298 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
285 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 299 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
286 | mTopRightMenu | 300 | mTopRightMenu |
287 | .setHeight(150) //默认高度480 | 301 | .setHeight(150) //默认高度480 |
288 | .setWidth(320) //默认宽度wrap_content | 302 | .setWidth(320) //默认宽度wrap_content |
289 | .showIcon(showIcon) //显示菜单图标,默认为true | 303 | .showIcon(showIcon) //显示菜单图标,默认为true |
290 | .dimBackground(dimBg) //背景变暗,默认为true | 304 | .dimBackground(dimBg) //背景变暗,默认为true |
291 | .needAnimationStyle(needAnim) //显示动画,默认为true | 305 | .needAnimationStyle(needAnim) //显示动画,默认为true |
292 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 306 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
293 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 307 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
294 | @Override | 308 | @Override |
295 | public void onMenuItemClick(int position) { | 309 | public void onMenuItemClick(int position) { |
296 | switch (position) { | 310 | switch (position) { |
297 | case 0: | 311 | case 0: |
298 | //清除数据 | 312 | new CircleDialog.Builder(MainActivity.this) |
299 | SaveParam.getInstance().clearData(MainActivity.this); | 313 | .setCanceledOnTouchOutside(false) |
300 | Intent settingintent = new Intent(); | 314 | .setWidth(0.4f) |
301 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 315 | .setCancelable(false) |
302 | startActivity(settingintent); | 316 | .setText("您确定要退出,更换其他账号登录吗?") |
303 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 317 | .setNegative("取消", null) |
304 | finish(); | 318 | .setPositive("确定", new View.OnClickListener() { |
319 | @Override | ||
320 | public void onClick(View v) { | ||
321 | //清除数据 | ||
322 | SaveParam.getInstance().clearData(MainActivity.this); | ||
323 | Intent settingintent = new Intent(); | ||
324 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | ||
325 | startActivity(settingintent); | ||
326 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
327 | finish(); | ||
328 | } | ||
329 | }) | ||
330 | .show(); | ||
305 | break; | 331 | break; |
306 | case 1: | 332 | case 1: |
307 | Intent accontMintent = new Intent(); | 333 | Intent accontMintent = new Intent(); |
308 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 334 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
309 | startActivity(accontMintent); | 335 | startActivity(accontMintent); |
310 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 336 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
311 | break; | 337 | break; |
312 | } | 338 | } |
313 | } | 339 | } |
314 | }) | 340 | }) |
315 | .addMenuList(menuItems) | 341 | .addMenuList(menuItems) |
316 | .showAsDropDown(iv_setting, -250, 0); | 342 | .showAsDropDown(iv_setting, -250, 0); |
317 | break; | 343 | break; |
318 | case R.id.iv_sign: | 344 | case R.id.iv_sign: |
319 | new CircleDialog.Builder(this) | 345 | new CircleDialog.Builder(this) |
320 | .setCanceledOnTouchOutside(false) | 346 | .setCanceledOnTouchOutside(false) |
321 | .setCancelable(true) | 347 | .setCancelable(true) |
322 | .setTitle("个性签名") | 348 | .setTitle("个性签名") |
323 | .setInputHint("请输入个性签名") | 349 | .setInputHint("请输入个性签名") |
324 | .setWidth(0.5f) | 350 | .setWidth(0.5f) |
325 | .configInput(new ConfigInput() { | 351 | .configInput(new ConfigInput() { |
326 | @Override | 352 | @Override |
327 | public void onConfig(InputParams params) { | 353 | public void onConfig(InputParams params) { |
328 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 354 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
329 | } | 355 | } |
330 | }) | 356 | }) |
331 | .setNegative("取消", null) | 357 | .setNegative("取消", null) |
332 | .setPositiveInput("确定", new OnInputClickListener() { | 358 | .setPositiveInput("确定", new OnInputClickListener() { |
333 | @Override | 359 | @Override |
334 | public void onClick(String text, View v) { | 360 | public void onClick(String text, View v) { |
335 | if (text.equals("")) { | 361 | if (text.equals("")) { |
336 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 362 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
337 | } else { | 363 | } else { |
338 | try { | 364 | try { |
339 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); | 365 | String typeaccount = SaveParam.getInstance().getCustomizeParam(MainActivity.this,SaveParam.ACCOUNT); |
340 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 366 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
341 | long auserID = Long.parseLong(userID); | 367 | long auserID = Long.parseLong(userID); |
342 | int typeaccount1=Integer.parseInt(typeaccount); | 368 | int typeaccount1=Integer.parseInt(typeaccount); |
343 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); | 369 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,typeaccount1,text); |
344 | } catch (NumberFormatException e) { | 370 | } catch (NumberFormatException e) { |
345 | e.printStackTrace(); | 371 | e.printStackTrace(); |
346 | } | 372 | } |
347 | 373 | ||
348 | tv_sign.setText(text); | 374 | tv_sign.setText(text); |
349 | } | 375 | } |
350 | 376 | ||
351 | } | 377 | } |
352 | }) | 378 | }) |
353 | .show(); | 379 | .show(); |
354 | break; | 380 | break; |
355 | case R.id.linel_mycuoti: | 381 | case R.id.linel_mycuoti: |
356 | AlertUtils.showToast(this, "hhahahah "); | 382 | AlertUtils.showToast(this, "hhahahah "); |
357 | break; | 383 | break; |
358 | case R.id.linel_mynote: | 384 | case R.id.linel_mynote: |
359 | AlertUtils.showToast(this, "hhahahah "); | 385 | AlertUtils.showToast(this, "hhahahah "); |
360 | break; | 386 | break; |
361 | case R.id.linel_mycollege: | 387 | case R.id.linel_mycollege: |
362 | AlertUtils.showToast(this, "hhahahah "); | 388 | AlertUtils.showToast(this, "hhahahah "); |
363 | break; | 389 | break; |
364 | case R.id.linel_myclass: | 390 | case R.id.linel_myclass: |
365 | AlertUtils.showToast(this, "hhahahah "); | 391 | AlertUtils.showToast(this, "hhahahah "); |
366 | break; | 392 | break; |
367 | } | 393 | } |
368 | 394 | ||
369 | } | 395 | } |
370 | 396 | ||
371 | @Override | 397 | @Override |
372 | protected void onResume() { | 398 | protected void onResume() { |
373 | super.onResume(); | 399 | super.onResume(); |
374 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 400 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
375 | //账户类型 | 401 | //账户类型 |
376 | String accounts = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 402 | String accounts = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
377 | //加载个人信息 | 403 | //加载个人信息 |
378 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 404 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
379 | if (xiongzuo==null){ | 405 | if (xiongzuo==null){ |
380 | tv_mygad.setText(""); | 406 | tv_mygad.setText(""); |
381 | }else { | 407 | }else { |
382 | tv_mygad.setText(xiongzuo); | 408 | tv_mygad.setText(xiongzuo); |
383 | } | 409 | } |
384 | try { | 410 | try { |
385 | int graderID; | 411 | int graderID; |
386 | long auserID = Long.parseLong(userID); | 412 | long auserID = Long.parseLong(userID); |
387 | int typeaccount1=Integer.parseInt(accounts); | 413 | int typeaccount1=Integer.parseInt(accounts); |
388 | //获取最近播放视频 | 414 | //获取最近播放视频 |
389 | HttpManager.getInstance().getstuyvidioinfo(this,auserID,handler); | 415 | HttpManager.getInstance().getstuyvidioinfo(this,auserID,handler); |
390 | //获取个人信息 | 416 | //获取个人信息 |
391 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); | 417 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,typeaccount1,handler); |
392 | 418 | ||
393 | 419 | ||
394 | 420 | ||
395 | } catch (NumberFormatException e) { | 421 | } catch (NumberFormatException e) { |
396 | e.printStackTrace(); | 422 | e.printStackTrace(); |
397 | } | 423 | } |
398 | 424 | ||
399 | } | 425 | } |
400 | 426 | ||
401 | //回调头像监听 | 427 | //回调头像监听 |
402 | @Override | 428 | @Override |
403 | public void heard(Context context, View v,int headpitiaon) { | 429 | public void heard(Context context, View v,int headpitiaon) { |
404 | String picUrl = ""; | 430 | String picUrl = ""; |
405 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 431 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
406 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 432 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
407 | switch (v.getId()){ | 433 | switch (v.getId()){ |
408 | //选择默认图片 | 434 | //选择默认图片 |
409 | case R.id.oktakephone: | 435 | case R.id.oktakephone: |
410 | if (headpitiaon==1){ | 436 | if (headpitiaon==1){ |
411 | mSimpleDraweeView.setImageDrawable(null); | 437 | mSimpleDraweeView.setImageDrawable(null); |
412 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | 438 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); |
413 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; | 439 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/61e8d8cf-651f-49c9-beb2-ff1387af390a.png"; |
414 | try { | 440 | try { |
415 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 441 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
416 | } catch (UnsupportedEncodingException e) { | 442 | } catch (UnsupportedEncodingException e) { |
417 | e.printStackTrace(); | 443 | e.printStackTrace(); |
418 | } | 444 | } |
419 | }else if (headpitiaon==2){ | 445 | }else if (headpitiaon==2){ |
420 | mSimpleDraweeView.setImageDrawable(null); | 446 | mSimpleDraweeView.setImageDrawable(null); |
421 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | 447 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); |
422 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; | 448 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"; |
423 | try { | 449 | try { |
424 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 450 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
425 | } catch (UnsupportedEncodingException e) { | 451 | } catch (UnsupportedEncodingException e) { |
426 | e.printStackTrace(); | 452 | e.printStackTrace(); |
427 | } | 453 | } |
428 | }else if (headpitiaon==3){ | 454 | }else if (headpitiaon==3){ |
429 | mSimpleDraweeView.setImageDrawable(null); | 455 | mSimpleDraweeView.setImageDrawable(null); |
430 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | 456 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); |
431 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; | 457 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/184112f4-bfe0-4db8-bc1e-6212755b241c.png"; |
432 | try { | 458 | try { |
433 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 459 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
434 | } catch (UnsupportedEncodingException e) { | 460 | } catch (UnsupportedEncodingException e) { |
435 | e.printStackTrace(); | 461 | e.printStackTrace(); |
436 | } | 462 | } |
437 | }else if (headpitiaon==4){ | 463 | }else if (headpitiaon==4){ |
438 | mSimpleDraweeView.setImageDrawable(null); | 464 | mSimpleDraweeView.setImageDrawable(null); |
439 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | 465 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); |
440 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; | 466 | picUrl = "http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/e31c9e11-9276-4bf4-a162-b66272fdc351.png"; |
441 | try { | 467 | try { |
442 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); | 468 | HttpManager.getInstance().headerdeft(this, userID,typeaccount,picUrl); |
443 | } catch (UnsupportedEncodingException e) { | 469 | } catch (UnsupportedEncodingException e) { |
444 | e.printStackTrace(); | 470 | e.printStackTrace(); |
445 | } | 471 | } |
446 | }else{ | 472 | }else{ |
447 | mSimpleDraweeView.setImageDrawable(null); | 473 | mSimpleDraweeView.setImageDrawable(null); |
448 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; | 474 | mSimpleDraweeView.setImageResource(R.mipmap.header_default);; |
449 | } | 475 | } |
450 | 476 | ||
451 | break; | 477 | break; |
452 | case R.id.canceltakephone: | 478 | case R.id.canceltakephone: |
453 | 479 | ||
454 | break; | 480 | break; |
455 | //拍摄和相册 | 481 | //拍摄和相册 |
456 | case R.id.take_pic: | 482 | case R.id.take_pic: |
457 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 483 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
458 | uploadAvatarFromPhotoRequest(); | 484 | uploadAvatarFromPhotoRequest(); |
459 | } | 485 | } |
460 | 486 | ||
461 | break; | 487 | break; |
462 | case R.id.xiangce: | 488 | case R.id.xiangce: |
463 | uploadAvatarFromAlbumRequest(); | 489 | uploadAvatarFromAlbumRequest(); |
464 | break; | 490 | break; |
465 | 491 | ||
466 | } | 492 | } |
467 | 493 | ||
468 | } | 494 | } |
469 | 495 | ||
470 | //照相 | 496 | //照相 |
471 | private void uploadAvatarFromPhotoRequest() { | 497 | private void uploadAvatarFromPhotoRequest() { |
472 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 498 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
473 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 499 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
474 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 500 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
475 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 501 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
476 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 502 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
477 | } | 503 | } |
478 | 504 | ||
479 | //选择图库 | 505 | //选择图库 |
480 | private void uploadAvatarFromAlbumRequest() { | 506 | private void uploadAvatarFromAlbumRequest() { |
481 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 507 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
482 | photoPickerIntent.setType("image/*"); | 508 | photoPickerIntent.setType("image/*"); |
483 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 509 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
484 | } | 510 | } |
485 | //回掉 | 511 | //回掉 |
486 | @Override | 512 | @Override |
487 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 513 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
488 | super.onActivityResult(requestCode, resultCode, data); | 514 | super.onActivityResult(requestCode, resultCode, data); |
489 | if (resultCode != -1) { | 515 | if (resultCode != -1) { |
490 | return; | 516 | return; |
491 | } | 517 | } |
492 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 518 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
493 | Uri newUri; | 519 | Uri newUri; |
494 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 520 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
495 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 521 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
496 | } else { | 522 | } else { |
497 | newUri = data.getData(); | 523 | newUri = data.getData(); |
498 | } | 524 | } |
499 | if (newUri != null) { | 525 | if (newUri != null) { |
500 | startPhotoZoom(newUri); | 526 | startPhotoZoom(newUri); |
501 | } else { | 527 | } else { |
502 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 528 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
503 | } | 529 | } |
504 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 530 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
505 | startPhotoZoom(uri); | 531 | startPhotoZoom(uri); |
506 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 532 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
507 | uploadAvatarFromPhoto(); | 533 | uploadAvatarFromPhoto(); |
508 | } | 534 | } |
509 | } | 535 | } |
510 | 536 | ||
511 | private void uploadAvatarFromPhoto() { | 537 | private void uploadAvatarFromPhoto() { |
512 | compressAndUploadAvatar(file.getPath()); | 538 | compressAndUploadAvatar(file.getPath()); |
513 | 539 | ||
514 | } | 540 | } |
515 | private void compressAndUploadAvatar(String fileSrc) { | 541 | private void compressAndUploadAvatar(String fileSrc) { |
516 | 542 | ||
517 | 543 | ||
518 | //上传到服务器 | 544 | //上传到服务器 |
519 | 545 | ||
520 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 546 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
521 | String mimeType = "image/*"; | 547 | String mimeType = "image/*"; |
522 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 548 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
523 | //String fileName = cover.getName(); | 549 | //String fileName = cover.getName(); |
524 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 550 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
525 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); | 551 | String typeaccount = SaveParam.getInstance().getCustomizeParam(this,SaveParam.ACCOUNT); |
526 | 552 | ||
527 | //上传头像 | 553 | //上传头像 |
528 | 554 | ||
529 | try { | 555 | try { |
530 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); | 556 | HttpManager.getInstance().header(this, userID,typeaccount,file.getPath()); |
531 | } catch (UnsupportedEncodingException e) { | 557 | } catch (UnsupportedEncodingException e) { |
532 | e.printStackTrace(); | 558 | e.printStackTrace(); |
533 | } | 559 | } |
534 | 560 | ||
535 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 561 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
536 | //Fresco设置圆形头像 | 562 | //Fresco设置圆形头像 |
537 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 563 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
538 | GenericDraweeHierarchy hierarchy = builder | 564 | GenericDraweeHierarchy hierarchy = builder |
539 | .setDesiredAspectRatio(1f) | 565 | .setDesiredAspectRatio(1f) |
540 | .setFailureImage(R.mipmap.blank) | 566 | .setFailureImage(R.mipmap.blank) |
541 | //圆形头像 | 567 | //圆形头像 |
542 | .setRoundingParams(RoundingParams.asCircle()) | 568 | .setRoundingParams(RoundingParams.asCircle()) |
543 | .build(); | 569 | .build(); |
544 | 570 | ||
545 | //加载本地图片 | 571 | //加载本地图片 |
546 | Uri uri = Uri.fromFile(cover); | 572 | Uri uri = Uri.fromFile(cover); |
547 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 573 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
548 | .setOldController(mSimpleDraweeView.getController()) | 574 | .setOldController(mSimpleDraweeView.getController()) |
549 | .setUri(uri) | 575 | .setUri(uri) |
550 | .build(); | 576 | .build(); |
551 | mSimpleDraweeView.setHierarchy(hierarchy); | 577 | mSimpleDraweeView.setHierarchy(hierarchy); |
552 | mSimpleDraweeView.setController(controller); | 578 | mSimpleDraweeView.setController(controller); |
553 | 579 | ||
554 | } | 580 | } |
555 | 581 | ||
556 | public void startPhotoZoom(Uri uri) { | 582 | public void startPhotoZoom(Uri uri) { |
557 | Intent intent = new Intent("com.android.camera.action.CROP"); | 583 | Intent intent = new Intent("com.android.camera.action.CROP"); |
558 | intent.setDataAndType(uri, "image/*"); | 584 | intent.setDataAndType(uri, "image/*"); |
559 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 585 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
560 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 586 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
561 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 587 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
562 | intent.putExtra("aspectY", 1);// x:y=1:1 | 588 | intent.putExtra("aspectY", 1);// x:y=1:1 |
563 | // intent.putExtra("outputX", 400);//图片输出大小 | 589 | // intent.putExtra("outputX", 400);//图片输出大小 |
564 | // intent.putExtra("outputY", 400); | 590 | // intent.putExtra("outputY", 400); |
565 | intent.putExtra("output", Uri.fromFile(file)); | 591 | intent.putExtra("output", Uri.fromFile(file)); |
566 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 592 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
567 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 593 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
568 | } | 594 | } |
569 | 595 | ||
570 | @Override | 596 | @Override |
571 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 597 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
572 | switch (requestCode) { | 598 | switch (requestCode) { |
573 | 599 | ||
574 | case PermissionUtil.REQUEST_SHOWCAMERA: | 600 | case PermissionUtil.REQUEST_SHOWCAMERA: |
575 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 601 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
576 | // Permission Granted | 602 | // Permission Granted |
577 | uploadAvatarFromPhotoRequest(); | 603 | uploadAvatarFromPhotoRequest(); |
578 | 604 | ||
579 | } else { | 605 | } else { |
580 | if (!SharedPreferenceMark.getHasShowCamera()) { | 606 | if (!SharedPreferenceMark.getHasShowCamera()) { |
581 | SharedPreferenceMark.setHasShowCamera(true); | 607 | SharedPreferenceMark.setHasShowCamera(true); |
582 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 608 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
583 | 609 | ||
584 | } else { | 610 | } else { |
585 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 611 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
586 | .show(); | 612 | .show(); |
587 | } | 613 | } |
588 | } | 614 | } |
589 | break; | 615 | break; |
590 | default: | 616 | default: |
591 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 617 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
592 | } | 618 | } |
593 | } | 619 | } |
594 | private long exitTime = 0; | 620 | private long exitTime = 0; |
595 | @Override | 621 | @Override |
596 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 622 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
597 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 623 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
598 | if ((System.currentTimeMillis() - exitTime) > 2000) { | 624 | if ((System.currentTimeMillis() - exitTime) > 2000) { |
599 | Toast.makeText(getApplicationContext(), "再按一次退出程序", | 625 | Toast.makeText(getApplicationContext(), "再按一次退出程序", |
600 | Toast.LENGTH_SHORT).show(); | 626 | Toast.LENGTH_SHORT).show(); |
601 | exitTime = System.currentTimeMillis(); | 627 | exitTime = System.currentTimeMillis(); |
602 | } else { | 628 | } else { |
603 | SysApplication.getInstance().exit(); | 629 | SysApplication.getInstance().exit(); |
604 | } | 630 | } |
605 | return false; | 631 | return false; |
606 | } | 632 | } |
607 | return super.onKeyDown(keyCode, event); | 633 | return super.onKeyDown(keyCode, event); |
608 | } | 634 | } |
609 | } | 635 | } |
610 | 636 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/SysApplication.java
1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.app.Application; | 4 | import android.app.Application; |
5 | 5 | ||
6 | import java.util.LinkedList; | 6 | import java.util.LinkedList; |
7 | import java.util.List; | 7 | import java.util.List; |
8 | |||
8 | public class SysApplication extends Application { | 9 | public class SysApplication extends Application { |
9 | private List<Activity> mList = new LinkedList<Activity>(); | 10 | private List<Activity> mList = new LinkedList<Activity>(); |
10 | private static SysApplication instance; | 11 | private static SysApplication instance; |
12 | |||
11 | private SysApplication() { | 13 | private SysApplication() { |
12 | } | 14 | } |
15 | |||
13 | public synchronized static SysApplication getInstance() { | 16 | public synchronized static SysApplication getInstance() { |
14 | if (null == instance) { | 17 | if (null == instance) { |
15 | instance = new SysApplication(); | 18 | instance = new SysApplication(); |
16 | } | 19 | } |
17 | return instance; | 20 | return instance; |
18 | } | 21 | } |
22 | |||
19 | // add Activity | 23 | // add Activity |
20 | public void addActivity(Activity activity) { | 24 | public void addActivity(Activity activity) { |
21 | mList.add(activity); | 25 | mList.add(activity); |
22 | } | 26 | } |
27 | |||
23 | public void exit() { | 28 | public void exit() { |
24 | try { | 29 | try { |
25 | for (Activity activity : mList) { | 30 | for (Activity activity : mList) { |
26 | if (activity != null) | 31 | if (activity != null) |
27 | activity.finish(); | 32 | activity.finish(); |
28 | } | 33 | } |
29 | } catch (Exception e) { | 34 | } catch (Exception e) { |
30 | e.printStackTrace(); | 35 | e.printStackTrace(); |
31 | } finally { | 36 | } finally { |
32 | System.exit(0); | 37 | System.exit(0); |
33 | } | 38 | } |
34 | } | 39 | } |
40 | |||
35 | public void onLowMemory() { | 41 | public void onLowMemory() { |
36 | super.onLowMemory(); | 42 | super.onLowMemory(); |
37 | System.gc(); | 43 | System.gc(); |
38 | } | 44 | } |
39 | } | 45 | } |
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.content.Context; | 4 | import android.content.Context; |
5 | import android.content.Intent; | ||
4 | import android.support.v4.app.FragmentActivity; | 6 | import android.support.v4.app.FragmentActivity; |
5 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
6 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
7 | import android.view.View; | 9 | import android.view.View; |
8 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
9 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
10 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
11 | import android.widget.TextView; | 13 | import android.widget.TextView; |
12 | 14 | ||
13 | import com.facebook.drawee.view.SimpleDraweeView; | 15 | import com.facebook.drawee.view.SimpleDraweeView; |
14 | import com.hjx.personalcenter.R; | 16 | import com.hjx.personalcenter.R; |
17 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | ||
15 | import com.hjx.personalcenter.db.Content; | 18 | import com.hjx.personalcenter.db.Content; |
16 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
17 | import com.hjx.personalcenter.http.HttpManager; | 20 | import com.hjx.personalcenter.http.HttpManager; |
18 | import com.hjx.personalcenter.model.ChildsInfo; | 21 | import com.hjx.personalcenter.model.ChildsInfo; |
19 | import com.hjx.personalcenter.util.GetDevicesUtil; | 22 | import com.hjx.personalcenter.util.GetDevicesUtil; |
20 | import com.mylhyl.circledialog.CircleDialog; | 23 | import com.mylhyl.circledialog.CircleDialog; |
21 | 24 | ||
22 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
23 | import java.util.List; | 26 | import java.util.List; |
24 | 27 | ||
25 | /** | 28 | /** |
26 | * Created by h on 2017/8/26. | 29 | * Created by h on 2017/8/26. |
27 | */ | 30 | */ |
28 | 31 | ||
29 | public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdapter.AccountChildsHolder> implements View.OnClickListener { | 32 | public class AccountChildsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener { |
30 | private List<ChildsInfo.DataBean> specailList; | 33 | private List<ChildsInfo.DataBean> specailList; |
31 | private LayoutInflater mInflater; | 34 | private LayoutInflater mInflater; |
32 | private Context mContext ; | 35 | private Context mContext; |
36 | private static final int BODY_TYPE = 00002; | ||
37 | private static final int FOOT_TYPE = 00003; | ||
38 | private int footCount = 1;//尾部个数,后续可以自己拓展 | ||
33 | 39 | ||
34 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList,Context context) { | 40 | public AccountChildsAdapter(ArrayList<ChildsInfo.DataBean> specailList, Context context) { |
35 | this.mContext = context; | 41 | this.mContext = context; |
36 | this.specailList = specailList; | 42 | this.specailList = specailList; |
37 | mInflater = LayoutInflater.from(context); | 43 | mInflater = LayoutInflater.from(context); |
38 | } | 44 | } |
39 | 45 | ||
40 | public OnItemClickListener mOnItemClickListener; | 46 | public OnItemClickListener mOnItemClickListener; |
41 | 47 | ||
42 | @Override | 48 | @Override |
43 | public void onClick(View v) { | 49 | public void onClick(View v) { |
44 | if (mOnItemClickListener ==null){ | 50 | if (mOnItemClickListener == null) { |
45 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); | 51 | mOnItemClickListener.onItemClick(v, (int) v.getTag()); |
46 | } | 52 | } |
47 | 53 | ||
48 | } | 54 | } |
49 | 55 | ||
56 | private int getBodySize() { | ||
57 | return specailList.size(); | ||
58 | } | ||
59 | |||
60 | private boolean isFoot(int position) { | ||
61 | return footCount != 0 && (position >= (getBodySize())); | ||
62 | } | ||
63 | |||
64 | @Override | ||
65 | public int getItemViewType(int position) { | ||
66 | if (isFoot(position)) { | ||
67 | return FOOT_TYPE; | ||
68 | } else { | ||
69 | return BODY_TYPE; | ||
70 | } | ||
71 | } | ||
72 | |||
50 | public interface OnItemClickListener { | 73 | public interface OnItemClickListener { |
51 | void onItemClick(View view, int position); | 74 | void onItemClick(View view, int position); |
52 | } | 75 | } |
53 | 76 | ||
54 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { | 77 | public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) { |
55 | this.mOnItemClickListener = mOnItemClickLitener; | 78 | this.mOnItemClickListener = mOnItemClickLitener; |
56 | } | 79 | } |
57 | 80 | ||
58 | public void setList(List<ChildsInfo.DataBean> list) { | 81 | public void setList(List<ChildsInfo.DataBean> list) { |
59 | this.specailList = list; | 82 | this.specailList = list; |
60 | notifyDataSetChanged(); | 83 | notifyDataSetChanged(); |
61 | } | 84 | } |
62 | 85 | ||
63 | @Override | 86 | @Override |
64 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 87 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
65 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); | 88 | switch (viewType) { |
66 | view.setOnClickListener(this); | 89 | case BODY_TYPE: |
67 | AccountChildsHolder holder = new AccountChildsHolder(view); | 90 | return new AccountChildsHolder(mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false)); |
68 | return holder; | 91 | case FOOT_TYPE: |
92 | return new FootViewHolder(mInflater.inflate(R.layout.activity_account_management_add, parent, false)); | ||
93 | default: | ||
94 | return null; | ||
95 | } | ||
96 | // View view = ; | ||
97 | // view.setOnClickListener(this); | ||
98 | // AccountChildsHolder holder = new AccountChildsHolder(view); | ||
99 | // return holder; | ||
69 | } | 100 | } |
70 | 101 | ||
71 | @Override | 102 | @Override |
72 | public void onBindViewHolder(AccountChildsHolder holder, int position) { | 103 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { |
73 | final ChildsInfo.DataBean bean = specailList.get(position); | 104 | if (holder instanceof AccountChildsHolder) { |
74 | if (bean != null) { | 105 | final ChildsInfo.DataBean bean = specailList.get(position); |
75 | holder.mSimpleDraweeView.setImageURI(bean.getImage()); | 106 | if (bean != null) { |
76 | holder.iv_child_name.setText(bean.getName()); | 107 | ((AccountChildsHolder) holder).mSimpleDraweeView.setImageURI(bean.getImage()); |
77 | holder.iv_child_grade.setText(bean.getGrade()); | 108 | ((AccountChildsHolder) holder).iv_child_name.setText(bean.getName()); |
78 | holder.iv_child_school.setText(bean.getSchool()); | 109 | ((AccountChildsHolder) holder).iv_child_grade.setText(bean.getGrade()); |
79 | holder.iv_child_adress.setText(bean.getRegion()); | 110 | ((AccountChildsHolder) holder).iv_child_school.setText(bean.getSchool()); |
80 | if ("已使用".equals(bean.getStatus())){ | 111 | ((AccountChildsHolder) holder).iv_child_adress.setText(bean.getRegion()); |
81 | holder.chang_account.setText("使用中"); | 112 | if ("已使用".equals(bean.getStatus())) { |
82 | holder.chang_account.setEnabled(false); | 113 | ((AccountChildsHolder) holder).chang_account.setText("使用中"); |
83 | holder.delete_account.setEnabled(false); | 114 | ((AccountChildsHolder) holder).chang_account.setEnabled(false); |
84 | holder.iv_using_pic.setVisibility(View.VISIBLE); | 115 | ((AccountChildsHolder) holder).delete_account.setEnabled(false); |
85 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); | 116 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.VISIBLE); |
86 | }else { | 117 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_blue_bg); |
87 | holder.chang_account.setText("切换用户"); | 118 | } else { |
88 | holder.chang_account.setEnabled(true); | 119 | ((AccountChildsHolder) holder).chang_account.setText("切换用户"); |
89 | holder.delete_account.setEnabled(true); | 120 | ((AccountChildsHolder) holder).chang_account.setEnabled(true); |
90 | holder.iv_using_pic.setVisibility(View.GONE); | 121 | ((AccountChildsHolder) holder).delete_account.setEnabled(true); |
91 | holder.ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); | 122 | ((AccountChildsHolder) holder).iv_using_pic.setVisibility(View.GONE); |
92 | } | 123 | ((AccountChildsHolder) holder).ll_backgrangd.setBackgroundResource(R.drawable.corcle_black_bg); |
93 | holder.delete_account.setOnClickListener(new View.OnClickListener() { | 124 | } |
94 | @Override | 125 | ((AccountChildsHolder) holder).delete_account.setOnClickListener(new View.OnClickListener() { |
95 | public void onClick(View v) { | 126 | @Override |
96 | new CircleDialog.Builder((FragmentActivity)mContext) | 127 | public void onClick(View v) { |
97 | .setCanceledOnTouchOutside(false) | 128 | new CircleDialog.Builder((FragmentActivity) mContext) |
98 | .setWidth(0.4f) | 129 | .setCanceledOnTouchOutside(false) |
99 | .setCancelable(false) | 130 | .setWidth(0.4f) |
100 | .setText("您确定删除该子账户?") | 131 | .setCancelable(false) |
101 | .setNegative("取消", null) | 132 | .setText("您确定删除该子账户?") |
102 | .setPositive("确定", new View.OnClickListener() { | 133 | .setNegative("取消", null) |
103 | @Override | 134 | .setPositive("确定", new View.OnClickListener() { |
104 | public void onClick(View v) { | 135 | @Override |
105 | HttpManager.getInstance().deletechildAccountinfo(mContext,bean.getSubAccountId()); | 136 | public void onClick(View v) { |
106 | } | 137 | HttpManager.getInstance().deletechildAccountinfo(mContext, bean.getSubAccountId()); |
107 | }) | 138 | } |
108 | .show(); | 139 | }) |
109 | 140 | .show(); | |
141 | |||
142 | |||
143 | } | ||
144 | }); | ||
145 | ((AccountChildsHolder) holder).chang_account.setOnClickListener(new View.OnClickListener() { | ||
146 | @Override | ||
147 | public void onClick(View v) { | ||
148 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
149 | .setCanceledOnTouchOutside(false) | ||
150 | .setWidth(0.4f) | ||
151 | .setCancelable(false) | ||
152 | .setText("您确定切换为该子账户?") | ||
153 | .setNegative("取消", null) | ||
154 | .setPositive("确定", new View.OnClickListener() { | ||
155 | @Override | ||
156 | public void onClick(View v) { | ||
157 | Content.changgeaccountflag = 2; | ||
158 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ACCOUNT, "2"); | ||
159 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSID, bean.getSubAccountId()); | ||
160 | //保存子账号年级id | ||
161 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENS, bean.getGradeId()); | ||
162 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | ||
163 | HttpManager.getInstance().changechildAccountinfo(mContext, bean.getSubAccountId(), bean.getParentId(), | ||
164 | devicenumber, 2); | ||
165 | } | ||
166 | }) | ||
167 | .show(); | ||
168 | |||
169 | } | ||
170 | }); | ||
110 | 171 | ||
172 | } | ||
111 | 173 | ||
112 | } | 174 | } else if (holder instanceof FootViewHolder) { |
113 | }); | 175 | ((FootViewHolder) holder).add_account.setOnClickListener(new View.OnClickListener() { |
114 | holder.chang_account.setOnClickListener(new View.OnClickListener() { | ||
115 | @Override | 176 | @Override |
116 | public void onClick(View v) { | 177 | public void onClick(View v) { |
117 | new CircleDialog.Builder((FragmentActivity)mContext) | 178 | Content.accountflag = 2; |
118 | .setCanceledOnTouchOutside(false) | 179 | Intent account = new Intent(); |
119 | .setWidth(0.4f) | 180 | account.setClass(mContext, RegisterInfoActivity.class); |
120 | .setCancelable(false) | 181 | mContext.startActivity(account); |
121 | .setText("您确定切换为该子账户?") | 182 | ((Activity) mContext).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
122 | .setNegative("取消", null) | ||
123 | .setPositive("确定", new View.OnClickListener() { | ||
124 | @Override | ||
125 | public void onClick(View v) { | ||
126 | Content.changgeaccountflag =2; | ||
127 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ACCOUNT,"2"); | ||
128 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CHILDSID,bean.getSubAccountId()); | ||
129 | //保存子账号年级id | ||
130 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CHILDSGRADENS,bean.getGradeId() ); | ||
131 | String devicenumber = GetDevicesUtil.getDevicesInfo(mContext).getDeviceNumber(); | ||
132 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId(), | ||
133 | devicenumber,2); | ||
134 | } | ||
135 | }) | ||
136 | .show(); | ||
137 | 183 | ||
138 | } | 184 | } |
139 | }); | 185 | }); |
140 | |||
141 | } | 186 | } |
142 | 187 | ||
143 | 188 | ||
144 | } | 189 | } |
145 | 190 | ||
146 | @Override | 191 | @Override |
147 | public int getItemCount() { | 192 | public int getItemCount() { |
148 | 193 | ||
149 | return specailList.size(); | 194 | return getBodySize() + footCount; |
150 | } | 195 | } |
151 | 196 | ||
152 | class AccountChildsHolder extends RecyclerView.ViewHolder { | 197 | private static class AccountChildsHolder extends RecyclerView.ViewHolder { |
153 | ImageView iv_using_pic; | 198 | ImageView iv_using_pic; |
154 | LinearLayout ll_backgrangd; | 199 | LinearLayout ll_backgrangd; |
155 | SimpleDraweeView mSimpleDraweeView; | 200 | SimpleDraweeView mSimpleDraweeView; |
156 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, | 201 | TextView iv_child_name, iv_child_grade, iv_child_school, iv_child_adress, |
157 | delete_account,chang_account; | 202 | delete_account, chang_account; |
203 | |||
158 | public AccountChildsHolder(View itemView) { | 204 | public AccountChildsHolder(View itemView) { |
159 | super(itemView); | 205 | super(itemView); |
160 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); | 206 | mSimpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.iv_child_head); |
161 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); | 207 | iv_child_name = (TextView) itemView.findViewById(R.id.iv_child_name); |
162 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); | 208 | iv_child_grade = (TextView) itemView.findViewById(R.id.iv_child_grade); |
163 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); | 209 | iv_child_school = (TextView) itemView.findViewById(R.id.iv_child_school); |
164 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); | 210 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.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.view.Gravity; | 9 | import android.view.Gravity; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
14 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
15 | import android.widget.ListView; | 15 | import android.widget.ListView; |
16 | 16 | ||
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.CitysAdapter; | 18 | import com.hjx.personalcenter.adapter.CitysAdapter; |
19 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 20 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CityInfo; | 23 | import com.hjx.personalcenter.model.CityInfo; |
24 | import com.mylhyl.circledialog.BaseCircleDialog; | 24 | import com.mylhyl.circledialog.BaseCircleDialog; |
25 | import com.mylhyl.circledialog.res.values.CircleDimen; | 25 | import com.mylhyl.circledialog.res.values.CircleDimen; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 自定义市级列表对话框 | 31 | * 自定义市级列表对话框 |
32 | * Created by h on 2017/8/10. | 32 | * Created by h on 2017/8/10. |
33 | */ | 33 | */ |
34 | @SuppressLint("ValidFragment") | 34 | @SuppressLint("ValidFragment") |
35 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 35 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
36 | private CitysAdapter listadapter; | 36 | private CitysAdapter listadapter; |
37 | private ListView listView; | 37 | private ListView listView; |
38 | private ImageView cance; | 38 | private ImageView cance; |
39 | private Context context; | 39 | private Context context; |
40 | private DialogCallBack.CitysCallBack mCallBack; | 40 | private DialogCallBack.CitysCallBack mCallBack; |
41 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); | 41 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); |
42 | public CitysListDialog() { | 42 | public CitysListDialog() { |
43 | context= getActivity(); | 43 | context= getActivity(); |
44 | } | 44 | } |
45 | public CitysListDialog(DialogCallBack.CitysCallBack callBack) { | 45 | public CitysListDialog(DialogCallBack.CitysCallBack callBack) { |
46 | this.mCallBack = callBack; | 46 | this.mCallBack = callBack; |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | public static CitysListDialog getInstance(DialogCallBack.CitysCallBack callBack) { | 50 | public static CitysListDialog getInstance(DialogCallBack.CitysCallBack callBack) { |
51 | CitysListDialog dialogFragment = new CitysListDialog(callBack); | 51 | CitysListDialog dialogFragment = new CitysListDialog(callBack); |
52 | dialogFragment.setCanceledBack(true); | 52 | dialogFragment.setCanceledBack(true); |
53 | dialogFragment.setCanceledOnTouchOutside(false); | 53 | dialogFragment.setCanceledOnTouchOutside(false); |
54 | dialogFragment.setRadius(CircleDimen.RADIUS); | 54 | dialogFragment.setRadius(CircleDimen.RADIUS); |
55 | dialogFragment.setWidth(0.5f); | 55 | dialogFragment.setWidth(0.5f); |
56 | dialogFragment.setGravity(Gravity.CENTER); | 56 | dialogFragment.setGravity(Gravity.CENTER); |
57 | dialogFragment.setBackgroundColor(Color.WHITE); | 57 | dialogFragment.setBackgroundColor(Color.WHITE); |
58 | return dialogFragment; | 58 | return dialogFragment; |
59 | } | 59 | } |
60 | Handler handler = new Handler(){ | 60 | Handler handler = new Handler(){ |
61 | @Override | 61 | @Override |
62 | public void handleMessage(Message msg) { | 62 | public void handleMessage(Message msg) { |
63 | super.handleMessage(msg); | 63 | super.handleMessage(msg); |
64 | switch (msg.what){ | 64 | switch (msg.what){ |
65 | case HttpCode.CITYS: | 65 | case HttpCode.CITYS: |
66 | data.clear(); | 66 | data.clear(); |
67 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); | 67 | data.addAll( (List<CityInfo.CitiesBean>)msg.obj); |
68 | if (data==null){ | ||
69 | dismiss(); | ||
70 | } | ||
68 | listadapter.notifyDataSetChanged(); | 71 | listadapter.notifyDataSetChanged(); |
69 | break; | 72 | break; |
70 | } | 73 | } |
71 | } | 74 | } |
72 | }; | 75 | }; |
73 | 76 | ||
74 | @Override | 77 | @Override |
75 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 78 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
76 | return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); | 79 | return inflater.inflate(R.layout.custom_adilog_cityslist, container, false); |
77 | } | 80 | } |
78 | 81 | ||
79 | @Override | 82 | @Override |
80 | public void onActivityCreated(Bundle savedInstanceState) { | 83 | public void onActivityCreated(Bundle savedInstanceState) { |
81 | super.onActivityCreated(savedInstanceState); | 84 | super.onActivityCreated(savedInstanceState); |
82 | listView = (ListView) getView().findViewById(R.id.listadapter); | 85 | listView = (ListView) getView().findViewById(R.id.listadapter); |
83 | cance = (ImageView) getView().findViewById(R.id.cancel); | 86 | cance = (ImageView) getView().findViewById(R.id.cancel); |
84 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); | 87 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.PROVINCES); |
85 | listadapter = new CitysAdapter(data,getActivity()); | 88 | listadapter = new CitysAdapter(data,getActivity()); |
86 | listView.setAdapter(listadapter); | 89 | listView.setAdapter(listadapter); |
87 | listView.setOnItemClickListener(this); | 90 | listView.setOnItemClickListener(this); |
88 | cance.setOnClickListener(new View.OnClickListener() { | 91 | cance.setOnClickListener(new View.OnClickListener() { |
89 | @Override | 92 | @Override |
90 | public void onClick(View v) { | 93 | public void onClick(View v) { |
91 | dismiss(); | 94 | dismiss(); |
92 | } | 95 | } |
93 | }); | 96 | }); |
94 | try { | 97 | try { |
95 | long a = Long.parseLong(citys); | 98 | long a = Long.parseLong(citys); |
96 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); | 99 | HttpManager.getInstance().cityinfo(getActivity(),a,handler); |
97 | } catch (NumberFormatException e) { | 100 | } catch (NumberFormatException e) { |
98 | e.printStackTrace(); | 101 | e.printStackTrace(); |
99 | } | 102 | } |
100 | 103 | ||
101 | 104 | ||
102 | } | 105 | } |
103 | 106 | ||
104 | @Override | 107 | @Override |
105 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 108 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
106 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); | 109 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CITYS, ""+data.get(position).getRegionId()); |
107 | mCallBack.province1OnItemClick(data,position,2); | 110 | mCallBack.province1OnItemClick(data,position,2); |
108 | dismiss(); | 111 | dismiss(); |
109 | 112 | ||
110 | } | 113 | } |
111 | } | 114 | } |
112 | 115 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.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.view.Gravity; | 9 | import android.view.Gravity; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
14 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
15 | import android.widget.ListView; | 15 | import android.widget.ListView; |
16 | 16 | ||
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.CountryAdapter; | 18 | import com.hjx.personalcenter.adapter.CountryAdapter; |
19 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
20 | import com.hjx.personalcenter.http.HttpCode; | 20 | import com.hjx.personalcenter.http.HttpCode; |
21 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
22 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
23 | import com.hjx.personalcenter.model.CountyInfo; | 23 | import com.hjx.personalcenter.model.CountyInfo; |
24 | import com.mylhyl.circledialog.BaseCircleDialog; | 24 | import com.mylhyl.circledialog.BaseCircleDialog; |
25 | import com.mylhyl.circledialog.res.values.CircleDimen; | 25 | import com.mylhyl.circledialog.res.values.CircleDimen; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Created by wei on 2017/8/21. | 31 | * Created by wei on 2017/8/21. |
32 | */ | 32 | */ |
33 | @SuppressLint("ValidFragment") | 33 | @SuppressLint("ValidFragment") |
34 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 34 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
35 | private CountryAdapter listadapter; | 35 | private CountryAdapter listadapter; |
36 | private ListView listView; | 36 | private ListView listView; |
37 | private ImageView cance; | 37 | private ImageView cance; |
38 | private DialogCallBack.CountryCallBack mCallBack; | 38 | private DialogCallBack.CountryCallBack mCallBack; |
39 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); | 39 | private ArrayList<CountyInfo.CountiesBean> data = new ArrayList<>(); |
40 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { | 40 | public CountryDialog(DialogCallBack.CountryCallBack callBack) { |
41 | this.mCallBack = callBack; | 41 | this.mCallBack = callBack; |
42 | } | 42 | } |
43 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { | 43 | public static CountryDialog getInstance(DialogCallBack.CountryCallBack callBack) { |
44 | CountryDialog dialogFragment = new CountryDialog(callBack); | 44 | CountryDialog dialogFragment = new CountryDialog(callBack); |
45 | dialogFragment.setCanceledBack(true); | 45 | dialogFragment.setCanceledBack(true); |
46 | dialogFragment.setCanceledOnTouchOutside(true); | 46 | dialogFragment.setCanceledOnTouchOutside(true); |
47 | dialogFragment.setRadius(CircleDimen.RADIUS); | 47 | dialogFragment.setRadius(CircleDimen.RADIUS); |
48 | dialogFragment.setWidth(0.5f); | 48 | dialogFragment.setWidth(0.5f); |
49 | dialogFragment.setGravity(Gravity.CENTER); | 49 | dialogFragment.setGravity(Gravity.CENTER); |
50 | dialogFragment.setBackgroundColor(Color.WHITE); | 50 | dialogFragment.setBackgroundColor(Color.WHITE); |
51 | return dialogFragment; | 51 | return dialogFragment; |
52 | } | 52 | } |
53 | Handler handler = new Handler(){ | 53 | Handler handler = new Handler(){ |
54 | @Override | 54 | @Override |
55 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
56 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
57 | switch (msg.what){ | 57 | switch (msg.what){ |
58 | case HttpCode.COUNTRY: | 58 | case HttpCode.COUNTRY: |
59 | 59 | ||
60 | data.clear(); | 60 | data.clear(); |
61 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); | 61 | data.addAll( (List<CountyInfo.CountiesBean>)msg.obj); |
62 | if (data==null){ | ||
63 | dismiss(); | ||
64 | } | ||
62 | listadapter.notifyDataSetChanged(); | 65 | listadapter.notifyDataSetChanged(); |
63 | break; | 66 | break; |
64 | } | 67 | } |
65 | } | 68 | } |
66 | }; | 69 | }; |
67 | 70 | ||
68 | @Override | 71 | @Override |
69 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 72 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
70 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); | 73 | return inflater.inflate(R.layout.custom_adilog_countrylist, container, false); |
71 | } | 74 | } |
72 | 75 | ||
73 | @Override | 76 | @Override |
74 | public void onActivityCreated(Bundle savedInstanceState) { | 77 | public void onActivityCreated(Bundle savedInstanceState) { |
75 | super.onActivityCreated(savedInstanceState); | 78 | super.onActivityCreated(savedInstanceState); |
76 | listView = (ListView) getView().findViewById(R.id.listadapter); | 79 | listView = (ListView) getView().findViewById(R.id.listadapter); |
77 | cance = (ImageView) getView().findViewById(R.id.cancel); | 80 | cance = (ImageView) getView().findViewById(R.id.cancel); |
78 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 81 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
79 | listadapter = new CountryAdapter(data,getActivity()); | 82 | listadapter = new CountryAdapter(data,getActivity()); |
80 | listView.setAdapter(listadapter); | 83 | listView.setAdapter(listadapter); |
81 | listView.setOnItemClickListener(this); | 84 | listView.setOnItemClickListener(this); |
82 | cance.setOnClickListener(new View.OnClickListener() { | 85 | cance.setOnClickListener(new View.OnClickListener() { |
83 | @Override | 86 | @Override |
84 | public void onClick(View v) { | 87 | public void onClick(View v) { |
85 | dismiss(); | 88 | dismiss(); |
86 | } | 89 | } |
87 | }); | 90 | }); |
88 | try { | 91 | try { |
89 | int a = Integer.parseInt(citys); | 92 | int a = Integer.parseInt(citys); |
90 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); | 93 | HttpManager.getInstance().countyinfo(getActivity(),a,handler); |
91 | } catch (NumberFormatException e) { | 94 | } catch (NumberFormatException e) { |
92 | e.printStackTrace(); | 95 | e.printStackTrace(); |
93 | } | 96 | } |
94 | 97 | ||
95 | 98 | ||
96 | } | 99 | } |
97 | 100 | ||
98 | @Override | 101 | @Override |
99 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 102 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
100 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.COUNTRY, ""+data.get(position).getRegionId()); | 103 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.COUNTRY, ""+data.get(position).getRegionId()); |
101 | mCallBack.province2OnItemClick(data,position,3); | 104 | mCallBack.province2OnItemClick(data,position,3); |
102 | dismiss(); | 105 | dismiss(); |
103 | 106 | ||
104 | } | 107 | } |
105 | } | 108 | } |
106 | 109 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.java
1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
2 | 2 | ||
3 | import android.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.view.Gravity; | 9 | import android.view.Gravity; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
14 | import android.widget.ImageView; | 14 | import android.widget.ImageView; |
15 | import android.widget.ListView; | 15 | import android.widget.ListView; |
16 | 16 | ||
17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
18 | import com.hjx.personalcenter.adapter.GrandeAdapter; | 18 | import com.hjx.personalcenter.adapter.GrandeAdapter; |
19 | 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.HttpCode; | 20 | import com.hjx.personalcenter.http.HttpCode; |
22 | import com.hjx.personalcenter.http.HttpManager; | 21 | import com.hjx.personalcenter.http.HttpManager; |
23 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 22 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
24 | import com.hjx.personalcenter.model.GradeInfo; | 23 | import com.hjx.personalcenter.model.GradeInfo; |
25 | import com.mylhyl.circledialog.BaseCircleDialog; | 24 | import com.mylhyl.circledialog.BaseCircleDialog; |
26 | import com.mylhyl.circledialog.res.values.CircleDimen; | 25 | import com.mylhyl.circledialog.res.values.CircleDimen; |
27 | 26 | ||
28 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
29 | import java.util.List; | 28 | import java.util.List; |
30 | 29 | ||
31 | /**自定义年级列表对话框 | 30 | /**自定义年级列表对话框 |
32 | * Created by h on 2017/8/10. | 31 | * Created by h on 2017/8/10. |
33 | */ | 32 | */ |
34 | @SuppressLint("ValidFragment") | 33 | @SuppressLint("ValidFragment") |
35 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 34 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { |
36 | private GrandeAdapter listadapter; | 35 | private GrandeAdapter listadapter; |
37 | private ListView listView; | 36 | private ListView listView; |
38 | private ImageView cance; | 37 | private ImageView cance; |
39 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); | 38 | ArrayList<GradeInfo.DataBean.ChildrenBean> data = new ArrayList<>(); |
40 | private DialogCallBack.GradeCallBack mCallBack; | 39 | private DialogCallBack.GradeCallBack mCallBack; |
41 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { | 40 | public GradeListDialog(DialogCallBack.GradeCallBack callBack) { |
42 | this.mCallBack = callBack; | 41 | this.mCallBack = callBack; |
43 | } | 42 | } |
44 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { | 43 | public static GradeListDialog getInstance(DialogCallBack.GradeCallBack callBack) { |
45 | GradeListDialog dialogFragment = new GradeListDialog(callBack); | 44 | GradeListDialog dialogFragment = new GradeListDialog(callBack); |
46 | dialogFragment.setCanceledBack(true); | 45 | dialogFragment.setCanceledBack(true); |
47 | dialogFragment.setCanceledOnTouchOutside(true); | 46 | dialogFragment.setCanceledOnTouchOutside(true); |
48 | dialogFragment.setRadius(CircleDimen.RADIUS); | 47 | dialogFragment.setRadius(CircleDimen.RADIUS); |
49 | dialogFragment.setWidth(0.5f); | 48 | dialogFragment.setWidth(0.5f); |
50 | dialogFragment.setGravity(Gravity.CENTER); | 49 | dialogFragment.setGravity(Gravity.CENTER); |
51 | dialogFragment.setBackgroundColor(Color.WHITE); | 50 | dialogFragment.setBackgroundColor(Color.WHITE); |
52 | return dialogFragment; | 51 | return dialogFragment; |
53 | } | 52 | } |
54 | Handler handler = new Handler(){ | 53 | Handler handler = new Handler(){ |
55 | @Override | 54 | @Override |
56 | public void handleMessage(Message msg) { | 55 | public void handleMessage(Message msg) { |
57 | super.handleMessage(msg); | 56 | super.handleMessage(msg); |
58 | switch (msg.what){ | 57 | switch (msg.what){ |
59 | case HttpCode.GRADER: | 58 | case HttpCode.GRADER: |
60 | data.clear(); | 59 | data.clear(); |
61 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); | 60 | data.addAll( (List<GradeInfo.DataBean.ChildrenBean>)msg.obj); |
62 | listadapter.notifyDataSetChanged(); | 61 | listadapter.notifyDataSetChanged(); |
63 | break; | 62 | break; |
64 | } | 63 | } |
65 | } | 64 | } |
66 | }; | 65 | }; |
67 | @Override | 66 | @Override |
68 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 67 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
69 | 68 | ||
70 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); | 69 | return inflater.inflate(R.layout.custom_adilog_gradelist, container, false); |
71 | } | 70 | } |
72 | @Override | 71 | @Override |
73 | public void onActivityCreated(Bundle savedInstanceState) { | 72 | public void onActivityCreated(Bundle savedInstanceState) { |
74 | super.onActivityCreated(savedInstanceState); | 73 | super.onActivityCreated(savedInstanceState); |
75 | listView = (ListView) getView().findViewById(R.id.listadapter); | 74 | listView = (ListView) getView().findViewById(R.id.listadapter); |
76 | cance = (ImageView) getView().findViewById(R.id.cancel); | 75 | cance = (ImageView) getView().findViewById(R.id.cancel); |
77 | listadapter = new GrandeAdapter(data,getActivity()); | 76 | listadapter = new GrandeAdapter(data,getActivity()); |
78 | listView.setAdapter(listadapter); | 77 | listView.setAdapter(listadapter); |
79 | listView.setOnItemClickListener(this); | 78 | listView.setOnItemClickListener(this); |
80 | cance.setOnClickListener(new View.OnClickListener() { | 79 | cance.setOnClickListener(new View.OnClickListener() { |
81 | @Override | 80 | @Override |
82 | public void onClick(View v) { | 81 | public void onClick(View v) { |
83 | dismiss(); | 82 | dismiss(); |
84 | } | 83 | } |
85 | }); | 84 | }); |
86 | HttpManager.getInstance().getgrade(getActivity(),handler); | 85 | HttpManager.getInstance().getgrade(getActivity(),handler); |
87 | 86 | ||
88 | } | 87 | } |
89 | 88 | ||
90 | @Override | 89 | @Override |
91 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 90 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
92 | if (Content.accountflag ==2){ | 91 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.ACCOUNT); |
93 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS, ""+data.get(position).getId()); | 92 | if ("2".equals(accounts)){ |
94 | }else { | 93 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS, ""+data.get(position).getId()); |
95 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); | 94 | }else { |
96 | } | 95 | SaveParam.getInstance().saveCustomizeParam(getActivity(), SaveParam.GRADENS, ""+data.get(position).getId()); |
96 | } | ||
97 | |||
98 | |||
97 | 99 | ||
98 | mCallBack.province3OnItemClick(data,position,5); | 100 | mCallBack.province3OnItemClick(data,position,5); |
99 | dismiss(); | 101 | dismiss(); |
100 | 102 | ||
101 | 103 | ||
102 | } | 104 | } |
103 | } | 105 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/Content.java
1 | package com.hjx.personalcenter.db; | 1 | package com.hjx.personalcenter.db; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by h on 2017/8/17. | 4 | * Created by h on 2017/8/17. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | public class Content { | 7 | public class Content { |
8 | public static int authcodeflag;//其他是进入填写保卡信息验证,2是修改保卡手机号验证,1是更改绑定验证 | 8 | public static int authcodeflag;//其他是进入填写保卡信息验证,2是修改保卡手机号验证,1是更改绑定验证 |
9 | public static int adressflag;//1购买地址,2客户地址 | 9 | public static int adressflag;//1购买地址,2客户地址 |
10 | public static int accountflag;//1主账户注册信息,2子账户注册信息 | 10 | public static int accountflag;//1主账户注册信息,2子账户注册信息 |
11 | public static int changgeaccountflag;//账户切换成功标志 | 11 | public static int changgeaccountflag;//账户切换成功标志 |
12 | public static int changeinfoflag;//1提交个人信息2是提交版本信息 | 12 | public static int changeinfoflag;//1提交个人信息2是提交版本信息 |
13 | public static int cardintentflag;//1跳转绑定二维码2跳转开始界面 | ||
13 | } | 14 | } |
14 | 15 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.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.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.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 8 | import android.support.v4.app.Fragment; |
9 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
10 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
13 | import android.widget.Button; | 13 | import android.widget.Button; |
14 | import android.widget.EditText; | 14 | import android.widget.EditText; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | import android.widget.Toast; | 16 | import android.widget.Toast; |
17 | 17 | ||
18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; |
20 | import com.hjx.personalcenter.activity.MainActivity; | 20 | import com.hjx.personalcenter.activity.MainActivity; |
21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; | 21 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; |
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.util.AlertUtils; | 27 | import com.hjx.personalcenter.util.AlertUtils; |
28 | import com.hjx.personalcenter.util.GetDevicesUtil; | ||
28 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; | 29 | import com.hjx.personalcenter.util.PhoneNumCheckUtils; |
29 | 30 | ||
30 | import org.json.JSONException; | 31 | import org.json.JSONException; |
31 | import org.json.JSONObject; | 32 | import org.json.JSONObject; |
32 | 33 | ||
33 | /** | 34 | /** |
34 | * 登录 | 35 | * 登录 |
35 | * Created by h on 2017/8/8. | 36 | * Created by h on 2017/8/8. |
36 | */ | 37 | */ |
37 | 38 | ||
38 | public class LoginFragment extends Fragment implements View.OnClickListener { | 39 | public class LoginFragment extends Fragment implements View.OnClickListener { |
39 | private View mView; | 40 | private View mView; |
40 | private int type; | 41 | private int type; |
41 | private TextView tv_forget_pwd; | 42 | private TextView tv_forget_pwd; |
42 | private Button btn_login; | 43 | private Button btn_login; |
43 | private EditText phonenumber,login_pwwd; | 44 | private EditText phonenumber, login_pwwd; |
44 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 45 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
45 | Intent intent = new Intent(); | 46 | Intent intent = new Intent(); |
47 | |||
46 | public static LoginFragment newInstance(int type) { | 48 | public static LoginFragment newInstance(int type) { |
47 | LoginFragment fragment = new LoginFragment(); | 49 | LoginFragment fragment = new LoginFragment(); |
48 | Bundle bundle = new Bundle(); | 50 | Bundle bundle = new Bundle(); |
49 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 51 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
50 | fragment.setArguments(bundle); | 52 | fragment.setArguments(bundle); |
51 | return fragment; | 53 | return fragment; |
52 | 54 | ||
53 | } | 55 | } |
54 | Handler handler = new Handler(){ | 56 | |
57 | Handler handler = new Handler() { | ||
55 | @Override | 58 | @Override |
56 | public void handleMessage(Message msg) { | 59 | public void handleMessage(Message msg) { |
57 | super.handleMessage(msg); | 60 | super.handleMessage(msg); |
58 | 61 | ||
59 | switch (msg.what){ | 62 | switch (msg.what) { |
60 | case HttpCode.LOGIN_SUCESS: | 63 | case HttpCode.LOGIN_SUCESS: |
61 | JSONObject jsonObject; | 64 | JSONObject jsonObject; |
62 | String status; | 65 | String status; |
63 | try { | 66 | try { |
64 | jsonObject = new JSONObject((String) msg.obj); | 67 | jsonObject = new JSONObject((String) msg.obj); |
65 | status = jsonObject.getString("status"); | 68 | status = jsonObject.getString("status"); |
66 | if (status.equals("100")) { | 69 | if (status.equals("100")) { |
67 | String access_token = jsonObject.getString("access_token"); | 70 | String access_token = jsonObject.getString("access_token"); |
68 | String userId = jsonObject.getString("userId"); | 71 | String userId = jsonObject.getString("userId"); |
69 | final String name = phonenumber.getText().toString().trim(); | 72 | final String name = phonenumber.getText().toString().trim(); |
70 | final String pwd = login_pwwd.getText().toString().trim(); | 73 | final String pwd = login_pwwd.getText().toString().trim(); |
71 | // | 74 | // |
72 | try { | 75 | try { |
73 | long auserID = Long.parseLong(userId); | 76 | long auserID = Long.parseLong(userId); |
74 | //检测注册信息是否完整 | 77 | //检测注册信息是否完整 |
75 | HttpManager.getInstance().registerinfocheck(getActivity(),auserID,handler); | 78 | HttpManager.getInstance().registerinfocheck(getActivity(), auserID, handler); |
76 | //登录成功,保存登录数据并且获取个人信息 | 79 | //登录成功,保存登录数据并且获取个人信息 |
77 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); | 80 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, userId); |
78 | 81 | ||
79 | 82 | ||
80 | |||
81 | } catch (NumberFormatException e) { | 83 | } catch (NumberFormatException e) { |
82 | e.printStackTrace(); | 84 | e.printStackTrace(); |
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
86 | } else if (status.equals("200")) { | 88 | } else if (status.equals("200")) { |
87 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); | 89 | Toast.makeText(getActivity(), "用户名不存在!", Toast.LENGTH_LONG).show(); |
88 | return; | 90 | return; |
89 | } else if (status.equals("204")) { | 91 | } else if (status.equals("204")) { |
90 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); | 92 | Toast.makeText(getActivity(), "密码错误!", Toast.LENGTH_LONG).show(); |
91 | } else { | 93 | } else { |
92 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); | 94 | Toast.makeText(getActivity(), "登录失败!请检查网络", Toast.LENGTH_LONG).show(); |
93 | 95 | ||
94 | 96 | ||
95 | } | 97 | } |
96 | } catch (JSONException e) { | 98 | } catch (JSONException e) { |
97 | e.printStackTrace(); | 99 | e.printStackTrace(); |
98 | } | 100 | } |
99 | break; | 101 | break; |
100 | case HttpCode.REGISTER_SUCESS: | 102 | case HttpCode.REGISTER_SUCESS: |
101 | try { | 103 | try { |
102 | jsonObject = new JSONObject( (String) msg.obj); | 104 | jsonObject = new JSONObject((String) msg.obj); |
103 | status = jsonObject.optString("status"); | 105 | status = jsonObject.optString("status"); |
104 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); | 106 | JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); |
105 | boolean isRegisterInfoComplete =isregisterinfo.optBoolean("isRegisterInfoComplete"); | 107 | boolean isRegisterInfoComplete = isregisterinfo.optBoolean("isRegisterInfoComplete"); |
106 | if (status.equals("1")){ | 108 | if (status.equals("1")) { |
107 | if (!isRegisterInfoComplete){ | 109 | if (!isRegisterInfoComplete) { |
108 | Content.accountflag = 1; | 110 | Content.accountflag = 1; |
109 | Intent intent = new Intent(); | 111 | Intent intent = new Intent(); |
110 | intent.setClass(getActivity(), RegisterInfoActivity.class); | 112 | intent.setClass(getActivity(), RegisterInfoActivity.class); |
111 | getActivity().startActivity(intent); | 113 | getActivity().startActivity(intent); |
112 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 114 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
113 | }else { | 115 | } else { |
114 | String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | 116 | String deviceNumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
115 | try { | 117 | //是否填写保卡 |
116 | long auserID = Long.parseLong(userID); | 118 | HttpManager.getInstance().cardinfocheck(getActivity(), deviceNumber, handler); |
117 | //是否填写保卡 | ||
118 | HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | ||
119 | } catch (NumberFormatException e) { | ||
120 | e.printStackTrace(); | ||
121 | } | ||
122 | 119 | ||
123 | 120 | ||
124 | } | 121 | } |
125 | 122 | ||
126 | }else{ | 123 | } else { |
127 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 124 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
128 | } | 125 | } |
129 | 126 | ||
130 | } catch (JSONException e) { | 127 | } catch (JSONException e) { |
131 | e.printStackTrace(); | 128 | e.printStackTrace(); |
132 | } | 129 | } |
133 | 130 | ||
134 | break; | 131 | break; |
135 | case HttpCode.CHECKCARD: | 132 | case HttpCode.CHECKCARD: |
136 | try { | 133 | try { |
137 | jsonObject = new JSONObject( (String) msg.obj); | 134 | jsonObject = new JSONObject((String) msg.obj); |
138 | status = jsonObject.optString("status"); | 135 | status = jsonObject.optString("status"); |
139 | if (status.equals("1")){ | 136 | if (status.equals("1")) { |
140 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); | 137 | SaveParam.getInstance().saveLoginParam(getActivity(), "login", "true"); |
141 | Intent intent = new Intent(); | 138 | Intent intent = new Intent(); |
142 | intent.setClass(getActivity(), MainActivity.class); | 139 | intent.setClass(getActivity(), MainActivity.class); |
143 | getActivity().startActivity(intent); | 140 | getActivity().startActivity(intent); |
144 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 141 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
145 | 142 | ||
146 | }else if(status.equals("2001")){ | 143 | } else if (status.equals("2001")) { |
147 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); | 144 | ElectronicCardDialog.getInstance().show(getChildFragmentManager(), "ElectronicCardDialog"); |
148 | }else{ | 145 | } else { |
149 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | 146 | Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); |
150 | } | 147 | } |
151 | 148 | ||
152 | } catch (JSONException e) { | 149 | } catch (JSONException e) { |
153 | e.printStackTrace(); | 150 | e.printStackTrace(); |
154 | } | 151 | } |
155 | 152 | ||
156 | break; | 153 | break; |
157 | } | 154 | } |
158 | } | 155 | } |
159 | }; | 156 | }; |
160 | 157 | ||
161 | @Override | 158 | @Override |
162 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 159 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
163 | if (mView == null) { | 160 | if (mView == null) { |
164 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); | 161 | mView = inflater.inflate(R.layout.fragment_loginandregister_login, container, false); |
165 | initView(mView); | 162 | initView(mView); |
166 | initData(); | 163 | initData(); |
167 | setLister(); | 164 | setLister(); |
168 | 165 | ||
169 | 166 | ||
170 | } | 167 | } |
171 | return mView; | 168 | return mView; |
172 | } | 169 | } |
170 | |||
173 | //初始化 | 171 | //初始化 |
174 | private void initView(View mView) { | 172 | private void initView(View mView) { |
175 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); | 173 | tv_forget_pwd = (TextView) mView.findViewById(R.id.tv_forget_pwd); |
176 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); | 174 | phonenumber = (EditText) mView.findViewById(R.id.et_phonenumber); |
177 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); | 175 | login_pwwd = (EditText) mView.findViewById(R.id.et_password); |
178 | btn_login = (Button) mView.findViewById(R.id.btn_login); | 176 | btn_login = (Button) mView.findViewById(R.id.btn_login); |
179 | 177 | ||
180 | } | 178 | } |
179 | |||
181 | private void initData() { | 180 | private void initData() { |
182 | } | 181 | } |
182 | |||
183 | private void setLister() { | 183 | private void setLister() { |
184 | tv_forget_pwd.setOnClickListener(this); | 184 | tv_forget_pwd.setOnClickListener(this); |
185 | btn_login.setOnClickListener(this); | 185 | btn_login.setOnClickListener(this); |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | @Override | 189 | @Override |
190 | public void onClick(View v) { | 190 | public void onClick(View v) { |
191 | switch (v.getId()){ | 191 | switch (v.getId()) { |
192 | case R.id.tv_forget_pwd: | 192 | case R.id.tv_forget_pwd: |
193 | intent.setClass(getActivity(),ForgotPasswordActivity.class); | 193 | intent.setClass(getActivity(), ForgotPasswordActivity.class); |
194 | startActivity(intent); | 194 | startActivity(intent); |
195 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | 195 | getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); |
196 | break; | 196 | break; |
197 | case R.id.btn_login: | 197 | case R.id.btn_login: |
198 | login(); | 198 | login(); |
199 | break; | 199 | break; |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | private void login() { | 204 | private void login() { |
205 | final String name = phonenumber.getText().toString().trim(); | 205 | final String name = phonenumber.getText().toString().trim(); |
206 | final String pwd = login_pwwd.getText().toString().trim(); | 206 | final String pwd = login_pwwd.getText().toString().trim(); |
207 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { | 207 | if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd)) { |
208 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); | 208 | AlertUtils.showToast(getActivity(), "请输入手机号和密码"); |
209 | return; | 209 | return; |
210 | }else if (!PhoneNumCheckUtils.isPhone(name)){ | 210 | } else if (!PhoneNumCheckUtils.isPhone(name)) { |
211 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); | 211 | AlertUtils.showToast(getActivity(), "请输入正确的手机号"); |
212 | }else { | 212 | } else { |
213 | //登录接口 | 213 | //登录接口 |
214 | HttpManager.getInstance().login(name,pwd, getActivity(),handler); | 214 | HttpManager.getInstance().login(name, pwd, getActivity(), handler); |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
2 | 2 | ||
3 | import android.app.Activity; | ||
4 | import android.content.Context; | ||
5 | import android.graphics.Color; | 3 | import android.graphics.Color; |
6 | import android.os.Bundle; | 4 | import android.os.Bundle; |
7 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
8 | import android.support.v4.app.Fragment; | 6 | import android.support.v4.app.Fragment; |
7 | import android.support.v4.view.ViewPager; | ||
9 | import android.util.Log; | 8 | import android.util.Log; |
10 | import android.view.Gravity; | 9 | import android.view.Gravity; |
11 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
12 | import android.view.View; | 11 | import android.view.View; |
13 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
14 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
15 | import android.widget.EditText; | 14 | import android.widget.EditText; |
16 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
16 | import android.widget.LinearLayout; | ||
17 | import android.widget.TextView; | 17 | import android.widget.TextView; |
18 | 18 | ||
19 | import com.bigkoo.pickerview.TimePickerView; | 19 | import com.bigkoo.pickerview.TimePickerView; |
20 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | ||
21 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 22 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
22 | import com.hjx.personalcenter.customdialog.CountryDialog; | 23 | import com.hjx.personalcenter.customdialog.CountryDialog; |
23 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 24 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
24 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 25 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
25 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 26 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
26 | import com.hjx.personalcenter.db.SaveParam; | 27 | import com.hjx.personalcenter.db.SaveParam; |
27 | import com.hjx.personalcenter.http.HttpManager; | 28 | import com.hjx.personalcenter.http.HttpManager; |
28 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 29 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
29 | import com.hjx.personalcenter.model.CityInfo; | 30 | import com.hjx.personalcenter.model.CityInfo; |
30 | import com.hjx.personalcenter.model.CountyInfo; | 31 | import com.hjx.personalcenter.model.CountyInfo; |
31 | import com.hjx.personalcenter.model.GradeInfo; | 32 | import com.hjx.personalcenter.model.GradeInfo; |
32 | import com.hjx.personalcenter.model.ProvinceInfo; | 33 | import com.hjx.personalcenter.model.ProvinceInfo; |
33 | import com.hjx.personalcenter.model.SchoolInfo; | 34 | import com.hjx.personalcenter.model.SchoolInfo; |
34 | import com.hjx.personalcenter.util.AlertUtils; | 35 | import com.hjx.personalcenter.util.AlertUtils; |
35 | import com.hjx.personalcenter.util.BrithdayStar; | 36 | import com.hjx.personalcenter.util.BrithdayStar; |
36 | import com.hjx.personalcenter.util.GetDevicesUtil; | 37 | import com.hjx.personalcenter.util.GetDevicesUtil; |
37 | import com.mylhyl.circledialog.CircleDialog; | 38 | import com.mylhyl.circledialog.CircleDialog; |
38 | import com.mylhyl.circledialog.callback.ConfigDialog; | 39 | import com.mylhyl.circledialog.callback.ConfigDialog; |
39 | import com.mylhyl.circledialog.params.DialogParams; | 40 | import com.mylhyl.circledialog.params.DialogParams; |
40 | 41 | ||
41 | import org.apache.http.util.TextUtils; | 42 | import org.apache.http.util.TextUtils; |
42 | 43 | ||
43 | import java.text.SimpleDateFormat; | 44 | import java.text.SimpleDateFormat; |
44 | import java.util.ArrayList; | 45 | import java.util.ArrayList; |
45 | import java.util.Date; | 46 | import java.util.Date; |
46 | 47 | ||
47 | /** | 48 | /** |
48 | * Created by h on 2017/8/12. | 49 | * Created by h on 2017/8/12. |
49 | */ | 50 | */ |
50 | 51 | ||
51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 52 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 53 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
53 | private View mView; | 54 | private View mView; |
54 | private int type; | 55 | private int type; |
55 | private TimePickerView pvTime; | 56 | private TimePickerView pvTime; |
57 | private LinearLayout tv_version; | ||
56 | 58 | ||
57 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 59 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
58 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; | 60 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender, sub; |
59 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; | 61 | public static String TABLAYOUT_FRAGMENT = "presonfragment"; |
60 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; | 62 | private ImageView my_adress, my_sex, my_bthday, my_grade, my_school, ccancel; |
61 | 63 | ||
62 | 64 | ||
63 | public static PresonInfoFragment newInstance(int type) { | 65 | public static PresonInfoFragment newInstance(int type) { |
64 | PresonInfoFragment fragment = new PresonInfoFragment(); | 66 | PresonInfoFragment fragment = new PresonInfoFragment(); |
65 | Bundle bundle = new Bundle(); | 67 | Bundle bundle = new Bundle(); |
66 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 68 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
67 | fragment.setArguments(bundle); | 69 | fragment.setArguments(bundle); |
68 | return fragment; | 70 | return fragment; |
69 | 71 | ||
70 | } | 72 | } |
71 | 73 | ||
72 | @Override | 74 | @Override |
73 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 75 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
74 | if (mView == null) { | 76 | if (mView == null) { |
75 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 77 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
76 | initView(mView); | 78 | initView(mView); |
77 | initData(); | 79 | initData(); |
78 | setLister(); | 80 | setLister(); |
79 | initTimePicker(); | 81 | initTimePicker(); |
80 | 82 | ||
81 | 83 | ||
82 | } | 84 | } |
83 | return mView; | 85 | return mView; |
84 | } | 86 | } |
85 | 87 | ||
86 | //初始化 | 88 | //初始化 |
87 | private void initView(View mView) { | 89 | private void initView(View mView) { |
88 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 90 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
89 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 91 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
90 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 92 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
91 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 93 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
92 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 94 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
93 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 95 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
94 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 96 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
95 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 97 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
96 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); | 98 | my_adress = (ImageView) mView.findViewById(R.id.my_adress); |
97 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); | 99 | my_sex = (ImageView) mView.findViewById(R.id.my_sex); |
98 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); | 100 | my_bthday = (ImageView) mView.findViewById(R.id.my_bthday); |
99 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); | 101 | my_grade = (ImageView) mView.findViewById(R.id.my_grade); |
100 | my_school = (ImageView) mView.findViewById(R.id.my_school); | 102 | my_school = (ImageView) mView.findViewById(R.id.my_school); |
101 | sub = (TextView) mView.findViewById(R.id.presonal_sub); | 103 | sub = (TextView) mView.findViewById(R.id.presonal_sub); |
102 | ccancel = (ImageView) mView.findViewById(R.id.cancel); | 104 | ccancel = (ImageView) mView.findViewById(R.id.cancel); |
105 | tv_version = (LinearLayout) mView.findViewById(R.id.tv_version); | ||
103 | 106 | ||
104 | 107 | ||
105 | } | 108 | } |
106 | 109 | ||
107 | private void initData() { | 110 | private void initData() { |
108 | 111 | ||
109 | } | 112 | } |
110 | 113 | ||
111 | private void setLister() { | 114 | private void setLister() { |
112 | tv_sex.setOnClickListener(this); | 115 | tv_sex.setOnClickListener(this); |
113 | tv_useinfo_adress.setOnClickListener(this); | 116 | tv_useinfo_adress.setOnClickListener(this); |
114 | tv_useinfo_birthday.setOnClickListener(this); | 117 | tv_useinfo_birthday.setOnClickListener(this); |
115 | tv_useinfo_school.setOnClickListener(this); | 118 | tv_useinfo_school.setOnClickListener(this); |
116 | tv_useinfo_gender.setOnClickListener(this); | 119 | tv_useinfo_gender.setOnClickListener(this); |
117 | my_adress.setOnClickListener(this); | 120 | my_adress.setOnClickListener(this); |
118 | my_sex.setOnClickListener(this); | 121 | my_sex.setOnClickListener(this); |
119 | my_bthday.setOnClickListener(this); | 122 | my_bthday.setOnClickListener(this); |
120 | my_grade.setOnClickListener(this); | 123 | my_grade.setOnClickListener(this); |
121 | my_school.setOnClickListener(this); | 124 | my_school.setOnClickListener(this); |
122 | sub.setOnClickListener(this); | 125 | sub.setOnClickListener(this); |
126 | tv_version.setOnClickListener(this); | ||
123 | } | 127 | } |
124 | 128 | ||
125 | @Override | 129 | @Override |
126 | public void onClick(View v) { | 130 | public void onClick(View v) { |
127 | String presonal1 = tv_username1.getText().toString().trim(); | 131 | String presonal1 = tv_username1.getText().toString().trim(); |
128 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 132 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
129 | String presonal3 = tv_sex.getText().toString().trim(); | 133 | String presonal3 = tv_sex.getText().toString().trim(); |
130 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 134 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
131 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 135 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
132 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 136 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
133 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 137 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
134 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 138 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
135 | switch (v.getId()) { | 139 | switch (v.getId()) { |
136 | case R.id.tv_sex: | 140 | case R.id.tv_sex: |
137 | case R.id.my_sex: | 141 | case R.id.my_sex: |
138 | final String[] items = {"男", "女"}; | 142 | final String[] items = {"男", "女"}; |
139 | new CircleDialog.Builder(getActivity()) | 143 | new CircleDialog.Builder(getActivity()) |
140 | .configDialog(new ConfigDialog() { | 144 | .configDialog(new ConfigDialog() { |
141 | @Override | 145 | @Override |
142 | public void onConfig(DialogParams params) { | 146 | public void onConfig(DialogParams params) { |
143 | //增加弹出动画 | 147 | //增加弹出动画 |
144 | params.gravity = Gravity.CENTER; | 148 | params.gravity = Gravity.CENTER; |
145 | } | 149 | } |
146 | }) | 150 | }) |
147 | .setTitle("请选择性别") | 151 | .setTitle("请选择性别") |
148 | .setWidth(0.5f) | 152 | .setWidth(0.5f) |
149 | .setItems(items, new AdapterView.OnItemClickListener() { | 153 | .setItems(items, new AdapterView.OnItemClickListener() { |
150 | @Override | 154 | @Override |
151 | public void onItemClick(AdapterView<?> parent, View view, int | 155 | public void onItemClick(AdapterView<?> parent, View view, int |
152 | position, long id) { | 156 | position, long id) { |
153 | switch (position) { | 157 | switch (position) { |
154 | case 0: | 158 | case 0: |
155 | tv_sex.setText("男"); | 159 | tv_sex.setText("男"); |
156 | break; | 160 | break; |
157 | case 1: | 161 | case 1: |
158 | tv_sex.setText("女"); | 162 | tv_sex.setText("女"); |
159 | break; | 163 | break; |
160 | } | 164 | } |
161 | 165 | ||
162 | } | 166 | } |
163 | }) | 167 | }) |
164 | .show(); | 168 | .show(); |
165 | break; | 169 | break; |
166 | case R.id.tv_useinfo_adress: | 170 | case R.id.tv_useinfo_adress: |
167 | case R.id.my_adress: | 171 | case R.id.my_adress: |
168 | tv_useinfo_school.setText(""); | 172 | tv_useinfo_school.setText(""); |
169 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 173 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
170 | break; | 174 | break; |
171 | case R.id.tv_useinfo_birthday: | 175 | case R.id.tv_useinfo_birthday: |
172 | case R.id.my_bthday: | 176 | case R.id.my_bthday: |
173 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 177 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
174 | break; | 178 | break; |
175 | case R.id.tv_useinfo_school: | 179 | case R.id.tv_useinfo_school: |
176 | case R.id.my_school: | 180 | case R.id.my_school: |
177 | if (TextUtils.isEmpty(presonal4) || | 181 | if (TextUtils.isEmpty(presonal4) || |
178 | TextUtils.isEmpty(presonal7)) { | 182 | TextUtils.isEmpty(presonal7)) { |
179 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 183 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
180 | return; | 184 | return; |
181 | } else { | 185 | } else { |
182 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 186 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
183 | } | 187 | } |
184 | 188 | ||
185 | 189 | ||
186 | break; | 190 | break; |
187 | case R.id.tv_useinfo_gender: | 191 | case R.id.tv_useinfo_gender: |
188 | case R.id.my_grade: | 192 | case R.id.my_grade: |
189 | tv_useinfo_school.setText(""); | 193 | tv_useinfo_school.setText(""); |
190 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 194 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
191 | break; | 195 | break; |
192 | case R.id.cancel: | 196 | case R.id.cancel: |
193 | getActivity().finish(); | 197 | getActivity().finish(); |
194 | break; | 198 | break; |
199 | case R.id.tv_version: | ||
200 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | ||
201 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | ||
202 | @Override | ||
203 | public void gotoFragment(ViewPager viewPager) { | ||
204 | //fragment传递数据 | ||
205 | viewPager.setCurrentItem(1); | ||
206 | } | ||
207 | }); | ||
208 | mainActivity.forSkip(); | ||
209 | break; | ||
195 | case R.id.presonal_sub: | 210 | case R.id.presonal_sub: |
196 | Log.e("test", "你提交个人信息"); | 211 | Log.e("test", "你提交个人信息"); |
197 | if (TextUtils.isEmpty(presonal1) || | 212 | if (TextUtils.isEmpty(presonal1) || |
198 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 213 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
199 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || | 214 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
200 | TextUtils.isEmpty(presonal8)) { | 215 | TextUtils.isEmpty(presonal8)) { |
201 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 216 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
202 | return; | 217 | return; |
203 | } else { | 218 | } else { |
204 | 219 | ||
205 | int a = 0, b = 0; | 220 | int a = 0, b = 0; |
206 | int d = 1; | 221 | int d = 1; |
207 | Object schoolids; | 222 | Object schoolids; |
208 | Long f = null; | 223 | Long f = null; |
209 | //保存星座 | 224 | //保存星座 |
210 | BrithdayStar brithdayStar = new BrithdayStar(); | 225 | BrithdayStar brithdayStar = new BrithdayStar(); |
211 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 226 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
212 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 227 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
213 | 228 | ||
214 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 229 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
215 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 230 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
216 | if (regionId == null) { | 231 | if (regionId == null) { |
217 | regionId = regionId1; | 232 | regionId = regionId1; |
218 | } | 233 | } |
219 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | 234 | String grade = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
220 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | 235 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); |
221 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 236 | String type = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
222 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 237 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
223 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); | 238 | String devicenumber = GetDevicesUtil.getDevicesInfo(getActivity()).getDeviceNumber(); |
224 | String changeinfo = null; | 239 | String changeinfo = null; |
225 | if ("男".equals(presonal3)) { | 240 | if ("男".equals(presonal3)) { |
226 | changeinfo = "male"; | 241 | changeinfo = "male"; |
227 | } else { | 242 | } else { |
228 | changeinfo = "female"; | 243 | changeinfo = "female"; |
229 | } | 244 | } |
230 | try { | 245 | try { |
231 | a = Integer.parseInt(regionId); | 246 | a = Integer.parseInt(regionId); |
232 | b = Integer.parseInt(grade); | 247 | b = Integer.parseInt(grade); |
233 | if (TextUtils.isEmpty(presonal6)) { | 248 | if (TextUtils.isEmpty(presonal6)) { |
234 | schoolids = null; | 249 | schoolids = null; |
235 | } else { | 250 | } else { |
236 | schoolids = Long.parseLong(schoolid); | 251 | schoolids = Long.parseLong(schoolid); |
237 | } | 252 | } |
238 | d = Integer.parseInt(type); | 253 | d = Integer.parseInt(type); |
239 | f = Long.parseLong(userID); | 254 | f = Long.parseLong(userID); |
240 | //提交个人信息 | 255 | //提交个人信息 |
241 | HttpManager.getInstance().changepresonalinfo(getActivity(), | 256 | HttpManager.getInstance().changepresonalinfo(getActivity(), |
242 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); | 257 | f, d, presonal1, presonal5, b, a, schoolids, presonal8, changeinfo, presonal4 + presonal2, devicenumber); |
243 | 258 | ||
244 | } catch (Exception e) { | 259 | } catch (Exception e) { |
245 | e.printStackTrace(); | 260 | e.printStackTrace(); |
246 | } | 261 | } |
247 | 262 | ||
248 | break; | 263 | break; |
249 | 264 | ||
250 | } | 265 | } |
251 | } | 266 | } |
252 | } | 267 | } |
253 | 268 | ||
254 | //自定义时间选择器 | 269 | //自定义时间选择器 |
255 | private void initTimePicker() { | 270 | private void initTimePicker() { |
256 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 271 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
257 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 272 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
258 | // Calendar selectedDate = Calendar.getInstance(); | 273 | // Calendar selectedDate = Calendar.getInstance(); |
259 | // Calendar startDate = Calendar.getInstance(); | 274 | // Calendar startDate = Calendar.getInstance(); |
260 | // startDate.set(1900, 1, 1); | 275 | // startDate.set(1900, 1, 1); |
261 | // Calendar endDate = Calendar.getInstance(); | 276 | // Calendar endDate = Calendar.getInstance(); |
262 | // endDate.set(2100, 1, 1); | 277 | // endDate.set(2100, 1, 1); |
263 | //时间选择器 | 278 | //时间选择器 |
264 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 279 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
265 | @Override | 280 | @Override |
266 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 281 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
267 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 282 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
268 | /*btn_Time.setText(getTime(date));*/ | 283 | /*btn_Time.setText(getTime(date));*/ |
269 | TextView btn = (TextView) v; | 284 | TextView btn = (TextView) v; |
270 | btn.setText(getTime(date)); | 285 | btn.setText(getTime(date)); |
271 | } | 286 | } |
272 | }) | 287 | }) |
273 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 288 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
274 | .setType(new boolean[]{true, true, true, false, false, false}) | 289 | .setType(new boolean[]{true, true, true, false, false, false}) |
275 | .setLabel("", "", "", "", "", "") | 290 | .setLabel("", "", "", "", "", "") |
276 | .isCenterLabel(false) | 291 | .isCenterLabel(false) |
277 | .setDividerColor(Color.DKGRAY) | 292 | .setDividerColor(Color.DKGRAY) |
278 | .setContentSize(21) | 293 | .setContentSize(21) |
279 | // .setDate(selectedDate) | 294 | // .setDate(selectedDate) |
280 | // .setRangDate(startDate, endDate) | 295 | // .setRangDate(startDate, endDate) |
281 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 296 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
282 | .setDecorView(null) | 297 | .setDecorView(null) |
283 | .setTitleText("出生日期") | 298 | .setTitleText("出生日期") |
284 | .setTitleSize(22) | 299 | .setTitleSize(22) |
285 | .setCancelColor(Color.GRAY) | 300 | .setCancelColor(Color.GRAY) |
286 | .setSubCalSize(22) | 301 | .setSubCalSize(22) |
287 | .setDividerColor(Color.GRAY) | 302 | .setDividerColor(Color.GRAY) |
288 | .setSubmitColor(Color.GRAY) | 303 | .setSubmitColor(Color.GRAY) |
289 | .build(); | 304 | .build(); |
290 | } | 305 | } |
291 | 306 | ||
292 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 307 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
293 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 308 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
294 | return format.format(date); | 309 | return format.format(date); |
295 | } | 310 | } |
296 | 311 | ||
297 | @Override | 312 | @Override |
298 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 313 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
299 | String regionName = data.get(position).getRegionName(); | 314 | String regionName = data.get(position).getRegionName(); |
300 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 315 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
301 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 316 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
302 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 317 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
303 | tv_useinfo_adress.setText(""); | 318 | tv_useinfo_adress.setText(""); |
304 | tv_useinfo_adress.setText(provice + regionName); | 319 | tv_useinfo_adress.setText(provice + regionName); |
305 | 320 | ||
306 | 321 | ||
307 | } | 322 | } |
308 | 323 | ||
309 | @Override | 324 | @Override |
310 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 325 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
311 | String regionName = data.get(position).getRegionName(); | 326 | String regionName = data.get(position).getRegionName(); |
312 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 327 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
313 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 328 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
314 | tv_useinfo_adress.setText(""); | 329 | tv_useinfo_adress.setText(""); |
315 | tv_useinfo_adress.setText(provices + citys + regionName); | 330 | tv_useinfo_adress.setText(provices + citys + regionName); |
316 | 331 | ||
317 | } | 332 | } |
318 | 333 | ||
319 | @Override | 334 | @Override |
320 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 335 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
321 | String regionName = data.get(position).getName(); | 336 | String regionName = data.get(position).getName(); |
322 | tv_useinfo_gender.setText(regionName); | 337 | tv_useinfo_gender.setText(regionName); |
323 | } | 338 | } |
324 | 339 | ||
325 | @Override | 340 | @Override |
326 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 341 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
327 | String regionName = data.get(position).getRegionName(); | 342 | String regionName = data.get(position).getRegionName(); |
328 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 343 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
329 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 344 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
330 | tv_useinfo_adress.setText(""); | 345 | tv_useinfo_adress.setText(""); |
331 | tv_useinfo_adress.setText(regionName); | 346 | tv_useinfo_adress.setText(regionName); |
332 | } | 347 | } |
333 | 348 | ||
334 | @Override | 349 | @Override |
335 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 350 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
336 | String regionName = data.get(position).getSchoolName(); | 351 | String regionName = data.get(position).getSchoolName(); |
337 | tv_useinfo_school.setText(regionName); | 352 | tv_useinfo_school.setText(regionName); |
338 | 353 | ||
339 | 354 | ||
340 | } | 355 | } |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
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.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.util.Log; | 9 | import android.util.Log; |
9 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
10 | import android.view.View; | 11 | import android.view.View; |
11 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
12 | import android.widget.AdapterView; | 13 | import android.widget.AdapterView; |
13 | import android.widget.GridView; | 14 | import android.widget.GridView; |
14 | import android.widget.ImageView; | 15 | import android.widget.ImageView; |
16 | import android.widget.LinearLayout; | ||
15 | import android.widget.TextView; | 17 | import android.widget.TextView; |
16 | 18 | ||
17 | import com.facebook.drawee.view.SimpleDraweeView; | 19 | import com.facebook.drawee.view.SimpleDraweeView; |
18 | import com.hjx.personalcenter.R; | 20 | import com.hjx.personalcenter.R; |
21 | import com.hjx.personalcenter.activity.ChangePresonalInfoActivity; | ||
19 | import com.hjx.personalcenter.adapter.GridAdapter; | 22 | import com.hjx.personalcenter.adapter.GridAdapter; |
20 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 23 | import com.hjx.personalcenter.customdialog.VerSionDialog; |
21 | import com.hjx.personalcenter.db.SaveParam; | 24 | import com.hjx.personalcenter.db.SaveParam; |
22 | import com.hjx.personalcenter.http.HttpCode; | 25 | import com.hjx.personalcenter.http.HttpCode; |
23 | import com.hjx.personalcenter.http.HttpManager; | 26 | import com.hjx.personalcenter.http.HttpManager; |
24 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 27 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
25 | import com.hjx.personalcenter.model.DefautPublishInfo; | 28 | import com.hjx.personalcenter.model.DefautPublishInfo; |
26 | import com.hjx.personalcenter.model.VersionInfo; | 29 | import com.hjx.personalcenter.model.VersionInfo; |
27 | 30 | ||
28 | import java.util.ArrayList; | 31 | import java.util.ArrayList; |
29 | import java.util.List; | 32 | import java.util.List; |
30 | 33 | ||
31 | /** | 34 | /** |
32 | * Created by h on 2017/8/12. | 35 | * Created by h on 2017/8/12. |
33 | */ | 36 | */ |
34 | 37 | ||
35 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { | 38 | public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener, DialogCallBack.VersionCallBack { |
36 | private GridView gridView; | 39 | private GridView gridView; |
37 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); | 40 | private ArrayList<DefautPublishInfo.DataBean> defautPublishInfos = new ArrayList<>(); |
38 | private GridAdapter sim_adapter; | 41 | private GridAdapter sim_adapter; |
39 | private View mView; | 42 | private View mView; |
40 | private int type; | 43 | private int type; |
41 | private ImageView cances; | 44 | private ImageView cances; |
45 | private LinearLayout tv_presons; | ||
42 | private TextView publish, sub; | 46 | private TextView publish, sub; |
43 | private SimpleDraweeView simpleDraweeView; | 47 | private SimpleDraweeView simpleDraweeView; |
44 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; | 48 | public static String TABLAYOUT_FRAGMENT = "versionfragment"; |
45 | 49 | ||
46 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; | 50 | private String chinese, math,english,physics,chemistry,history,geography,political,biology,science; |
47 | public static VersionsInfoFragment newInstance(int type) { | 51 | public static VersionsInfoFragment newInstance(int type) { |
48 | VersionsInfoFragment fragment = new VersionsInfoFragment(); | 52 | VersionsInfoFragment fragment = new VersionsInfoFragment(); |
49 | Bundle bundle = new Bundle(); | 53 | Bundle bundle = new Bundle(); |
50 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 54 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
51 | fragment.setArguments(bundle); | 55 | fragment.setArguments(bundle); |
52 | return fragment; | 56 | return fragment; |
53 | 57 | ||
54 | } | 58 | } |
55 | 59 | ||
56 | Handler handler = new Handler() { | 60 | Handler handler = new Handler() { |
57 | @Override | 61 | @Override |
58 | public void handleMessage(Message msg) { | 62 | public void handleMessage(Message msg) { |
59 | super.handleMessage(msg); | 63 | super.handleMessage(msg); |
60 | switch (msg.what) { | 64 | switch (msg.what) { |
61 | case HttpCode.PUBLISH_SUCESS: | 65 | case HttpCode.PUBLISH_SUCESS: |
62 | defautPublishInfos.clear(); | 66 | defautPublishInfos.clear(); |
63 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); | 67 | defautPublishInfos.addAll((List<DefautPublishInfo.DataBean>) msg.obj); |
64 | sim_adapter.notifyDataSetChanged(); | 68 | sim_adapter.notifyDataSetChanged(); |
65 | for (int i = 0; i < defautPublishInfos.size(); i++) { | 69 | for (int i = 0; i < defautPublishInfos.size(); i++) { |
66 | String subject = defautPublishInfos.get(i).getSubject(); | 70 | String subject = defautPublishInfos.get(i).getSubject(); |
67 | if (subject.equals("语文")) { | 71 | if (subject.equals("语文")) { |
68 | chinese = defautPublishInfos.get(i).getPress(); | 72 | chinese = defautPublishInfos.get(i).getPress(); |
69 | } else if (subject.equals("数学")) { | 73 | } else if (subject.equals("数学")) { |
70 | math = defautPublishInfos.get(i).getPress(); | 74 | math = defautPublishInfos.get(i).getPress(); |
71 | } else if (subject.equals("英语")) { | 75 | } else if (subject.equals("英语")) { |
72 | english = defautPublishInfos.get(i).getPress(); | 76 | english = defautPublishInfos.get(i).getPress(); |
73 | } else if (subject.equals("物理")) { | 77 | } else if (subject.equals("物理")) { |
74 | physics = defautPublishInfos.get(i).getPress(); | 78 | physics = defautPublishInfos.get(i).getPress(); |
75 | } else if (subject.equals("化学")) { | 79 | } else if (subject.equals("化学")) { |
76 | chemistry = defautPublishInfos.get(i).getPress(); | 80 | chemistry = defautPublishInfos.get(i).getPress(); |
77 | } else if (subject.equals("历史")) { | 81 | } else if (subject.equals("历史")) { |
78 | history = defautPublishInfos.get(i).getPress(); | 82 | history = defautPublishInfos.get(i).getPress(); |
79 | } else if (subject.equals("地理")) { | 83 | } else if (subject.equals("地理")) { |
80 | geography = defautPublishInfos.get(i).getPress(); | 84 | geography = defautPublishInfos.get(i).getPress(); |
81 | } else if (subject.equals("政治")) { | 85 | } else if (subject.equals("政治")) { |
82 | political = defautPublishInfos.get(i).getPress(); | 86 | political = defautPublishInfos.get(i).getPress(); |
83 | }else if (subject.equals("生物")) { | 87 | }else if (subject.equals("生物")) { |
84 | biology = defautPublishInfos.get(i).getPress(); | 88 | biology = defautPublishInfos.get(i).getPress(); |
85 | }else if (subject.equals("科学")) { | 89 | }else if (subject.equals("科学")) { |
86 | science = defautPublishInfos.get(i).getPress(); | 90 | science = defautPublishInfos.get(i).getPress(); |
87 | } | 91 | } |
88 | } | 92 | } |
89 | break; | 93 | break; |
90 | } | 94 | } |
91 | } | 95 | } |
92 | }; | 96 | }; |
93 | 97 | ||
94 | @Override | 98 | @Override |
95 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 99 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
96 | if (mView == null) { | 100 | if (mView == null) { |
97 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); | 101 | mView = inflater.inflate(R.layout.fragment_changge_version_info, container, false); |
98 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 102 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
99 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); | 103 | String graderid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.GRADENS); |
100 | //子账户年级id | 104 | //子账户年级id |
101 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); | 105 | String graderidchilds = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSGRADENS); |
102 | //账户类型 | 106 | //账户类型 |
103 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 107 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
108 | String childID = SaveParam.getInstance().getCustomizeParam(getActivity(),SaveParam.CHILDSID); | ||
104 | try { | 109 | try { |
105 | int graderID; | 110 | Object auserID; |
106 | long auserID = Long.parseLong(userID); | 111 | int type; |
107 | if ("2".equals(accounts)) { | 112 | int graderIDs =Integer.parseInt(graderid); |
108 | graderID = Integer.parseInt(graderidchilds); | 113 | if ("2".equals(accounts)){ |
109 | } else { | 114 | type=Integer.parseInt(accounts); |
110 | graderID = Integer.parseInt(graderid); | 115 | auserID =childID; |
116 | }else { | ||
117 | type =Integer.parseInt(accounts); | ||
118 | auserID =Long.parseLong(userID); | ||
111 | } | 119 | } |
112 | |||
113 | //获取版本信息 | 120 | //获取版本信息 |
114 | HttpManager.getInstance().getpublishinfo(getActivity(), auserID, graderID, handler); | 121 | HttpManager.getInstance().getpublishinfo(getActivity(),auserID,graderIDs,type,handler); |
115 | 122 | ||
116 | } catch (NumberFormatException e) { | 123 | } catch (NumberFormatException e) { |
117 | e.printStackTrace(); | 124 | e.printStackTrace(); |
118 | } | 125 | } |
119 | 126 | ||
120 | initView(mView); | 127 | initView(mView); |
121 | initData(); | 128 | initData(); |
122 | setLister(); | 129 | setLister(); |
123 | 130 | ||
124 | 131 | ||
125 | } | 132 | } |
126 | return mView; | 133 | return mView; |
127 | } | 134 | } |
128 | 135 | ||
129 | //初始化 | 136 | //初始化 |
130 | private void initView(View mView) { | 137 | private void initView(View mView) { |
131 | gridView = (GridView) mView.findViewById(R.id.grideview); | 138 | gridView = (GridView) mView.findViewById(R.id.grideview); |
132 | cances = (ImageView) mView.findViewById(R.id.cancel); | 139 | cances = (ImageView) mView.findViewById(R.id.cancel); |
133 | sub = (TextView) mView.findViewById(R.id.version_sub); | 140 | sub = (TextView) mView.findViewById(R.id.version_sub); |
141 | tv_presons = (LinearLayout) mView.findViewById(R.id.tv_presons); | ||
134 | 142 | ||
135 | } | 143 | } |
136 | 144 | ||
137 | private void initData() { | 145 | private void initData() { |
138 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); | 146 | sim_adapter = new GridAdapter(defautPublishInfos, getActivity()); |
139 | //配置适配器 | 147 | //配置适配器 |
140 | gridView.setAdapter(sim_adapter); | 148 | gridView.setAdapter(sim_adapter); |
141 | } | 149 | } |
142 | 150 | ||
143 | private void setLister() { | 151 | private void setLister() { |
144 | gridView.setOnItemClickListener(this); | 152 | gridView.setOnItemClickListener(this); |
145 | sub.setOnClickListener(this); | 153 | sub.setOnClickListener(this); |
154 | tv_presons.setOnClickListener(this); | ||
146 | } | 155 | } |
147 | 156 | ||
148 | @Override | 157 | @Override |
149 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | 158 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
150 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); | 159 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.SUBJECT, defautPublishInfos.get(position).getSubject()); |
151 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); | 160 | VerSionDialog.getInstance(this).show(getChildFragmentManager(), "VerSionDialog"); |
152 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); | 161 | simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.image_publish); |
153 | publish = (TextView) view.findViewById(R.id.tv_publish); | 162 | publish = (TextView) view.findViewById(R.id.tv_publish); |
154 | 163 | ||
155 | } | 164 | } |
156 | 165 | ||
157 | 166 | ||
158 | @Override | 167 | @Override |
159 | public void onResume() { | 168 | public void onResume() { |
160 | super.onResume(); | 169 | super.onResume(); |
161 | 170 | ||
162 | } | 171 | } |
163 | 172 | ||
164 | @Override | 173 | @Override |
165 | public void onClick(View v) { | 174 | public void onClick(View v) { |
166 | switch (v.getId()) { | 175 | switch (v.getId()) { |
167 | case R.id.version_sub: | 176 | case R.id.version_sub: |
168 | Log.e("test", "你提交版本信息"); | 177 | Log.e("test", "你提交版本信息"); |
169 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 178 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
170 | //子账户id | 179 | //子账户id |
171 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); | 180 | String childsidid = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.CHILDSID); |
172 | //账户类型 | 181 | //账户类型 |
173 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); | 182 | String accounts = SaveParam.getInstance().getCustomizeParam(getActivity(), SaveParam.ACCOUNT); |
174 | try { | 183 | try { |
175 | String id = null; | 184 | String id = null; |
176 | //String piblish = "清华大学出版社"; | 185 | //String piblish = "清华大学出版社"; |
177 | if ("2".equals(accounts)) { | 186 | if ("2".equals(accounts)) { |
178 | id = childsidid; | 187 | id = childsidid; |
179 | } else { | 188 | } else { |
180 | id = userID; | 189 | id = userID; |
181 | } | 190 | } |
182 | //修改版本信息 | 191 | //修改版本信息 |
183 | HttpManager.getInstance().changepublishinfo(getActivity(), id,math,english, chinese,physics,chemistry,history,geography,political,biology,science); | 192 | HttpManager.getInstance().changepublishinfo(getActivity(), id,chinese,math,english,physics,chemistry,history,geography,political,biology,science); |
184 | 193 | ||
185 | } catch (NumberFormatException e) { | 194 | } catch (NumberFormatException e) { |
186 | e.printStackTrace(); | 195 | e.printStackTrace(); |
187 | } | 196 | } |
188 | 197 | ||
189 | 198 | ||
190 | break; | 199 | break; |
200 | case R.id.tv_presons: | ||
201 | final ChangePresonalInfoActivity mainActivity = (ChangePresonalInfoActivity) getActivity(); | ||
202 | mainActivity.setFragment2Fragment(new ChangePresonalInfoActivity.Fragment2Fragment() { | ||
203 | @Override | ||
204 | public void gotoFragment(ViewPager viewPager) { | ||
205 | //fragment传递数据 | ||
206 | viewPager.setCurrentItem(0); | ||
207 | } | ||
208 | }); | ||
209 | mainActivity.forSkip(); | ||
210 | break; | ||
211 | |||
191 | case R.id.cancel: | 212 | case R.id.cancel: |
192 | getActivity().finish(); | 213 | getActivity().finish(); |
193 | break; | 214 | break; |
194 | } | 215 | } |
195 | 216 | ||
196 | } | 217 | } |
197 | 218 | ||
198 | @Override | 219 | @Override |
199 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | 220 | public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { |
200 | String imageurl = data.get(position).getPressCover(); | 221 | String imageurl = data.get(position).getPressCover(); |
201 | String publishs = data.get(position).getPressName(); | 222 | String publishs = data.get(position).getPressName(); |
202 | 223 | ||
203 | simpleDraweeView.setImageURI(imageurl); | 224 | simpleDraweeView.setImageURI(imageurl); |
204 | publish.setText(publishs); | 225 | publish.setText(publishs); |
205 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); | 226 | String subject = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SUBJECT); |
206 | Log.e("test", "选择的科目" + subject); | 227 | Log.e("test", "选择的科目" + subject); |
207 | if ("语文".equals(subject)) { | 228 | if ("语文".equals(subject)) { |
208 | chinese = publishs; | 229 | chinese = publishs; |
209 | } else if ("数学".equals(subject)) { | 230 | } else if ("数学".equals(subject)) { |
210 | math = publishs; | 231 | math = publishs; |
211 | }else if ("英语".equals(subject)) { | 232 | }else if ("英语".equals(subject)) { |
212 | english = publishs; | 233 | english = publishs; |
213 | }else if ("物理".equals(subject)) { | 234 | }else if ("物理".equals(subject)) { |
214 | physics = publishs; | 235 | physics = publishs; |
215 | }else if ("化学".equals(subject)) { | 236 | }else if ("化学".equals(subject)) { |
216 | chemistry = publishs; | 237 | chemistry = publishs; |
217 | }else if ("历史".equals(subject)) { | 238 | }else if ("历史".equals(subject)) { |
218 | history = publishs; | 239 | history = publishs; |
219 | }else if ("地理".equals(subject)) { | 240 | }else if ("地理".equals(subject)) { |
220 | geography = publishs; | 241 | geography = publishs; |
221 | }else if ("政治".equals(subject)) { | 242 | }else if ("政治".equals(subject)) { |
222 | political = publishs; | 243 | political = publishs; |
223 | }else if ("生物".equals(subject)) { | 244 | }else if ("生物".equals(subject)) { |
224 | biology = publishs; | 245 | biology = publishs; |
225 | }else if ("科学".equals(subject)) { | 246 | }else if ("科学".equals(subject)) { |
226 | science = publishs; | 247 | science = publishs; |
227 | } | 248 | } |
228 | 249 | ||
229 | } | 250 | } |
230 | } | 251 | } |
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.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
15 | import com.hjx.personalcenter.activity.BangDingCode; | ||
15 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 16 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
16 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 17 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
17 | import com.hjx.personalcenter.db.Content; | 18 | import com.hjx.personalcenter.db.Content; |
18 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
19 | import com.hjx.personalcenter.gson.GsonTool; | 20 | import com.hjx.personalcenter.gson.GsonTool; |
20 | import com.hjx.personalcenter.model.AppVersion; | 21 | import com.hjx.personalcenter.model.AppVersion; |
21 | import com.hjx.personalcenter.model.CardInfo; | 22 | import com.hjx.personalcenter.model.CardInfo; |
22 | import com.hjx.personalcenter.model.ChildsInfo; | 23 | import com.hjx.personalcenter.model.ChildsInfo; |
23 | import com.hjx.personalcenter.model.CityInfo; | 24 | import com.hjx.personalcenter.model.CityInfo; |
24 | import com.hjx.personalcenter.model.CountyInfo; | 25 | import com.hjx.personalcenter.model.CountyInfo; |
25 | import com.hjx.personalcenter.model.DefautPublishInfo; | 26 | import com.hjx.personalcenter.model.DefautPublishInfo; |
26 | import com.hjx.personalcenter.model.GradeInfo; | 27 | import com.hjx.personalcenter.model.GradeInfo; |
27 | import com.hjx.personalcenter.model.PesonalInfo; | 28 | import com.hjx.personalcenter.model.PesonalInfo; |
28 | import com.hjx.personalcenter.model.ProvinceInfo; | 29 | import com.hjx.personalcenter.model.ProvinceInfo; |
29 | import com.hjx.personalcenter.model.SchoolInfo; | 30 | import com.hjx.personalcenter.model.SchoolInfo; |
30 | import com.hjx.personalcenter.model.SignInfo; | 31 | import com.hjx.personalcenter.model.SignInfo; |
31 | import com.hjx.personalcenter.model.VersionInfo; | 32 | import com.hjx.personalcenter.model.VersionInfo; |
32 | import com.hjx.personalcenter.model.VideoInfo; | 33 | import com.hjx.personalcenter.model.VideoInfo; |
33 | import com.hjx.personalcenter.util.AlertUtils; | 34 | import com.hjx.personalcenter.util.AlertUtils; |
34 | import com.hjx.personalcenter.util.DialogPermission; | 35 | import com.hjx.personalcenter.util.DialogPermission; |
35 | import com.loopj.android.http.AsyncHttpResponseHandler; | 36 | import com.loopj.android.http.AsyncHttpResponseHandler; |
36 | import com.loopj.android.http.JsonHttpResponseHandler; | 37 | import com.loopj.android.http.JsonHttpResponseHandler; |
37 | import com.loopj.android.http.RequestParams; | 38 | import com.loopj.android.http.RequestParams; |
38 | 39 | ||
39 | import org.apache.http.Header; | 40 | import org.apache.http.Header; |
40 | import org.apache.http.entity.ByteArrayEntity; | 41 | import org.apache.http.entity.ByteArrayEntity; |
41 | import org.apache.http.message.BasicHeader; | 42 | import org.apache.http.message.BasicHeader; |
42 | import org.apache.http.protocol.HTTP; | 43 | import org.apache.http.protocol.HTTP; |
43 | import org.json.JSONException; | 44 | import org.json.JSONException; |
44 | import org.json.JSONObject; | 45 | import org.json.JSONObject; |
45 | 46 | ||
46 | import java.io.File; | 47 | import java.io.File; |
47 | import java.io.FileNotFoundException; | 48 | import java.io.FileNotFoundException; |
48 | import java.io.UnsupportedEncodingException; | 49 | import java.io.UnsupportedEncodingException; |
49 | import java.util.ArrayList; | 50 | import java.util.ArrayList; |
50 | import java.util.List; | 51 | import java.util.List; |
51 | 52 | ||
52 | public class HttpManager { | 53 | public class HttpManager { |
53 | private static HttpManager instance; | 54 | private static HttpManager instance; |
54 | private ProgressDialog mProgress = null; | 55 | private ProgressDialog mProgress = null; |
55 | 56 | ||
56 | public static HttpManager getInstance() { | 57 | public static HttpManager getInstance() { |
57 | if (instance == null) { | 58 | if (instance == null) { |
58 | instance = new HttpManager(); | 59 | instance = new HttpManager(); |
59 | } | 60 | } |
60 | return instance; | 61 | return instance; |
61 | } | 62 | } |
62 | 63 | ||
63 | 64 | ||
64 | //登录接口 | 65 | //登录接口 |
65 | 66 | ||
66 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 67 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
67 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 68 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
68 | true, true, null); | 69 | true, true, null); |
69 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 70 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
70 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 71 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
71 | @Override | 72 | @Override |
72 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 73 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
73 | closeProgress(); | 74 | closeProgress(); |
74 | Message msg = Message.obtain(); | 75 | Message msg = Message.obtain(); |
75 | msg.what = HttpCode.LOGIN_SUCESS; | 76 | msg.what = HttpCode.LOGIN_SUCESS; |
76 | msg.obj = new String(arg2); | 77 | msg.obj = new String(arg2); |
77 | handler.sendMessage(msg); | 78 | handler.sendMessage(msg); |
78 | 79 | ||
79 | 80 | ||
80 | } | 81 | } |
81 | 82 | ||
82 | @Override | 83 | @Override |
83 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 84 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
84 | closeProgress(); | 85 | closeProgress(); |
85 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 86 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
86 | } | 87 | } |
87 | }); | 88 | }); |
88 | } | 89 | } |
89 | 90 | ||
90 | //注册接口 | 91 | //注册接口 |
91 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 92 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
92 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 93 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
93 | false, true, null); | 94 | false, true, null); |
94 | JSONObject jsonObject = new JSONObject(); | 95 | JSONObject jsonObject = new JSONObject(); |
95 | ByteArrayEntity entity = null; | 96 | ByteArrayEntity entity = null; |
96 | try { | 97 | try { |
97 | jsonObject.put(HttpKey.USERNAME, username); | 98 | jsonObject.put(HttpKey.USERNAME, username); |
98 | jsonObject.put(HttpKey.PASSWORD, password); | 99 | jsonObject.put(HttpKey.PASSWORD, password); |
99 | jsonObject.put(HttpKey.SMSCODE, smscode); | 100 | jsonObject.put(HttpKey.SMSCODE, smscode); |
100 | jsonObject.put(HttpKey.SOURCE, source); | 101 | jsonObject.put(HttpKey.SOURCE, source); |
101 | Log.e("test", "jsonObject" + jsonObject); | 102 | Log.e("test", "jsonObject" + jsonObject); |
102 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 103 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
103 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 104 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
104 | } catch (JSONException e) { | 105 | } catch (JSONException e) { |
105 | e.printStackTrace(); | 106 | e.printStackTrace(); |
106 | } catch (UnsupportedEncodingException e) { | 107 | } catch (UnsupportedEncodingException e) { |
107 | e.printStackTrace(); | 108 | e.printStackTrace(); |
108 | } | 109 | } |
109 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 110 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
110 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 111 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
111 | @Override | 112 | @Override |
112 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 113 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
113 | super.onSuccess(statusCode, headers, response); | 114 | super.onSuccess(statusCode, headers, response); |
114 | closeProgress(); | 115 | closeProgress(); |
115 | Log.e("test", "onSuccess" + response); | 116 | Log.e("test", "onSuccess" + response); |
116 | Message msg = Message.obtain(); | 117 | Message msg = Message.obtain(); |
117 | msg.what = HttpCode.REGISTERED_SUCESS; | 118 | msg.what = HttpCode.REGISTERED_SUCESS; |
118 | msg.obj = response; | 119 | msg.obj = response; |
119 | handler.sendMessage(msg); | 120 | handler.sendMessage(msg); |
120 | 121 | ||
121 | } | 122 | } |
122 | 123 | ||
123 | @Override | 124 | @Override |
124 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 125 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
125 | super.onFailure(statusCode, headers, throwable, errorResponse); | 126 | super.onFailure(statusCode, headers, throwable, errorResponse); |
126 | closeProgress(); | 127 | closeProgress(); |
127 | Log.e("test", "onFailure" + errorResponse); | 128 | Log.e("test", "onFailure" + errorResponse); |
128 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 129 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
129 | } | 130 | } |
130 | 131 | ||
131 | }); | 132 | }); |
132 | } | 133 | } |
133 | 134 | ||
134 | //注册验证码 | 135 | //注册验证码 |
135 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 136 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
136 | RequestParams params = new RequestParams(); | 137 | RequestParams params = new RequestParams(); |
137 | params.put(HttpKey.TYPE, type); | 138 | params.put(HttpKey.TYPE, type); |
138 | params.put(HttpKey.MOBIL, mobile); | 139 | params.put(HttpKey.MOBIL, mobile); |
139 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 140 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
140 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 141 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
141 | 142 | ||
142 | @Override | 143 | @Override |
143 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 144 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
144 | Log.e("test", "onSuccess-----" + response); | 145 | Log.e("test", "onSuccess-----" + response); |
145 | Message msg = Message.obtain(); | 146 | Message msg = Message.obtain(); |
146 | msg.what = HttpCode.AUTHCODE_SUCESS; | 147 | msg.what = HttpCode.AUTHCODE_SUCESS; |
147 | msg.obj = response; | 148 | msg.obj = response; |
148 | handler.sendMessage(msg); | 149 | handler.sendMessage(msg); |
149 | } | 150 | } |
150 | 151 | ||
151 | @Override | 152 | @Override |
152 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 153 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
153 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 154 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
154 | } | 155 | } |
155 | }); | 156 | }); |
156 | } | 157 | } |
157 | 158 | ||
158 | 159 | ||
159 | //手机号是否注册 | 160 | //手机号是否注册 |
160 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 161 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
161 | RequestParams params = new RequestParams(); | 162 | RequestParams params = new RequestParams(); |
162 | params.put(HttpKey.USERNAME, mobile); | 163 | params.put(HttpKey.USERNAME, mobile); |
163 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 164 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
164 | @Override | 165 | @Override |
165 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 166 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
166 | Log.e("test", "isregistered" + response.toString()); | 167 | Log.e("test", "isregistered" + response.toString()); |
167 | Message msg = Message.obtain(); | 168 | Message msg = Message.obtain(); |
168 | msg.what = HttpCode.IS_REFISTER; | 169 | msg.what = HttpCode.IS_REFISTER; |
169 | msg.obj = response; | 170 | msg.obj = response; |
170 | handler.sendMessage(msg); | 171 | handler.sendMessage(msg); |
171 | 172 | ||
172 | } | 173 | } |
173 | 174 | ||
174 | @Override | 175 | @Override |
175 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 176 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
176 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 177 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
177 | 178 | ||
178 | } | 179 | } |
179 | }); | 180 | }); |
180 | } | 181 | } |
181 | 182 | ||
182 | //修改密码 | 183 | //修改密码 |
183 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 184 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
184 | RequestParams params = new RequestParams(); | 185 | RequestParams params = new RequestParams(); |
185 | params.put(HttpKey.USERNAME, username); | 186 | params.put(HttpKey.USERNAME, username); |
186 | params.put(HttpKey.OLDPASS, old_pwd1); | 187 | params.put(HttpKey.OLDPASS, old_pwd1); |
187 | params.put(HttpKey.NEWPASS, newpassword3); | 188 | params.put(HttpKey.NEWPASS, newpassword3); |
188 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 189 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
189 | HttpClient.getInstance().setTimeout(10 * 1000); | 190 | HttpClient.getInstance().setTimeout(10 * 1000); |
190 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 191 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
191 | @Override | 192 | @Override |
192 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 193 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
193 | try { | 194 | try { |
194 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 195 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
195 | String status = jsonObject.optString("status"); | 196 | String status = jsonObject.optString("status"); |
196 | if (status.equals("100")) { | 197 | if (status.equals("100")) { |
197 | Log.e("test", "onSuccess" + new String(bytes)); | 198 | Log.e("test", "onSuccess" + new String(bytes)); |
198 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 199 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
199 | SaveParam.getInstance().clearData((Activity) context); | 200 | SaveParam.getInstance().clearData((Activity) context); |
200 | Intent intent = new Intent(); | 201 | Intent intent = new Intent(); |
201 | intent.setClass(context, LoginAndRegisterActivity.class); | 202 | intent.setClass(context, LoginAndRegisterActivity.class); |
202 | ((Activity) context).startActivity(intent); | 203 | ((Activity) context).startActivity(intent); |
203 | ((Activity) context).finish(); | 204 | ((Activity) context).finish(); |
204 | } else { | 205 | } else { |
205 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 206 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
206 | } | 207 | } |
207 | } catch (JSONException e) { | 208 | } catch (JSONException e) { |
208 | e.printStackTrace(); | 209 | e.printStackTrace(); |
209 | } | 210 | } |
210 | } | 211 | } |
211 | 212 | ||
212 | @Override | 213 | @Override |
213 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 214 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
214 | Log.e("test", "onFailure" + new String(bytes)); | 215 | Log.e("test", "onFailure" + new String(bytes)); |
215 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 216 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
216 | } | 217 | } |
217 | }); | 218 | }); |
218 | 219 | ||
219 | } | 220 | } |
220 | 221 | ||
221 | //忘记密码 | 222 | //忘记密码 |
222 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 223 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
223 | RequestParams params = new RequestParams(); | 224 | RequestParams params = new RequestParams(); |
224 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 225 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
225 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 226 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
226 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 227 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
227 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 228 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
228 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 229 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
229 | @Override | 230 | @Override |
230 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 231 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
231 | try { | 232 | try { |
232 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 233 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
233 | String status = jsonObject.optString("status"); | 234 | String status = jsonObject.optString("status"); |
234 | if (status.equals("100")) { | 235 | if (status.equals("100")) { |
235 | Log.e("test", "onSuccess" + new String(bytes)); | 236 | Log.e("test", "onSuccess" + new String(bytes)); |
236 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 237 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
237 | ((Activity) context).finish(); | 238 | ((Activity) context).finish(); |
238 | } else { | 239 | } else { |
239 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | 240 | Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); |
240 | } | 241 | } |
241 | } catch (JSONException e) { | 242 | } catch (JSONException e) { |
242 | e.printStackTrace(); | 243 | e.printStackTrace(); |
243 | } | 244 | } |
244 | } | 245 | } |
245 | 246 | ||
246 | @Override | 247 | @Override |
247 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 248 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
248 | Log.e("test", "onFailure" + new String(bytes)); | 249 | Log.e("test", "onFailure" + new String(bytes)); |
249 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 250 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
250 | } | 251 | } |
251 | }); | 252 | }); |
252 | 253 | ||
253 | } | 254 | } |
254 | 255 | ||
255 | //保存用户登录信息 | 256 | //保存用户登录信息 |
256 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { | 257 | public void saveLoginInfo(Context context, String username, String password, String access_token, String userId) { |
257 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 258 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
258 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 259 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
259 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 260 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
260 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 261 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
261 | 262 | ||
262 | 263 | ||
263 | } | 264 | } |
264 | 265 | ||
265 | //提交保卡信息 | 266 | //提交保卡信息 |
266 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 267 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
267 | String buyAddress, String buyTime, String alterSaleCall, | 268 | String buyAddress, String buyTime, String alterSaleCall, |
268 | String productModel, String deviceNumber, String macAddress, | 269 | String productModel, String deviceNumber, String macAddress, |
269 | String mobilePhone) { | 270 | String mobilePhone) { |
270 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 271 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
271 | false, true, null); | 272 | false, true, null); |
272 | RequestParams params = new RequestParams(); | 273 | RequestParams params = new RequestParams(); |
273 | 274 | ||
274 | params.put(HttpKey.USEID, userId); | 275 | params.put(HttpKey.USEID, userId); |
275 | params.put(HttpKey.CUSTOMENAME, customerName); | 276 | params.put(HttpKey.CUSTOMENAME, customerName); |
276 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 277 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
277 | params.put(HttpKey.BUYADREES, buyAddress); | 278 | params.put(HttpKey.BUYADREES, buyAddress); |
278 | params.put(HttpKey.BUYTIME, buyTime); | 279 | params.put(HttpKey.BUYTIME, buyTime); |
279 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 280 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
280 | params.put(HttpKey.PRODUCTMODEL, productModel); | 281 | params.put(HttpKey.PRODUCTMODEL, productModel); |
281 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 282 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
282 | params.put(HttpKey.MACADRESS, macAddress); | 283 | params.put(HttpKey.MACADRESS, macAddress); |
283 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 284 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
284 | 285 | ||
285 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 286 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
286 | 287 | ||
287 | Log.e("test", "params" + params); | 288 | Log.e("test", "params" + params); |
288 | HttpClient.getInstance().setTimeout(5 * 1000); | 289 | HttpClient.getInstance().setTimeout(5 * 1000); |
289 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 290 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
290 | @Override | 291 | @Override |
291 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 292 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
292 | JSONObject jsonObject = null; | 293 | JSONObject jsonObject = null; |
293 | closeProgress(); | 294 | closeProgress(); |
294 | try { | 295 | try { |
295 | jsonObject = new JSONObject(new String(bytes)); | 296 | jsonObject = new JSONObject(new String(bytes)); |
296 | String status = jsonObject.optString("status"); | 297 | String status = jsonObject.optString("status"); |
297 | if (status.equals("1")) { | 298 | if (status.equals("1")) { |
298 | Log.e("test", "onSuccess" + jsonObject); | 299 | Log.e("test", "onSuccess" + jsonObject); |
299 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 300 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
300 | Intent intent = new Intent(); | 301 | if (Content.cardintentflag ==1){ |
301 | intent.setClass((Activity) context, TheStartPageActivity.class); | 302 | Intent intent = new Intent(); |
302 | ((Activity) context).startActivity(intent); | 303 | intent.setClass((Activity) context, TheStartPageActivity.class); |
303 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 304 | ((Activity) context).startActivity(intent); |
304 | ((Activity) context).finish(); | 305 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
306 | ((Activity) context).finish(); | ||
307 | }else if (Content.cardintentflag ==2){ | ||
308 | Intent intent = new Intent(); | ||
309 | intent.setClass((Activity) context, BangDingCode.class); | ||
310 | ((Activity) context).startActivity(intent); | ||
311 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | ||
312 | ((Activity) context).finish(); | ||
313 | |||
314 | } | ||
315 | |||
316 | |||
305 | } else { | 317 | } else { |
306 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | 318 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
307 | } | 319 | } |
308 | } catch (JSONException e) { | 320 | } catch (JSONException e) { |
309 | e.printStackTrace(); | 321 | e.printStackTrace(); |
310 | } | 322 | } |
311 | 323 | ||
312 | 324 | ||
313 | } | 325 | } |
314 | 326 | ||
315 | @Override | 327 | @Override |
316 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 328 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
317 | Log.e("test", "onFailure" + (throwable)); | 329 | Log.e("test", "onFailure" + (throwable)); |
318 | closeProgress(); | 330 | closeProgress(); |
319 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | 331 | AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); |
320 | 332 | ||
321 | } | 333 | } |
322 | }); | 334 | }); |
323 | 335 | ||
324 | } | 336 | } |
325 | 337 | ||
326 | //获取保卡信息 | 338 | //获取保卡信息 |
327 | public void getcardinfo(final Context mContext, long userId, final Handler handler) { | 339 | public void getcardinfo(final Context mContext, String deviceNumber, final Handler handler) { |
328 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 340 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
329 | false, true, null); | 341 | false, true, null); |
330 | HttpClient.getInstance().setTimeout(5 * 1000); | 342 | HttpClient.getInstance().setTimeout(5 * 1000); |
331 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 343 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
332 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | 344 | HttpClient.getInstance().get(HttpUrl.getcardinfo + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
333 | @Override | 345 | @Override |
334 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 346 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
335 | closeProgress(); | 347 | closeProgress(); |
336 | Log.e("test", "保卡信息" + new String(arg2)); | 348 | Log.e("test", "保卡信息" + new String(arg2)); |
337 | try { | 349 | try { |
338 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 350 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
339 | int status = jsonObject.optInt("status"); | 351 | int status = jsonObject.optInt("status"); |
340 | if (status == 1) { | 352 | if (status == 1) { |
341 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 353 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
342 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 354 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
343 | Message msg = Message.obtain(); | 355 | Message msg = Message.obtain(); |
344 | msg.what = HttpCode.SUCHCARDINFO; | 356 | msg.what = HttpCode.SUCHCARDINFO; |
345 | msg.obj = schoolInfoBeanList; | 357 | msg.obj = schoolInfoBeanList; |
346 | handler.sendMessage(msg); | 358 | handler.sendMessage(msg); |
347 | 359 | ||
348 | 360 | ||
349 | } else { | 361 | } else { |
350 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 362 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
351 | 363 | ||
352 | } | 364 | } |
353 | } catch (JSONException e) { | 365 | } catch (JSONException e) { |
354 | e.printStackTrace(); | 366 | e.printStackTrace(); |
355 | } | 367 | } |
356 | 368 | ||
357 | } | 369 | } |
358 | 370 | ||
359 | @Override | 371 | @Override |
360 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 372 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
361 | closeProgress(); | 373 | closeProgress(); |
362 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 374 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
363 | } | 375 | } |
364 | }); | 376 | }); |
365 | } | 377 | } |
366 | 378 | ||
367 | //修改保卡信息电话 | 379 | //修改保卡信息电话 |
368 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 380 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
369 | RequestParams params = new RequestParams(); | 381 | RequestParams params = new RequestParams(); |
370 | params.put("userId", userId); | 382 | params.put("userId", userId); |
371 | params.put("customerPhone", customerPhone); | 383 | params.put("customerPhone", customerPhone); |
372 | params.put("authCode", authCode); | 384 | params.put("authCode", authCode); |
373 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 385 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
374 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 386 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
375 | @Override | 387 | @Override |
376 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 388 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
377 | try { | 389 | try { |
378 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 390 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
379 | String status = jsonObject.optString("status"); | 391 | String status = jsonObject.optString("status"); |
380 | if (status.equals("1")) { | 392 | if (status.equals("1")) { |
381 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 393 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
382 | if (Content.authcodeflag==2){ | 394 | if (Content.authcodeflag==2){ |
383 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | 395 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); |
384 | }else if (Content.authcodeflag==1){ | 396 | }else if (Content.authcodeflag==1){ |
385 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); | 397 | SaveParam.getInstance().saveLoginParam(mContext, "username", customerPhone); |
386 | }else { | 398 | }else { |
387 | AlertUtils.showToast(mContext, "修改未知的手机号"); | 399 | AlertUtils.showToast(mContext, "修改未知的手机号"); |
388 | } | 400 | } |
389 | ((Activity) mContext).finish(); | 401 | ((Activity) mContext).finish(); |
390 | } else if (status.equals("1001")) { | 402 | } else if (status.equals("1001")) { |
391 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 403 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
392 | } else { | 404 | } else { |
393 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 405 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
394 | } | 406 | } |
395 | } catch (JSONException e) { | 407 | } catch (JSONException e) { |
396 | e.printStackTrace(); | 408 | e.printStackTrace(); |
397 | } | 409 | } |
398 | } | 410 | } |
399 | 411 | ||
400 | @Override | 412 | @Override |
401 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 413 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
402 | Log.e("test", "onFailure" + new String(bytes)); | 414 | Log.e("test", "onFailure" + new String(bytes)); |
403 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 415 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
404 | } | 416 | } |
405 | }); | 417 | }); |
406 | } | 418 | } |
407 | 419 | ||
408 | //修改保卡信息地址 | 420 | //修改保卡信息地址 |
409 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 421 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
410 | RequestParams params = new RequestParams(); | 422 | RequestParams params = new RequestParams(); |
411 | params.put("userId", userId); | 423 | params.put("userId", userId); |
412 | params.put("customerPhone", customerPhone); | 424 | params.put("customerPhone", customerPhone); |
413 | params.put("authCode", authCode); | 425 | params.put("authCode", authCode); |
414 | params.put("customerAddress", customerAddress); | 426 | params.put("customerAddress", customerAddress); |
415 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 427 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
416 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 428 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
417 | @Override | 429 | @Override |
418 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 430 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
419 | try { | 431 | try { |
420 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 432 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
421 | String status = jsonObject.optString("status"); | 433 | String status = jsonObject.optString("status"); |
422 | if (status.equals("1")) { | 434 | if (status.equals("1")) { |
423 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | 435 | Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); |
424 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 436 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); |
425 | ((Activity) mContext).finish(); | 437 | ((Activity) mContext).finish(); |
426 | } else { | 438 | } else { |
427 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 439 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
428 | } | 440 | } |
429 | } catch (JSONException e) { | 441 | } catch (JSONException e) { |
430 | e.printStackTrace(); | 442 | e.printStackTrace(); |
431 | } | 443 | } |
432 | } | 444 | } |
433 | 445 | ||
434 | @Override | 446 | @Override |
435 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 447 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
436 | Log.e("test", "onFailure" + new String(bytes)); | 448 | Log.e("test", "onFailure" + new String(bytes)); |
437 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 449 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
438 | } | 450 | } |
439 | }); | 451 | }); |
440 | } | 452 | } |
441 | 453 | ||
442 | //验证是否保卡信息 | 454 | //验证是否保卡信息 |
443 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 455 | public void cardinfocheck(final Context mContext, String deviceNumber, final Handler handler) { |
444 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 456 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
445 | false, true, null); | 457 | false, true, null); |
446 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 458 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
447 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | 459 | HttpClient.getInstance().get(HttpUrl.cardcheck + "?deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
448 | @Override | 460 | @Override |
449 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 461 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
450 | Log.e("test", "---" + new String(arg2)); | 462 | Log.e("test", "---" + new String(arg2)); |
451 | closeProgress(); | 463 | closeProgress(); |
452 | Message msg = Message.obtain(); | 464 | Message msg = Message.obtain(); |
453 | msg.what = HttpCode.CHECKCARD; | 465 | msg.what = HttpCode.CHECKCARD; |
454 | msg.obj = new String(arg2); | 466 | msg.obj = new String(arg2); |
455 | handler.sendMessage(msg); | 467 | handler.sendMessage(msg); |
456 | 468 | ||
457 | 469 | ||
458 | } | 470 | } |
459 | 471 | ||
460 | @Override | 472 | @Override |
461 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 473 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
462 | closeProgress(); | 474 | closeProgress(); |
463 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 475 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
464 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 476 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
465 | } | 477 | } |
466 | }); | 478 | }); |
467 | } | 479 | } |
468 | 480 | ||
469 | ///获取年级 | 481 | ///获取年级 |
470 | public void getgrade(final Context mContext, final Handler handler) { | 482 | public void getgrade(final Context mContext, final Handler handler) { |
471 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 483 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
472 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 484 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
473 | @Override | 485 | @Override |
474 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 486 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
475 | Log.e("test", "年级" + new String(arg2)); | 487 | Log.e("test", "年级" + new String(arg2)); |
476 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 488 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
477 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 489 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
478 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | 490 | for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { |
479 | String name = gradeInfo.getData().get(i).getName(); | 491 | String name = gradeInfo.getData().get(i).getName(); |
480 | int id = gradeInfo.getData().get(i).getId(); | 492 | int id = gradeInfo.getData().get(i).getId(); |
481 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 493 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
482 | for (int j = 0; j < gradeinfoList.size(); j++) { | 494 | for (int j = 0; j < gradeinfoList.size(); j++) { |
483 | String secondname = gradeinfoList.get(j).getName(); | 495 | String secondname = gradeinfoList.get(j).getName(); |
484 | int secondid = gradeinfoList.get(j).getId(); | 496 | int secondid = gradeinfoList.get(j).getId(); |
485 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 497 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
486 | dataBean.setName(secondname); | 498 | dataBean.setName(secondname); |
487 | dataBean.setId(secondid); | 499 | dataBean.setId(secondid); |
488 | gradeInfoLists.add(dataBean); | 500 | gradeInfoLists.add(dataBean); |
489 | } | 501 | } |
490 | 502 | ||
491 | } | 503 | } |
492 | 504 | ||
493 | Message message = Message.obtain(); | 505 | Message message = Message.obtain(); |
494 | message.what = HttpCode.GRADER; | 506 | message.what = HttpCode.GRADER; |
495 | message.obj = gradeInfoLists; | 507 | message.obj = gradeInfoLists; |
496 | handler.sendMessage(message); | 508 | handler.sendMessage(message); |
497 | 509 | ||
498 | 510 | ||
499 | } | 511 | } |
500 | 512 | ||
501 | @Override | 513 | @Override |
502 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 514 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
503 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 515 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
504 | } | 516 | } |
505 | }); | 517 | }); |
506 | } | 518 | } |
507 | 519 | ||
508 | /** | 520 | /** |
509 | * 获取学校 | 521 | * 获取学校 |
510 | * | 522 | * |
511 | * @param mContext | 523 | * @param mContext |
512 | * @param regionId | 524 | * @param regionId |
513 | * @param gradeId | 525 | * @param gradeId |
514 | * @param handler | 526 | * @param handler |
515 | */ | 527 | */ |
516 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 528 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
517 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 529 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
518 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 530 | HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
519 | @Override | 531 | @Override |
520 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 532 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
521 | Log.e("test", "学校" + new String(arg2)); | 533 | Log.e("test", "学校" + new String(arg2)); |
522 | try { | 534 | try { |
523 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 535 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
524 | int status = jsonObject.optInt("status"); | 536 | int status = jsonObject.optInt("status"); |
525 | if (status == 1) { | 537 | if (status == 1) { |
526 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 538 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
527 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 539 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
528 | Message message = Message.obtain(); | 540 | Message message = Message.obtain(); |
529 | message.what = HttpCode.SCHOOL; | 541 | message.what = HttpCode.SCHOOL; |
530 | message.obj = schoolInfoBeanList; | 542 | message.obj = schoolInfoBeanList; |
531 | handler.sendMessage(message); | 543 | handler.sendMessage(message); |
532 | 544 | ||
533 | 545 | ||
534 | } else { | 546 | } else { |
535 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 547 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
536 | 548 | ||
537 | } | 549 | } |
538 | } catch (JSONException e) { | 550 | } catch (JSONException e) { |
539 | e.printStackTrace(); | 551 | e.printStackTrace(); |
540 | } | 552 | } |
541 | 553 | ||
542 | } | 554 | } |
543 | 555 | ||
544 | @Override | 556 | @Override |
545 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 557 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
546 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 558 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
547 | } | 559 | } |
548 | }); | 560 | }); |
549 | } | 561 | } |
550 | 562 | ||
551 | 563 | ||
552 | /** | 564 | /** |
553 | * 获取个人信息 | 565 | * 获取个人信息 |
554 | * | 566 | * |
555 | * @param mContext | 567 | * @param mContext |
556 | * @param userId | 568 | * @param userId |
557 | * @param handler | 569 | * @param handler |
558 | */ | 570 | */ |
559 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { | 571 | public void getpresonalinfo(final Context mContext, long userId, int type, final Handler handler) { |
560 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 572 | // mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
561 | // false, true, null); | 573 | // false, true, null); |
562 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 574 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
563 | HttpClient.getInstance().setConnectTimeout(5 * 1000); | 575 | HttpClient.getInstance().setConnectTimeout(5 * 1000); |
564 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 576 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
565 | @Override | 577 | @Override |
566 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 578 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
567 | closeProgress(); | 579 | closeProgress(); |
568 | Log.e("test", "个人信息" + new String(arg2)); | 580 | Log.e("test", "个人信息" + new String(arg2)); |
569 | try { | 581 | try { |
570 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 582 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
571 | int status = jsonObject.optInt("status"); | 583 | int status = jsonObject.optInt("status"); |
572 | if (status == 1) { | 584 | if (status == 1) { |
573 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 585 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
574 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 586 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
575 | Message message = Message.obtain(); | 587 | Message message = Message.obtain(); |
576 | message.what = HttpCode.GETINFO; | 588 | message.what = HttpCode.GETINFO; |
577 | message.obj = pesonalInfoBeanList; | 589 | message.obj = pesonalInfoBeanList; |
578 | handler.sendMessage(message); | 590 | handler.sendMessage(message); |
579 | 591 | ||
580 | 592 | ||
581 | } else { | 593 | } else { |
582 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 594 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
583 | 595 | ||
584 | } | 596 | } |
585 | } catch (JSONException e) { | 597 | } catch (JSONException e) { |
586 | e.printStackTrace(); | 598 | e.printStackTrace(); |
587 | } | 599 | } |
588 | 600 | ||
589 | 601 | ||
590 | } | 602 | } |
591 | 603 | ||
592 | @Override | 604 | @Override |
593 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 605 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
594 | closeProgress(); | 606 | closeProgress(); |
595 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 607 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
596 | } | 608 | } |
597 | }); | 609 | }); |
598 | } | 610 | } |
599 | 611 | ||
600 | //修改个人信息 | 612 | //修改个人信息 |
601 | public void changepresonalinfo(final Context mContext, Long id, int type | 613 | public void changepresonalinfo(final Context mContext, Long id, int type |
602 | , String name, String birthday, int gradeId, long regionId, | 614 | , String name, String birthday, int gradeId, long regionId, |
603 | Object schoolId, String qq, String gender | 615 | Object schoolId, String qq, String gender |
604 | , String regionName, String devicenumber) throws UnsupportedEncodingException { | 616 | , String regionName, String devicenumber) throws UnsupportedEncodingException { |
605 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 617 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
606 | false, true, null); | 618 | false, true, null); |
607 | RequestParams params = new RequestParams(); | 619 | RequestParams params = new RequestParams(); |
608 | 620 | ||
609 | params.put(HttpKey.USEID, id); | 621 | params.put(HttpKey.USEID, id); |
610 | params.put(HttpKey.TYPE, type); | 622 | params.put(HttpKey.TYPE, type); |
611 | params.put(HttpKey.NAME, name); | 623 | params.put(HttpKey.NAME, name); |
612 | params.put(HttpKey.BIRDays, birthday); | 624 | params.put(HttpKey.BIRDays, birthday); |
613 | params.put(HttpKey.GRADE, gradeId); | 625 | params.put(HttpKey.GRADE, gradeId); |
614 | params.put(HttpKey.REGION, regionId); | 626 | params.put(HttpKey.REGION, regionId); |
615 | params.put(HttpKey.SCHOOL, schoolId); | 627 | params.put(HttpKey.SCHOOL, schoolId); |
616 | params.put(HttpKey.QQ, qq); | 628 | params.put(HttpKey.QQ, qq); |
617 | params.put(HttpKey.GENDER, gender); | 629 | params.put(HttpKey.GENDER, gender); |
618 | params.put(HttpKey.REGIONNAME, regionName); | 630 | params.put(HttpKey.REGIONNAME, regionName); |
619 | params.put(HttpKey.DEVINUMBER, devicenumber); | 631 | params.put(HttpKey.DEVINUMBER, devicenumber); |
620 | Log.e("test", "个人信息" + params); | 632 | Log.e("test", "个人信息" + params); |
621 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 633 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
622 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { | 634 | HttpClient.getInstance().post(mContext, HttpUrl.changepresonalinfo, params, new JsonHttpResponseHandler() { |
623 | @Override | 635 | @Override |
624 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 636 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
625 | super.onSuccess(statusCode, headers, response); | 637 | super.onSuccess(statusCode, headers, response); |
626 | closeProgress(); | 638 | closeProgress(); |
627 | String status = response.optString("status"); | 639 | String status = response.optString("status"); |
628 | if (status.equals("1")) { | 640 | if (status.equals("1")) { |
629 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 641 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
630 | ((Activity) mContext).finish(); | 642 | ((Activity) mContext).finish(); |
631 | } else { | 643 | } else { |
632 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | 644 | AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); |
633 | } | 645 | } |
634 | 646 | ||
635 | } | 647 | } |
636 | 648 | ||
637 | @Override | 649 | @Override |
638 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 650 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
639 | super.onFailure(statusCode, headers, throwable, errorResponse); | 651 | super.onFailure(statusCode, headers, throwable, errorResponse); |
640 | closeProgress(); | 652 | closeProgress(); |
641 | Log.e("test", "onFailure" + errorResponse); | 653 | Log.e("test", "onFailure" + errorResponse); |
642 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 654 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
643 | } | 655 | } |
644 | 656 | ||
645 | }); | 657 | }); |
646 | } | 658 | } |
647 | //提交注册信息 | 659 | //提交注册信息 |
648 | public void subregisterinfo(final Context mContext, Long userId | 660 | public void subregisterinfo(final Context mContext, Long userId |
649 | , String name, int gradeId, long regionId, String regionName, Object schoolId, | 661 | , String name, int gradeId, long regionId, String regionName, Object schoolId, |
650 | String math, String english, String physics, String chinese, String chemistry, | 662 | String math, String english, String physics, String chinese, String chemistry, |
651 | String history, String geography, String political, String biology, String science, final Handler handler){ | 663 | String history, String geography, String political, String biology, String science, final Handler handler){ |
652 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 664 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
653 | false, true, null); | 665 | false, true, null); |
654 | RequestParams params = new RequestParams(); | 666 | RequestParams params = new RequestParams(); |
655 | 667 | ||
656 | params.put(HttpKey.USEID, userId); | 668 | params.put(HttpKey.USEID, userId); |
657 | params.put(HttpKey.NAME, name); | 669 | params.put(HttpKey.NAME, name); |
658 | params.put(HttpKey.GRADE, gradeId); | 670 | params.put(HttpKey.GRADE, gradeId); |
659 | params.put(HttpKey.REGION, regionId); | 671 | params.put(HttpKey.REGION, regionId); |
660 | params.put(HttpKey.SCHOOL, schoolId); | 672 | params.put(HttpKey.SCHOOL, schoolId); |
661 | params.put(HttpKey.REGIONNAME, regionName); | 673 | params.put(HttpKey.REGIONNAME, regionName); |
662 | params.put(HttpKey.MATH, math); | 674 | params.put(HttpKey.MATH, math); |
663 | params.put(HttpKey.ENGLISH, english); | 675 | params.put(HttpKey.ENGLISH, english); |
664 | params.put(HttpKey.PHYSICES, physics); | 676 | params.put(HttpKey.PHYSICES, physics); |
665 | params.put(HttpKey.CHINESE, chinese); | 677 | params.put(HttpKey.CHINESE, chinese); |
666 | params.put(HttpKey.CHEMISTRY, chemistry); | 678 | params.put(HttpKey.CHEMISTRY, chemistry); |
667 | params.put(HttpKey.HISTIRY, history); | 679 | params.put(HttpKey.HISTIRY, history); |
668 | params.put(HttpKey.GEOGRAPHY, geography); | 680 | params.put(HttpKey.GEOGRAPHY, geography); |
669 | params.put(HttpKey.POLITICAL, political); | 681 | params.put(HttpKey.POLITICAL, political); |
670 | params.put(HttpKey.BIOLOGY, biology); | 682 | params.put(HttpKey.BIOLOGY, biology); |
671 | params.put(HttpKey.SCIENCE, science); | 683 | params.put(HttpKey.SCIENCE, science); |
672 | 684 | ||
673 | Log.e("test", "注册信息" + params); | 685 | Log.e("test", "注册信息" + params); |
674 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 686 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
675 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { | 687 | HttpClient.getInstance().post(mContext, HttpUrl.submitregisterURL, params, new JsonHttpResponseHandler() { |
676 | @Override | 688 | @Override |
677 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 689 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
678 | super.onSuccess(statusCode, headers, response); | 690 | super.onSuccess(statusCode, headers, response); |
679 | closeProgress(); | 691 | closeProgress(); |
680 | Message message = Message.obtain(); | 692 | Message message = Message.obtain(); |
681 | message.what = HttpCode.REGISTERINFO_SUCESS; | 693 | message.what = HttpCode.REGISTERINFO_SUCESS; |
682 | message.obj = new String(String.valueOf(response)); | 694 | message.obj = new String(String.valueOf(response)); |
683 | handler.sendMessage(message); | 695 | handler.sendMessage(message); |
684 | 696 | ||
685 | } | 697 | } |
686 | 698 | ||
687 | @Override | 699 | @Override |
688 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 700 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
689 | super.onFailure(statusCode, headers, throwable, errorResponse); | 701 | super.onFailure(statusCode, headers, throwable, errorResponse); |
690 | closeProgress(); | 702 | closeProgress(); |
691 | Log.e("test", "onFailure" + errorResponse); | 703 | Log.e("test", "onFailure" + errorResponse); |
692 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 704 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
693 | } | 705 | } |
694 | 706 | ||
695 | }); | 707 | }); |
696 | } | 708 | } |
697 | //修改版本信息 | 709 | //修改版本信息 |
698 | public void changepublishinfo(final Context mContext, String userId, | 710 | public void changepublishinfo(final Context mContext, String userId, String chinese, |
699 | String math, String english, String physics, String chinese, String chemistry, | 711 | String math, String english, String physics, String chemistry, |
700 | String history, String geography, String political, String biology, String science){ | 712 | String history, String geography, String political, String biology, String science){ |
701 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 713 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
702 | false, true, null); | 714 | false, true, null); |
703 | RequestParams params = new RequestParams(); | 715 | RequestParams params = new RequestParams(); |
704 | params.put(HttpKey.USEID, userId); | 716 | params.put(HttpKey.USEID, userId); |
717 | params.put(HttpKey.CHINESE, chinese); | ||
705 | params.put(HttpKey.MATH, math); | 718 | params.put(HttpKey.MATH, math); |
706 | params.put(HttpKey.ENGLISH, english); | 719 | params.put(HttpKey.ENGLISH, english); |
707 | params.put(HttpKey.PHYSICES, physics); | 720 | params.put(HttpKey.PHYSICES, physics); |
708 | params.put(HttpKey.CHINESE, chinese); | ||
709 | params.put(HttpKey.CHEMISTRY, chemistry); | 721 | params.put(HttpKey.CHEMISTRY, chemistry); |
710 | params.put(HttpKey.HISTIRY, history); | 722 | params.put(HttpKey.HISTIRY, history); |
711 | params.put(HttpKey.GEOGRAPHY, geography); | 723 | params.put(HttpKey.GEOGRAPHY, geography); |
712 | params.put(HttpKey.POLITICAL, political); | 724 | params.put(HttpKey.POLITICAL, political); |
713 | params.put(HttpKey.BIOLOGY, biology); | 725 | params.put(HttpKey.BIOLOGY, biology); |
714 | params.put(HttpKey.SCIENCE, science); | 726 | params.put(HttpKey.SCIENCE, science); |
715 | 727 | ||
716 | Log.e("test", "版本信息信息" + params); | 728 | Log.e("test", "版本信息信息" + params); |
717 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 729 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
718 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { | 730 | HttpClient.getInstance().post(mContext, HttpUrl.chagepublishURL, params, new JsonHttpResponseHandler() { |
719 | @Override | 731 | @Override |
720 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 732 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
721 | super.onSuccess(statusCode, headers, response); | 733 | super.onSuccess(statusCode, headers, response); |
722 | closeProgress(); | 734 | closeProgress(); |
723 | String status = response.optString("status"); | 735 | String status = response.optString("status"); |
724 | if (status.equals("1")) { | 736 | if (status.equals("1")) { |
725 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); | 737 | Toast.makeText(mContext, "版本信息修改成功", Toast.LENGTH_LONG).show(); |
726 | ((Activity) mContext).finish(); | 738 | ((Activity) mContext).finish(); |
727 | } else { | 739 | } else { |
728 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 740 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
729 | } | 741 | } |
730 | 742 | ||
731 | } | 743 | } |
732 | 744 | ||
733 | @Override | 745 | @Override |
734 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 746 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
735 | super.onFailure(statusCode, headers, throwable, errorResponse); | 747 | super.onFailure(statusCode, headers, throwable, errorResponse); |
736 | closeProgress(); | 748 | closeProgress(); |
737 | Log.e("test", "onFailure" + errorResponse); | 749 | Log.e("test", "onFailure" + errorResponse); |
738 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 750 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
739 | } | 751 | } |
740 | 752 | ||
741 | }); | 753 | }); |
742 | } | 754 | } |
743 | 755 | ||
744 | //修改个性签名 | 756 | //修改个性签名 |
745 | public void changsignature(final Context mContext, long userId, int type, final String signature) { | 757 | public void changsignature(final Context mContext, long userId, int type, final String signature) { |
746 | RequestParams params = new RequestParams(); | 758 | RequestParams params = new RequestParams(); |
747 | params.put("userId", userId); | 759 | params.put("userId", userId); |
748 | params.put("type", type); | 760 | params.put("type", type); |
749 | params.put("signature", signature); | 761 | params.put("signature", signature); |
750 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 762 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
751 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 763 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
752 | @Override | 764 | @Override |
753 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 765 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
754 | try { | 766 | try { |
755 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 767 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
756 | String status = jsonObject.optString("status"); | 768 | String status = jsonObject.optString("status"); |
757 | if (status.equals("1")) { | 769 | if (status.equals("1")) { |
758 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 770 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
759 | } else { | 771 | } else { |
760 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 772 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
761 | } | 773 | } |
762 | } catch (JSONException e) { | 774 | } catch (JSONException e) { |
763 | e.printStackTrace(); | 775 | e.printStackTrace(); |
764 | } | 776 | } |
765 | } | 777 | } |
766 | 778 | ||
767 | @Override | 779 | @Override |
768 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 780 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
769 | Log.e("test", "onFailure" + new String(bytes)); | 781 | Log.e("test", "onFailure" + new String(bytes)); |
770 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 782 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
771 | } | 783 | } |
772 | }); | 784 | }); |
773 | } | 785 | } |
774 | 786 | ||
775 | /** | 787 | /** |
776 | * 获取个性签名 | 788 | * 获取个性签名 |
777 | * | 789 | * |
778 | * @param mContext | 790 | * @param mContext |
779 | * @param userId | 791 | * @param userId |
780 | * @param handler | 792 | * @param handler |
781 | */ | 793 | */ |
782 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { | 794 | public void getsignatures(final Context mContext, long userId, int type, final Handler handler) { |
783 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 795 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
784 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { | 796 | HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId + "&type=" + type, new AsyncHttpResponseHandler() { |
785 | @Override | 797 | @Override |
786 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 798 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
787 | Log.e("test", "个性签名" + new String(arg2)); | 799 | Log.e("test", "个性签名" + new String(arg2)); |
788 | try { | 800 | try { |
789 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 801 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
790 | int status = jsonObject.optInt("status"); | 802 | int status = jsonObject.optInt("status"); |
791 | if (status == 1) { | 803 | if (status == 1) { |
792 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 804 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
793 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 805 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
794 | Message message = Message.obtain(); | 806 | Message message = Message.obtain(); |
795 | message.what = HttpCode.SIGN; | 807 | message.what = HttpCode.SIGN; |
796 | message.obj = signInfoBeanList; | 808 | message.obj = signInfoBeanList; |
797 | handler.sendMessage(message); | 809 | handler.sendMessage(message); |
798 | 810 | ||
799 | 811 | ||
800 | } else if (status == 1000) { | 812 | } else if (status == 1000) { |
801 | //AlertUtils.showToast(mContext, "您还没有签名哦"); | 813 | //AlertUtils.showToast(mContext, "您还没有签名哦"); |
802 | 814 | ||
803 | } else { | 815 | } else { |
804 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 816 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
805 | } | 817 | } |
806 | } catch (JSONException e) { | 818 | } catch (JSONException e) { |
807 | e.printStackTrace(); | 819 | e.printStackTrace(); |
808 | } | 820 | } |
809 | 821 | ||
810 | 822 | ||
811 | } | 823 | } |
812 | 824 | ||
813 | @Override | 825 | @Override |
814 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 826 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
815 | Log.e("test", "失败原因" + arg3); | 827 | Log.e("test", "失败原因" + arg3); |
816 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 828 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
817 | } | 829 | } |
818 | }); | 830 | }); |
819 | } | 831 | } |
820 | 832 | ||
821 | /** | 833 | /** |
822 | * 用户反馈 | 834 | * 用户反馈 |
823 | * | 835 | * |
824 | * @param mContext | 836 | * @param mContext |
825 | * @param userId | 837 | * @param userId |
826 | * @param content | 838 | * @param content |
827 | * @param contact | 839 | * @param contact |
828 | * @param imgs | 840 | * @param imgs |
829 | * @param feedtype | 841 | * @param feedtype |
830 | * @throws UnsupportedEncodingException | 842 | * @throws UnsupportedEncodingException |
831 | */ | 843 | */ |
832 | public void feedback(final Context mContext, String userId, String content, | 844 | public void feedback(final Context mContext, String userId, String content, |
833 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { | 845 | String contact, String imgs, String feedtype) throws UnsupportedEncodingException { |
834 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | 846 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", |
835 | false, true, null); | 847 | false, true, null); |
836 | File file = new File(imgs); | 848 | File file = new File(imgs); |
837 | if (file.exists() && file.length() > 0) { | 849 | if (file.exists() && file.length() > 0) { |
838 | RequestParams params = new RequestParams(); | 850 | RequestParams params = new RequestParams(); |
839 | try { | 851 | try { |
840 | params.put("userId", userId); | 852 | params.put("userId", userId); |
841 | params.put("content", content); | 853 | params.put("content", content); |
842 | params.put("contact", contact); | 854 | params.put("contact", contact); |
843 | params.put("imgs", file); | 855 | params.put("imgs", file); |
844 | params.put("feedtype", feedtype); | 856 | params.put("feedtype", feedtype); |
845 | } catch (FileNotFoundException e) { | 857 | } catch (FileNotFoundException e) { |
846 | e.printStackTrace(); | 858 | e.printStackTrace(); |
847 | } | 859 | } |
848 | Log.e("test", "onSuccess" + params); | 860 | Log.e("test", "onSuccess" + params); |
849 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { | 861 | HttpClient.getInstance().post(HttpUrl.feedbackURL, params, new AsyncHttpResponseHandler() { |
850 | @Override | 862 | @Override |
851 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 863 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
852 | closeProgress(); | 864 | closeProgress(); |
853 | Log.e("test", "onSuccess" + new String(bytes)); | 865 | Log.e("test", "onSuccess" + new String(bytes)); |
854 | try { | 866 | try { |
855 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 867 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
856 | String status = jsonObject.optString("status"); | 868 | String status = jsonObject.optString("status"); |
857 | if (status.equals("1")) { | 869 | if (status.equals("1")) { |
858 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); | 870 | Toast.makeText(mContext, "您的宝贵意见已经提交成功。", Toast.LENGTH_LONG).show(); |
859 | ((Activity) mContext).finish(); | 871 | ((Activity) mContext).finish(); |
860 | } else { | 872 | } else { |
861 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 873 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
862 | } | 874 | } |
863 | } catch (JSONException e) { | 875 | } catch (JSONException e) { |
864 | e.printStackTrace(); | 876 | e.printStackTrace(); |
865 | } | 877 | } |
866 | } | 878 | } |
867 | 879 | ||
868 | @Override | 880 | @Override |
869 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 881 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
870 | closeProgress(); | 882 | closeProgress(); |
871 | Log.e("test", "错误信息" + new String(bytes)); | 883 | Log.e("test", "错误信息" + new String(bytes)); |
872 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 884 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
873 | 885 | ||
874 | } | 886 | } |
875 | }); | 887 | }); |
876 | } else { | 888 | } else { |
877 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 889 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
878 | } | 890 | } |
879 | } | 891 | } |
880 | 892 | ||
881 | /** | 893 | /** |
882 | * 查询子账户信息 | 894 | * 查询子账户信息 |
883 | * | 895 | * |
884 | * @param mContext | 896 | * @param mContext |
885 | * @param userId | 897 | * @param userId |
886 | * @param handler | 898 | * @param handler |
887 | */ | 899 | */ |
888 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { | 900 | public void getchildAccountinfo(final Context mContext, long userId, String deviceNumber, final Handler handler) { |
889 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", | 901 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取子账户信息...", |
890 | false, true, null); | 902 | false, true, null); |
891 | 903 | ||
892 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); | 904 | Log.e("test", "ID" + userId + "deviceNumber" + deviceNumber); |
893 | HttpClient.getInstance().setTimeout(5 * 1000); | 905 | HttpClient.getInstance().setTimeout(5 * 1000); |
894 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 906 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
895 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { | 907 | HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber, new AsyncHttpResponseHandler() { |
896 | @Override | 908 | @Override |
897 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 909 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
898 | closeProgress(); | 910 | closeProgress(); |
899 | Log.e("test", "子账户信息" + new String(arg2)); | 911 | Log.e("test", "子账户信息" + new String(arg2)); |
900 | try { | 912 | try { |
901 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 913 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
902 | int status = jsonObject.optInt("status"); | 914 | int status = jsonObject.optInt("status"); |
903 | if (status == 1) { | 915 | if (status == 1) { |
904 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 | 916 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
905 | Log.e("test", "子账户信息" + childsInfo); | 917 | Log.e("test", "子账户信息" + childsInfo); |
906 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | 918 | List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); |
907 | Log.e("test", "子账户信息" + schoolInfoBeanList); | 919 | Log.e("test", "子账户信息" + schoolInfoBeanList); |
908 | Message msg = Message.obtain(); | 920 | Message msg = Message.obtain(); |
909 | msg.what = HttpCode.CHILDS_SUCESS; | 921 | msg.what = HttpCode.CHILDS_SUCESS; |
910 | msg.obj = schoolInfoBeanList; | 922 | msg.obj = schoolInfoBeanList; |
911 | handler.sendMessage(msg); | 923 | handler.sendMessage(msg); |
912 | 924 | ||
913 | }else { | 925 | }else { |
914 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 926 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
915 | 927 | ||
916 | } | 928 | } |
917 | } catch (JSONException e) { | 929 | } catch (JSONException e) { |
918 | e.printStackTrace(); | 930 | e.printStackTrace(); |
919 | 931 | ||
920 | } | 932 | } |
921 | 933 | ||
922 | } | 934 | } |
923 | 935 | ||
924 | @Override | 936 | @Override |
925 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 937 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
926 | closeProgress(); | 938 | closeProgress(); |
927 | // Log.e("test", "错误信息" + new String(arg2)); | 939 | // Log.e("test", "错误信息" + new String(arg2)); |
928 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 940 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
929 | } | 941 | } |
930 | }); | 942 | }); |
931 | 943 | ||
932 | } | 944 | } |
933 | 945 | ||
934 | /** | 946 | /** |
935 | * 删除子账户信息 | 947 | * 删除子账户信息 |
936 | * | 948 | * |
937 | * @param mContext | 949 | * @param mContext |
938 | * @param subAccountId | 950 | * @param subAccountId |
939 | */ | 951 | */ |
940 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { | 952 | public void deletechildAccountinfo(final Context mContext, String subAccountId) { |
941 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", | 953 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
942 | false, true, null); | 954 | false, true, null); |
943 | HttpClient.getInstance().setTimeout(5 * 1000); | 955 | HttpClient.getInstance().setTimeout(5 * 1000); |
944 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 956 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
945 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | 957 | HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { |
946 | @Override | 958 | @Override |
947 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 959 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
948 | closeProgress(); | 960 | closeProgress(); |
949 | Log.e("test", "子账户信息" + new String(arg2)); | 961 | Log.e("test", "子账户信息" + new String(arg2)); |
950 | try { | 962 | try { |
951 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 963 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
952 | int status = jsonObject.optInt("status"); | 964 | int status = jsonObject.optInt("status"); |
953 | if (status == 1) { | 965 | if (status == 1) { |
954 | AlertUtils.showToast(mContext, "子账号删除成功!"); | 966 | AlertUtils.showToast(mContext, "子账号删除成功!"); |
955 | ((Activity) mContext).finish(); | 967 | ((Activity) mContext).finish(); |
956 | } else { | 968 | } else { |
957 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | 969 | AlertUtils.showToast(mContext, "你好,子账号删除失败!"); |
958 | 970 | ||
959 | } | 971 | } |
960 | } catch (JSONException e) { | 972 | } catch (JSONException e) { |
961 | e.printStackTrace(); | 973 | e.printStackTrace(); |
962 | } | 974 | } |
963 | 975 | ||
964 | } | 976 | } |
965 | 977 | ||
966 | @Override | 978 | @Override |
967 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 979 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
968 | closeProgress(); | 980 | closeProgress(); |
969 | Log.e("test", "错误信息" + new String(arg2)); | 981 | Log.e("test", "错误信息" + new String(arg2)); |
970 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 982 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
971 | } | 983 | } |
972 | }); | 984 | }); |
973 | 985 | ||
974 | } | 986 | } |
975 | 987 | ||
976 | /** | 988 | /** |
977 | * 添加子账户信息 | 989 | * 添加子账户信息 |
978 | */ | 990 | */ |
979 | public void addchildAccountinfo(final Context mContext, long parentId, String image, | 991 | public void addchildAccountinfo(final Context mContext, long parentId, String image, |
980 | String name, final Long grade, Object school, Long region | 992 | String name, final Long grade, Object school, Long region |
981 | , String deviceNumber, String regionName) { | 993 | , String deviceNumber, String regionName) { |
982 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", | 994 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
983 | false, true, null); | 995 | false, true, null); |
984 | RequestParams params = new RequestParams(); | 996 | RequestParams params = new RequestParams(); |
985 | 997 | ||
986 | params.put(HttpKey.PARENTID, parentId); | 998 | params.put(HttpKey.PARENTID, parentId); |
987 | params.put(HttpKey.IMAGE, image); | 999 | params.put(HttpKey.IMAGE, image); |
988 | params.put(HttpKey.NAME, name); | 1000 | params.put(HttpKey.NAME, name); |
989 | params.put(HttpKey.GRADE, grade); | 1001 | params.put(HttpKey.GRADE, grade); |
990 | params.put(HttpKey.SCHOOL, school); | 1002 | params.put(HttpKey.SCHOOL, school); |
991 | params.put(HttpKey.REGION, region); | 1003 | params.put(HttpKey.REGION, region); |
992 | params.put(HttpKey.DEVINUMBER, deviceNumber); | 1004 | params.put(HttpKey.DEVINUMBER, deviceNumber); |
993 | params.put(HttpKey.REGIONNAME, regionName); | 1005 | params.put(HttpKey.REGIONNAME, regionName); |
994 | 1006 | ||
995 | Log.e("test", "子账户信息" + params); | 1007 | Log.e("test", "子账户信息" + params); |
996 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 1008 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
997 | HttpClient.getInstance().setTimeout(5 * 1000); | 1009 | HttpClient.getInstance().setTimeout(5 * 1000); |
998 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1010 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
999 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | 1011 | HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { |
1000 | @Override | 1012 | @Override |
1001 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1013 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1002 | closeProgress(); | 1014 | closeProgress(); |
1003 | 1015 | ||
1004 | Log.e("test", "子账户信息" + new String(arg2)); | 1016 | Log.e("test", "子账户信息" + new String(arg2)); |
1005 | try { | 1017 | try { |
1006 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1018 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1007 | int status = jsonObject.optInt("status"); | 1019 | int status = jsonObject.optInt("status"); |
1008 | if (status == 1) { | 1020 | if (status == 1) { |
1009 | AlertUtils.showToast(mContext, "子账号添加成功!"); | 1021 | AlertUtils.showToast(mContext, "子账号添加成功!"); |
1010 | ((Activity) mContext).finish(); | 1022 | ((Activity) mContext).finish(); |
1011 | } else { | 1023 | } else { |
1012 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | 1024 | AlertUtils.showToast(mContext, "你好,子账号添加失败!"); |
1013 | 1025 | ||
1014 | } | 1026 | } |
1015 | } catch (JSONException e) { | 1027 | } catch (JSONException e) { |
1016 | e.printStackTrace(); | 1028 | e.printStackTrace(); |
1017 | } | 1029 | } |
1018 | 1030 | ||
1019 | } | 1031 | } |
1020 | 1032 | ||
1021 | @Override | 1033 | @Override |
1022 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1034 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1023 | closeProgress(); | 1035 | closeProgress(); |
1024 | Log.e("test", "错误信息" + new String(arg2)); | 1036 | Log.e("test", "错误信息" + new String(arg2)); |
1025 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1037 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1026 | } | 1038 | } |
1027 | }); | 1039 | }); |
1028 | 1040 | ||
1029 | } | 1041 | } |
1030 | 1042 | ||
1031 | /** | 1043 | /** |
1032 | * 切换子账户信息 | 1044 | * 切换子账户信息 |
1033 | * | 1045 | * |
1034 | * @param mContext | 1046 | * @param mContext |
1035 | * @param subAccountId | 1047 | * @param subAccountId |
1036 | */ | 1048 | */ |
1037 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId | 1049 | public void changechildAccountinfo(final Context mContext, String subAccountId, long userId |
1038 | , String deviceNumber, int type) { | 1050 | , String deviceNumber, int type) { |
1039 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | 1051 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1040 | false, true, null); | 1052 | false, true, null); |
1041 | HttpClient.getInstance().setTimeout(5 * 1000); | 1053 | HttpClient.getInstance().setTimeout(5 * 1000); |
1042 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1054 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1043 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId | 1055 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId |
1044 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { | 1056 | + "&deviceNumber=" + deviceNumber + "&type=" + type, new AsyncHttpResponseHandler() { |
1045 | @Override | 1057 | @Override |
1046 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1058 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1047 | closeProgress(); | 1059 | closeProgress(); |
1048 | Log.e("test", "子账户信息" + new String(arg2)); | 1060 | Log.e("test", "子账户信息" + new String(arg2)); |
1049 | try { | 1061 | try { |
1050 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1062 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1051 | int status = jsonObject.optInt("status"); | 1063 | int status = jsonObject.optInt("status"); |
1052 | if (status == 1) { | 1064 | if (status == 1) { |
1053 | AlertUtils.showToast(mContext, "子账号切换成功!"); | 1065 | AlertUtils.showToast(mContext, "子账号切换成功!"); |
1054 | ((Activity) mContext).finish(); | 1066 | ((Activity) mContext).finish(); |
1055 | 1067 | ||
1056 | } else { | 1068 | } else { |
1057 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | 1069 | AlertUtils.showToast(mContext, "你好,子账号切换失败!"); |
1058 | 1070 | ||
1059 | } | 1071 | } |
1060 | } catch (JSONException e) { | 1072 | } catch (JSONException e) { |
1061 | e.printStackTrace(); | 1073 | e.printStackTrace(); |
1062 | } | 1074 | } |
1063 | 1075 | ||
1064 | } | 1076 | } |
1065 | 1077 | ||
1066 | @Override | 1078 | @Override |
1067 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1079 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1068 | closeProgress(); | 1080 | closeProgress(); |
1069 | Log.e("test", "错误信息" + new String(arg2)); | 1081 | Log.e("test", "错误信息" + new String(arg2)); |
1070 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1082 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1071 | } | 1083 | } |
1072 | }); | 1084 | }); |
1073 | 1085 | ||
1074 | } | 1086 | } |
1075 | 1087 | ||
1076 | /** | 1088 | /** |
1077 | * 切换主账户信息 | 1089 | * 切换主账户信息 |
1078 | * | 1090 | * |
1079 | * @param mContext | 1091 | * @param mContext |
1080 | * @param type | 1092 | * @param type |
1081 | */ | 1093 | */ |
1082 | public void Accountinfo(final Context mContext, long userId | 1094 | public void Accountinfo(final Context mContext, long userId |
1083 | , String deviceNumber, int type) { | 1095 | , String deviceNumber, int type) { |
1084 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", | 1096 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换主账户...", |
1085 | false, true, null); | 1097 | false, true, null); |
1086 | HttpClient.getInstance().setTimeout(5 * 1000); | 1098 | HttpClient.getInstance().setTimeout(5 * 1000); |
1087 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1099 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1088 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber | 1100 | HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?userId=" + userId + "&deviceNumber=" + deviceNumber |
1089 | + "&type=" + type, new AsyncHttpResponseHandler() { | 1101 | + "&type=" + type, new AsyncHttpResponseHandler() { |
1090 | @Override | 1102 | @Override |
1091 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1103 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1092 | closeProgress(); | 1104 | closeProgress(); |
1093 | Log.e("test", "子账户信息" + new String(arg2)); | 1105 | Log.e("test", "子账户信息" + new String(arg2)); |
1094 | try { | 1106 | try { |
1095 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1107 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1096 | int status = jsonObject.optInt("status"); | 1108 | int status = jsonObject.optInt("status"); |
1097 | if (status == 1) { | 1109 | if (status == 1) { |
1098 | AlertUtils.showToast(mContext, "主账号切换成功!"); | 1110 | AlertUtils.showToast(mContext, "主账号切换成功!"); |
1099 | ((Activity) mContext).finish(); | 1111 | ((Activity) mContext).finish(); |
1100 | 1112 | ||
1101 | } else { | 1113 | } else { |
1102 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); | 1114 | AlertUtils.showToast(mContext, "你好,主账号切换失败!"); |
1103 | 1115 | ||
1104 | } | 1116 | } |
1105 | } catch (JSONException e) { | 1117 | } catch (JSONException e) { |
1106 | e.printStackTrace(); | 1118 | e.printStackTrace(); |
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | } | 1121 | } |
1110 | 1122 | ||
1111 | @Override | 1123 | @Override |
1112 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1124 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1113 | closeProgress(); | 1125 | closeProgress(); |
1114 | Log.e("test", "错误信息" + new String(arg2)); | 1126 | Log.e("test", "错误信息" + new String(arg2)); |
1115 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1127 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1116 | } | 1128 | } |
1117 | }); | 1129 | }); |
1118 | 1130 | ||
1119 | } | 1131 | } |
1120 | 1132 | ||
1121 | /** | 1133 | /** |
1122 | * 头像拍张 | 1134 | * 头像拍张 |
1123 | * | 1135 | * |
1124 | * @param mContext | 1136 | * @param mContext |
1125 | * @param userId | 1137 | * @param userId |
1126 | * @param img | 1138 | * @param img |
1127 | * @throws UnsupportedEncodingException | 1139 | * @throws UnsupportedEncodingException |
1128 | */ | 1140 | */ |
1129 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { | 1141 | public void header(final Context mContext, String userId, String type, String img) throws UnsupportedEncodingException { |
1130 | File file = new File(img); | 1142 | File file = new File(img); |
1131 | if (file.exists() && file.length() > 0) { | 1143 | if (file.exists() && file.length() > 0) { |
1132 | RequestParams params = new RequestParams(); | 1144 | RequestParams params = new RequestParams(); |
1133 | try { | 1145 | try { |
1134 | params.put("userId", userId); | 1146 | params.put("userId", userId); |
1135 | params.put("type", type); | 1147 | params.put("type", type); |
1136 | params.put("img", file); | 1148 | params.put("img", file); |
1137 | } catch (FileNotFoundException e) { | 1149 | } catch (FileNotFoundException e) { |
1138 | e.printStackTrace(); | 1150 | e.printStackTrace(); |
1139 | } | 1151 | } |
1140 | Log.e("test", "params" + params); | 1152 | Log.e("test", "params" + params); |
1141 | HttpClient.getInstance().setTimeout(5 * 1000); | 1153 | HttpClient.getInstance().setTimeout(5 * 1000); |
1142 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { | 1154 | HttpClient.getInstance().post(HttpUrl.headerURL, params, new AsyncHttpResponseHandler() { |
1143 | @Override | 1155 | @Override |
1144 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1156 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1145 | Log.e("test", "onSuccess" + new String(bytes)); | 1157 | Log.e("test", "onSuccess" + new String(bytes)); |
1146 | try { | 1158 | try { |
1147 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1159 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1148 | String status = jsonObject.optString("status"); | 1160 | String status = jsonObject.optString("status"); |
1149 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1161 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
1150 | String imagUrl = jsonObject1.optString("imgUrl"); | 1162 | String imagUrl = jsonObject1.optString("imgUrl"); |
1151 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1163 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
1152 | if (status.equals("1")) { | 1164 | if (status.equals("1")) { |
1153 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1165 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1154 | } else { | 1166 | } else { |
1155 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1167 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1156 | } | 1168 | } |
1157 | } catch (JSONException e) { | 1169 | } catch (JSONException e) { |
1158 | e.printStackTrace(); | 1170 | e.printStackTrace(); |
1159 | } | 1171 | } |
1160 | } | 1172 | } |
1161 | 1173 | ||
1162 | @Override | 1174 | @Override |
1163 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1175 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1164 | closeProgress(); | 1176 | closeProgress(); |
1165 | Log.e("test", "错误信息" + new String(bytes)); | 1177 | Log.e("test", "错误信息" + new String(bytes)); |
1166 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1178 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1167 | 1179 | ||
1168 | } | 1180 | } |
1169 | }); | 1181 | }); |
1170 | } else { | 1182 | } else { |
1171 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); | 1183 | Toast.makeText(mContext, "文件不存在", Toast.LENGTH_LONG).show(); |
1172 | } | 1184 | } |
1173 | } | 1185 | } |
1174 | /** | 1186 | /** |
1175 | * 头像默认 | 1187 | * 头像默认 |
1176 | * | 1188 | * |
1177 | * @param mContext | 1189 | * @param mContext |
1178 | * @param userId | 1190 | * @param userId |
1179 | * @param | 1191 | * @param |
1180 | * @throws UnsupportedEncodingException | 1192 | * @throws UnsupportedEncodingException |
1181 | */ | 1193 | */ |
1182 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { | 1194 | public void headerdeft(final Context mContext, String userId, String type,String defaultImg) throws UnsupportedEncodingException { |
1183 | RequestParams params = new RequestParams(); | 1195 | RequestParams params = new RequestParams(); |
1184 | params.put("userId", userId); | 1196 | params.put("userId", userId); |
1185 | params.put("type", type); | 1197 | params.put("type", type); |
1186 | params.put("defaultImg", defaultImg); | 1198 | params.put("defaultImg", defaultImg); |
1187 | Log.e("test", "params" + params); | 1199 | Log.e("test", "params" + params); |
1188 | HttpClient.getInstance().setTimeout(5 * 1000); | 1200 | HttpClient.getInstance().setTimeout(5 * 1000); |
1189 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { | 1201 | HttpClient.getInstance().post(HttpUrl.headerdefaultURL, params, new AsyncHttpResponseHandler() { |
1190 | @Override | 1202 | @Override |
1191 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 1203 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
1192 | Log.e("test", "onSuccess" + new String(bytes)); | 1204 | Log.e("test", "onSuccess" + new String(bytes)); |
1193 | try { | 1205 | try { |
1194 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 1206 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
1195 | String status = jsonObject.optString("status"); | 1207 | String status = jsonObject.optString("status"); |
1196 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); | 1208 | JSONObject jsonObject1 =jsonObject.getJSONObject("data"); |
1197 | String imagUrl = jsonObject1.optString("imgUrl"); | 1209 | String imagUrl = jsonObject1.optString("imgUrl"); |
1198 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); | 1210 | SaveParam.getInstance().saveLoginParam(mContext,SaveParam.HEADURL,imagUrl); |
1199 | if (status.equals("1")) { | 1211 | if (status.equals("1")) { |
1200 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); | 1212 | Toast.makeText(mContext, "头像上传成功。", Toast.LENGTH_LONG).show(); |
1201 | } else { | 1213 | } else { |
1202 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | 1214 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); |
1203 | } | 1215 | } |
1204 | } catch (JSONException e) { | 1216 | } catch (JSONException e) { |
1205 | e.printStackTrace(); | 1217 | e.printStackTrace(); |
1206 | } | 1218 | } |
1207 | } | 1219 | } |
1208 | 1220 | ||
1209 | @Override | 1221 | @Override |
1210 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 1222 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
1211 | closeProgress(); | 1223 | closeProgress(); |
1212 | Log.e("test", "错误信息" + new String(bytes)); | 1224 | Log.e("test", "错误信息" + new String(bytes)); |
1213 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1225 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1214 | 1226 | ||
1215 | } | 1227 | } |
1216 | }); | 1228 | }); |
1217 | } | 1229 | } |
1218 | 1230 | ||
1219 | /** | 1231 | /** |
1220 | * 检查注册信息是否完整 | 1232 | * 检查注册信息是否完整 |
1221 | * @param mContext | 1233 | * @param mContext |
1222 | * @param userId | 1234 | * @param userId |
1223 | */ | 1235 | */ |
1224 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | 1236 | public void registerinfocheck(final Context mContext, long userId, final Handler handler) { |
1225 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | 1237 | mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", |
1226 | false, true, null); | 1238 | false, true, null); |
1227 | HttpClient.getInstance().setTimeout(5 * 1000); | 1239 | HttpClient.getInstance().setTimeout(5 * 1000); |
1228 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1240 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1229 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId , new AsyncHttpResponseHandler() { | 1241 | HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId , new AsyncHttpResponseHandler() { |
1230 | @Override | 1242 | @Override |
1231 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1243 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1232 | closeProgress(); | 1244 | closeProgress(); |
1233 | Log.e("test", "注册信息" + new String(arg2)); | 1245 | Log.e("test", "注册信息" + new String(arg2)); |
1234 | Message msg = Message.obtain(); | 1246 | Message msg = Message.obtain(); |
1235 | msg.what = HttpCode.REGISTER_SUCESS; | 1247 | msg.what = HttpCode.REGISTER_SUCESS; |
1236 | msg.obj = new String(arg2); | 1248 | msg.obj = new String(arg2); |
1237 | handler.sendMessage(msg); | 1249 | handler.sendMessage(msg); |
1238 | 1250 | ||
1239 | } | 1251 | } |
1240 | 1252 | ||
1241 | @Override | 1253 | @Override |
1242 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1254 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1243 | closeProgress(); | 1255 | closeProgress(); |
1244 | // Log.e("test", "错误信息" + new String(arg2)); | 1256 | // Log.e("test", "错误信息" + new String(arg2)); |
1245 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1257 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1246 | 1258 | ||
1247 | } | 1259 | } |
1248 | }); | 1260 | }); |
1249 | 1261 | ||
1250 | } | 1262 | } |
1251 | /** | 1263 | /** |
1252 | * 获取最近学习视频 | 1264 | * 获取最近学习视频 |
1253 | * @param mContext | 1265 | * @param mContext |
1254 | * @param userId | 1266 | * @param userId |
1255 | */ | 1267 | */ |
1256 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { | 1268 | public void getstuyvidioinfo(final Context mContext, long userId, final Handler handler) { |
1257 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", | 1269 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取最近学习视频...", |
1258 | false, true, null); | 1270 | false, true, null); |
1259 | HttpClient.getInstance().setTimeout(5 * 1000); | 1271 | HttpClient.getInstance().setTimeout(5 * 1000); |
1260 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1272 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1261 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId , new AsyncHttpResponseHandler() { | 1273 | HttpClient.getInstance().get(HttpUrl.getvidioURL + "?userId=" + userId , new AsyncHttpResponseHandler() { |
1262 | @Override | 1274 | @Override |
1263 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1275 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1264 | closeProgress(); | 1276 | closeProgress(); |
1265 | Log.e("test", "近学习视频" + new String(arg2)); | 1277 | Log.e("test", "近学习视频" + new String(arg2)); |
1266 | try { | 1278 | try { |
1267 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1279 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1268 | int status = jsonObject.optInt("status"); | 1280 | int status = jsonObject.optInt("status"); |
1269 | if (status == 1) { | 1281 | if (status == 1) { |
1270 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 | 1282 | VideoInfo videoInfo = GsonTool.getPerson(new String(arg2), VideoInfo.class);//解析json数据 |
1271 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); | 1283 | List<VideoInfo.DataBean> schoolInfoBeanList = videoInfo.getData(); |
1272 | Message msg = Message.obtain(); | 1284 | Message msg = Message.obtain(); |
1273 | msg.what = HttpCode.GETVIDIO_SUCESS; | 1285 | msg.what = HttpCode.GETVIDIO_SUCESS; |
1274 | msg.obj = schoolInfoBeanList; | 1286 | msg.obj = schoolInfoBeanList; |
1275 | handler.sendMessage(msg); | 1287 | handler.sendMessage(msg); |
1276 | 1288 | ||
1277 | }else { | 1289 | }else { |
1278 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | 1290 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); |
1279 | 1291 | ||
1280 | } | 1292 | } |
1281 | } catch (JSONException e) { | 1293 | } catch (JSONException e) { |
1282 | e.printStackTrace(); | 1294 | e.printStackTrace(); |
1283 | 1295 | ||
1284 | } | 1296 | } |
1285 | 1297 | ||
1286 | } | 1298 | } |
1287 | 1299 | ||
1288 | @Override | 1300 | @Override |
1289 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1301 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1290 | closeProgress(); | 1302 | closeProgress(); |
1291 | // Log.e("test", "错误信息" + new String(arg2)); | 1303 | // Log.e("test", "错误信息" + new String(arg2)); |
1292 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1304 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1293 | 1305 | ||
1294 | } | 1306 | } |
1295 | }); | 1307 | }); |
1296 | 1308 | ||
1297 | } | 1309 | } |
1298 | 1310 | ||
1299 | 1311 | ||
1300 | /** | 1312 | /** |
1301 | * 系统升级 | 1313 | * 系统升级 |
1302 | * | 1314 | * |
1303 | * @param mContext | 1315 | * @param mContext |
1304 | * @param pid appName | 1316 | * @param pid appName |
1305 | */ | 1317 | */ |
1306 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 1318 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { |
1307 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", | 1319 | mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否升级版本...", |
1308 | false, true, null); | 1320 | false, true, null); |
1309 | HttpClient.getInstance().setTimeout(5 * 1000); | 1321 | HttpClient.getInstance().setTimeout(5 * 1000); |
1310 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1322 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1311 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | 1323 | HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { |
1312 | @Override | 1324 | @Override |
1313 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1325 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1314 | closeProgress(); | 1326 | closeProgress(); |
1315 | Log.e("test", "版本升级信息" + new String(arg2)); | 1327 | Log.e("test", "版本升级信息" + new String(arg2)); |
1316 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 | 1328 | AppVersion appVersion = GsonTool.getPerson(new String(arg2), AppVersion.class);//解析json数据 |
1317 | Message msg = Message.obtain(); | 1329 | Message msg = Message.obtain(); |
1318 | msg.what = HttpCode.APPUPDATE_SUCESS; | 1330 | msg.what = HttpCode.APPUPDATE_SUCESS; |
1319 | msg.obj = appVersion; | 1331 | msg.obj = appVersion; |
1320 | handler.sendMessage(msg); | 1332 | handler.sendMessage(msg); |
1321 | 1333 | ||
1322 | 1334 | ||
1323 | } | 1335 | } |
1324 | 1336 | ||
1325 | @Override | 1337 | @Override |
1326 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1338 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1327 | closeProgress(); | 1339 | closeProgress(); |
1328 | Log.e("test", "错误信息" + new String(arg2)); | 1340 | Log.e("test", "错误信息" + new String(arg2)); |
1329 | } | 1341 | } |
1330 | }); | 1342 | }); |
1331 | 1343 | ||
1332 | } | 1344 | } |
1333 | //版本信息 | 1345 | //版本信息 |
1334 | public void versioninfo(final Context mContext,String subjectName, final Handler handler) { | 1346 | public void versioninfo(final Context mContext,String subjectName, final Handler handler) { |
1335 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1347 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1336 | HttpClient.getInstance().get(HttpUrl.getversionURL+"?subjectName="+subjectName, new AsyncHttpResponseHandler() { | 1348 | HttpClient.getInstance().get(HttpUrl.getversionURL+"?subjectName="+subjectName, new AsyncHttpResponseHandler() { |
1337 | @Override | 1349 | @Override |
1338 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1350 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1339 | Log.e("test", "版本信息" + new String(arg2)); | 1351 | Log.e("test", "版本信息" + new String(arg2)); |
1340 | try { | 1352 | try { |
1341 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1353 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1342 | int status = jsonObject.optInt("status"); | 1354 | int status = jsonObject.optInt("status"); |
1343 | if (status == 1) { | 1355 | if (status == 1) { |
1344 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 | 1356 | VersionInfo versionInfo = GsonTool.getPerson(new String(arg2), VersionInfo.class);//解析json数据 |
1345 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); | 1357 | List<VersionInfo.DataBean> versionInfoList = versionInfo.getData(); |
1346 | Message message = Message.obtain(); | 1358 | Message message = Message.obtain(); |
1347 | message.what = HttpCode.VERSION_SUCESS; | 1359 | message.what = HttpCode.VERSION_SUCESS; |
1348 | message.obj = versionInfoList; | 1360 | message.obj = versionInfoList; |
1349 | handler.sendMessage(message); | 1361 | handler.sendMessage(message); |
1350 | 1362 | ||
1351 | } else if(status == 1000){ | 1363 | } else if(status == 1000){ |
1352 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); | 1364 | AlertUtils.showToast(mContext, "你好,该科目没有版本信息"); |
1353 | 1365 | ||
1354 | }else { | 1366 | }else { |
1355 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1367 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1356 | } | 1368 | } |
1357 | } catch (JSONException e) { | 1369 | } catch (JSONException e) { |
1358 | e.printStackTrace(); | 1370 | e.printStackTrace(); |
1359 | } | 1371 | } |
1360 | 1372 | ||
1361 | 1373 | ||
1362 | } | 1374 | } |
1363 | 1375 | ||
1364 | @Override | 1376 | @Override |
1365 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1377 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1366 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1378 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1367 | } | 1379 | } |
1368 | }); | 1380 | }); |
1369 | } | 1381 | } |
1370 | 1382 | ||
1371 | 1383 | ||
1372 | 1384 | ||
1373 | 1385 | ||
1374 | 1386 | ||
1375 | 1387 | ||
1376 | ///省级接口 | 1388 | ///省级接口 |
1377 | public void provices(final Context mContext, final Handler handler) { | 1389 | public void provices(final Context mContext, final Handler handler) { |
1378 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1390 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1379 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1391 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
1380 | @Override | 1392 | @Override |
1381 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1393 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1382 | Log.e("test", "省" + new String(arg2)); | 1394 | Log.e("test", "省" + new String(arg2)); |
1383 | try { | 1395 | try { |
1384 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1396 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1385 | int status = jsonObject.optInt("status"); | 1397 | int status = jsonObject.optInt("status"); |
1386 | if (status == 100) { | 1398 | if (status == 100) { |
1387 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1399 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
1388 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1400 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
1389 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1401 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
1390 | Message message = Message.obtain(); | 1402 | Message message = Message.obtain(); |
1391 | message.what = HttpCode.PROVICES; | 1403 | message.what = HttpCode.PROVICES; |
1392 | message.obj = provincesBeanList; | 1404 | message.obj = provincesBeanList; |
1393 | handler.sendMessage(message); | 1405 | handler.sendMessage(message); |
1394 | 1406 | ||
1395 | 1407 | ||
1396 | } else { | 1408 | } else { |
1397 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1409 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1398 | 1410 | ||
1399 | } | 1411 | } |
1400 | } catch (JSONException e) { | 1412 | } catch (JSONException e) { |
1401 | e.printStackTrace(); | 1413 | e.printStackTrace(); |
1402 | } | 1414 | } |
1403 | 1415 | ||
1404 | 1416 | ||
1405 | } | 1417 | } |
1406 | 1418 | ||
1407 | @Override | 1419 | @Override |
1408 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1420 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1409 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1421 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1410 | } | 1422 | } |
1411 | }); | 1423 | }); |
1412 | } | 1424 | } |
1413 | //获取版本信息接口 | 1425 | //获取版本信息接口 |
1414 | public void getpublishinfo(final Context mContext, long userId,int gradeId, final Handler handler) { | 1426 | public void getpublishinfo(final Context mContext, Object userId,int gradeId, int type,final Handler handler) { |
1415 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1427 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1416 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 1428 | HttpClient.getInstance().get(HttpUrl.getpublishURL + "?userId=" + userId+ "&gradeId=" + gradeId+ "&type=" + type, new AsyncHttpResponseHandler() { |
1417 | @Override | 1429 | @Override |
1418 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1430 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1419 | Log.e("test", "获取版本信息接口" + new String(arg2)); | 1431 | Log.e("test", "获取版本信息接口" + new String(arg2)); |
1420 | try { | 1432 | try { |
1421 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1433 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1422 | int status = jsonObject.optInt("status"); | 1434 | int status = jsonObject.optInt("status"); |
1423 | if (status == 1) { | 1435 | if (status == 1) { |
1424 | Gson gson = new Gson(); | 1436 | Gson gson = new Gson(); |
1425 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); | 1437 | DefautPublishInfo defautPublishInfo = gson.fromJson(new String(arg2), DefautPublishInfo.class); |
1426 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); | 1438 | List<DefautPublishInfo.DataBean> defautPublishInfoBeanList = defautPublishInfo.getData(); |
1427 | Message message = Message.obtain(); | 1439 | Message message = Message.obtain(); |
1428 | message.what = HttpCode.PUBLISH_SUCESS; | 1440 | message.what = HttpCode.PUBLISH_SUCESS; |
1429 | message.obj = defautPublishInfoBeanList; | 1441 | message.obj = defautPublishInfoBeanList; |
1430 | handler.sendMessage(message); | 1442 | handler.sendMessage(message); |
1431 | 1443 | ||
1432 | } else { | 1444 | } else { |
1433 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1445 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1434 | 1446 | ||
1435 | } | 1447 | } |
1436 | } catch (JSONException e) { | 1448 | } catch (JSONException e) { |
1437 | e.printStackTrace(); | 1449 | e.printStackTrace(); |
1438 | } | 1450 | } |
1439 | 1451 | ||
1440 | 1452 | ||
1441 | } | 1453 | } |
1442 | 1454 | ||
1443 | @Override | 1455 | @Override |
1444 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1456 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1445 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1457 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1446 | } | 1458 | } |
1447 | }); | 1459 | }); |
1448 | } | 1460 | } |
1449 | 1461 | ||
1450 | 1462 | ||
1451 | //市级接口 | 1463 | //市级接口 |
1452 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { | 1464 | public void cityinfo(final Context mContext, long regionId, final Handler handler) { |
1453 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1465 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1454 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1466 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1455 | @Override | 1467 | @Override |
1456 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1468 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1457 | Log.e("test", "市" + new String(arg2)); | 1469 | Log.e("test", "市" + new String(arg2)); |
1458 | try { | 1470 | try { |
1459 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1471 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1460 | int status = jsonObject.optInt("status"); | 1472 | int status = jsonObject.optInt("status"); |
1461 | if (status == 100) { | 1473 | if (status == 100) { |
1462 | Gson gson = new Gson(); | 1474 | Gson gson = new Gson(); |
1463 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1475 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
1464 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1476 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
1465 | Message message = Message.obtain(); | 1477 | Message message = Message.obtain(); |
1466 | message.what = HttpCode.CITYS; | 1478 | message.what = HttpCode.CITYS; |
1467 | message.obj = cityInfoBeanList; | 1479 | message.obj = cityInfoBeanList; |
1468 | handler.sendMessage(message); | 1480 | handler.sendMessage(message); |
1469 | 1481 | ||
1470 | } else { | 1482 | } else { |
1471 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1483 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1472 | 1484 | ||
1473 | } | 1485 | } |
1474 | } catch (JSONException e) { | 1486 | } catch (JSONException e) { |
1475 | e.printStackTrace(); | 1487 | e.printStackTrace(); |
1476 | } | 1488 | } |
1477 | 1489 | ||
1478 | 1490 | ||
1479 | } | 1491 | } |
1480 | 1492 | ||
1481 | @Override | 1493 | @Override |
1482 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1494 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1483 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1495 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1484 | } | 1496 | } |
1485 | }); | 1497 | }); |
1486 | } | 1498 | } |
1487 | 1499 | ||
1488 | //区县级接口 | 1500 | //区县级接口 |
1489 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1501 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
1490 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1502 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1491 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1503 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
1492 | @Override | 1504 | @Override |
1493 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1505 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1494 | Log.e("test", "区" + new String(arg2)); | 1506 | Log.e("test", "区" + new String(arg2)); |
1495 | try { | 1507 | try { |
1496 | JSONObject jsonObject = new JSONObject(new String(arg2)); | 1508 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1497 | int status = jsonObject.optInt("status"); | 1509 | int status = jsonObject.optInt("status"); |
1498 | if (status == 100) { | 1510 | if (status == 100) { |
1499 | Gson gson = new Gson(); | 1511 | Gson gson = new Gson(); |
1500 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1512 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
1501 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1513 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
1502 | Message message = Message.obtain(); | 1514 | Message message = Message.obtain(); |
1503 | message.what = HttpCode.COUNTRY; | 1515 | message.what = HttpCode.COUNTRY; |
1504 | message.obj = countyInfoInfoBeanList; | 1516 | message.obj = countyInfoInfoBeanList; |
1505 | handler.sendMessage(message); | 1517 | handler.sendMessage(message); |
1506 | } else { | 1518 | } else { |
1507 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | 1519 | AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); |
1508 | 1520 | ||
1509 | } | 1521 | } |
1510 | } catch (JSONException e) { | 1522 | } catch (JSONException e) { |
1511 | e.printStackTrace(); | 1523 | e.printStackTrace(); |
1512 | } | 1524 | } |
1513 | 1525 | ||
1514 | 1526 | ||
1515 | } | 1527 | } |
1516 | 1528 | ||
1517 | @Override | 1529 | @Override |
1518 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1530 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
1519 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | 1531 | AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); |
1520 | } | 1532 | } |
1521 | }); | 1533 | }); |
1522 | } | 1534 | } |
1523 | 1535 | ||
1524 | 1536 | ||
1525 | private void closeProgress() { | 1537 | private void closeProgress() { |
1526 | try { | 1538 | try { |
1527 | if (mProgress != null) { | 1539 | if (mProgress != null) { |
1528 | mProgress.dismiss(); | 1540 | mProgress.dismiss(); |
1529 | mProgress = null; | 1541 | mProgress = null; |
1530 | } | 1542 | } |
1531 | } catch (Exception e) { | 1543 | } catch (Exception e) { |
1532 | e.printStackTrace(); | 1544 | e.printStackTrace(); |
1533 | } | 1545 | } |
1534 | } | 1546 | } |
1535 | public boolean onKeyDown(int keyCode, KeyEvent event) | 1547 | public boolean onKeyDown(int keyCode, KeyEvent event) |
1536 | { | 1548 | { |
1537 | if (keyCode == KeyEvent.KEYCODE_BACK ) | 1549 | if (keyCode == KeyEvent.KEYCODE_BACK ) |
1538 | { | 1550 | { |
1539 | 1551 | ||
1540 | HttpManager.getInstance().closeProgress(); | 1552 | HttpManager.getInstance().closeProgress(); |
1541 | } | 1553 | } |
1542 | 1554 | ||
1543 | return false; | 1555 | return false; |
1544 | 1556 | ||
1545 | } | 1557 | } |
1546 | 1558 | ||
1547 | } | 1559 | } |
PersonalCenter/app/src/main/res/layout/activity_account_management.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: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/cancel" | 16 | android:id="@+id/cancel" |
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/account_management" | 29 | android:text="@string/account_management" |
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 | <LinearLayout | 34 | <LinearLayout |
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_margin="20dp" | 37 | android:layout_margin="20dp" |
38 | android:gravity="center_vertical" | 38 | android:gravity="center_vertical" |
39 | android:orientation="horizontal"> | 39 | android:orientation="horizontal"> |
40 | 40 | ||
41 | <View | 41 | <View |
42 | android:layout_width="5dp" | 42 | android:layout_width="5dp" |
43 | android:layout_height="20dp" | 43 | android:layout_height="20dp" |
44 | android:background="@color/login_text_blue"> | 44 | android:background="@color/login_text_blue"> |
45 | 45 | ||
46 | </View> | 46 | </View> |
47 | 47 | ||
48 | <TextView | 48 | <TextView |
49 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
51 | android:layout_marginLeft="5dp" | 51 | android:layout_marginLeft="5dp" |
52 | android:text="账户安全" | 52 | android:text="账户安全" |
53 | android:textSize="22sp" /> | 53 | android:textSize="22sp" /> |
54 | 54 | ||
55 | </LinearLayout> | 55 | </LinearLayout> |
56 | 56 | ||
57 | <LinearLayout | 57 | <LinearLayout |
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:layout_marginLeft="60dp" | 60 | android:layout_marginLeft="60dp" |
61 | android:orientation="vertical"> | 61 | android:orientation="vertical"> |
62 | 62 | ||
63 | <LinearLayout | 63 | <LinearLayout |
64 | android:layout_width="match_parent" | 64 | android:layout_width="match_parent" |
65 | android:layout_height="wrap_content"> | 65 | android:layout_height="wrap_content"> |
66 | 66 | ||
67 | 67 | ||
68 | <TextView | 68 | <TextView |
69 | android:layout_width="0dp" | 69 | android:layout_width="0dp" |
70 | android:layout_height="wrap_content" | 70 | android:layout_height="wrap_content" |
71 | android:layout_weight="1.5" | 71 | android:layout_weight="1.5" |
72 | android:text="当前绑定手机号" | 72 | android:text="当前绑定手机号" |
73 | android:textSize="22sp" /> | 73 | android:textSize="22sp" /> |
74 | 74 | ||
75 | <TextView | 75 | <TextView |
76 | android:id="@+id/cunt_username" | 76 | android:id="@+id/cunt_username" |
77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
78 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
79 | android:layout_marginLeft="50dp" | 79 | android:layout_marginLeft="50dp" |
80 | android:layout_weight="6" | 80 | android:layout_weight="6" |
81 | android:text="" | 81 | android:text="" |
82 | android:textSize="22sp" /> | 82 | android:textSize="22sp" /> |
83 | 83 | ||
84 | <TextView | 84 | <TextView |
85 | android:id="@+id/changBangding" | 85 | android:id="@+id/changBangding" |
86 | android:layout_width="0dp" | 86 | android:layout_width="0dp" |
87 | android:layout_height="wrap_content" | 87 | android:layout_height="wrap_content" |
88 | android:layout_weight="1" | 88 | android:layout_weight="1" |
89 | android:text="更换绑定" | 89 | android:text="更换绑定" |
90 | android:textSize="22sp" /> | 90 | android:textSize="22sp" /> |
91 | 91 | ||
92 | <ImageView | 92 | <ImageView |
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_weight="0.1" | 95 | android:layout_weight="0.1" |
96 | android:padding="10dp" | 96 | android:padding="10dp" |
97 | android:src="@mipmap/youjiantou" /> | 97 | android:src="@mipmap/youjiantou" /> |
98 | </LinearLayout> | 98 | </LinearLayout> |
99 | 99 | ||
100 | <LinearLayout | 100 | <LinearLayout |
101 | android:layout_width="match_parent" | 101 | android:layout_width="match_parent" |
102 | android:layout_height="wrap_content" | 102 | android:layout_height="wrap_content" |
103 | android:layout_marginTop="30dp"> | 103 | android:layout_marginTop="30dp"> |
104 | 104 | ||
105 | 105 | ||
106 | <TextView | 106 | <TextView |
107 | android:layout_width="0dp" | 107 | android:layout_width="0dp" |
108 | android:layout_height="wrap_content" | 108 | android:layout_height="wrap_content" |
109 | android:layout_weight="1.5" | 109 | android:layout_weight="1.5" |
110 | android:text="登录密码" | 110 | android:text="登录密码" |
111 | android:textSize="22sp" /> | 111 | android:textSize="22sp" /> |
112 | 112 | ||
113 | <TextView | 113 | <TextView |
114 | android:layout_width="0dp" | 114 | android:layout_width="0dp" |
115 | android:layout_height="wrap_content" | 115 | android:layout_height="wrap_content" |
116 | android:layout_marginLeft="50dp" | 116 | android:layout_marginLeft="50dp" |
117 | android:layout_weight="6" | 117 | android:layout_weight="6" |
118 | android:text="已设置" | 118 | android:text="已设置" |
119 | android:textSize="22sp" /> | 119 | android:textSize="22sp" /> |
120 | 120 | ||
121 | <TextView | 121 | <TextView |
122 | android:id="@+id/changpassword" | 122 | android:id="@+id/changpassword" |
123 | android:layout_width="0dp" | 123 | android:layout_width="0dp" |
124 | android:layout_height="wrap_content" | 124 | android:layout_height="wrap_content" |
125 | android:layout_weight="1" | 125 | android:layout_weight="1" |
126 | android:text="修改密码" | 126 | android:text="修改密码" |
127 | android:textSize="22sp" /> | 127 | android:textSize="22sp" /> |
128 | 128 | ||
129 | <ImageView | 129 | <ImageView |
130 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
131 | android:layout_height="wrap_content" | 131 | android:layout_height="wrap_content" |
132 | android:layout_weight="0.1" | 132 | android:layout_weight="0.1" |
133 | android:padding="10dp" | 133 | android:padding="10dp" |
134 | android:src="@mipmap/youjiantou" /> | 134 | android:src="@mipmap/youjiantou" /> |
135 | </LinearLayout> | 135 | </LinearLayout> |
136 | 136 | ||
137 | </LinearLayout> | 137 | </LinearLayout> |
138 | 138 | ||
139 | <View | 139 | <View |
140 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
141 | android:layout_height="0.7dp" | 141 | android:layout_height="0.7dp" |
142 | android:layout_margin="20dp" | 142 | android:layout_margin="20dp" |
143 | android:background="#FF909090" /> | 143 | android:background="#FF909090" /> |
144 | 144 | ||
145 | <LinearLayout | 145 | <LinearLayout |
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_margin="20dp" | 148 | android:layout_margin="20dp" |
149 | android:gravity="center_vertical" | 149 | android:gravity="center_vertical" |
150 | android:orientation="horizontal"> | 150 | android:orientation="horizontal"> |
151 | 151 | ||
152 | <View | 152 | <View |
153 | android:layout_width="5dp" | 153 | android:layout_width="5dp" |
154 | android:layout_height="20dp" | 154 | android:layout_height="20dp" |
155 | android:background="@color/login_text_blue"> | 155 | android:background="@color/login_text_blue"> |
156 | 156 | ||
157 | </View> | 157 | </View> |
158 | 158 | ||
159 | <TextView | 159 | <TextView |
160 | android:layout_width="wrap_content" | 160 | android:layout_width="wrap_content" |
161 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
162 | android:layout_marginLeft="5dp" | 162 | android:layout_marginLeft="5dp" |
163 | android:text="子账户管理" | 163 | android:text="子账户管理" |
164 | android:textSize="22sp" /> | 164 | android:textSize="22sp" /> |
165 | 165 | ||
166 | </LinearLayout> | 166 | </LinearLayout> |
167 | 167 | ||
168 | <LinearLayout | 168 | <LinearLayout |
169 | android:layout_width="match_parent" | 169 | android:layout_width="match_parent" |
170 | android:layout_height="match_parent" | 170 | android:layout_height="match_parent" |
171 | android:layout_marginLeft="30dp" | 171 | android:layout_marginLeft="30dp" |
172 | android:orientation="vertical"> | 172 | android:orientation="vertical"> |
173 | 173 | ||
174 | <LinearLayout | 174 | <LinearLayout |
175 | android:layout_width="match_parent" | 175 | android:layout_width="match_parent" |
176 | android:layout_height="wrap_content"> | 176 | android:layout_height="wrap_content"> |
177 | 177 | ||
178 | <LinearLayout | 178 | <LinearLayout |
179 | android:layout_width="0dp" | 179 | android:layout_width="0dp" |
180 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
181 | android:layout_weight="1"> | 181 | android:layout_weight="1"> |
182 | 182 | ||
183 | <LinearLayout | 183 | <LinearLayout |
184 | android:id="@+id/ll_zhu_backgrangd" | 184 | android:id="@+id/ll_zhu_backgrangd" |
185 | android:layout_width="wrap_content" | 185 | android:layout_width="wrap_content" |
186 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
187 | android:background="@drawable/corcle_blue_bg" | 187 | android:background="@drawable/corcle_blue_bg" |
188 | android:orientation="vertical"> | 188 | android:orientation="vertical"> |
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="horizontal"> | 193 | android:orientation="horizontal"> |
194 | 194 | ||
195 | <com.facebook.drawee.view.SimpleDraweeView | 195 | <com.facebook.drawee.view.SimpleDraweeView |
196 | android:id="@+id/tv_account_head" | 196 | android:id="@+id/tv_account_head" |
197 | android:layout_width="60dp" | 197 | android:layout_width="60dp" |
198 | android:layout_height="60dp" | 198 | android:layout_height="60dp" |
199 | android:layout_margin="10dp" | 199 | android:layout_margin="10dp" |
200 | fresco:placeholderImage="@mipmap/header_default" | 200 | fresco:placeholderImage="@mipmap/header_default" |
201 | fresco:placeholderImageScaleType="fitCenter" | 201 | fresco:placeholderImageScaleType="fitCenter" |
202 | fresco:roundAsCircle="true" /> | 202 | fresco:roundAsCircle="true" /> |
203 | 203 | ||
204 | <LinearLayout | 204 | <LinearLayout |
205 | android:layout_width="0dp" | 205 | android:layout_width="0dp" |
206 | android:layout_height="wrap_content" | 206 | android:layout_height="wrap_content" |
207 | android:layout_marginLeft="10dp" | 207 | android:layout_marginLeft="10dp" |
208 | android:layout_marginTop="10dp" | 208 | android:layout_marginTop="10dp" |
209 | android:layout_weight="1" | 209 | android:layout_weight="1" |
210 | android:orientation="vertical"> | 210 | android:orientation="vertical"> |
211 | 211 | ||
212 | <TextView | 212 | <TextView |
213 | android:id="@+id/tv_account_name" | 213 | android:id="@+id/tv_account_name" |
214 | android:layout_width="wrap_content" | 214 | android:layout_width="wrap_content" |
215 | android:layout_height="wrap_content" | 215 | android:layout_height="wrap_content" |
216 | android:text="" | 216 | android:text="" |
217 | android:textSize="18sp" /> | 217 | android:textSize="18sp" /> |
218 | 218 | ||
219 | <TextView | 219 | <TextView |
220 | android:id="@+id/tv_account_grade" | 220 | android:id="@+id/tv_account_grade" |
221 | android:layout_width="wrap_content" | 221 | android:layout_width="wrap_content" |
222 | android:layout_height="wrap_content" | 222 | android:layout_height="wrap_content" |
223 | android:text="" | 223 | android:text="" |
224 | android:textSize="18sp" /> | 224 | android:textSize="18sp" /> |
225 | 225 | ||
226 | <TextView | 226 | <TextView |
227 | android:id="@+id/tv_account_school" | 227 | android:id="@+id/tv_account_school" |
228 | android:layout_width="wrap_content" | 228 | android:layout_width="wrap_content" |
229 | android:layout_height="wrap_content" | 229 | android:layout_height="wrap_content" |
230 | android:text="" | 230 | android:text="" |
231 | android:textSize="18sp" /> | 231 | android:textSize="18sp" /> |
232 | 232 | ||
233 | <TextView | 233 | <TextView |
234 | android:id="@+id/tv_account_adress" | 234 | android:id="@+id/tv_account_adress" |
235 | android:layout_width="wrap_content" | 235 | android:layout_width="wrap_content" |
236 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
237 | android:text="" | 237 | android:text="" |
238 | android:textSize="18sp" /> | 238 | android:textSize="18sp" /> |
239 | 239 | ||
240 | 240 | ||
241 | </LinearLayout> | 241 | </LinearLayout> |
242 | 242 | ||
243 | <ImageView | 243 | <ImageView |
244 | android:id="@+id/iv_shiyongzhong" | 244 | android:id="@+id/iv_shiyongzhong" |
245 | android:layout_width="wrap_content" | 245 | android:layout_width="wrap_content" |
246 | android:layout_height="wrap_content" | 246 | android:layout_height="wrap_content" |
247 | android:layout_gravity="right" | 247 | android:layout_gravity="right" |
248 | android:layout_marginLeft="60dp" | 248 | android:layout_marginLeft="60dp" |
249 | android:src="@mipmap/shiyongzhong" | 249 | android:src="@mipmap/shiyongzhong" |
250 | android:visibility="gone" /> | 250 | android:visibility="gone" /> |
251 | 251 | ||
252 | </LinearLayout> | 252 | </LinearLayout> |
253 | 253 | ||
254 | <View | 254 | <View |
255 | android:layout_width="match_parent" | 255 | android:layout_width="match_parent" |
256 | android:layout_height="0.7dp" | 256 | android:layout_height="0.7dp" |
257 | android:layout_margin="10dp" | 257 | android:layout_margin="10dp" |
258 | android:background="@color/cutoff_line"> | 258 | android:background="@color/cutoff_line"> |
259 | 259 | ||
260 | </View> | 260 | </View> |
261 | 261 | ||
262 | <LinearLayout | 262 | <LinearLayout |
263 | android:layout_width="match_parent" | 263 | android:layout_width="match_parent" |
264 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
265 | android:layout_marginBottom="10dp" | 265 | android:layout_marginBottom="10dp" |
266 | android:orientation="horizontal"> | 266 | android:orientation="horizontal"> |
267 | 267 | ||
268 | <TextView | 268 | <TextView |
269 | android:id="@+id/change_zhu_account" | 269 | android:id="@+id/change_zhu_account" |
270 | android:layout_width="0dp" | 270 | android:layout_width="0dp" |
271 | android:layout_height="wrap_content" | 271 | android:layout_height="wrap_content" |
272 | android:layout_weight="1" | 272 | android:layout_weight="1" |
273 | android:gravity="center" | 273 | android:gravity="center" |
274 | android:text="切换主账户" | 274 | android:text="切换主账户" |
275 | android:textSize="18sp" /> | 275 | android:textSize="18sp" /> |
276 | 276 | ||
277 | 277 | ||
278 | </LinearLayout> | 278 | </LinearLayout> |
279 | 279 | ||
280 | </LinearLayout> | 280 | </LinearLayout> |
281 | 281 | ||
282 | 282 | ||
283 | </LinearLayout> | 283 | </LinearLayout> |
284 | 284 | ||
285 | <LinearLayout | 285 | <LinearLayout |
286 | android:layout_width="0dp" | 286 | android:layout_width="0dp" |
287 | android:layout_height="wrap_content" | 287 | android:layout_height="wrap_content" |
288 | android:layout_weight="1"> | 288 | android:layout_weight="1"> |
289 | 289 | ||
290 | </LinearLayout> | 290 | </LinearLayout> |
291 | 291 | ||
292 | <LinearLayout | 292 | <LinearLayout |
293 | android:layout_width="0dp" | 293 | android:layout_width="0dp" |
294 | android:layout_height="wrap_content" | 294 | android:layout_height="wrap_content" |
295 | android:layout_weight="1"> | 295 | android:layout_weight="1"> |
296 | 296 | ||
297 | </LinearLayout> | 297 | </LinearLayout> |
298 | </LinearLayout> | 298 | </LinearLayout> |
299 | 299 | ||
300 | <RelativeLayout | 300 | <RelativeLayout |
301 | android:layout_width="match_parent" | 301 | android:layout_width="match_parent" |
302 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
303 | android:layout_marginTop="20dp" | 303 | android:layout_marginTop="20dp" |
304 | android:orientation="horizontal"> | 304 | android:orientation="horizontal"> |
305 | 305 | ||
306 | <android.support.v7.widget.RecyclerView | 306 | <android.support.v7.widget.RecyclerView |
307 | android:id="@+id/id_recyclerview_horizontal" | 307 | android:id="@+id/id_recyclerview_horizontal" |
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:layout_centerVertical="true" | 310 | android:layout_centerVertical="true" |
311 | android:layout_toLeftOf="@+id/add_account" | ||
312 | android:scrollbars="none"> | 311 | android:scrollbars="none"> |
313 | 312 | ||
314 | </android.support.v7.widget.RecyclerView> | 313 | </android.support.v7.widget.RecyclerView> |
315 | 314 | ||
316 | <LinearLayout | ||
317 | android:id="@+id/add_account" | ||
318 | android:layout_width="415dp" | ||
319 | android:layout_height="165dp" | ||
320 | android:layout_alignParentRight="true" | ||
321 | android:layout_marginLeft="10dp" | ||
322 | android:layout_marginRight="20dp" | ||
323 | android:background="@drawable/corcle_black_bg" | ||
324 | android:gravity="center"> | ||
325 | |||
326 | <ImageView | ||
327 | android:layout_width="wrap_content" | ||
328 | android:layout_height="wrap_content" | ||
329 | android:src="@mipmap/jia" /> | ||
330 | |||
331 | </LinearLayout> | ||
332 | 315 | ||
333 | 316 | ||
334 | </RelativeLayout> | 317 | </RelativeLayout> |
335 | 318 | ||
336 | </LinearLayout> | 319 | </LinearLayout> |
337 | 320 | ||
338 | 321 | ||
339 | </LinearLayout> | 322 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_account_management_add.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:orientation="vertical" | ||
4 | android:layout_width="match_parent" | ||
5 | android:layout_height="match_parent"> | ||
6 | <LinearLayout | ||
7 | android:id="@+id/add_account" | ||
8 | android:layout_width="400dp" | ||
9 | android:layout_height="165dp" | ||
10 | android:layout_alignParentRight="true" | ||
11 | android:layout_marginRight="20dp" | ||
12 | android:background="@drawable/corcle_black_bg" | ||
13 | android:gravity="center"> | ||
14 | |||
15 | <ImageView | ||
16 | android:layout_width="wrap_content" | ||
17 | android:layout_height="wrap_content" | ||
18 | android:src="@mipmap/jia" /> | ||
19 | |||
20 | </LinearLayout> | ||
21 | |||
22 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/activity_change_preson_info.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"> | 8 | tools:context="com.hjx.personalcenter.activity.LoginAndRegisterActivity"> |
9 | 9 | ||
10 | <LinearLayout | 10 | <LinearLayout |
11 | android:layout_width="wrap_content" | 11 | android:layout_width="wrap_content" |
12 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
13 | android:layout_marginTop="30dp" | ||
14 | android:layout_below="@+id/title" | 13 | android:layout_below="@+id/title" |
15 | android:orientation="vertical"> | 14 | android:orientation="vertical"> |
16 | 15 | ||
17 | <com.hjx.personalcenter.thirdparty.SlidingTabLayout | 16 | <!--<com.hjx.personalcenter.thirdparty.SlidingTabLayout--> |
18 | android:id="@+id/TabLayout_id" | 17 | <!--android:id="@+id/TabLayout_id"--> |
19 | android:layout_gravity="center" | 18 | <!--android:layout_gravity="center"--> |
20 | android:layout_width="wrap_content" | 19 | <!--android:layout_width="wrap_content"--> |
21 | android:layout_height="50dp"> | 20 | <!--android:layout_height="50dp">--> |
22 | </com.hjx.personalcenter.thirdparty.SlidingTabLayout> | 21 | <!--</com.hjx.personalcenter.thirdparty.SlidingTabLayout>--> |
23 | 22 | ||
24 | <android.support.v4.view.ViewPager | 23 | <android.support.v4.view.ViewPager |
25 | android:id="@+id/viewpager_login" | 24 | android:id="@+id/viewpager_login" |
26 | android:layout_width="match_parent" | 25 | android:layout_width="match_parent" |
27 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
28 | android:background="@color/white" /> | 27 | android:background="@color/white" /> |
29 | </LinearLayout> | 28 | </LinearLayout> |
30 | 29 | ||
31 | </RelativeLayout> | 30 | </RelativeLayout> |
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:padding="20dp" | 85 | android:padding="20dp" |
85 | android:layout_height="60dp" /> | 86 | android:layout_height="60dp" /> |
86 | <TextView | 87 | <TextView |
87 | android:layout_width="match_parent" | 88 | android:layout_width="match_parent" |
88 | android:text="@string/hint" | 89 | android:text="@string/hint" |
89 | android:padding="20dp" | 90 | android:padding="20dp" |
90 | android:textSize="18sp" | 91 | android:textSize="18sp" |
91 | android:layout_height="wrap_content" /> | 92 | android:layout_height="wrap_content" /> |
92 | 93 | ||
93 | 94 | ||
94 | 95 | ||
95 | </LinearLayout> | 96 | </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" | ||
48 | android:layout_height="wrap_content" | ||
49 | android:layout_marginTop="50dp" | ||
50 | android:orientation="horizontal"> | ||
51 | <LinearLayout | ||
52 | android:layout_width="0dp" | ||
53 | android:layout_weight="1" | ||
54 | android:gravity="center" | ||
55 | android:layout_height="match_parent"> | ||
56 | <TextView | ||
57 | android:id="@+id/tv_presonal" | ||
58 | android:layout_width="wrap_content" | ||
59 | android:layout_height="wrap_content" | ||
60 | android:textSize="22sp" | ||
61 | android:textColor="@color/login_edittext_pressed" | ||
62 | android:text="个人信息"/> | ||
63 | |||
64 | </LinearLayout> | ||
65 | <LinearLayout | ||
66 | android:id="@+id/tv_version" | ||
67 | android:layout_width="0dp" | ||
68 | android:layout_weight="1" | ||
69 | android:gravity="center" | ||
70 | android:layout_height="match_parent"> | ||
71 | <TextView | ||
72 | android:textSize="22sp" | ||
73 | android:layout_width="wrap_content" | ||
74 | android:layout_height="wrap_content" | ||
75 | android:text="版本信息"/> | ||
76 | |||
77 | </LinearLayout> | ||
78 | |||
79 | </LinearLayout> | ||
80 | |||
81 | |||
82 | <LinearLayout | ||
47 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
48 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
49 | android:layout_marginTop="80dp" | 85 | android:layout_marginTop="80dp" |
50 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
51 | 87 | ||
52 | <View | 88 | <View |
53 | android:layout_width="450dp" | 89 | android:layout_width="450dp" |
54 | android:layout_height="0.7dp" | 90 | android:layout_height="0.7dp" |
55 | android:layout_marginLeft="150dp" | 91 | android:layout_marginLeft="150dp" |
56 | android:background="@color/cutoff_line"> | 92 | android:background="@color/cutoff_line"> |
57 | 93 | ||
58 | </View> | 94 | </View> |
59 | 95 | ||
60 | <View | 96 | <View |
61 | android:layout_width="450dp" | 97 | android:layout_width="450dp" |
62 | android:layout_height="0.7dp" | 98 | android:layout_height="0.7dp" |
63 | android:layout_marginLeft="80dp" | 99 | android:layout_marginLeft="80dp" |
64 | android:background="@color/cutoff_line"> | 100 | android:background="@color/cutoff_line"> |
65 | 101 | ||
66 | </View> | 102 | </View> |
67 | 103 | ||
68 | 104 | ||
69 | </LinearLayout> | 105 | </LinearLayout> |
70 | 106 | ||
71 | <LinearLayout | 107 | <LinearLayout |
72 | android:layout_width="match_parent" | 108 | android:layout_width="match_parent" |
73 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
74 | android:layout_marginLeft="200dp" | 110 | android:layout_marginLeft="200dp" |
75 | android:gravity="center_vertical" | 111 | android:gravity="center_vertical" |
76 | android:orientation="horizontal"> | 112 | android:orientation="horizontal"> |
77 | 113 | ||
78 | <LinearLayout | 114 | <LinearLayout |
79 | android:layout_width="0dp" | 115 | android:layout_width="0dp" |
80 | android:layout_height="80dp" | 116 | android:layout_height="80dp" |
81 | android:layout_weight="1" | 117 | android:layout_weight="1" |
82 | android:gravity="center_vertical"> | 118 | android:gravity="center_vertical"> |
83 | 119 | ||
84 | <TextView | 120 | <TextView |
85 | android:layout_width="wrap_content" | 121 | android:layout_width="wrap_content" |
86 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" |
87 | android:text="昵称" | 123 | android:text="昵称" |
88 | android:textSize="22sp" /> | 124 | android:textSize="22sp" /> |
89 | 125 | ||
90 | <EditText | 126 | <EditText |
91 | android:id="@+id/tv_username1" | 127 | android:id="@+id/tv_username1" |
92 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
93 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
94 | android:layout_marginLeft="50dp" | 130 | android:layout_marginLeft="50dp" |
95 | android:textColor="@color/electronic_text" | 131 | android:textColor="@color/electronic_text" |
96 | android:background="@null" | 132 | android:background="@null" |
97 | android:hint="请输入12个以内的中文或英文字符" | 133 | android:hint="请输入12个以内的中文或英文字符" |
98 | android:textSize="22sp" /> | 134 | android:textSize="22sp" /> |
99 | 135 | ||
100 | </LinearLayout> | 136 | </LinearLayout> |
101 | 137 | ||
102 | <LinearLayout | 138 | <LinearLayout |
103 | android:layout_width="0dp" | 139 | android:layout_width="0dp" |
104 | android:layout_height="80dp" | 140 | android:layout_height="80dp" |
105 | android:layout_weight="1" | 141 | android:layout_weight="1" |
106 | android:gravity="center_vertical"> | 142 | android:gravity="center_vertical"> |
107 | 143 | ||
108 | <TextView | 144 | <TextView |
109 | android:layout_width="wrap_content" | 145 | android:layout_width="wrap_content" |
110 | android:layout_height="wrap_content" | 146 | android:layout_height="wrap_content" |
111 | android:text="地区" | 147 | android:text="地区" |
112 | android:textSize="22sp" /> | 148 | android:textSize="22sp" /> |
113 | 149 | ||
114 | <TextView | 150 | <TextView |
115 | android:id="@+id/tv_useinfo_adress" | 151 | android:id="@+id/tv_useinfo_adress" |
116 | android:layout_width="wrap_content" | 152 | android:layout_width="wrap_content" |
117 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
118 | android:layout_marginLeft="50dp" | 154 | android:layout_marginLeft="50dp" |
119 | android:hint="请选择" | 155 | android:hint="请选择" |
120 | android:textSize="22sp" /> | 156 | android:textSize="22sp" /> |
121 | 157 | ||
122 | <ImageView | 158 | <ImageView |
123 | android:id="@+id/my_adress" | 159 | android:id="@+id/my_adress" |
124 | android:padding="20dp" | 160 | android:padding="20dp" |
125 | android:layout_width="wrap_content" | 161 | android:layout_width="wrap_content" |
126 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
127 | android:layout_marginLeft="150dp" | 163 | android:layout_marginLeft="150dp" |
128 | android:src="@mipmap/xiajiantou"> | 164 | android:src="@mipmap/xiajiantou"> |
129 | 165 | ||
130 | </ImageView> | 166 | </ImageView> |
131 | </LinearLayout> | 167 | </LinearLayout> |
132 | 168 | ||
133 | </LinearLayout> | 169 | </LinearLayout> |
134 | 170 | ||
135 | <LinearLayout | 171 | <LinearLayout |
136 | android:layout_width="wrap_content" | 172 | android:layout_width="wrap_content" |
137 | android:layout_height="wrap_content" | 173 | android:layout_height="wrap_content" |
138 | android:orientation="horizontal"> | 174 | android:orientation="horizontal"> |
139 | 175 | ||
140 | <View | 176 | <View |
141 | android:layout_width="450dp" | 177 | android:layout_width="450dp" |
142 | android:layout_height="0.7dp" | 178 | android:layout_height="0.7dp" |
143 | android:layout_marginLeft="150dp" | 179 | android:layout_marginLeft="150dp" |
144 | android:background="@color/cutoff_line"> | 180 | android:background="@color/cutoff_line"> |
145 | 181 | ||
146 | </View> | 182 | </View> |
147 | 183 | ||
148 | <View | 184 | <View |
149 | android:layout_width="450dp" | 185 | android:layout_width="450dp" |
150 | android:layout_height="0.7dp" | 186 | android:layout_height="0.7dp" |
151 | android:layout_marginLeft="80dp" | 187 | android:layout_marginLeft="80dp" |
152 | android:background="@color/cutoff_line"> | 188 | android:background="@color/cutoff_line"> |
153 | 189 | ||
154 | </View> | 190 | </View> |
155 | 191 | ||
156 | 192 | ||
157 | </LinearLayout> | 193 | </LinearLayout> |
158 | 194 | ||
159 | <LinearLayout | 195 | <LinearLayout |
160 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
161 | android:layout_height="wrap_content" | 197 | android:layout_height="wrap_content" |
162 | android:layout_marginLeft="200dp" | 198 | android:layout_marginLeft="200dp" |
163 | android:gravity="center_vertical" | 199 | android:gravity="center_vertical" |
164 | android:orientation="horizontal"> | 200 | android:orientation="horizontal"> |
165 | 201 | ||
166 | <LinearLayout | 202 | <LinearLayout |
167 | android:layout_width="0dp" | 203 | android:layout_width="0dp" |
168 | android:layout_height="80dp" | 204 | android:layout_height="80dp" |
169 | android:layout_weight="1" | 205 | android:layout_weight="1" |
170 | android:gravity="center_vertical"> | 206 | android:gravity="center_vertical"> |
171 | 207 | ||
172 | <TextView | 208 | <TextView |
173 | android:layout_width="wrap_content" | 209 | android:layout_width="wrap_content" |
174 | android:layout_height="wrap_content" | 210 | android:layout_height="wrap_content" |
175 | android:text="性别" | 211 | android:text="性别" |
176 | android:textSize="22sp" /> | 212 | android:textSize="22sp" /> |
177 | 213 | ||
178 | <TextView | 214 | <TextView |
179 | android:id="@+id/tv_sex" | 215 | android:id="@+id/tv_sex" |
180 | android:layout_width="wrap_content" | 216 | android:layout_width="wrap_content" |
181 | android:layout_height="wrap_content" | 217 | android:layout_height="wrap_content" |
182 | android:layout_marginLeft="50dp" | 218 | android:layout_marginLeft="50dp" |
183 | android:hint="请选择" | 219 | android:hint="请选择" |
184 | android:textSize="22sp" /> | 220 | android:textSize="22sp" /> |
185 | 221 | ||
186 | <ImageView | 222 | <ImageView |
187 | android:id="@+id/my_sex" | 223 | android:id="@+id/my_sex" |
188 | android:padding="20dp" | 224 | android:padding="20dp" |
189 | android:layout_width="wrap_content" | 225 | android:layout_width="wrap_content" |
190 | android:layout_height="wrap_content" | 226 | android:layout_height="wrap_content" |
191 | android:layout_marginLeft="150dp" | 227 | android:layout_marginLeft="150dp" |
192 | android:src="@mipmap/xiajiantou"> | 228 | android:src="@mipmap/xiajiantou"> |
193 | 229 | ||
194 | </ImageView> | 230 | </ImageView> |
195 | 231 | ||
196 | 232 | ||
197 | </LinearLayout> | 233 | </LinearLayout> |
198 | 234 | ||
199 | <LinearLayout | 235 | <LinearLayout |
200 | android:layout_width="0dp" | 236 | android:layout_width="0dp" |
201 | android:layout_height="80dp" | 237 | android:layout_height="80dp" |
202 | android:layout_weight="1" | 238 | android:layout_weight="1" |
203 | android:gravity="center_vertical"> | 239 | android:gravity="center_vertical"> |
204 | 240 | ||
205 | <TextView | 241 | <TextView |
206 | android:layout_width="wrap_content" | 242 | android:layout_width="wrap_content" |
207 | android:layout_height="wrap_content" | 243 | android:layout_height="wrap_content" |
208 | android:text=" " | 244 | android:text=" " |
209 | android:textColor="@color/white" | 245 | android:textColor="@color/white" |
210 | android:textSize="22sp" /> | 246 | android:textSize="22sp" /> |
211 | 247 | ||
212 | <EditText | 248 | <EditText |
213 | android:id="@+id/tv_useinfo_adress1" | 249 | android:id="@+id/tv_useinfo_adress1" |
214 | android:layout_width="wrap_content" | 250 | android:layout_width="wrap_content" |
215 | android:layout_height="wrap_content" | 251 | android:layout_height="wrap_content" |
216 | android:layout_marginLeft="50dp" | 252 | android:layout_marginLeft="50dp" |
217 | android:textColor="@color/electronic_text" | 253 | android:textColor="@color/electronic_text" |
218 | android:background="@null" | 254 | android:background="@null" |
219 | android:hint="请输入详细地址" | 255 | android:hint="请输入详细地址" |
220 | android:textSize="22sp" /> | 256 | android:textSize="22sp" /> |
221 | 257 | ||
222 | </LinearLayout> | 258 | </LinearLayout> |
223 | 259 | ||
224 | </LinearLayout> | 260 | </LinearLayout> |
225 | 261 | ||
226 | <LinearLayout | 262 | <LinearLayout |
227 | android:layout_width="wrap_content" | 263 | android:layout_width="wrap_content" |
228 | android:layout_height="wrap_content" | 264 | android:layout_height="wrap_content" |
229 | 265 | ||
230 | android:orientation="horizontal"> | 266 | android:orientation="horizontal"> |
231 | 267 | ||
232 | <View | 268 | <View |
233 | android:layout_width="450dp" | 269 | android:layout_width="450dp" |
234 | android:layout_height="0.7dp" | 270 | android:layout_height="0.7dp" |
235 | android:layout_marginLeft="150dp" | 271 | android:layout_marginLeft="150dp" |
236 | android:background="@color/cutoff_line"> | 272 | android:background="@color/cutoff_line"> |
237 | 273 | ||
238 | </View> | 274 | </View> |
239 | 275 | ||
240 | <View | 276 | <View |
241 | android:layout_width="450dp" | 277 | android:layout_width="450dp" |
242 | android:layout_height="0.7dp" | 278 | android:layout_height="0.7dp" |
243 | android:layout_marginLeft="80dp" | 279 | android:layout_marginLeft="80dp" |
244 | android:background="@color/cutoff_line"> | 280 | android:background="@color/cutoff_line"> |
245 | 281 | ||
246 | </View> | 282 | </View> |
247 | 283 | ||
248 | 284 | ||
249 | </LinearLayout> | 285 | </LinearLayout> |
250 | 286 | ||
251 | <LinearLayout | 287 | <LinearLayout |
252 | android:layout_width="match_parent" | 288 | android:layout_width="match_parent" |
253 | android:layout_height="wrap_content" | 289 | android:layout_height="wrap_content" |
254 | android:layout_marginLeft="200dp" | 290 | android:layout_marginLeft="200dp" |
255 | android:gravity="center_vertical" | 291 | android:gravity="center_vertical" |
256 | android:orientation="horizontal"> | 292 | android:orientation="horizontal"> |
257 | 293 | ||
258 | 294 | ||
259 | <LinearLayout | 295 | <LinearLayout |
260 | android:layout_width="0dp" | 296 | android:layout_width="0dp" |
261 | android:layout_height="80dp" | 297 | android:layout_height="80dp" |
262 | android:layout_weight="1" | 298 | android:layout_weight="1" |
263 | android:gravity="center_vertical"> | 299 | android:gravity="center_vertical"> |
264 | 300 | ||
265 | <TextView | 301 | <TextView |
266 | android:layout_width="wrap_content" | 302 | android:layout_width="wrap_content" |
267 | android:layout_height="wrap_content" | 303 | android:layout_height="wrap_content" |
268 | android:text="生日" | 304 | android:text="生日" |
269 | android:textSize="22sp" /> | 305 | android:textSize="22sp" /> |
270 | 306 | ||
271 | <TextView | 307 | <TextView |
272 | android:id="@+id/tv_useinfo_birthday" | 308 | android:id="@+id/tv_useinfo_birthday" |
273 | android:layout_width="wrap_content" | 309 | android:layout_width="wrap_content" |
274 | android:layout_height="wrap_content" | 310 | android:layout_height="wrap_content" |
275 | android:layout_marginLeft="50dp" | 311 | android:layout_marginLeft="50dp" |
276 | android:hint="请选择" | 312 | android:hint="请选择" |
277 | android:textSize="22sp" /> | 313 | android:textSize="22sp" /> |
278 | 314 | ||
279 | <ImageView | 315 | <ImageView |
280 | android:id="@+id/my_bthday" | 316 | android:id="@+id/my_bthday" |
281 | android:padding="20dp" | 317 | android:padding="20dp" |
282 | android:layout_width="wrap_content" | 318 | android:layout_width="wrap_content" |
283 | android:layout_height="wrap_content" | 319 | android:layout_height="wrap_content" |
284 | android:layout_marginLeft="150dp" | 320 | android:layout_marginLeft="150dp" |
285 | android:src="@mipmap/xiajiantou"/> | 321 | android:src="@mipmap/xiajiantou"/> |
286 | </LinearLayout> | 322 | </LinearLayout> |
287 | <LinearLayout | 323 | <LinearLayout |
288 | android:layout_width="0dp" | 324 | android:layout_width="0dp" |
289 | android:layout_height="80dp" | 325 | android:layout_height="80dp" |
290 | android:layout_weight="1" | 326 | android:layout_weight="1" |
291 | android:gravity="center_vertical"> | 327 | android:gravity="center_vertical"> |
292 | 328 | ||
293 | <TextView | 329 | <TextView |
294 | android:layout_width="wrap_content" | 330 | android:layout_width="wrap_content" |
295 | android:layout_height="wrap_content" | 331 | android:layout_height="wrap_content" |
296 | android:text="年级" | 332 | android:text="年级" |
297 | android:textSize="22sp" /> | 333 | android:textSize="22sp" /> |
298 | 334 | ||
299 | <TextView | 335 | <TextView |
300 | android:id="@+id/tv_useinfo_gender" | 336 | android:id="@+id/tv_useinfo_gender" |
301 | android:layout_width="wrap_content" | 337 | android:layout_width="wrap_content" |
302 | android:layout_height="wrap_content" | 338 | android:layout_height="wrap_content" |
303 | android:layout_marginLeft="50dp" | 339 | android:layout_marginLeft="50dp" |
304 | android:hint="请选择" | 340 | android:hint="请选择" |
305 | android:textSize="22sp" /> | 341 | android:textSize="22sp" /> |
306 | 342 | ||
307 | <ImageView | 343 | <ImageView |
308 | android:id="@+id/my_grade" | 344 | android:id="@+id/my_grade" |
309 | android:padding="20dp" | 345 | android:padding="20dp" |
310 | android:layout_width="wrap_content" | 346 | android:layout_width="wrap_content" |
311 | android:layout_height="wrap_content" | 347 | android:layout_height="wrap_content" |
312 | android:layout_marginLeft="150dp" | 348 | android:layout_marginLeft="150dp" |
313 | android:src="@mipmap/xiajiantou"/> | 349 | android:src="@mipmap/xiajiantou"/> |
314 | </LinearLayout> | 350 | </LinearLayout> |
315 | 351 | ||
316 | </LinearLayout> | 352 | </LinearLayout> |
317 | 353 | ||
318 | <LinearLayout | 354 | <LinearLayout |
319 | android:layout_width="wrap_content" | 355 | android:layout_width="wrap_content" |
320 | android:layout_height="wrap_content" | 356 | android:layout_height="wrap_content" |
321 | 357 | ||
322 | android:orientation="horizontal"> | 358 | android:orientation="horizontal"> |
323 | 359 | ||
324 | <View | 360 | <View |
325 | android:layout_width="450dp" | 361 | android:layout_width="450dp" |
326 | android:layout_height="0.7dp" | 362 | android:layout_height="0.7dp" |
327 | android:layout_marginLeft="150dp" | 363 | android:layout_marginLeft="150dp" |
328 | android:background="@color/cutoff_line"> | 364 | android:background="@color/cutoff_line"> |
329 | 365 | ||
330 | </View> | 366 | </View> |
331 | 367 | ||
332 | <View | 368 | <View |
333 | android:layout_width="450dp" | 369 | android:layout_width="450dp" |
334 | android:layout_height="0.7dp" | 370 | android:layout_height="0.7dp" |
335 | android:layout_marginLeft="80dp" | 371 | android:layout_marginLeft="80dp" |
336 | android:background="@color/cutoff_line"> | 372 | android:background="@color/cutoff_line"> |
337 | 373 | ||
338 | </View> | 374 | </View> |
339 | 375 | ||
340 | 376 | ||
341 | </LinearLayout> | 377 | </LinearLayout> |
342 | 378 | ||
343 | <LinearLayout | 379 | <LinearLayout |
344 | android:layout_width="match_parent" | 380 | android:layout_width="match_parent" |
345 | android:layout_height="wrap_content" | 381 | android:layout_height="wrap_content" |
346 | android:layout_marginLeft="200dp" | 382 | android:layout_marginLeft="200dp" |
347 | android:gravity="center_vertical" | 383 | android:gravity="center_vertical" |
348 | android:orientation="horizontal"> | 384 | android:orientation="horizontal"> |
349 | 385 | ||
350 | <LinearLayout | 386 | <LinearLayout |
351 | android:id="@+id/lineL_buy_time" | 387 | android:id="@+id/lineL_buy_time" |
352 | android:layout_width="0dp" | 388 | android:layout_width="0dp" |
353 | android:layout_height="80dp" | 389 | android:layout_height="80dp" |
354 | android:layout_weight="1" | 390 | android:layout_weight="1" |
355 | android:gravity="center_vertical"> | 391 | android:gravity="center_vertical"> |
356 | 392 | ||
357 | <TextView | 393 | <TextView |
358 | android:layout_width="wrap_content" | 394 | android:layout_width="wrap_content" |
359 | android:layout_height="wrap_content" | 395 | android:layout_height="wrap_content" |
360 | android:text="Q Q" | 396 | android:text="Q Q" |
361 | android:textSize="22sp" /> | 397 | android:textSize="22sp" /> |
362 | 398 | ||
363 | <EditText | 399 | <EditText |
364 | android:id="@+id/tv_useinfo_qq" | 400 | android:id="@+id/tv_useinfo_qq" |
365 | android:layout_width="wrap_content" | 401 | android:layout_width="wrap_content" |
366 | android:layout_height="wrap_content" | 402 | android:layout_height="wrap_content" |
367 | android:layout_marginLeft="50dp" | 403 | android:layout_marginLeft="50dp" |
368 | android:background="@null" | 404 | android:background="@null" |
369 | android:textColor="@color/electronic_text" | 405 | android:textColor="@color/electronic_text" |
370 | android:hint="请输入" | 406 | android:hint="请输入" |
371 | android:textSize="22sp" /> | 407 | android:textSize="22sp" /> |
372 | 408 | ||
373 | </LinearLayout> | 409 | </LinearLayout> |
374 | 410 | ||
375 | <LinearLayout | 411 | <LinearLayout |
376 | android:layout_width="0dp" | 412 | android:layout_width="0dp" |
377 | android:layout_height="80dp" | 413 | android:layout_height="80dp" |
378 | android:layout_weight="1" | 414 | android:layout_weight="1" |
379 | 415 | ||
380 | android:gravity="center_vertical"> | 416 | android:gravity="center_vertical"> |
381 | 417 | ||
382 | <TextView | 418 | <TextView |
383 | android:layout_width="wrap_content" | 419 | android:layout_width="wrap_content" |
384 | android:layout_height="wrap_content" | 420 | android:layout_height="wrap_content" |
385 | android:text="学校" | 421 | android:text="学校" |
386 | android:textSize="22sp" /> | 422 | android:textSize="22sp" /> |
387 | 423 | ||
388 | <TextView | 424 | <TextView |
389 | android:id="@+id/tv_useinfo_school" | 425 | android:id="@+id/tv_useinfo_school" |
390 | android:layout_width="wrap_content" | 426 | android:layout_width="wrap_content" |
391 | android:layout_height="wrap_content" | 427 | android:layout_height="wrap_content" |
392 | android:layout_marginLeft="50dp" | 428 | android:layout_marginLeft="50dp" |
393 | android:hint="请选择" | 429 | android:hint="请选择" |
394 | android:textSize="22sp" /> | 430 | android:textSize="22sp" /> |
395 | 431 | ||
396 | <ImageView | 432 | <ImageView |
397 | android:id="@+id/my_school" | 433 | android:id="@+id/my_school" |
398 | android:padding="20dp" | 434 | android:padding="20dp" |
399 | android:layout_width="wrap_content" | 435 | android:layout_width="wrap_content" |
400 | android:layout_height="wrap_content" | 436 | android:layout_height="wrap_content" |
401 | android:layout_marginLeft="150dp" | 437 | android:layout_marginLeft="150dp" |
402 | android:src="@mipmap/xiajiantou"> | 438 | android:src="@mipmap/xiajiantou"> |
403 | 439 | ||
404 | </ImageView> | 440 | </ImageView> |
405 | </LinearLayout> | 441 | </LinearLayout> |
406 | 442 | ||
407 | </LinearLayout> | 443 | </LinearLayout> |
408 | 444 | ||
409 | <LinearLayout | 445 | <LinearLayout |
410 | android:layout_width="wrap_content" | 446 | android:layout_width="wrap_content" |
411 | android:layout_height="wrap_content" | 447 | android:layout_height="wrap_content" |
412 | android:orientation="horizontal"> | 448 | android:orientation="horizontal"> |
413 | 449 | ||
414 | <View | 450 | <View |
415 | android:layout_width="450dp" | 451 | android:layout_width="450dp" |
416 | android:layout_height="0.7dp" | 452 | android:layout_height="0.7dp" |
417 | android:layout_marginLeft="150dp" | 453 | android:layout_marginLeft="150dp" |
418 | android:background="@color/cutoff_line"> | 454 | android:background="@color/cutoff_line"> |
419 | 455 | ||
420 | </View> | 456 | </View> |
421 | 457 | ||
422 | <View | 458 | <View |
423 | android:layout_width="450dp" | 459 | android:layout_width="450dp" |
424 | android:layout_height="0.7dp" | 460 | android:layout_height="0.7dp" |
425 | android:layout_marginLeft="80dp" | 461 | android:layout_marginLeft="80dp" |
426 | android:background="@color/cutoff_line"> | 462 | android:background="@color/cutoff_line"> |
427 | 463 | ||
428 | </View> | 464 | </View> |
429 | 465 | ||
430 | 466 | ||
431 | </LinearLayout> | 467 | </LinearLayout> |
432 | 468 | ||
433 | </LinearLayout> | 469 | </LinearLayout> |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:orientation="vertical" android:layout_width="match_parent" | 3 | android:orientation="vertical" android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:background="@color/white"> | 5 | android:background="@color/white"> |
6 | <RelativeLayout | 6 | <RelativeLayout |
7 | android:id="@+id/title" | 7 | android:id="@+id/title" |
8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
9 | android:layout_height="50dp" | 9 | android:layout_height="50dp" |
10 | android:background="@color/login_text_blue"> | 10 | android:background="@color/login_text_blue"> |
11 | 11 | ||
12 | <ImageView | 12 | <ImageView |
13 | android:id="@+id/cancel" | 13 | android:id="@+id/cancel" |
14 | android:layout_width="wrap_content" | 14 | android:layout_width="wrap_content" |
15 | android:layout_height="match_parent" | 15 | android:layout_height="match_parent" |
16 | android:paddingLeft="20dp" | 16 | android:paddingLeft="20dp" |
17 | android:paddingRight="20dp" | 17 | android:paddingRight="20dp" |
18 | android:src="@mipmap/title_back" /> | 18 | android:src="@mipmap/title_back" /> |
19 | 19 | ||
20 | <TextView | 20 | <TextView |
21 | android:id="@+id/menu_title" | 21 | android:id="@+id/menu_title" |
22 | android:layout_width="wrap_content" | 22 | android:layout_width="wrap_content" |
23 | android:layout_height="match_parent" | 23 | android:layout_height="match_parent" |
24 | android:layout_centerInParent="true" | 24 | android:layout_centerInParent="true" |
25 | android:gravity="center_vertical" | 25 | android:gravity="center_vertical" |
26 | android:text="修改版本信息" | 26 | android:text="修改版本信息" |
27 | android:textColor="@android:color/white" | 27 | android:textColor="@android:color/white" |
28 | android:textSize="22sp" /> | 28 | android:textSize="22sp" /> |
29 | <TextView | 29 | <TextView |
30 | android:id="@+id/version_sub" | 30 | android:id="@+id/version_sub" |
31 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
32 | android:layout_height="match_parent" | 32 | android:layout_height="match_parent" |
33 | android:paddingLeft="20dp" | 33 | android:paddingLeft="20dp" |
34 | android:paddingRight="20dp" | 34 | android:paddingRight="20dp" |
35 | android:gravity="center_vertical" | 35 | android:gravity="center_vertical" |
36 | android:layout_alignParentRight="true" | 36 | android:layout_alignParentRight="true" |
37 | android:text="保存" | 37 | android:text="保存" |
38 | android:textColor="@android:color/white" | 38 | android:textColor="@android:color/white" |
39 | android:textSize="22sp" /> | 39 | android:textSize="22sp" /> |
40 | 40 | ||
41 | 41 | ||
42 | </RelativeLayout> | 42 | </RelativeLayout> |
43 | <LinearLayout | ||
44 | android:id="@+id/tiles" | ||
45 | android:layout_width="match_parent" | ||
46 | android:layout_height="wrap_content" | ||
47 | android:layout_below="@+id/title" | ||
48 | android:layout_marginTop="50dp" | ||
49 | android:orientation="horizontal"> | ||
50 | <LinearLayout | ||
51 | android:id="@+id/tv_presons" | ||
52 | android:layout_width="0dp" | ||
53 | android:layout_weight="1" | ||
54 | android:gravity="center" | ||
55 | android:layout_height="match_parent"> | ||
56 | <TextView | ||
57 | android:id="@+id/tv_presonal" | ||
58 | android:layout_width="wrap_content" | ||
59 | android:layout_height="wrap_content" | ||
60 | android:textSize="22sp" | ||
61 | android:text="个人信息"/> | ||
62 | |||
63 | </LinearLayout> | ||
64 | <LinearLayout | ||
65 | android:layout_width="0dp" | ||
66 | android:layout_weight="1" | ||
67 | android:gravity="center" | ||
68 | android:layout_height="match_parent"> | ||
69 | <TextView | ||
70 | android:textSize="22sp" | ||
71 | android:layout_width="wrap_content" | ||
72 | android:layout_height="wrap_content" | ||
73 | android:textColor="@color/login_edittext_pressed" | ||
74 | android:text="版本信息"/> | ||
75 | |||
76 | </LinearLayout> | ||
77 | |||
78 | </LinearLayout> | ||
43 | <GridView | 79 | <GridView |
44 | android:id="@+id/grideview" | 80 | android:id="@+id/grideview" |
45 | android:layout_margin="30dp" | 81 | android:layout_margin="30dp" |
46 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
47 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
48 | android:gravity="center_vertical" | 84 | android:gravity="center_vertical" |
49 | android:layout_below="@+id/title" | 85 | android:layout_below="@+id/tiles" |
50 | android:verticalSpacing="20dp" | 86 | android:verticalSpacing="20dp" |
51 | android:numColumns="5"> | 87 | android:numColumns="5"> |
52 | 88 | ||
53 | </GridView> | 89 | </GridView> |
54 | 90 | ||
55 | </RelativeLayout> | 91 | </RelativeLayout> |
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.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_width="415dp" | 5 | android:layout_width="400dp" |
6 | android:layout_height="match_parent"> | 6 | android:layout_height="match_parent"> |
7 | <LinearLayout | 7 | <LinearLayout |
8 | android:id="@+id/ll_backgrangd" | 8 | android:id="@+id/ll_backgrangd" |
9 | android:layout_width="wrap_content" | 9 | android:layout_width="wrap_content" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | android:background="@drawable/corcle_black_bg" | 11 | android:background="@drawable/corcle_black_bg" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | <LinearLayout | 14 | <LinearLayout |
15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
17 | android:orientation="horizontal"> | 17 | android:orientation="horizontal"> |
18 | <com.facebook.drawee.view.SimpleDraweeView | 18 | <com.facebook.drawee.view.SimpleDraweeView |
19 | android:id="@+id/iv_child_head" | 19 | android:id="@+id/iv_child_head" |
20 | android:layout_width="60dp" | 20 | android:layout_width="60dp" |
21 | android:layout_height="60dp" | 21 | android:layout_height="60dp" |
22 | android:layout_margin="10dp" | 22 | android:layout_margin="10dp" |
23 | fresco:placeholderImage="@mipmap/header_default" | 23 | fresco:placeholderImage="@mipmap/header_default" |
24 | fresco:roundAsCircle="true" | 24 | fresco:roundAsCircle="true" |
25 | fresco:placeholderImageScaleType="fitCenter" /> | 25 | fresco:placeholderImageScaleType="fitCenter" /> |
26 | 26 | ||
27 | 27 | ||
28 | <LinearLayout | 28 | <LinearLayout |
29 | android:layout_width="0dp" | 29 | android:layout_width="0dp" |
30 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
31 | android:layout_marginLeft="10dp" | 31 | android:layout_marginLeft="10dp" |
32 | android:layout_marginTop="10dp" | 32 | android:layout_marginTop="10dp" |
33 | android:layout_weight="1" | 33 | android:layout_weight="1" |
34 | android:orientation="vertical"> | 34 | android:orientation="vertical"> |
35 | 35 | ||
36 | <TextView | 36 | <TextView |
37 | android:id="@+id/iv_child_name" | 37 | android:id="@+id/iv_child_name" |
38 | android:layout_width="wrap_content" | 38 | android:layout_width="wrap_content" |
39 | android:layout_height="wrap_content" | 39 | android:layout_height="wrap_content" |
40 | android:text="" | 40 | android:text="" |
41 | android:textSize="18sp" /> | 41 | android:textSize="18sp" /> |
42 | 42 | ||
43 | <TextView | 43 | <TextView |
44 | android:id="@+id/iv_child_grade" | 44 | android:id="@+id/iv_child_grade" |
45 | android:layout_width="wrap_content" | 45 | android:layout_width="wrap_content" |
46 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
47 | android:text="" | 47 | android:text="" |
48 | android:textSize="18sp" /> | 48 | android:textSize="18sp" /> |
49 | 49 | ||
50 | <TextView | 50 | <TextView |
51 | android:id="@+id/iv_child_school" | 51 | android:id="@+id/iv_child_school" |
52 | android:layout_width="wrap_content" | 52 | android:layout_width="wrap_content" |
53 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
54 | android:text="" | 54 | android:text="" |
55 | android:textSize="18sp" /> | 55 | android:textSize="18sp" /> |
56 | 56 | ||
57 | <TextView | 57 | <TextView |
58 | android:id="@+id/iv_child_adress" | 58 | android:id="@+id/iv_child_adress" |
59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
60 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
61 | android:text="" | 61 | android:text="" |
62 | android:textSize="18sp" /> | 62 | android:textSize="18sp" /> |
63 | 63 | ||
64 | </LinearLayout> | 64 | </LinearLayout> |
65 | <ImageView | 65 | <ImageView |
66 | android:id="@+id/iv_using_pic" | 66 | android:id="@+id/iv_using_pic" |
67 | android:layout_width="wrap_content" | 67 | android:layout_width="wrap_content" |
68 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
69 | android:layout_gravity="right" | 69 | android:layout_gravity="right" |
70 | android:layout_marginLeft="60dp" | 70 | android:layout_marginLeft="60dp" |
71 | android:visibility="gone" | 71 | android:visibility="gone" |
72 | android:src="@mipmap/shiyongzhong" /> | 72 | android:src="@mipmap/shiyongzhong" /> |
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | </LinearLayout> | 76 | </LinearLayout> |
77 | 77 | ||
78 | <View | 78 | <View |
79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
80 | android:layout_height="0.7dp" | 80 | android:layout_height="0.7dp" |
81 | android:layout_margin="10dp" | 81 | android:layout_margin="10dp" |
82 | android:background="@color/cutoff_line"> | 82 | android:background="@color/cutoff_line"> |
83 | 83 | ||
84 | </View> | 84 | </View> |
85 | 85 | ||
86 | <LinearLayout | 86 | <LinearLayout |
87 | android:layout_width="match_parent" | 87 | android:layout_width="match_parent" |
88 | android:layout_height="wrap_content" | 88 | android:layout_height="wrap_content" |
89 | android:layout_marginBottom="10dp" | 89 | android:layout_marginBottom="10dp" |
90 | android:orientation="horizontal"> | 90 | android:orientation="horizontal"> |
91 | 91 | ||
92 | <TextView | 92 | <TextView |
93 | android:id="@+id/delete_child_account" | 93 | android:id="@+id/delete_child_account" |
94 | android:layout_width="0dp" | 94 | android:layout_width="0dp" |
95 | android:layout_height="wrap_content" | 95 | android:layout_height="wrap_content" |
96 | android:layout_weight="1" | 96 | android:layout_weight="1" |
97 | android:gravity="center" | 97 | android:gravity="center" |
98 | android:text="删除用户" | 98 | android:text="删除用户" |
99 | android:textSize="18sp" /> | 99 | android:textSize="18sp" /> |
100 | 100 | ||
101 | <TextView | 101 | <TextView |
102 | android:id="@+id/chang_account" | 102 | android:id="@+id/chang_account" |
103 | android:layout_width="0dp" | 103 | android:layout_width="0dp" |
104 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
105 | android:layout_weight="1" | 105 | android:layout_weight="1" |
106 | android:gravity="center" | 106 | android:gravity="center" |
107 | android:text="切换使用" | 107 | android:text="切换使用" |
108 | android:textSize="18sp" /> | 108 | android:textSize="18sp" /> |
109 | 109 | ||
110 | 110 | ||
111 | </LinearLayout> | 111 | </LinearLayout> |
112 | 112 | ||
113 | </LinearLayout> | 113 | </LinearLayout> |
114 | 114 | ||
115 | </LinearLayout> | 115 | </LinearLayout> |