Commit 1ab8c799948e751fb22b8417aae4a47642d2de94
1 parent
c7ea65ea71
Exists in
master
个人信息,获取个人信息,个性签名,账户管理等等,接口的重新调试
Showing
19 changed files
with
316 additions
and
133 deletions
Show diff stats
PersonalCenter/.idea/misc.xml
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | <ConfirmationsSetting value="0" id="Add" /> |
38 | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
39 | 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 | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
42 | 42 | </component> |
43 | 43 | <component name="ProjectType"> | ... | ... |
PersonalCenter/app/build.gradle
... | ... | @@ -42,5 +42,6 @@ dependencies { |
42 | 42 | compile 'com.zaaach:toprightmenu:1.0' |
43 | 43 | compile 'com.facebook.fresco:fresco:1.1.0' |
44 | 44 | compile'com.android.support:recyclerview-v7:25.+' |
45 | - | |
45 | + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | |
46 | + releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | |
46 | 47 | } | ... | ... |
PersonalCenter/app/src/main/AndroidManifest.xml
... | ... | @@ -2,8 +2,8 @@ |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 | package="com.hjx.personalcenter"> |
4 | 4 | |
5 | - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
6 | 5 | <application |
6 | + android:name=".activity.MyApplication" | |
7 | 7 | android:allowBackup="true" |
8 | 8 | android:icon="@mipmap/ic_launcher" |
9 | 9 | android:label="@string/app_name" |
... | ... | @@ -118,6 +118,7 @@ |
118 | 118 | </activity> |
119 | 119 | </application> |
120 | 120 | <!--权限--> |
121 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
121 | 122 | <uses-permission android:name="android.permission.CAMERA" /> |
122 | 123 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
123 | 124 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/AccountManagementActivity.java
... | ... | @@ -79,12 +79,14 @@ public class AccountManagementActivity extends AppCompatActivity implements View |
79 | 79 | iv_account_head = (ImageView) findViewById(R.id.tv_account_head); |
80 | 80 | cancel = (ImageView) findViewById(R.id.cancel); |
81 | 81 | add_accunt = (LinearLayout) findViewById(R.id.add_account); |
82 | - | |
83 | - | |
84 | 82 | listview = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
85 | 83 | } |
86 | 84 | |
87 | 85 | private void initData() { |
86 | + if (Content.changgeaccountflag ==1){ | |
87 | + tv_delete.setText("使用中"); | |
88 | + tv_delete.setEnabled(true); | |
89 | + } | |
88 | 90 | String cunt_username = SaveParam.getInstance().getLoginParam(this,"username"); |
89 | 91 | String tv_usernames = SaveParam.getInstance().getLoginParam(this,SaveParam.USERNAME); |
90 | 92 | String tv_grades = SaveParam.getInstance().getLoginParam(this,SaveParam.GRADES); |
... | ... | @@ -132,7 +134,6 @@ public class AccountManagementActivity extends AppCompatActivity implements View |
132 | 134 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
133 | 135 | break; |
134 | 136 | case R.id.add_account: |
135 | - | |
136 | 137 | Content.accountflag = 2; |
137 | 138 | Intent account = new Intent(); |
138 | 139 | account.setClass(AccountManagementActivity.this,RegisterInfoActivity.class); |
... | ... | @@ -140,9 +141,15 @@ public class AccountManagementActivity extends AppCompatActivity implements View |
140 | 141 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
141 | 142 | |
142 | 143 | break; |
144 | + case R.id.tv_account_delete: | |
145 | + Content.changgeaccountflag =1; | |
146 | + SaveParam.getInstance().saveLoginParam(this,SaveParam.ACCOUNT,"1"); | |
147 | + | |
148 | + break; | |
143 | 149 | case R.id.cancel: |
144 | 150 | finish(); |
145 | 151 | break; |
152 | + | |
146 | 153 | } |
147 | 154 | |
148 | 155 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangeEletronicCardPhoneActivity.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChangePresonalInfoActivity.java
... | ... | @@ -4,6 +4,8 @@ import android.os.Bundle; |
4 | 4 | import android.support.v4.app.Fragment; |
5 | 5 | import android.support.v4.view.ViewPager; |
6 | 6 | import android.support.v7.app.AppCompatActivity; |
7 | +import android.view.View; | |
8 | +import android.widget.ImageView; | |
7 | 9 | import android.widget.TextView; |
8 | 10 | |
9 | 11 | import com.hjx.personalcenter.R; |
... | ... | @@ -20,10 +22,11 @@ import java.util.List; |
20 | 22 | * Created by h on 2017/8/12. |
21 | 23 | */ |
22 | 24 | |
23 | -public class ChangePresonalInfoActivity extends AppCompatActivity { | |
25 | +public class ChangePresonalInfoActivity extends AppCompatActivity implements View.OnClickListener { | |
24 | 26 | private ViewPager viewPager; |
25 | 27 | private SlidingTabLayout tableLayout; |
26 | 28 | private TextView subsave; |
29 | + private ImageView cancel; | |
27 | 30 | private List<Fragment> presoninfo; |
28 | 31 | private LoginAndRegisterAdapter presoninfodapter; |
29 | 32 | private List<String> title = Arrays.asList("个人信息", "版本信息"); |
... | ... | @@ -39,6 +42,7 @@ public class ChangePresonalInfoActivity extends AppCompatActivity { |
39 | 42 | private void initView() { |
40 | 43 | viewPager = (ViewPager) findViewById(R.id.viewpager_login); |
41 | 44 | tableLayout = (SlidingTabLayout) findViewById(R.id.TabLayout_id); |
45 | + cancel = (ImageView) findViewById(R.id.cancel); | |
42 | 46 | subsave = (TextView) findViewById(R.id.presonal_sub); |
43 | 47 | } |
44 | 48 | |
... | ... | @@ -66,6 +70,16 @@ public class ChangePresonalInfoActivity extends AppCompatActivity { |
66 | 70 | } |
67 | 71 | |
68 | 72 | private void setLister() { |
73 | + cancel.setOnClickListener(this); | |
69 | 74 | } |
70 | 75 | |
76 | + @Override | |
77 | + public void onClick(View v) { | |
78 | + switch (v.getId()){ | |
79 | + case R.id.cancel: | |
80 | + finish(); | |
81 | + break; | |
82 | + } | |
83 | + | |
84 | + } | |
71 | 85 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ChoiseTextBookActivity.java
... | ... | @@ -8,6 +8,7 @@ import android.support.v7.app.AppCompatActivity; |
8 | 8 | import android.view.View; |
9 | 9 | import android.widget.Button; |
10 | 10 | import android.widget.GridView; |
11 | +import android.widget.ImageView; | |
11 | 12 | import android.widget.SimpleAdapter; |
12 | 13 | |
13 | 14 | import com.hjx.personalcenter.R; |
... | ... | @@ -31,6 +32,7 @@ import java.util.Map; |
31 | 32 | public class ChoiseTextBookActivity extends AppCompatActivity implements View.OnClickListener { |
32 | 33 | private GridView gridView; |
33 | 34 | private Button btn_ok; |
35 | + private ImageView cancel; | |
34 | 36 | private List<Map<String, Object>> data_list; |
35 | 37 | private SimpleAdapter sim_adapter; |
36 | 38 | // 图片封装为一个数组 |
... | ... | @@ -88,6 +90,7 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
88 | 90 | |
89 | 91 | private void initView() { |
90 | 92 | gridView = (GridView) findViewById(R.id.grideview); |
93 | + cancel = (ImageView) findViewById(R.id.cancel); | |
91 | 94 | btn_ok = (Button) findViewById(R.id.btn_ok); |
92 | 95 | } |
93 | 96 | |
... | ... | @@ -104,6 +107,7 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
104 | 107 | |
105 | 108 | private void initLister() { |
106 | 109 | btn_ok.setOnClickListener(this); |
110 | + cancel.setOnClickListener(this); | |
107 | 111 | |
108 | 112 | } |
109 | 113 | public List<Map<String, Object>> getData(){ |
... | ... | @@ -132,6 +136,9 @@ public class ChoiseTextBookActivity extends AppCompatActivity implements View.On |
132 | 136 | } |
133 | 137 | |
134 | 138 | break; |
139 | + case R.id.cancel: | |
140 | + finish(); | |
141 | + break; | |
135 | 142 | } |
136 | 143 | |
137 | 144 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/ElectronicCardValidationActivity.java
... | ... | @@ -9,6 +9,7 @@ import android.text.TextUtils; |
9 | 9 | import android.view.View; |
10 | 10 | import android.widget.Button; |
11 | 11 | import android.widget.EditText; |
12 | +import android.widget.ImageView; | |
12 | 13 | import android.widget.TextView; |
13 | 14 | |
14 | 15 | import com.hjx.personalcenter.R; |
... | ... | @@ -29,6 +30,7 @@ public class ElectronicCardValidationActivity extends Activity implements View.O |
29 | 30 | private Button btn_card_valiyanzhen,get_authcode; |
30 | 31 | private EditText phonenumber,anth_6num;//;//密码 |
31 | 32 | private TextView menu_title; |
33 | + private ImageView cancel; | |
32 | 34 | private int i = 0; |
33 | 35 | private Thread thread; |
34 | 36 | private String sourceStr ="android"; |
... | ... | @@ -81,6 +83,7 @@ public class ElectronicCardValidationActivity extends Activity implements View.O |
81 | 83 | anth_6num = (EditText) findViewById(R.id.et_authcode); |
82 | 84 | phonenumber = (EditText) findViewById(R.id.et_phonenumber); |
83 | 85 | menu_title = (TextView) findViewById(R.id.menu_title); |
86 | + cancel = (ImageView) findViewById(R.id.cancel); | |
84 | 87 | } |
85 | 88 | |
86 | 89 | private void initData() { |
... | ... | @@ -104,6 +107,7 @@ public class ElectronicCardValidationActivity extends Activity implements View.O |
104 | 107 | private void initLister() { |
105 | 108 | get_authcode.setOnClickListener(this); |
106 | 109 | btn_card_valiyanzhen.setOnClickListener(this); |
110 | + cancel.setOnClickListener(this); | |
107 | 111 | |
108 | 112 | } |
109 | 113 | |
... | ... | @@ -171,6 +175,9 @@ public class ElectronicCardValidationActivity extends Activity implements View.O |
171 | 175 | } |
172 | 176 | |
173 | 177 | break; |
178 | + case R.id.cancel: | |
179 | + finish(); | |
180 | + break; | |
174 | 181 | } |
175 | 182 | } |
176 | 183 | // 线程类 定时器 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MyApplication.java
... | ... | @@ -5,6 +5,7 @@ import android.content.Context; |
5 | 5 | |
6 | 6 | import com.facebook.drawee.backends.pipeline.Fresco; |
7 | 7 | import com.hjx.personalcenter.util.ImageCache; |
8 | +import com.squareup.leakcanary.LeakCanary; | |
8 | 9 | import com.tencent.bugly.crashreport.CrashReport; |
9 | 10 | |
10 | 11 | /** |
... | ... | @@ -20,6 +21,8 @@ public class MyApplication extends Application { |
20 | 21 | public void onCreate() { |
21 | 22 | super.onCreate(); |
22 | 23 | context = getApplicationContext(); |
24 | + //c初始化内存检测 | |
25 | + LeakCanary.install(this); | |
23 | 26 | //初始化Fresco |
24 | 27 | Fresco.initialize(this); |
25 | 28 | mImageCache = new ImageCache(); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/AccountChildsAdapter.java
... | ... | @@ -10,6 +10,8 @@ import android.widget.TextView; |
10 | 10 | |
11 | 11 | import com.facebook.drawee.view.SimpleDraweeView; |
12 | 12 | import com.hjx.personalcenter.R; |
13 | +import com.hjx.personalcenter.db.Content; | |
14 | +import com.hjx.personalcenter.db.SaveParam; | |
13 | 15 | import com.hjx.personalcenter.http.HttpManager; |
14 | 16 | import com.hjx.personalcenter.model.ChildsInfo; |
15 | 17 | import com.mylhyl.circledialog.CircleDialog; |
... | ... | @@ -50,7 +52,6 @@ public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdap |
50 | 52 | @Override |
51 | 53 | public AccountChildsHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
52 | 54 | View view = mInflater.inflate(R.layout.recycler_childaccunt_item_view, parent, false); |
53 | - | |
54 | 55 | AccountChildsHolder holder = new AccountChildsHolder(view); |
55 | 56 | return holder; |
56 | 57 | } |
... | ... | @@ -97,6 +98,8 @@ public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdap |
97 | 98 | .setPositive("确定", new View.OnClickListener() { |
98 | 99 | @Override |
99 | 100 | public void onClick(View v) { |
101 | + Content.changgeaccountflag =2; | |
102 | + SaveParam.getInstance().saveLoginParam(mContext,SaveParam.ACCOUNT,"2"); | |
100 | 103 | HttpManager.getInstance().changechildAccountinfo(mContext,bean.getSubAccountId(),bean.getParentId()); |
101 | 104 | } |
102 | 105 | }) |
... | ... | @@ -128,6 +131,10 @@ public class AccountChildsAdapter extends RecyclerView.Adapter<AccountChildsAdap |
128 | 131 | iv_child_adress = (TextView) itemView.findViewById(R.id.iv_child_adress); |
129 | 132 | delete_account = (TextView) itemView.findViewById(R.id.delete_child_account); |
130 | 133 | chang_account = (TextView) itemView.findViewById(R.id.chang_account); |
134 | + if (Content.changgeaccountflag==2){ | |
135 | + chang_account.setText("使用中"); | |
136 | + chang_account.setEnabled(true); | |
137 | + } | |
131 | 138 | |
132 | 139 | } |
133 | 140 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/Content.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
... | ... | @@ -36,6 +36,9 @@ public class SaveParam { |
36 | 36 | public static String CITYS = "citys";//市 |
37 | 37 | public static String COUNTRY = "country";//区 |
38 | 38 | |
39 | + //账户管理 | |
40 | + public static String ACCOUNT = "account";//账户类型 | |
41 | + | |
39 | 42 | |
40 | 43 | public void saveLoginParam(Context context,String spname, String spstr) { |
41 | 44 | SharedPreferences sp = context.getSharedPreferences("loginparam", | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
... | ... | @@ -186,7 +186,7 @@ public class PresonInfoFragment extends Fragment implements View.OnClickListener |
186 | 186 | regionId = regionId1; |
187 | 187 | } |
188 | 188 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
189 | - String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | |
189 | + String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.SCHOOOlID); | |
190 | 190 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); |
191 | 191 | try { |
192 | 192 | a = Integer.parseInt(regionId); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
... | ... | @@ -18,6 +18,7 @@ import android.widget.ImageView; |
18 | 18 | |
19 | 19 | import com.hjx.personalcenter.R; |
20 | 20 | import com.hjx.personalcenter.activity.RegisterInfoActivity; |
21 | +import com.hjx.personalcenter.db.Content; | |
21 | 22 | import com.hjx.personalcenter.http.HttpCode; |
22 | 23 | import com.hjx.personalcenter.http.HttpManager; |
23 | 24 | import com.hjx.personalcenter.util.AlertUtils; |
... | ... | @@ -71,8 +72,9 @@ public class RegisterFragment extends Fragment implements View.OnClickListener { |
71 | 72 | if (status.equals("100")) { |
72 | 73 | String usernameStr = phonenumber.getText().toString().trim(); |
73 | 74 | String passwordStr = password.getText().toString().trim(); |
74 | - HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); | |
75 | + //HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); | |
75 | 76 | AlertUtils.showToast(getActivity(), "注册成功!"); |
77 | + Content.accountflag =1; | |
76 | 78 | //检查信息是否填写完整 |
77 | 79 | Intent intent = new Intent(); |
78 | 80 | intent.setClass(getActivity(),RegisterInfoActivity.class); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... | ... | @@ -281,6 +281,8 @@ public class HttpManager { |
281 | 281 | intent.setClass(context, LoginAndRegisterActivity.class); |
282 | 282 | ((Activity) context).startActivity(intent); |
283 | 283 | ((Activity) context).finish(); |
284 | + }else{ | |
285 | + Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | |
284 | 286 | } |
285 | 287 | } catch (JSONException e) { |
286 | 288 | e.printStackTrace(); |
... | ... | @@ -333,6 +335,8 @@ public class HttpManager { |
333 | 335 | Log.e("test", "onSuccess" + new String(bytes)); |
334 | 336 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
335 | 337 | ((Activity) context).finish(); |
338 | + }else{ | |
339 | + Toast.makeText(context, "密码修改失败!", Toast.LENGTH_LONG).show(); | |
336 | 340 | } |
337 | 341 | } catch (JSONException e) { |
338 | 342 | e.printStackTrace(); |
... | ... | @@ -379,13 +383,6 @@ public class HttpManager { |
379 | 383 | |
380 | 384 | } |
381 | 385 | |
382 | - //保存用户登录信息 | |
383 | - public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { | |
384 | - SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); | |
385 | - SaveParam.getInstance().saveLoginParam(context, "gender", gender); | |
386 | - SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); | |
387 | - } | |
388 | - | |
389 | 386 | //提交保卡信息 |
390 | 387 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
391 | 388 | String buyAddress, String buyTime, String alterSaleCall, |
... | ... | @@ -426,6 +423,8 @@ public class HttpManager { |
426 | 423 | ((Activity) context).startActivity(intent); |
427 | 424 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
428 | 425 | ((Activity) context).finish(); |
426 | + } else { | |
427 | + Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); | |
429 | 428 | } |
430 | 429 | } catch (JSONException e) { |
431 | 430 | e.printStackTrace(); |
... | ... | @@ -464,23 +463,38 @@ public class HttpManager { |
464 | 463 | }); |
465 | 464 | |
466 | 465 | } |
466 | + | |
467 | 467 | //获取保卡信息 |
468 | - public void getcardinfo(final Context mContext, long userId , final Handler handler) { | |
468 | + public void getcardinfo(final Context mContext, long userId, final Handler handler) { | |
469 | 469 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
470 | 470 | false, true, null); |
471 | 471 | HttpClient.getInstance().setTimeout(5 * 1000); |
472 | 472 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
473 | - HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { | |
473 | + HttpClient.getInstance().get(HttpUrl.getcardinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | |
474 | 474 | @Override |
475 | 475 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
476 | 476 | closeProgress(); |
477 | 477 | Log.e("test", "保卡信息" + new String(arg2)); |
478 | - CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | |
479 | - CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | |
480 | - Message msg = Message.obtain(); | |
481 | - msg.what = HttpCode.SUCHCARDINFO; | |
482 | - msg.obj = schoolInfoBeanList; | |
483 | - handler.sendMessage(msg); | |
478 | + try { | |
479 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
480 | + int status = jsonObject.optInt("status"); | |
481 | + if (status == 1) { | |
482 | + CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | |
483 | + CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | |
484 | + Message msg = Message.obtain(); | |
485 | + msg.what = HttpCode.SUCHCARDINFO; | |
486 | + msg.obj = schoolInfoBeanList; | |
487 | + handler.sendMessage(msg); | |
488 | + | |
489 | + | |
490 | + } else { | |
491 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
492 | + | |
493 | + } | |
494 | + } catch (JSONException e) { | |
495 | + e.printStackTrace(); | |
496 | + } | |
497 | + | |
484 | 498 | } |
485 | 499 | |
486 | 500 | @Override |
... | ... | @@ -510,6 +524,7 @@ public class HttpManager { |
510 | 524 | } |
511 | 525 | }); |
512 | 526 | } |
527 | + | |
513 | 528 | //修改保卡信息电话 |
514 | 529 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
515 | 530 | RequestParams params = new RequestParams(); |
... | ... | @@ -525,10 +540,12 @@ public class HttpManager { |
525 | 540 | String status = jsonObject.optString("status"); |
526 | 541 | if (status.equals("1")) { |
527 | 542 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
528 | - SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); | |
543 | + SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.CARDPHONE, customerPhone); | |
529 | 544 | ((Activity) mContext).finish(); |
530 | - }else if (status.equals("1001")){ | |
545 | + } else if (status.equals("1001")) { | |
531 | 546 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
547 | + } else { | |
548 | + AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | |
532 | 549 | } |
533 | 550 | } catch (JSONException e) { |
534 | 551 | e.printStackTrace(); |
... | ... | @@ -562,6 +579,7 @@ public class HttpManager { |
562 | 579 | } |
563 | 580 | }); |
564 | 581 | } |
582 | + | |
565 | 583 | //修改保卡信息地址 |
566 | 584 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
567 | 585 | RequestParams params = new RequestParams(); |
... | ... | @@ -578,8 +596,10 @@ public class HttpManager { |
578 | 596 | String status = jsonObject.optString("status"); |
579 | 597 | if (status.equals("1")) { |
580 | 598 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
581 | - SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); | |
599 | + SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | |
582 | 600 | ((Activity) mContext).finish(); |
601 | + } else { | |
602 | + AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | |
583 | 603 | } |
584 | 604 | } catch (JSONException e) { |
585 | 605 | e.printStackTrace(); |
... | ... | @@ -613,20 +633,35 @@ public class HttpManager { |
613 | 633 | } |
614 | 634 | }); |
615 | 635 | } |
636 | + | |
616 | 637 | //验证是否保卡信息 |
617 | 638 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
618 | 639 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
619 | 640 | false, true, null); |
620 | 641 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
621 | - HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { | |
642 | + HttpClient.getInstance().get(HttpUrl.cardcheck + "?userId=" + userId, new AsyncHttpResponseHandler() { | |
622 | 643 | @Override |
623 | 644 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
624 | 645 | Log.e("test", "---" + new String(arg2)); |
625 | 646 | closeProgress(); |
626 | - Message msg = Message.obtain(); | |
627 | - msg.what = HttpCode.CHECKCARD; | |
628 | - msg.obj = new String(arg2); | |
629 | - handler.sendMessage(msg); | |
647 | + try { | |
648 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
649 | + int status = jsonObject.optInt("status"); | |
650 | + if (status == 1) { | |
651 | + Message msg = Message.obtain(); | |
652 | + msg.what = HttpCode.CHECKCARD; | |
653 | + msg.obj = new String(arg2); | |
654 | + handler.sendMessage(msg); | |
655 | + | |
656 | + | |
657 | + } else { | |
658 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
659 | + | |
660 | + } | |
661 | + } catch (JSONException e) { | |
662 | + e.printStackTrace(); | |
663 | + } | |
664 | + | |
630 | 665 | } |
631 | 666 | |
632 | 667 | @Override |
... | ... | @@ -667,7 +702,7 @@ public class HttpManager { |
667 | 702 | Log.e("test", "年级" + new String(arg2)); |
668 | 703 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
669 | 704 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
670 | - for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { | |
705 | + for (int i = 0; i < gradeInfo.getData().size() - 2; i++) { | |
671 | 706 | String name = gradeInfo.getData().get(i).getName(); |
672 | 707 | int id = gradeInfo.getData().get(i).getId(); |
673 | 708 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
... | ... | @@ -719,6 +754,7 @@ public class HttpManager { |
719 | 754 | |
720 | 755 | /** |
721 | 756 | * 获取学校 |
757 | + * | |
722 | 758 | * @param mContext |
723 | 759 | * @param regionId |
724 | 760 | * @param gradeId |
... | ... | @@ -726,16 +762,29 @@ public class HttpManager { |
726 | 762 | */ |
727 | 763 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
728 | 764 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
729 | - HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | |
765 | + HttpClient.getInstance().get(HttpUrl.schoolUrl + "?regionId=" + regionId + "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | |
730 | 766 | @Override |
731 | 767 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
732 | 768 | Log.e("test", "学校" + new String(arg2)); |
733 | - SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | |
734 | - List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | |
735 | - Message message = Message.obtain(); | |
736 | - message.what = HttpCode.SCHOOL; | |
737 | - message.obj = schoolInfoBeanList; | |
738 | - handler.sendMessage(message); | |
769 | + try { | |
770 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
771 | + int status = jsonObject.optInt("status"); | |
772 | + if (status == 1) { | |
773 | + SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | |
774 | + List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | |
775 | + Message message = Message.obtain(); | |
776 | + message.what = HttpCode.SCHOOL; | |
777 | + message.obj = schoolInfoBeanList; | |
778 | + handler.sendMessage(message); | |
779 | + | |
780 | + | |
781 | + } else { | |
782 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
783 | + | |
784 | + } | |
785 | + } catch (JSONException e) { | |
786 | + e.printStackTrace(); | |
787 | + } | |
739 | 788 | |
740 | 789 | } |
741 | 790 | |
... | ... | @@ -767,9 +816,9 @@ public class HttpManager { |
767 | 816 | } |
768 | 817 | |
769 | 818 | |
770 | - | |
771 | 819 | /** |
772 | 820 | * 获取个人信息 |
821 | + * | |
773 | 822 | * @param mContext |
774 | 823 | * @param userId |
775 | 824 | * @param handler |
... | ... | @@ -778,18 +827,32 @@ public class HttpManager { |
778 | 827 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
779 | 828 | false, true, null); |
780 | 829 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
781 | - HttpClient.getInstance().setConnectTimeout(5*1000); | |
782 | - HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { | |
830 | + HttpClient.getInstance().setConnectTimeout(5 * 1000); | |
831 | + HttpClient.getInstance().get(HttpUrl.getpresonalinfo + "?userId=" + userId, new AsyncHttpResponseHandler() { | |
783 | 832 | @Override |
784 | 833 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
785 | 834 | closeProgress(); |
786 | 835 | Log.e("test", "个人信息" + new String(arg2)); |
787 | - PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | |
788 | - PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | |
789 | - Message message = Message.obtain(); | |
790 | - message.what = HttpCode.GETINFO; | |
791 | - message.obj = pesonalInfoBeanList; | |
792 | - handler.sendMessage(message); | |
836 | + try { | |
837 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
838 | + int status = jsonObject.optInt("status"); | |
839 | + if (status == 1) { | |
840 | + PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | |
841 | + PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | |
842 | + Message message = Message.obtain(); | |
843 | + message.what = HttpCode.GETINFO; | |
844 | + message.obj = pesonalInfoBeanList; | |
845 | + handler.sendMessage(message); | |
846 | + | |
847 | + | |
848 | + } else { | |
849 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
850 | + | |
851 | + } | |
852 | + } catch (JSONException e) { | |
853 | + e.printStackTrace(); | |
854 | + } | |
855 | + | |
793 | 856 | |
794 | 857 | } |
795 | 858 | |
... | ... | @@ -820,6 +883,7 @@ public class HttpManager { |
820 | 883 | } |
821 | 884 | }); |
822 | 885 | } |
886 | + | |
823 | 887 | //修改个人信息 |
824 | 888 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { |
825 | 889 | Gson gson = new Gson(); |
... | ... | @@ -828,8 +892,8 @@ public class HttpManager { |
828 | 892 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
829 | 893 | false, true, null); |
830 | 894 | ByteArrayEntity entity = null; |
831 | - entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | |
832 | - entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | |
895 | + entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | |
896 | + entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | |
833 | 897 | |
834 | 898 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
835 | 899 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { |
... | ... | @@ -837,11 +901,13 @@ public class HttpManager { |
837 | 901 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
838 | 902 | super.onSuccess(statusCode, headers, response); |
839 | 903 | closeProgress(); |
840 | - String status = response.optString("status"); | |
841 | - if (status.equals("1")) { | |
842 | - Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | |
843 | - ((Activity) mContext).finish(); | |
844 | - } | |
904 | + String status = response.optString("status"); | |
905 | + if (status.equals("1")) { | |
906 | + Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | |
907 | + ((Activity) mContext).finish(); | |
908 | + } else { | |
909 | + AlertUtils.showToast(mContext, "您好,服务器异常,请稍后重试"); | |
910 | + } | |
845 | 911 | Log.e("test", "onSuccess" + response); |
846 | 912 | |
847 | 913 | } |
... | ... | @@ -876,6 +942,7 @@ public class HttpManager { |
876 | 942 | |
877 | 943 | }); |
878 | 944 | } |
945 | + | |
879 | 946 | //修改个性签名 |
880 | 947 | public void changsignature(final Context mContext, long userId, final String signature) { |
881 | 948 | RequestParams params = new RequestParams(); |
... | ... | @@ -890,6 +957,8 @@ public class HttpManager { |
890 | 957 | String status = jsonObject.optString("status"); |
891 | 958 | if (status.equals("1")) { |
892 | 959 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
960 | + } else { | |
961 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | |
893 | 962 | } |
894 | 963 | } catch (JSONException e) { |
895 | 964 | e.printStackTrace(); |
... | ... | @@ -926,22 +995,37 @@ public class HttpManager { |
926 | 995 | |
927 | 996 | /** |
928 | 997 | * 获取个性签名 |
998 | + * | |
929 | 999 | * @param mContext |
930 | 1000 | * @param userId |
931 | 1001 | * @param handler |
932 | 1002 | */ |
933 | - public void getsignatures(final Context mContext,long userId , final Handler handler) { | |
1003 | + public void getsignatures(final Context mContext, long userId, final Handler handler) { | |
934 | 1004 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
935 | - HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { | |
1005 | + HttpClient.getInstance().get(HttpUrl.getsignature + "?userId=" + userId, new AsyncHttpResponseHandler() { | |
936 | 1006 | @Override |
937 | 1007 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
938 | 1008 | Log.e("test", "个性签名" + new String(arg2)); |
939 | - SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | |
940 | - SignInfo.DataBean signInfoBeanList = signInfo.getData(); | |
941 | - Message message = Message.obtain(); | |
942 | - message.what = HttpCode.SIGN; | |
943 | - message.obj = signInfoBeanList; | |
944 | - handler.sendMessage(message); | |
1009 | + try { | |
1010 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
1011 | + int status = jsonObject.optInt("status"); | |
1012 | + if (status == 1) { | |
1013 | + SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | |
1014 | + SignInfo.DataBean signInfoBeanList = signInfo.getData(); | |
1015 | + Message message = Message.obtain(); | |
1016 | + message.what = HttpCode.SIGN; | |
1017 | + message.obj = signInfoBeanList; | |
1018 | + handler.sendMessage(message); | |
1019 | + | |
1020 | + | |
1021 | + } else { | |
1022 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
1023 | + | |
1024 | + } | |
1025 | + } catch (JSONException e) { | |
1026 | + e.printStackTrace(); | |
1027 | + } | |
1028 | + | |
945 | 1029 | |
946 | 1030 | } |
947 | 1031 | |
... | ... | @@ -975,6 +1059,7 @@ public class HttpManager { |
975 | 1059 | |
976 | 1060 | /** |
977 | 1061 | * 用户反馈 |
1062 | + * | |
978 | 1063 | * @param mContext |
979 | 1064 | * @param object |
980 | 1065 | * @throws UnsupportedEncodingException |
... | ... | @@ -999,6 +1084,8 @@ public class HttpManager { |
999 | 1084 | if (status.equals("1")) { |
1000 | 1085 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); |
1001 | 1086 | ((Activity) mContext).finish(); |
1087 | + } else { | |
1088 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试"); | |
1002 | 1089 | } |
1003 | 1090 | Log.e("test", "onSuccess" + response); |
1004 | 1091 | |
... | ... | @@ -1037,16 +1124,17 @@ public class HttpManager { |
1037 | 1124 | |
1038 | 1125 | /** |
1039 | 1126 | * 查询子账户信息 |
1127 | + * | |
1040 | 1128 | * @param mContext |
1041 | 1129 | * @param userId |
1042 | 1130 | * @param handler |
1043 | 1131 | */ |
1044 | - public void getchildAccountinfo(final Context mContext, long userId , final Handler handler) { | |
1132 | + public void getchildAccountinfo(final Context mContext, long userId, final Handler handler) { | |
1045 | 1133 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取信息...", |
1046 | 1134 | false, true, null); |
1047 | 1135 | HttpClient.getInstance().setTimeout(5 * 1000); |
1048 | 1136 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1049 | - HttpClient.getInstance().get(HttpUrl.childUserURL+ "?userId=" + userId , new AsyncHttpResponseHandler() { | |
1137 | + HttpClient.getInstance().get(HttpUrl.childUserURL + "?userId=" + userId, new AsyncHttpResponseHandler() { | |
1050 | 1138 | @Override |
1051 | 1139 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1052 | 1140 | closeProgress(); |
... | ... | @@ -1054,11 +1142,13 @@ public class HttpManager { |
1054 | 1142 | try { |
1055 | 1143 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1056 | 1144 | int status = jsonObject.optInt("status"); |
1057 | - if (status ==1000){ | |
1058 | - AlertUtils.showToast(mContext,"你好,你还未添加子账号,子账号为空!"); | |
1059 | - }else { | |
1145 | + if (status == 0) { | |
1146 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后再试!"); | |
1147 | + } else if (status == 1000) { | |
1148 | + AlertUtils.showToast(mContext, "你好,你还未添加子账号,子账号为空!"); | |
1149 | + } else { | |
1060 | 1150 | ChildsInfo childsInfo = GsonTool.getPerson(new String(arg2), ChildsInfo.class);//解析json数据 |
1061 | - List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | |
1151 | + List<ChildsInfo.DataBean> schoolInfoBeanList = childsInfo.getData(); | |
1062 | 1152 | Message msg = Message.obtain(); |
1063 | 1153 | msg.what = HttpCode.CHILDS_SUCESS; |
1064 | 1154 | msg.obj = schoolInfoBeanList; |
... | ... | @@ -1096,22 +1186,23 @@ public class HttpManager { |
1096 | 1186 | } |
1097 | 1187 | }) |
1098 | 1188 | .show(); |
1099 | - } | |
1189 | + } | |
1100 | 1190 | }); |
1101 | 1191 | |
1102 | 1192 | } |
1193 | + | |
1103 | 1194 | /** |
1104 | 1195 | * 删除子账户信息 |
1196 | + * | |
1105 | 1197 | * @param mContext |
1106 | 1198 | * @param subAccountId |
1107 | - * | |
1108 | 1199 | */ |
1109 | - public void deletechildAccountinfo(final Context mContext, long subAccountId ) { | |
1200 | + public void deletechildAccountinfo(final Context mContext, long subAccountId) { | |
1110 | 1201 | mProgress = DialogPermission.showProgress(mContext, null, "正在删除子账户...", |
1111 | 1202 | false, true, null); |
1112 | 1203 | HttpClient.getInstance().setTimeout(5 * 1000); |
1113 | 1204 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1114 | - HttpClient.getInstance().get(HttpUrl.deletechildUserURL+ "?subAccountId=" + subAccountId , new AsyncHttpResponseHandler() { | |
1205 | + HttpClient.getInstance().get(HttpUrl.deletechildUserURL + "?subAccountId=" + subAccountId, new AsyncHttpResponseHandler() { | |
1115 | 1206 | @Override |
1116 | 1207 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1117 | 1208 | closeProgress(); |
... | ... | @@ -1119,10 +1210,10 @@ public class HttpManager { |
1119 | 1210 | try { |
1120 | 1211 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1121 | 1212 | int status = jsonObject.optInt("status"); |
1122 | - if (status ==1){ | |
1123 | - AlertUtils.showToast(mContext,"子账号删除成功!"); | |
1124 | - }else { | |
1125 | - AlertUtils.showToast(mContext,"你好,子账号删除失败!"); | |
1213 | + if (status == 1) { | |
1214 | + AlertUtils.showToast(mContext, "子账号删除成功!"); | |
1215 | + } else { | |
1216 | + AlertUtils.showToast(mContext, "你好,子账号删除失败!"); | |
1126 | 1217 | |
1127 | 1218 | } |
1128 | 1219 | } catch (JSONException e) { |
... | ... | @@ -1160,12 +1251,12 @@ public class HttpManager { |
1160 | 1251 | }); |
1161 | 1252 | |
1162 | 1253 | } |
1254 | + | |
1163 | 1255 | /** |
1164 | 1256 | * 添加子账户信息 |
1165 | - * | |
1166 | 1257 | */ |
1167 | - public void addchildAccountinfo(final Context mContext, long parentId,String image, | |
1168 | - String name,String grade,String school,String region) { | |
1258 | + public void addchildAccountinfo(final Context mContext, long parentId, String image, | |
1259 | + String name, String grade, String school, String region) { | |
1169 | 1260 | mProgress = DialogPermission.showProgress(mContext, null, "正在添加子账户...", |
1170 | 1261 | false, true, null); |
1171 | 1262 | RequestParams params = new RequestParams(); |
... | ... | @@ -1181,7 +1272,7 @@ public class HttpManager { |
1181 | 1272 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
1182 | 1273 | HttpClient.getInstance().setTimeout(5 * 1000); |
1183 | 1274 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1184 | - HttpClient.getInstance().post(HttpUrl.addchildUserURL ,params, new AsyncHttpResponseHandler() { | |
1275 | + HttpClient.getInstance().post(HttpUrl.addchildUserURL, params, new AsyncHttpResponseHandler() { | |
1185 | 1276 | @Override |
1186 | 1277 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1187 | 1278 | closeProgress(); |
... | ... | @@ -1190,11 +1281,11 @@ public class HttpManager { |
1190 | 1281 | try { |
1191 | 1282 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1192 | 1283 | int status = jsonObject.optInt("status"); |
1193 | - if (status ==1){ | |
1194 | - AlertUtils.showToast(mContext,"子账号添加成功!"); | |
1284 | + if (status == 1) { | |
1285 | + AlertUtils.showToast(mContext, "子账号添加成功!"); | |
1195 | 1286 | ((Activity) mContext).finish(); |
1196 | - }else { | |
1197 | - AlertUtils.showToast(mContext,"你好,子账号添加失败!"); | |
1287 | + } else { | |
1288 | + AlertUtils.showToast(mContext, "你好,子账号添加失败!"); | |
1198 | 1289 | |
1199 | 1290 | } |
1200 | 1291 | } catch (JSONException e) { |
... | ... | @@ -1235,16 +1326,16 @@ public class HttpManager { |
1235 | 1326 | |
1236 | 1327 | /** |
1237 | 1328 | * 切换子账户信息 |
1329 | + * | |
1238 | 1330 | * @param mContext |
1239 | 1331 | * @param subAccountId |
1240 | - * | |
1241 | 1332 | */ |
1242 | - public void changechildAccountinfo(final Context mContext, long subAccountId ,long userId) { | |
1333 | + public void changechildAccountinfo(final Context mContext, long subAccountId, long userId) { | |
1243 | 1334 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1244 | 1335 | false, true, null); |
1245 | 1336 | HttpClient.getInstance().setTimeout(5 * 1000); |
1246 | 1337 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1247 | - HttpClient.getInstance().get(HttpUrl.changechildUserURL+ "?subAccountId=" + subAccountId+"&userId="+ userId, new AsyncHttpResponseHandler() { | |
1338 | + HttpClient.getInstance().get(HttpUrl.changechildUserURL + "?subAccountId=" + subAccountId + "&userId=" + userId, new AsyncHttpResponseHandler() { | |
1248 | 1339 | @Override |
1249 | 1340 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1250 | 1341 | closeProgress(); |
... | ... | @@ -1252,11 +1343,11 @@ public class HttpManager { |
1252 | 1343 | try { |
1253 | 1344 | JSONObject jsonObject = new JSONObject(new String(arg2)); |
1254 | 1345 | int status = jsonObject.optInt("status"); |
1255 | - if (status ==1){ | |
1256 | - AlertUtils.showToast(mContext,"子账号切换成功!"); | |
1346 | + if (status == 1) { | |
1347 | + AlertUtils.showToast(mContext, "子账号切换成功!"); | |
1257 | 1348 | |
1258 | - }else { | |
1259 | - AlertUtils.showToast(mContext,"你好,子账号切换失败!"); | |
1349 | + } else { | |
1350 | + AlertUtils.showToast(mContext, "你好,子账号切换失败!"); | |
1260 | 1351 | |
1261 | 1352 | } |
1262 | 1353 | } catch (JSONException e) { |
... | ... | @@ -1294,19 +1385,19 @@ public class HttpManager { |
1294 | 1385 | }); |
1295 | 1386 | |
1296 | 1387 | } |
1388 | + | |
1297 | 1389 | /** |
1298 | 1390 | * 系统升级 |
1299 | - * @param mContext | |
1300 | - * @param pid | |
1301 | - * appName | |
1302 | 1391 | * |
1392 | + * @param mContext | |
1393 | + * @param pid appName | |
1303 | 1394 | */ |
1304 | - public void updateAPP(final Context mContext, String pid , String appName, final Handler handler) { | |
1395 | + public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | |
1305 | 1396 | mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", |
1306 | 1397 | false, true, null); |
1307 | 1398 | HttpClient.getInstance().setTimeout(5 * 1000); |
1308 | 1399 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1309 | - HttpClient.getInstance().get(HttpUrl.updateappURL+ "?pid=" + pid+"&appName="+ appName, new AsyncHttpResponseHandler() { | |
1400 | + HttpClient.getInstance().get(HttpUrl.updateappURL + "?pid=" + pid + "&appName=" + appName, new AsyncHttpResponseHandler() { | |
1310 | 1401 | @Override |
1311 | 1402 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1312 | 1403 | closeProgress(); |
... | ... | @@ -1351,9 +1442,6 @@ public class HttpManager { |
1351 | 1442 | } |
1352 | 1443 | |
1353 | 1444 | |
1354 | - | |
1355 | - | |
1356 | - | |
1357 | 1445 | ///省级接口 |
1358 | 1446 | public void provices(final Context mContext, final Handler handler) { |
1359 | 1447 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
... | ... | @@ -1361,13 +1449,27 @@ public class HttpManager { |
1361 | 1449 | @Override |
1362 | 1450 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1363 | 1451 | Log.e("test", "省" + new String(arg2)); |
1364 | - ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | |
1365 | - Log.e("test", "状态码" + provinceInfo.getStatus()); | |
1366 | - List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | |
1367 | - Message message = Message.obtain(); | |
1368 | - message.what = HttpCode.PROVICES; | |
1369 | - message.obj = provincesBeanList; | |
1370 | - handler.sendMessage(message); | |
1452 | + try { | |
1453 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
1454 | + int status = jsonObject.optInt("status"); | |
1455 | + if (status == 100) { | |
1456 | + ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | |
1457 | + Log.e("test", "状态码" + provinceInfo.getStatus()); | |
1458 | + List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | |
1459 | + Message message = Message.obtain(); | |
1460 | + message.what = HttpCode.PROVICES; | |
1461 | + message.obj = provincesBeanList; | |
1462 | + handler.sendMessage(message); | |
1463 | + | |
1464 | + | |
1465 | + } else { | |
1466 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
1467 | + | |
1468 | + } | |
1469 | + } catch (JSONException e) { | |
1470 | + e.printStackTrace(); | |
1471 | + } | |
1472 | + | |
1371 | 1473 | |
1372 | 1474 | } |
1373 | 1475 | |
... | ... | @@ -1399,19 +1501,31 @@ public class HttpManager { |
1399 | 1501 | } |
1400 | 1502 | |
1401 | 1503 | //市级接口 |
1402 | - public void cityinfo(final Context mContext, long regionId , final Handler handler) { | |
1504 | + public void cityinfo(final Context mContext, long regionId, final Handler handler) { | |
1403 | 1505 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
1404 | 1506 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
1405 | 1507 | @Override |
1406 | 1508 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1407 | 1509 | Log.e("test", "市" + new String(arg2)); |
1408 | - Gson gson = new Gson(); | |
1409 | - CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | |
1410 | - List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | |
1411 | - Message message = Message.obtain(); | |
1412 | - message.what = HttpCode.CITYS; | |
1413 | - message.obj = cityInfoBeanList; | |
1414 | - handler.sendMessage(message); | |
1510 | + try { | |
1511 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
1512 | + int status = jsonObject.optInt("status"); | |
1513 | + if (status == 100) { | |
1514 | + Gson gson = new Gson(); | |
1515 | + CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | |
1516 | + List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | |
1517 | + Message message = Message.obtain(); | |
1518 | + message.what = HttpCode.CITYS; | |
1519 | + message.obj = cityInfoBeanList; | |
1520 | + handler.sendMessage(message); | |
1521 | + | |
1522 | + } else { | |
1523 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
1524 | + | |
1525 | + } | |
1526 | + } catch (JSONException e) { | |
1527 | + e.printStackTrace(); | |
1528 | + } | |
1415 | 1529 | |
1416 | 1530 | |
1417 | 1531 | } |
... | ... | @@ -1450,13 +1564,24 @@ public class HttpManager { |
1450 | 1564 | @Override |
1451 | 1565 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
1452 | 1566 | Log.e("test", "区" + new String(arg2)); |
1453 | - Gson gson = new Gson(); | |
1454 | - CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | |
1455 | - List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | |
1456 | - Message message = Message.obtain(); | |
1457 | - message.what = HttpCode.COUNTRY; | |
1458 | - message.obj = countyInfoInfoBeanList; | |
1459 | - handler.sendMessage(message); | |
1567 | + try { | |
1568 | + JSONObject jsonObject = new JSONObject(new String(arg2)); | |
1569 | + int status = jsonObject.optInt("status"); | |
1570 | + if (status == 100) { | |
1571 | + Gson gson = new Gson(); | |
1572 | + CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | |
1573 | + List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | |
1574 | + Message message = Message.obtain(); | |
1575 | + message.what = HttpCode.COUNTRY; | |
1576 | + message.obj = countyInfoInfoBeanList; | |
1577 | + handler.sendMessage(message); | |
1578 | + } else { | |
1579 | + AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
1580 | + | |
1581 | + } | |
1582 | + } catch (JSONException e) { | |
1583 | + e.printStackTrace(); | |
1584 | + } | |
1460 | 1585 | |
1461 | 1586 | |
1462 | 1587 | } | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_account_management.xml
... | ... | @@ -260,15 +260,14 @@ |
260 | 260 | android:orientation="horizontal"> |
261 | 261 | |
262 | 262 | <TextView |
263 | - android:id="@+id/tv_account_delete" | |
264 | 263 | android:layout_width="0dp" |
265 | 264 | android:layout_height="wrap_content" |
266 | 265 | android:layout_weight="1" |
267 | 266 | android:gravity="center" |
268 | - android:text="删除用户" | |
269 | 267 | android:textSize="18sp" /> |
270 | 268 | |
271 | 269 | <TextView |
270 | + android:id="@+id/tv_account_delete" | |
272 | 271 | android:layout_width="0dp" |
273 | 272 | android:layout_height="wrap_content" |
274 | 273 | android:layout_weight="1" | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_choisetextbook.xml
... | ... | @@ -30,17 +30,18 @@ |
30 | 30 | </RelativeLayout> |
31 | 31 | <GridView |
32 | 32 | android:id="@+id/grideview" |
33 | - android:layout_marginTop="10dp" | |
33 | + android:layout_margin="30dp" | |
34 | 34 | android:layout_width="match_parent" |
35 | 35 | android:layout_height="wrap_content" |
36 | + android:gravity="center_vertical" | |
36 | 37 | android:layout_below="@+id/title" |
38 | + android:verticalSpacing="20dp" | |
37 | 39 | android:numColumns="5"> |
38 | 40 | |
39 | 41 | </GridView> |
40 | 42 | <LinearLayout |
41 | 43 | android:layout_width="match_parent" |
42 | 44 | android:layout_height="match_parent" |
43 | - | |
44 | 45 | android:background="#ffffffff" |
45 | 46 | android:layout_below="@+id/grideview" |
46 | 47 | android:orientation="vertical" | ... | ... |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info.xml
... | ... | @@ -5,10 +5,12 @@ |
5 | 5 | android:background="@color/white"> |
6 | 6 | <GridView |
7 | 7 | android:id="@+id/grideview" |
8 | - android:layout_marginTop="20dp" | |
8 | + android:layout_margin="30dp" | |
9 | 9 | android:layout_width="match_parent" |
10 | 10 | android:layout_height="wrap_content" |
11 | + android:gravity="center_vertical" | |
11 | 12 | android:layout_below="@+id/title" |
13 | + android:verticalSpacing="20dp" | |
12 | 14 | android:numColumns="5"> |
13 | 15 | |
14 | 16 | </GridView> | ... | ... |
PersonalCenter/app/src/main/res/layout/recycler_childaccunt_item_view.xml
... | ... | @@ -36,31 +36,32 @@ |
36 | 36 | android:id="@+id/iv_child_name" |
37 | 37 | android:layout_width="wrap_content" |
38 | 38 | android:layout_height="wrap_content" |
39 | - android:text="删除用户" | |
39 | + android:text="" | |
40 | 40 | android:textSize="18sp" /> |
41 | 41 | |
42 | 42 | <TextView |
43 | 43 | android:id="@+id/iv_child_grade" |
44 | 44 | android:layout_width="wrap_content" |
45 | 45 | android:layout_height="wrap_content" |
46 | - android:text="使用中" | |
46 | + android:text="" | |
47 | 47 | android:textSize="18sp" /> |
48 | 48 | |
49 | 49 | <TextView |
50 | 50 | android:id="@+id/iv_child_school" |
51 | 51 | android:layout_width="wrap_content" |
52 | 52 | android:layout_height="wrap_content" |
53 | - android:text="删除用户" | |
53 | + android:text="" | |
54 | 54 | android:textSize="18sp" /> |
55 | 55 | |
56 | 56 | <TextView |
57 | 57 | android:id="@+id/iv_child_adress" |
58 | 58 | android:layout_width="wrap_content" |
59 | 59 | android:layout_height="wrap_content" |
60 | - android:text="使用中" | |
60 | + android:text="" | |
61 | 61 | android:textSize="18sp" /> |
62 | 62 | |
63 | 63 | |
64 | + | |
64 | 65 | </LinearLayout> |
65 | 66 | |
66 | 67 | ... | ... |